:root {
  --ink: #17221b;
  --muted: #6d776f;
  --line: #e4e9e5;
  --soft: #f4f7f4;
  --panel: #ffffff;
  --green: #1e6f4d;
  --green-dark: #164f39;
  --green-soft: #e9f5ef;
  --lime: #bedc7b;
  --red: #c74d4d;
  --red-soft: #fff0ee;
  --orange: #cf7c34;
  --blue: #3f6ea9;
  --shadow: 0 14px 36px rgba(26, 51, 36, 0.08);
  --radius: 18px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: #f7f9f7;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: #f7f9f7; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.eyebrow { margin: 0 0 10px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.eyebrow.light { color: #bde4cb; }
.muted { color: var(--muted); }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.nowrap { white-space: nowrap; }

.brand-mark { position: relative; width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border-radius: 14px; color: #fff; background: var(--green); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.brand-mark::after { content: ""; position: absolute; right: -3px; bottom: -3px; width: 16px; height: 16px; border-radius: 50%; background: var(--lime); border: 3px solid #fff; }
.brand-mark span { font-weight: 900; font-size: 15px; letter-spacing: -.04em; }
.brand-mark-large { width: 64px; height: 64px; border-radius: 19px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); box-shadow: none; }
.brand-mark-large::after { border-color: #173e2e; }
.brand-mark-large span { font-size: 20px; }

.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, .95fr) minmax(480px, 1.05fr); }
.login-brand-panel { position: relative; overflow: hidden; min-height: 100vh; padding: 56px clamp(42px, 5.5vw, 90px); display: flex; flex-direction: column; justify-content: space-between; color: #fff; background: radial-gradient(circle at 88% 20%, rgba(190,220,123,.24), transparent 28%), linear-gradient(145deg, #102b20, #184b35 62%, #1d5c40); }
.login-brand-panel::before, .login-brand-panel::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; }
.login-brand-panel::before { width: 520px; height: 520px; right: -260px; bottom: -110px; }
.login-brand-panel::after { width: 360px; height: 360px; right: -178px; bottom: -28px; }
.login-brand-panel h1 { margin: 0; max-width: 580px; font-size: clamp(42px, 3.7vw, 58px); line-height: 1.14; letter-spacing: -.055em; }
.login-intro { max-width: 500px; margin: 28px 0 0; color: rgba(255,255,255,.7); line-height: 1.8; font-size: 16px; }
.login-proof { display: flex; gap: clamp(22px, 4vw, 60px); position: relative; z-index: 1; }
.login-proof div { display: grid; gap: 5px; }
.login-proof strong { font-size: 28px; color: var(--lime); }
.login-proof span { color: rgba(255,255,255,.6); font-size: 12px; }
.login-form-panel { min-height: 100vh; display: grid; place-items: center; padding: 48px; background: #fbfcfb; }
.login-card { width: min(430px, 100%); }
.login-card h2 { margin: 0; font-size: 34px; letter-spacing: -.035em; }
.login-card > .muted { margin: 10px 0 35px; font-size: 14px; }
.login-step[hidden] { display: none; }
.mobile-brand { display: none; }
.field-label { display: block; margin: 20px 0 8px; font-size: 13px; font-weight: 700; }
.input-wrap { position: relative; }
.input-wrap input, .modal input, .user-form input, .user-form select, .toolbar input { width: 100%; height: 50px; border: 1px solid #dce3de; border-radius: 12px; outline: none; background: #fff; color: var(--ink); transition: .2s; }
.input-wrap input { padding: 0 66px 0 44px; }
.input-wrap input:focus, .modal input:focus, .user-form input:focus, .user-form select:focus, .toolbar input:focus { border-color: #69a887; box-shadow: 0 0 0 4px rgba(30,111,77,.09); }
.input-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #91a097; font-size: 13px; }
.password-toggle { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
.text-button { border: 0; padding: 5px; color: var(--green); background: transparent; font-size: 12px; font-weight: 700; }
.primary-button, .secondary-button, .danger-button { min-height: 42px; padding: 0 17px; border-radius: 11px; border: 1px solid transparent; font-weight: 700; transition: transform .15s, box-shadow .15s, opacity .15s; }
.primary-button { color: #fff; background: var(--green); box-shadow: 0 8px 20px rgba(30,111,77,.18); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 10px 25px rgba(30,111,77,.24); }
.primary-button:disabled, .secondary-button:disabled, .danger-button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.secondary-button { color: var(--ink); border-color: var(--line); background: #fff; }
.secondary-button:hover { border-color: #9eb4a6; }
.danger-button { color: var(--red); border-color: #f0cfca; background: var(--red-soft); }
.login-button { width: 100%; margin-top: 27px; height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; }
.otp-summary { margin: 0 0 26px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid #d8e9df; border-radius: 13px; color: #627168; background: var(--green-soft); font-size: 12px; }
.otp-summary strong { color: var(--green-dark); font-size: 16px; letter-spacing: .04em; }
.otp-input-wrap input { font-size: 18px; font-weight: 800; letter-spacing: .22em; }
.otp-options { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.otp-options .text-button:disabled { color: #a6b0aa; cursor: not-allowed; }
.security-note { text-align: center; margin-top: 18px; color: #8a958e; font-size: 11px; }
.security-note span { color: var(--green); }
.form-error { margin: 12px 0 0; color: var(--red); font-size: 12px; }
.form-hint { margin: 7px 0 0; color: var(--muted); font-size: 11px; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; width: 240px; display: flex; flex-direction: column; border-right: 1px solid #e6ebe7; background: #fff; }
.sidebar-brand { height: 92px; padding: 24px 22px; display: flex; align-items: center; gap: 13px; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { font-size: 15px; }
.sidebar-brand small { margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.sidebar-nav { padding: 10px 13px; flex: 1; overflow-y: auto; }
.sidebar-nav > p { margin: 22px 12px 8px; color: #a2aba5; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.nav-item { width: 100%; min-height: 46px; padding: 0 13px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 11px; color: #5d6861; background: transparent; font-size: 13px; text-align: left; }
.nav-item:hover { color: var(--green); background: var(--soft); }
.nav-item.active { color: #fff; background: var(--green); box-shadow: 0 8px 20px rgba(30,111,77,.16); }
.nav-icon { width: 22px; text-align: center; font-size: 17px; }
.sidebar-footer { margin: 12px; padding: 13px 10px; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); }
.user-avatar, .profile-button span { display: grid; place-items: center; border-radius: 12px; color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 800; }
.user-avatar { width: 36px; height: 36px; flex: 0 0 36px; }
.sidebar-user-copy { min-width: 0; flex: 1; }
.sidebar-user-copy strong, .sidebar-user-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy strong { font-size: 12px; }
.sidebar-user-copy span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px; color: #738078; background: transparent; }
.icon-button:hover { color: var(--green); background: var(--soft); }
.main-column { min-height: 100vh; margin-left: 240px; }
.topbar { position: sticky; z-index: 35; top: 0; min-height: 92px; padding: 18px 32px; display: flex; align-items: center; justify-content: space-between; gap: 25px; border-bottom: 1px solid #e7ebe8; background: rgba(250,252,250,.92); backdrop-filter: blur(16px); }
.topbar-title { display: flex; align-items: center; gap: 8px; }
.topbar-title h1 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.topbar-title p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.date-range-control { height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.date-range-control span { color: var(--muted); font-size: 11px; }
.date-range-control i { color: #b4bcb7; font-style: normal; }
.date-range-control input { width: 120px; border: 0; outline: none; color: var(--ink); background: transparent; font-size: 11px; }
.profile-button { width: 42px; height: 42px; border: 0; border-radius: 12px; padding: 0; background: transparent; }
.profile-button span { width: 100%; height: 100%; }
.menu-button { display: none; }
.sidebar-backdrop { display: none; }
.main-content { padding: 28px 32px 45px; }
.page { display: none; }
.page.active-page { display: block; animation: page-in .25s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.hero-strip { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.hero-strip h2 { margin: 0; font-size: 24px; letter-spacing: -.04em; }
.hero-strip p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.period-tabs { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.period-tabs button { height: 32px; padding: 0 12px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 11px; }
.period-tabs button.active { color: var(--green); background: var(--green-soft); font-weight: 800; }
.notice { margin: 0 0 20px; padding: 13px 15px; display: flex; align-items: flex-start; gap: 10px; border: 1px solid #ecd8b7; border-radius: 12px; color: #785220; background: #fff9ee; font-size: 12px; line-height: 1.6; }
.notice strong { color: #9a641c; }
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-card { min-height: 142px; padding: 19px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 6px 22px rgba(26,51,36,.035); }
.kpi-card.highlight { color: #fff; border-color: var(--green); background: linear-gradient(145deg, #1c6447, #174b37); box-shadow: 0 12px 28px rgba(30,111,77,.18); }
.kpi-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.kpi-card.highlight .kpi-head { color: rgba(255,255,255,.65); }
.kpi-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; color: var(--green); background: var(--green-soft); }
.kpi-card.highlight .kpi-icon { color: var(--lime); background: rgba(255,255,255,.1); }
.kpi-value { margin-top: 22px; font-size: clamp(21px, 2vw, 29px); font-weight: 850; letter-spacing: -.045em; white-space: nowrap; }
.kpi-foot { margin-top: 7px; color: var(--muted); font-size: 10px; }
.kpi-card.highlight .kpi-foot { color: rgba(255,255,255,.6); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 18px; margin-bottom: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 7px 25px rgba(27,48,35,.035); }
.panel-head { min-height: 65px; padding: 17px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid #edf0ed; }
.panel-head h3 { margin: 0; font-size: 14px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 13px; color: var(--muted); font-size: 10px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 7px; height: 7px; border-radius: 50%; }
.chart-wrap { min-height: 290px; padding: 15px 18px 10px; }
.trend-chart { width: 100%; height: 260px; overflow: visible; }
.chart-grid-line { stroke: #edf0ee; stroke-width: 1; }
.chart-axis-label { fill: #8d9790; font-size: 9px; }
.chart-line-revenue { fill: none; stroke: var(--green); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-line-cost { fill: none; stroke: var(--orange); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart-line-profit { fill: none; stroke: var(--blue); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: url(#revenueFade); }
.chart-dot { stroke: #fff; stroke-width: 2; }
.side-metrics { padding: 8px 20px 15px; }
.side-metric { padding: 15px 0; border-bottom: 1px solid #edf0ed; }
.side-metric:last-child { border-bottom: 0; }
.side-metric-head { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; }
.side-metric-head span { color: var(--muted); }
.side-metric-head strong { font-size: 12px; }
.progress { height: 6px; margin-top: 10px; overflow: hidden; border-radius: 99px; background: #eef2ef; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.progress.orange i { background: var(--orange); }
.progress.blue i { background: var(--blue); }
.progress.red i { background: var(--red); }

.table-panel { overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { height: 42px; padding: 0 16px; color: #78827b; background: #f8faf8; font-size: 10px; text-align: left; white-space: nowrap; }
td { min-height: 49px; padding: 13px 16px; border-top: 1px solid #edf0ed; vertical-align: middle; }
tbody tr:hover { background: #fbfdfb; }
.number-cell { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.primary-cell { max-width: 360px; }
.primary-cell strong, .primary-cell span { display: block; }
.primary-cell strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.primary-cell span { margin-top: 4px; color: var(--muted); font-size: 9px; }
.status-pill, .type-pill { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 0 8px; border-radius: 99px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.status-pill.good { color: var(--green); background: var(--green-soft); }
.status-pill.bad { color: var(--red); background: var(--red-soft); }
.status-pill.warn { color: #95611b; background: #fff5df; }
.type-pill { color: #4f6458; background: #eef2ef; }
.table-empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.table-empty strong { display: block; margin-bottom: 7px; color: var(--ink); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 0 0 16px; }
.toolbar-copy h2 { margin: 0; font-size: 21px; }
.toolbar-copy p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.toolbar-controls { display: flex; align-items: center; gap: 9px; }
.toolbar input { width: min(260px, 33vw); height: 42px; padding: 0 14px; font-size: 11px; }
.summary-chips { display: flex; gap: 10px; margin-bottom: 15px; overflow-x: auto; }
.summary-chip { min-width: 150px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.summary-chip span, .summary-chip strong { display: block; white-space: nowrap; }
.summary-chip span { color: var(--muted); font-size: 9px; }
.summary-chip strong { margin-top: 6px; font-size: 15px; }
.ranking { display: inline-grid; width: 24px; height: 24px; place-items: center; border-radius: 8px; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 800; }
.ranking.top { color: #8b5a16; background: #fff1cf; }
.person-cell { display: flex; align-items: center; gap: 9px; }
.mini-avatar { width: 30px; height: 30px; display: grid; flex: 0 0 30px; place-items: center; border-radius: 10px; color: #fff; background: linear-gradient(140deg, #2a7557, #76a986); font-weight: 800; }

.quality-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; }
.upload-panel { padding: 22px; }
.upload-zone { margin-top: 16px; padding: 38px 20px; border: 1.5px dashed #b9c9bf; border-radius: 15px; text-align: center; background: #fafcfa; transition: .2s; }
.upload-zone.dragging { border-color: var(--green); background: var(--green-soft); }
.upload-zone .upload-icon { width: 50px; height: 50px; display: grid; margin: 0 auto 13px; place-items: center; border-radius: 15px; color: var(--green); background: var(--green-soft); font-size: 22px; }
.upload-zone h3 { margin: 0; font-size: 14px; }
.upload-zone p { margin: 7px 0 17px; color: var(--muted); font-size: 10px; }
.upload-files { margin: 15px 0 0; display: grid; gap: 7px; text-align: left; }
.upload-file { padding: 9px 11px; display: flex; align-items: center; justify-content: space-between; border-radius: 9px; background: #fff; font-size: 10px; }
.upload-actions { margin-top: 14px; display: flex; justify-content: flex-end; }
.quality-list { padding: 8px 20px 20px; }
.quality-item { padding: 14px 0; display: flex; align-items: flex-start; gap: 10px; border-bottom: 1px solid var(--line); font-size: 11px; line-height: 1.6; }
.quality-item:last-child { border: 0; }
.quality-item i { width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; border-radius: 50%; color: #9b671d; background: #fff1d6; font-style: normal; }
.source-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 18px; }
.source-card { padding: 15px; border: 1px solid var(--line); border-radius: 12px; }
.source-card strong, .source-card span { display: block; }
.source-card strong { font-size: 11px; }
.source-card span { margin-top: 5px; color: var(--muted); font-size: 9px; }

.user-layout { display: grid; grid-template-columns: minmax(300px, .62fr) minmax(0, 1.38fr); gap: 18px; }
.user-form { padding: 22px; }
.user-form h3 { margin: 0; font-size: 15px; }
.user-form > p { margin: 6px 0 20px; color: var(--muted); font-size: 10px; }
.user-form input, .user-form select { padding: 0 13px; }
.user-form .primary-button { width: 100%; margin-top: 22px; }
.user-role { display: inline-block; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.row-actions button { min-height: 30px; padding: 0 9px; border-radius: 8px; font-size: 9px; }

.modal { width: min(440px, calc(100vw - 30px)); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 25px 80px rgba(15,40,26,.25); }
.modal::backdrop { background: rgba(12,25,18,.45); backdrop-filter: blur(4px); }
.modal form { padding: 24px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal input { padding: 0 13px; }
.modal-actions { margin-top: 24px; display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; z-index: 200; top: 20px; left: 50%; max-width: min(450px, calc(100vw - 30px)); padding: 12px 16px; transform: translate(-50%, -20px); border: 1px solid #cde4d6; border-radius: 11px; color: var(--green-dark); background: #f1fbf5; box-shadow: var(--shadow); font-size: 11px; opacity: 0; pointer-events: none; transition: .25s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { color: #913a3a; border-color: #efceca; background: #fff3f1; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi-grid .kpi-card:nth-child(4), .kpi-grid .kpi-card:nth-child(5) { grid-column: span 1; }
  .quality-grid { grid-template-columns: 1fr; }
}

@media (max-width: 920px) {
  .login-view { grid-template-columns: 1fr; }
  .login-brand-panel { display: none; }
  .login-form-panel { padding: 30px; }
  .mobile-brand { margin-bottom: 48px; display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 800; }
  .sidebar { transform: translateX(-102%); transition: transform .22s; box-shadow: 18px 0 45px rgba(21,40,29,.12); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 45; inset: 0; border: 0; background: rgba(17,31,23,.35); }
  .sidebar-backdrop.show { display: block; }
  .main-column { margin-left: 0; }
  .menu-button { display: grid; }
  .topbar { padding: 15px 20px; }
  .topbar-actions .secondary-button, .date-range-control > span { display: none; }
  .main-content { padding: 22px 20px 40px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .user-layout { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .topbar { align-items: flex-start; }
  .topbar-title p { display: none; }
  .topbar-title h1 { font-size: 18px; }
  .date-range-control { position: fixed; z-index: 34; left: 12px; right: 12px; bottom: 12px; justify-content: center; box-shadow: 0 10px 40px rgba(23,44,31,.16); }
  .date-range-control input { flex: 1; width: auto; }
  .main-content { padding: 18px 13px 70px; }
  .hero-strip { align-items: stretch; flex-direction: column; gap: 14px; }
  .period-tabs { align-self: flex-start; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-card { min-height: 126px; padding: 15px; }
  .kpi-card.highlight { grid-column: span 2; }
  .kpi-value { font-size: 22px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-controls { width: 100%; }
  .toolbar input { width: 100%; }
  .source-grid { grid-template-columns: 1fr; }
  .login-form-panel { padding: 22px; }
  .login-card h2 { font-size: 29px; }
}
