:root {
    --forest: #1c2e2a;
    --forest-2: #243832;
    --moss: #1f6b5c;
    --moss-2: #2e8f7a;
    --apricot: #d4896a;
    --apricot-2: #e2a48c;
    --cream: #f6f1ea;
    --paper: #fffcfa;
    --line: rgba(28, 46, 42, 0.08);
    --text: #1c2e2a;
    --muted: #6b7f79;
    --danger: #c45c4a;
    --warn: #c9983a;
    --ok: #1f6b5c;
    --shadow: 0 10px 30px rgba(28, 46, 42, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
    color: var(--text);
    background: var(--cream);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.shell { display: flex; height: 100vh; overflow: hidden; }
.side {
    width: 232px;
    background: linear-gradient(180deg, var(--forest) 0%, #152420 100%);
    color: #e8f3ef;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.side__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 28px 22px 20px;
}
.side__mark {
    width: 40px; height: 40px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--apricot-2), var(--apricot));
    color: #fff; font-weight: 700;
}
.side__name { font-family: "Songti SC", "Noto Serif SC", serif; letter-spacing: 0.12em; font-size: 16px; }
.side__sub { font-size: 12px; color: rgba(232, 243, 239, 0.55); margin-top: 2px; }
.side__nav { padding: 4px 12px 24px; overflow: auto; flex: 1; }
.side__group { margin: 4px 0 2px; }
.side__toggle {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 10px 10px 8px; border: 0; background: transparent; cursor: pointer;
    font-size: 11px; letter-spacing: 0.16em; color: rgba(232, 243, 239, 0.42);
}
.side__toggle:hover { color: rgba(232, 243, 239, 0.82); background: rgba(255,255,255,0.05); border-radius: 8px; }
.side__chevron {
    width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg); transition: transform .2s ease; opacity: .7; margin-right: 2px;
}
.side__group.is-open .side__chevron { transform: rotate(45deg); }
.side__items {
    display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease;
}
.side__group.is-open .side__items { grid-template-rows: 1fr; }
.side__items-inner { overflow: hidden; min-height: 0; }
.side__link {
    display: block; padding: 9px 12px; border-radius: 10px;
    color: rgba(232, 243, 239, 0.78); font-size: 14px; margin-bottom: 3px;
}
.side__link:hover { background: rgba(255,255,255,0.06); }
.side__link.is-on { background: rgba(212, 137, 106, 0.18); color: #f3d2c3; }

.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.top {
    height: 64px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px; background: rgba(255,252,250,0.86); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.top__title { font-size: 18px; font-weight: 600; }
.top__user { display: flex; gap: 16px; color: var(--muted); font-size: 13px; }
.top__user a { color: var(--apricot); }
.workspace { padding: 20px 24px 24px; flex: 1; min-height: 0; overflow: auto; }
.workspace:has(.dash) { overflow: hidden; padding: 14px 20px; display: flex; flex-direction: column; }

.panel {
    background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
    box-shadow: var(--shadow);
}
.panel__head { padding: 12px 16px 0; font-weight: 600; font-size: 13px; }

.dash {
    flex: 1; min-height: 0; display: grid; gap: 10px;
    grid-template-rows: auto auto minmax(0, 1fr);
}
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.card {
    background: var(--paper); border-radius: 14px; padding: 12px 16px;
    border: 1px solid var(--line); box-shadow: var(--shadow);
}
.card__label { color: var(--muted); font-size: 12px; }
.card__value { font-size: 22px; font-weight: 700; margin: 4px 0 2px; letter-spacing: -0.03em; }
.card__tip { color: var(--muted); font-size: 11px; }

.todo-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.todo {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line);
}
.todo strong { font-size: 16px; color: var(--apricot); }
.todo span { color: var(--muted); font-size: 12px; }

.charts {
    display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 10px; min-height: 0;
}
.chart-panel { padding: 0 10px 10px; display: flex; flex-direction: column; min-height: 0; height: 100%; }
.chart-box { position: relative; flex: 1; min-height: 0; }
.chart-box canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }

