:root {
  --ink: #17221d;
  --muted: #68736d;
  --muted-2: #8e9892;
  --paper: #f4f5f1;
  --surface: #ffffff;
  --surface-2: #f8f9f6;
  --line: #dfe4df;
  --line-strong: #cbd3cd;
  --brand: #1f4b3a;
  --brand-2: #2f6d55;
  --brand-soft: #e7f1eb;
  --nav: #17261f;
  --blue: #315fba;
  --blue-soft: #eaf0fc;
  --amber: #9a6412;
  --amber-soft: #fff2d8;
  --red: #a33a38;
  --red-soft: #fbe9e7;
  --violet: #6d4aad;
  --violet-soft: #f0eafa;
  --shadow: 0 12px 30px rgba(29, 49, 39, .08);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar: 248px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; min-width: 0; }
html { min-height: 100%; background: var(--paper); }
body { min-height: 100vh; margin: 0; overflow-x: hidden; background: var(--paper); color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(49, 95, 186, .25); outline-offset: 2px; }

.app-root { min-height: 100vh; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.muted { color: var(--muted); }
.tiny { color: var(--muted); font-size: 12px; }
.nowrap { white-space: nowrap; }
.mobile-only { display: none !important; }

.brand-mark {
  display: inline-grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center;
  border-radius: 11px; background: #d9a441; color: #17261f; font-family: Georgia, serif;
  font-size: 21px; font-weight: 800; box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
}
.brand-mark--large { width: 56px; height: 56px; border-radius: 17px; font-size: 30px; }

/* Login */
.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.05fr) minmax(420px, .95fr); background: var(--surface); }
.login-brand { position: relative; display: grid; place-items: center; overflow: hidden; padding: 64px; color: #f5f3e8; background: var(--nav); }
.login-brand::before, .login-brand::after { position: absolute; content: ""; border-radius: 50%; filter: blur(2px); }
.login-brand::before { width: 560px; height: 560px; right: -250px; top: -220px; border: 1px solid rgba(255,255,255,.1); box-shadow: 0 0 0 76px rgba(255,255,255,.025), 0 0 0 152px rgba(255,255,255,.018); }
.login-brand::after { width: 260px; height: 260px; left: -170px; bottom: -80px; background: rgba(217,164,65,.13); filter: blur(12px); }
.login-brand__inner { position: relative; z-index: 1; width: min(600px, 100%); }
.login-brand .eyebrow { margin-top: 24px; color: #d9a441; }
.login-brand h1 { max-width: 540px; margin: 12px 0 20px; font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(38px, 4.2vw, 64px); font-weight: 540; line-height: 1.12; letter-spacing: -.035em; }
.login-brand p:not(.eyebrow) { max-width: 500px; color: rgba(245,243,232,.72); font-size: 16px; line-height: 1.8; }
.login-proof { display: flex; align-items: center; gap: 12px; margin-top: 48px; color: rgba(255,255,255,.75); font-size: 12px; font-weight: 650; }
.login-proof i { width: 24px; height: 1px; background: rgba(217,164,65,.65); }
.login-panel { display: grid; place-items: center; align-content: center; padding: 48px; background: #f8f8f4; }
.login-card { width: min(430px, 100%); padding: 36px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.login-card__head { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.login-card h2 { margin: 0; font-size: 25px; letter-spacing: -.025em; }
.login-foot { margin: 22px 0 0; color: var(--muted); font-size: 12px; }
.creator-portal-link { display: flex; justify-content: space-between; gap: 12px; padding-top: 20px; margin: 24px 0 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.creator-portal-link a { color: var(--brand); font-weight: 700; }
.creator-binding-list { max-height: 250px; overflow-y: auto; display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.creator-binding-option { display: flex; gap: 10px; align-items: center; padding: 8px; background: var(--surface-2); border-radius: 7px; font-weight: 450; }
.creator-binding-option input { width: 17px; height: 17px; min-height: 17px; flex: 0 0 auto; accent-color: var(--brand); }
.creator-binding-option strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.creator-binding-option small { display: block; margin-top: 4px; }
.blogger-profile-editor { border-top: 1px solid var(--line); padding-top: 18px; }
.blogger-profile-editor summary { cursor: pointer; margin-bottom: 18px; color: var(--brand); font-weight: 700; font-size: 13px; }
.blogger-profile-title { margin-top: 26px; font-size: 14px; }
.blogger-source-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px 22px; margin: 15px 0; }
.blogger-source-details div { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.blogger-source-details dt { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.blogger-source-details dd { margin: 0; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.blogger-import-table { margin-top: 18px; max-height: 50vh; overflow: auto; }
.blogger-import-table summary { cursor: pointer; font-size: 12px; color: var(--brand); }
.blogger-import-table .control { min-width: 130px; }
.blogger-import-table input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--brand); }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 24px; padding: 4px; border-radius: 11px; background: #eef1ed; }
.segmented__item { min-height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 700; }
.segmented__item.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 2px 7px rgba(31,47,39,.1); }
.stack { display: grid; gap: 17px; }
.field { display: grid; gap: 7px; color: #455149; font-size: 13px; font-weight: 650; }
.field input, .field select, .field textarea, .control {
  width: 100%; min-height: 43px; border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--surface); padding: 10px 12px; font-size: 14px; font-weight: 450;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.field textarea { min-height: 92px; resize: vertical; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus, .control:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(47,109,85,.12); outline: none; }
.field input[readonly], .field select:disabled { color: var(--muted); background: var(--surface-2); }
.field small, .form-hint { color: var(--muted); font-size: 12px; font-weight: 450; line-height: 1.55; }
.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 62px; }
.password-wrap .text-button { position: absolute; right: 5px; top: 5px; height: 33px; }
.text-button { border: 0; border-radius: 7px; background: transparent; color: var(--brand-2); font-size: 12px; font-weight: 750; }
.text-button:hover { background: var(--brand-soft); }
.feishu-callout { display: flex; gap: 13px; padding: 16px; border: 1px solid #dce4fa; border-radius: 12px; background: #f4f7fe; }
.feishu-callout p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.feishu-logo { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border-radius: 10px; background: #3370ff; color: #fff; font-weight: 800; }
.inline-message { margin: 17px 0 0; padding: 11px 13px; border-radius: 9px; background: var(--red-soft); color: var(--red); font-size: 13px; line-height: 1.5; }

/* Shell */
.workspace { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; width: var(--sidebar); flex-direction: column; padding: 22px 15px 16px; color: #f4f5ef; background: var(--nav); }
.sidebar__brand { display: flex; align-items: center; gap: 12px; min-height: 48px; margin: 0 8px 26px; }
.sidebar__brand strong { display: block; font-size: 16px; letter-spacing: .02em; }
.sidebar__brand small { display: block; margin-top: 3px; color: rgba(255,255,255,.48); font-size: 10px; letter-spacing: .11em; text-transform: uppercase; }
.side-nav { display: grid; gap: 3px; overflow-y: auto; padding-right: 2px; scrollbar-width: thin; }
.nav-group-label { margin: 17px 11px 6px; color: rgba(255,255,255,.38); font-size: 10px; font-weight: 750; letter-spacing: .12em; }
.nav-link { display: flex; align-items: center; gap: 11px; min-height: 43px; padding: 9px 11px; border: 0; border-radius: 10px; color: rgba(255,255,255,.66); background: transparent; font-size: 13px; font-weight: 650; text-align: left; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-link.is-active { color: #fff; background: rgba(255,255,255,.105); box-shadow: inset 3px 0 #d9a441; }
.nav-icon { display: grid; width: 22px; height: 22px; flex: 0 0 auto; place-items: center; font-size: 16px; }
.nav-count { min-width: 22px; margin-left: auto; padding: 2px 6px; border-radius: 999px; color: #e5c780; background: rgba(217,164,65,.13); font-size: 10px; text-align: center; }
.sidebar__foot { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { display: flex; flex: 1; align-items: center; gap: 9px; overflow: hidden; }
.sidebar-user > span:last-child { overflow: hidden; }
.sidebar-user strong, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { font-size: 12px; }
.sidebar-user small { margin-top: 2px; color: rgba(255,255,255,.48); font-size: 10px; }
.avatar { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #15231c; background: #e2be70; font-size: 13px; font-weight: 800; }
.sidebar .icon-button { color: rgba(255,255,255,.65); }
.sidebar .icon-button:hover { background: rgba(255,255,255,.08); color: #fff; }

.main { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; min-height: 78px; align-items: center; justify-content: space-between; gap: 24px; padding: 14px 30px; border-bottom: 1px solid rgba(203,211,205,.82); background: rgba(244,245,241,.92); backdrop-filter: blur(16px); }
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.topbar__actions { display: flex; align-items: center; gap: 10px; }
.search-trigger { display: flex; min-height: 39px; align-items: center; gap: 9px; min-width: 230px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); font-size: 12px; text-align: left; }
.search-trigger kbd { margin-left: auto; padding: 2px 5px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); color: var(--muted-2); font-size: 10px; }
.page { width: min(1480px, 100%); margin: 0 auto; padding: 26px 30px 42px; }
.page:focus { outline: none; }

/* Shared components */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-head h2 { margin: 0 0 6px; font-size: 21px; letter-spacing: -.025em; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.button { display: inline-flex; min-height: 39px; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 720; transition: transform .12s ease, background .12s ease, border-color .12s ease; }
.button:hover { border-color: #b2bdb5; background: #fafbf9; }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: .5; }
.button--primary { border-color: var(--brand); background: var(--brand); color: #fff; }
.button--primary:hover { border-color: var(--brand-2); background: var(--brand-2); }
.button--feishu { border-color: #3370ff; background: #3370ff; color: #fff; }
.button--danger { border-color: #e5bdb9; color: var(--red); background: #fff; }
.button--danger:hover { border-color: #dda6a1; background: var(--red-soft); }
.button--ghost { border-color: transparent; background: transparent; color: var(--brand-2); }
.button--small { min-height: 31px; padding: 5px 9px; border-radius: 7px; font-size: 11px; }
.button--block { width: 100%; min-height: 45px; }
.icon-button { display: inline-grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 18px; }
.icon-button:hover { background: #e9ede9; color: var(--ink); }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 5px 18px rgba(29,49,39,.035); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.card__head h3 { margin: 0; font-size: 15px; }
.card__head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.card__body { padding: 20px; }
.card + .card { margin-top: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
.section-gap { margin-top: 20px; }
.divider { height: 1px; margin: 18px 0; background: var(--line); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 13px; margin-bottom: 20px; }
.kpi-card { position: relative; min-height: 128px; overflow: hidden; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; box-shadow: 0 4px 14px rgba(29,49,39,.035); }
button.kpi-card { width: 100%; color: inherit; }
.kpi-card:hover { border-color: #bdc8c0; box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi-card::after { position: absolute; right: -15px; bottom: -22px; width: 72px; height: 72px; content: ""; border-radius: 50%; background: var(--brand-soft); opacity: .55; }
.kpi-card[data-tone="amber"]::after { background: var(--amber-soft); }
.kpi-card[data-tone="red"]::after { background: var(--red-soft); }
.kpi-card[data-tone="blue"]::after { background: var(--blue-soft); }
.kpi-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 650; }
.kpi-value { display: block; margin-top: 15px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(24px, 2.1vw, 32px); font-weight: 650; line-height: 1; letter-spacing: -.035em; }
.kpi-foot { display: block; margin-top: 10px; color: var(--muted); font-size: 10px; }
.kpi-arrow { color: var(--muted-2); font-size: 15px; }

.filter-card { margin-bottom: 16px; padding: 14px; }
.filter-grid { display: grid; grid-template-columns: repeat(6, minmax(120px,1fr)); gap: 10px; }
.filter-grid .field { gap: 5px; font-size: 11px; }
.filter-grid .field input, .filter-grid .field select { min-height: 38px; padding: 7px 9px; font-size: 12px; }
.filter-actions { display: flex; align-items: end; gap: 7px; }
.filter-actions .button { flex: 1; min-height: 38px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.filter-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 0; border-radius: 999px; color: var(--brand); background: var(--brand-soft); font-size: 11px; }

.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { height: 42px; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); color: var(--muted); background: #f7f8f5; font-size: 10px; font-weight: 780; letter-spacing: .025em; text-align: left; white-space: nowrap; }
.data-table td { padding: 12px 10px; border-bottom: 1px solid #ebeeeb; vertical-align: middle; line-height: 1.45; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fafbf8; }
.cell-main { display: block; font-weight: 700; }
.cell-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.row-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.badge { display: inline-flex; min-height: 23px; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 999px; color: #506058; background: #edf0ed; font-size: 10px; font-weight: 750; white-space: nowrap; }
.badge::before { width: 5px; height: 5px; content: ""; border-radius: 50%; background: currentColor; opacity: .7; }
.badge--green { color: #26704f; background: #e4f3e9; }
.badge--amber { color: var(--amber); background: var(--amber-soft); }
.badge--red { color: var(--red); background: var(--red-soft); }
.badge--blue { color: var(--blue); background: var(--blue-soft); }
.badge--violet { color: var(--violet); background: var(--violet-soft); }
.tag { display: inline-block; padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--surface); font-size: 10px; white-space: nowrap; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.pagination__buttons { display: flex; gap: 6px; }

.empty-state, .loading-state, .error-state { display: grid; min-height: 230px; place-items: center; padding: 36px 20px; color: var(--muted); text-align: center; }
.state-box { max-width: 430px; }
.state-icon { display: grid; width: 46px; height: 46px; place-items: center; margin: 0 auto 12px; border-radius: 14px; color: var(--brand); background: var(--brand-soft); font-size: 22px; }
.error-state .state-icon { color: var(--red); background: var(--red-soft); }
.state-box h3 { margin: 0 0 6px; color: var(--ink); font-size: 15px; }
.state-box p { margin: 0 0 15px; font-size: 12px; line-height: 1.6; }
.spinner { width: 28px; height: 28px; margin: 0 auto 12px; border: 3px solid #dbe4dd; border-top-color: var(--brand); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.form-grid--3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
.field--full { grid-column: 1 / -1; }
.required::after { content: " *"; color: var(--red); }
.form-section { margin: 5px 0 1px; grid-column: 1/-1; padding-bottom: 8px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 13px; font-weight: 800; }
.check-row { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; line-height: 1.5; }
.check-row input { margin-top: 2px; }
.file-field { display: grid; gap: 8px; }
.file-field input[type="file"] { padding: 8px; }
.file-list { display: grid; gap: 7px; }
.file-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: 11px; }

/* Dashboard and workflows */
.activity-list { display: grid; gap: 0; }
.activity-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid #edf0ed; }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; color: var(--brand); background: var(--brand-soft); font-size: 13px; }
.activity-item strong { display: block; font-size: 12px; }
.activity-item p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.activity-item time { color: var(--muted-2); font-size: 10px; }
.metric-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.mini-metric { padding: 13px; border-radius: 10px; background: var(--surface-2); }
.mini-metric span { display: block; color: var(--muted); font-size: 10px; }
.mini-metric strong { display: block; margin-top: 6px; font-size: 17px; }
.progress { height: 7px; overflow: hidden; border-radius: 999px; background: #e8ece8; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--brand-2); }

.steps { display: grid; grid-template-columns: repeat(4,1fr); gap: 0; margin-bottom: 18px; }
.step { position: relative; display: grid; gap: 6px; justify-items: center; color: var(--muted-2); font-size: 10px; font-weight: 700; text-align: center; }
.step:not(:last-child)::after { position: absolute; top: 13px; left: calc(50% + 16px); right: calc(-50% + 16px); height: 1px; content: ""; background: var(--line-strong); }
.step__num { z-index: 1; display: grid; width: 27px; height: 27px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); }
.step.is-active, .step.is-done { color: var(--brand); }
.step.is-active .step__num, .step.is-done .step__num { border-color: var(--brand); color: #fff; background: var(--brand); }
.step.is-done:not(:last-child)::after { background: var(--brand); }
.drop-zone { display: grid; min-height: 230px; place-items: center; padding: 28px; border: 1.5px dashed #b9c5bc; border-radius: 14px; background: #fafbf8; text-align: center; transition: border-color .15s, background .15s; }
.drop-zone.is-dragging { border-color: var(--brand-2); background: var(--brand-soft); }
.drop-zone__icon { display: grid; width: 52px; height: 52px; place-items: center; margin: 0 auto 13px; border-radius: 16px; color: var(--brand); background: var(--brand-soft); font-size: 24px; }
.drop-zone h3 { margin: 0 0 7px; font-size: 15px; }
.drop-zone p { margin: 0 0 14px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.mapping-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px 12px; align-items: center; }
.mapping-grid__arrow { color: var(--muted-2); }
.error-list { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.error-line { display: grid; grid-template-columns: 64px 120px 1fr; gap: 10px; padding: 9px 11px; border-bottom: 1px solid var(--line); font-size: 11px; }
.error-line:last-child { border-bottom: 0; }
.error-line strong { color: var(--red); }

.timeline { position: relative; display: grid; gap: 0; }
.timeline-item { position: relative; display: grid; grid-template-columns: 28px 1fr; gap: 10px; min-height: 62px; }
.timeline-item:not(:last-child)::before { position: absolute; top: 24px; bottom: 0; left: 10px; width: 1px; content: ""; background: var(--line-strong); }
.timeline-dot { z-index: 1; display: grid; width: 21px; height: 21px; place-items: center; border: 2px solid var(--surface); border-radius: 50%; color: #fff; background: var(--brand-2); box-shadow: 0 0 0 1px var(--brand-2); font-size: 9px; }
.timeline-item h4 { margin: 1px 0 4px; font-size: 12px; }
.timeline-item p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.approval-box { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 14px; border: 1px solid #dce4fa; border-radius: 11px; background: #f7f9fe; }
.approval-box strong { display: block; font-size: 12px; }
.approval-box code { display: block; margin-top: 5px; color: var(--blue); font-size: 10px; overflow-wrap: anywhere; }
.category-cards { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.category-card { padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.category-card strong { font-size: 15px; }
.category-card p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.config-list { display: grid; }
.config-row { display: grid; grid-template-columns: minmax(150px,.7fr) minmax(260px,1.3fr); gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.config-row:last-child { border-bottom: 0; }
.config-row dt { color: var(--muted); font-size: 11px; font-weight: 700; }
.config-row dd { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.secret-mask { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.code-block { max-width: 100%; max-height: 360px; overflow: auto; margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: #17221d; color: #e8efe9; font: 11px/1.55 Consolas, "SFMono-Regular", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Modal */
.modal-root { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(13,24,18,.58); backdrop-filter: blur(4px); }
.modal { display: flex; width: min(760px, 100%); max-height: min(90vh, 900px); overflow: hidden; flex-direction: column; border-radius: 18px; background: var(--surface); box-shadow: 0 24px 70px rgba(0,0,0,.23); }
.modal--wide { width: min(1040px,100%); }
.modal__head { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.modal__head h2 { margin: 0; font-size: 18px; }
.modal__head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.modal__body { min-height: 0; overflow: auto; flex: 1 1 auto; padding: 21px 22px; }
.modal__foot { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fafbf9; }
body.has-modal { overflow: hidden; }

.toast-region { position: fixed; z-index: 160; top: 18px; right: 18px; display: grid; width: min(360px,calc(100vw - 32px)); gap: 8px; }
.toast { display: grid; grid-template-columns: 22px 1fr auto; gap: 9px; align-items: start; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow); font-size: 12px; animation: toast-in .18s ease-out; }
.toast strong { display: block; margin-bottom: 2px; }
.toast p { margin: 0; color: var(--muted); line-height: 1.45; }
.toast--error { border-color: #ecc6c2; }
.toast--success { border-color: #bdddc9; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

.mobile-nav, .mobile-sheet { display: none; }
.noscript { margin: 20px; padding: 15px; border-radius: 10px; color: var(--red); background: var(--red-soft); }

@media (max-width: 1180px) {
  .filter-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid-3 { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 920px) {
  .login-view { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; padding: 28px 20px; }
  .login-card { padding: 28px; }
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .topbar { min-height: 67px; padding: 11px 18px; }
  .topbar h1 { font-size: 19px; }
  .topbar__actions .search-trigger { min-width: 38px; width: 38px; padding: 7px; justify-content: center; }
  .topbar__actions .search-trigger span:last-of-type, .search-trigger kbd { display: none; }
  .mobile-only { display: inline-grid !important; }
  .page { padding: 20px 16px calc(92px + env(safe-area-inset-bottom)); }
  .mobile-nav { position: fixed; z-index: 45; right: 10px; bottom: calc(8px + env(safe-area-inset-bottom)); left: 10px; display: grid; grid-template-columns: repeat(5,1fr); min-height: 62px; padding: 5px; border: 1px solid rgba(255,255,255,.09); border-radius: 18px; background: rgba(23,38,31,.97); box-shadow: 0 14px 35px rgba(14,28,21,.25); backdrop-filter: blur(16px); }
  .mobile-nav__item { display: grid; gap: 2px; place-items: center; border: 0; border-radius: 13px; color: rgba(255,255,255,.56); background: transparent; font-size: 9px; font-weight: 650; }
  .mobile-nav__item span:first-child { font-size: 18px; line-height: 1; }
  .mobile-nav__item.is-active { color: #fff; background: rgba(255,255,255,.095); }
  .mobile-sheet { position: fixed; inset: 0; z-index: 90; display: block; }
  .mobile-sheet__backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(11,20,16,.52); }
  .mobile-sheet__panel { position: absolute; right: 0; bottom: 0; left: 0; padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; background: var(--surface); box-shadow: 0 -12px 45px rgba(0,0,0,.17); }
  .mobile-sheet__panel header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
  .mobile-more-links { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
  .mobile-more-link { display: grid; min-height: 76px; gap: 5px; place-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 10px; font-weight: 700; }
  .mobile-more-link span { font-size: 21px; }
  .modal-root { padding: 0; place-items: end center; }
  .modal { width: 100%; max-height: 94dvh; border-radius: 20px 20px 0 0; }
  .modal--wide { width: 100%; }
  .modal__body { padding: 18px 16px; }
  .modal__head { padding: 17px 16px; }
  .modal__foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
}

@media (max-width: 720px) {
  .page-head { align-items: stretch; flex-direction: column; gap: 12px; }
  .page-actions { justify-content: flex-start; }
  .page-actions .button { flex: 1; }
  .kpi-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { gap: 9px; }
  .kpi-card { min-height: 104px; padding: 15px; }
  .kpi-value { margin-top: 12px; font-size: 26px; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .filter-actions { grid-column: 1/-1; }
  .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
  .field--full, .form-section { grid-column: 1; }
  .card__head { align-items: flex-start; padding: 16px; }
  .card__body { padding: 16px; }
  .table-wrap { overflow: visible; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table thead { display: none; }
  .data-table { padding: 10px; background: var(--surface-2); }
  .data-table tbody { display: grid; gap: 10px; }
  .data-table tr { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 3px 10px rgba(29,49,39,.035); }
  .data-table tbody tr:hover { background: var(--surface); }
  .data-table td { display: grid; grid-template-columns: minmax(78px,34%) minmax(0,1fr); gap: 10px; padding: 9px 11px; border-bottom: 1px solid #edf0ed; overflow-wrap: anywhere; }
  .data-table td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 700; }
  .data-table td[data-label="操作"] { display: block; }
  .data-table td[data-label="操作"]::before { display: none; }
  .data-table td:last-child { border-bottom: 0; }
  .row-actions .button { flex: 1; }
  .pagination { align-items: stretch; flex-direction: column; }
  .pagination__buttons .button { flex: 1; }
  .category-cards, .metric-row { grid-template-columns: 1fr; }
  .mapping-grid { grid-template-columns: minmax(0,1fr) 18px minmax(0,1fr); font-size: 11px; }
  .error-line { grid-template-columns: 50px 90px 1fr; gap: 6px; }
  .config-row { grid-template-columns: 1fr; gap: 5px; }
  .approval-box { grid-template-columns: 1fr; }
  .activity-item { grid-template-columns: 32px 1fr; }
  .activity-item time { grid-column: 2; }
  .toast-region { top: 10px; right: 10px; width: calc(100vw - 20px); }
}

@media (max-width: 390px) {
  .topbar { padding-right: 12px; padding-left: 12px; }
  .topbar .eyebrow { display: none; }
  .page { padding-right: 12px; padding-left: 12px; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-actions { grid-column: 1; }
  .login-panel { padding: 16px 12px; }
  .login-card { padding: 22px 18px; border-radius: 17px; }
  .login-foot { text-align: center; }
  .mobile-nav { right: 6px; bottom: calc(6px + env(safe-area-inset-bottom)); left: 6px; border-radius: 16px; }
  .mobile-nav__item { font-size: 8px; }
  .mobile-more-links { grid-template-columns: repeat(2,1fr); }
  .steps { gap: 2px; }
  .step { font-size: 9px; }
  .modal__foot .button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