.toolbar {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    margin-bottom: 14px; padding: 14px 16px; background: var(--paper);
    border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.toolbar__filters { display: flex; flex-wrap: wrap; gap: 12px 14px; flex: 1; min-width: 0; align-items: flex-end; }
.toolbar__item { display: flex; flex-direction: column; gap: 6px; min-width: 128px; }
.toolbar__item.is-grow { flex: 1.6; min-width: 220px; }
.toolbar__label { font-size: 12px; color: var(--muted); font-weight: 600; }
.toolbar__item input, .toolbar__item select {
    height: 36px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px;
    background: #fff; color: var(--text); outline: none;
}
.toolbar__item select {
    min-width: 132px; padding-right: 32px; appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236b7f79' stroke-width='1.6' stroke-linecap='round' d='M1.5 1.5 L6 6 L10.5 1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
.toolbar__item input:focus, .toolbar__item select:focus {
    border-color: rgba(31,107,92,.4); box-shadow: 0 0 0 3px rgba(31,107,92,.12);
}
.toolbar__actions { display: flex; gap: 8px; flex-shrink: 0; margin-left: auto; }

.table-wrap { overflow: auto; border-radius: 18px; background: #fff; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f7f3ee; color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:hover td { background: #fbf8f4; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #eee; }
.thumb { width: 72px; height: 40px; object-fit: cover; border-radius: 8px; }

.tag { display: inline-flex; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.tag.ok { background: rgba(31,107,92,.12); color: var(--ok); }
.tag.warn { background: rgba(201,152,58,.14); color: #9a7420; }
.tag.danger { background: rgba(196,92,74,.12); color: var(--danger); }
.tag.off { background: rgba(28,46,42,.06); color: var(--muted); }

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    height: 36px; padding: 0 14px; border-radius: 10px; border: none; cursor: pointer;
}
.btn-primary { background: linear-gradient(135deg, var(--apricot-2), var(--apricot)); color: #fff; }
.btn-ghost { background: rgba(31,107,92,.08); color: var(--moss); }
.btn-text { background: transparent; color: var(--moss); padding: 0 8px; height: 30px; }
.btn-danger { background: rgba(196,92,74,.12); color: var(--danger); }
.btn + .btn { margin-left: 6px; }
.toolbar__actions .btn + .btn { margin-left: 0; }

.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 14px 4px 0; color: var(--muted); font-size: 13px; }
.pager button { height: 32px; min-width: 32px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.pager button.is-on { background: var(--forest); color: #fff; border-color: var(--forest); }

.mask {
    position: fixed; inset: 0; background: rgba(28,46,42,.38); display: none;
    align-items: center; justify-content: center; z-index: 50; padding: 24px;
}
.mask.show { display: flex; }
.modal {
    width: min(640px, 100%); background: #fff; border-radius: 20px; padding: 22px 24px 18px;
    box-shadow: 0 24px 60px rgba(28,46,42,.18); max-height: 86vh; overflow: auto;
}
.modal h3 { margin: 0 0 16px; font-size: 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fbfaf8;
}
.field textarea { min-height: 88px; resize: vertical; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.confirm-text { color: var(--muted); line-height: 1.7; margin: 0 0 18px; }

.toast {
    position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
    background: var(--forest); color: #fff; padding: 10px 16px; border-radius: 999px;
    font-size: 13px; z-index: 80; display: none;
}

.empty { padding: 48px; text-align: center; color: var(--muted); }

.login-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(ellipse 70% 50% at 10% 0%, rgba(226,164,140,.28), transparent 60%),
        linear-gradient(180deg, #fff5ef, #eaf2ef);
}
.login-card {
    width: 420px; background: rgba(255,252,250,.92); border-radius: 28px; padding: 40px 36px;
    border: 1px solid var(--line); box-shadow: var(--shadow);
}
.login-card__brand { font-family: "Songti SC", serif; font-size: 28px; letter-spacing: 0.16em; }
.login-card__sub { color: var(--muted); margin: 8px 0 28px; }
.login-form label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.login-form input {
    width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--line); padding: 0 14px;
}
.login-form button {
    width: 100%; height: 46px; margin-top: 22px; border: none; border-radius: 999px; cursor: pointer;
    background: linear-gradient(135deg, var(--apricot-2), var(--apricot)); color: #fff; font-weight: 600;
}
.login-hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: 14px; }

.setting-panel { padding: 24px; }
.setting-item { margin-bottom: 20px; }
.setting-item__head { display: flex; gap: 12px; align-items: baseline; margin-bottom: 8px; flex-wrap: wrap; }
.setting-item__head span { color: var(--muted); font-size: 13px; }
.setting-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.setting-tab {
    padding: 8px 14px; border-radius: 10px; background: #fff;
    border: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.setting-tab.is-on { background: var(--forest); color: #fff; border-color: var(--forest); }
.setting-intro { color: var(--muted); font-size: 13px; margin: 0 0 14px; line-height: 1.65; }
.setting-item select, .setting-item input[type="text"], .setting-item input:not([type]), .setting-item input[name] {
    width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: #fff;
}
.setting-item textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff;
}
.readonly { padding: 8px 0; line-height: 1.5; }
.img-pick--multi { flex-wrap: wrap; }
.img-pick--multi img { width: 56px; height: 40px; object-fit: cover; border-radius: 6px; }

.img-pick { display: flex; align-items: center; gap: 12px; }
.img-pick img { width: 72px; height: 48px; object-fit: cover; border-radius: 8px; background: #eee; }

@media (max-width: 1100px) {
    .cards, .todo-row { grid-template-columns: 1fr 1fr; }
    .charts { grid-template-columns: 1fr 1fr; grid-template-rows: none; }
    .chart-box { min-height: 160px; }
    .workspace:has(.dash) { overflow: auto; }
    .dash { height: auto; grid-template-rows: none; }
    .side { width: 200px; }
}
@media (max-width: 800px) {
    .shell { display: block; height: auto; overflow: visible; }
    .side { width: 100%; height: auto; }
    .cards, .todo-row, .charts { grid-template-columns: 1fr; }
    .toolbar__item.is-grow { min-width: 100%; }
}
