@layer tokens, reset, base, shell, components, content, overlays, responsive;

@layer tokens {
  :root {
    color-scheme: light;
    --ink: #18231f;
    --ink-soft: #405049;
    --ink-muted: #728078;
    --leaf: #355b4a;
    --leaf-deep: #28483a;
    --sage: #7f9b8b;
    --sage-wash: #edf2ed;
    --mist: #f4f6f2;
    --ivory: #fbfcf9;
    --paper: #ffffff;
    --line: #dfe5df;
    --line-soft: #ebefeb;
    --gold: #aa8a56;
    --danger: #a54f49;
    --danger-wash: #fff3f1;
    --warning: #aa6a24;
    --warning-wash: #fff7e9;
    --success: #327052;
    --success-wash: #edf7f1;
    --font-ui: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
    --font-data: Bahnschrift, "Segoe UI", Arial, sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --ease: cubic-bezier(.2, 0, 0, 1);
  }
}

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html, body { margin: 0; min-height: 100%; }
  button, input, select, textarea { font: inherit; }
  button { cursor: pointer; }
  img { display: block; max-width: 100%; }
  [hidden] { display: none !important; }
  :focus-visible { outline: 2px solid var(--leaf); outline-offset: 2px; }
}

@layer base {
  body {
    min-width: 1120px;
    background: var(--mist);
    color: var(--ink);
    font: 14px/1.55 var(--font-ui);
    -webkit-font-smoothing: antialiased;
  }
  h1, h2, h3, p { margin: 0; }
  h1, h2, h3 { letter-spacing: -.02em; }
  small { color: var(--ink-muted); }
  button { color: inherit; }
  input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink);
    transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease), background 140ms var(--ease);
  }
  input, select { height: 40px; padding: 0 12px; }
  textarea { min-height: 96px; padding: 10px 12px; resize: vertical; }
  input:hover, select:hover, textarea:hover { border-color: #c7d1c9; }
  input:focus, select:focus, textarea:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(53, 91, 74, .1); outline: 0; }
  input::placeholder, textarea::placeholder { color: #98a29d; }
  label { color: var(--ink-soft); font-size: 13px; }
  label > span:first-child { display: block; margin-bottom: 5px; color: var(--ink-muted); font-size: 12px; font-weight: 600; }
  .icon, .status-icon { display: none !important; }
  .visually-hidden, .sr-only {
    position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important;
    margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important;
  }
}

@layer shell {
  .app-shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 20; width: 216px;
    display: flex; flex-direction: column; padding: 26px 16px 18px;
    background: #f8faf7; border-right: 1px solid var(--line);
  }
  .brand { position: relative; min-height: 128px; padding: 3px 9px 24px; border-bottom: 1px solid var(--line-soft); overflow: hidden; }
  .brand > div { position: relative; z-index: 1; display: grid; gap: 2px; }
  .brand span { font-size: 25px; font-weight: 650; letter-spacing: .12em; }
  .brand small { color: var(--gold); font: 600 8px/1.2 var(--font-data); letter-spacing: .16em; }
  .brand > img { position: absolute; right: -24px; bottom: -88px; width: 126px; opacity: .18; }
  .sidebar nav { display: grid; gap: 5px; margin-top: 22px; }
  .sidebar nav button {
    position: relative; display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 8px;
    width: 100%; min-height: 46px; padding: 6px 10px; border: 0; border-radius: 8px;
    background: transparent; color: #53615a; text-align: left; font-weight: 550;
    transition: background 140ms var(--ease), color 140ms var(--ease), transform 100ms var(--ease);
  }
  .sidebar nav button:hover { background: var(--sage-wash); color: var(--leaf); }
  .sidebar nav button:active { transform: scale(.985); }
  .sidebar nav button.active { background: #e7eee8; color: var(--leaf-deep); font-weight: 700; }
  .sidebar nav button.active::before { content: ""; position: absolute; inset: 8px auto 8px 0; width: 3px; border-radius: 3px; background: var(--leaf); }
  .sidebar nav img { width: 27px; height: 27px; object-fit: contain; opacity: .78; }
  .sidebar nav button.active img { opacity: 1; }
  .logout { margin-top: auto; height: 42px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--ink-muted); text-align: left; padding: 0 13px; }
  .logout:hover { border-color: var(--line); background: #fff; color: var(--ink); }
  .workspace { grid-column: 2; min-width: 0; }
  .topbar {
    position: sticky; top: 0; z-index: 16; height: 76px; padding: 14px 30px;
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(251,252,249,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px);
  }
  .topbar > div:first-child > p { color: var(--gold); font: 600 9px/1.2 var(--font-data); letter-spacing: .14em; text-transform: uppercase; }
  .topbar h1 { margin-top: 3px; font-size: 20px; font-weight: 650; }
  .top-actions { position: relative; display: flex; align-items: center; gap: 8px; }
  .sync-pill, .notification-button, .operator {
    min-height: 38px; border: 1px solid var(--line); border-radius: 7px; background: #fff;
  }
  .sync-pill { display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; color: var(--success); font-size: 12px; font-weight: 650; }
  .sync-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-wash); }
  .notification-button { padding: 0 11px; color: var(--ink-soft); }
  .notification-button b { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 4px; padding: 0 5px; border-radius: 10px; background: var(--warning-wash); color: var(--warning); font: 700 11px/1 var(--font-data); }
  .operator { min-width: 126px; padding: 5px 11px; display: grid; grid-template-columns: 1fr; text-align: left; }
  .operator span { font-weight: 650; line-height: 1.2; }
  .operator small { font-size: 10px; line-height: 1.2; }
  .operator:hover, .notification-button:hover { border-color: #c9d3cb; background: var(--ivory); }
  .operator-menu {
    position: absolute; top: 45px; right: 0; z-index: 40; width: 190px; padding: 8px;
    border: 1px solid var(--line); border-radius: 9px; background: #fff;
    box-shadow: 0 14px 36px rgba(25,43,35,.12);
  }
  .operator-menu strong { display: block; padding: 8px 10px 6px; color: var(--ink-muted); font-size: 11px; letter-spacing: .08em; }
  .operator-menu button { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 6px; background: transparent; text-align: left; }
  .operator-menu button:hover { background: var(--sage-wash); }
  .view { padding: 28px 30px 48px; }
  .notice { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: 420px; padding: 12px 16px; border: 1px solid #b9d2c2; border-radius: 8px; background: #f0faf4; color: var(--success); box-shadow: 0 12px 28px rgba(22,45,34,.12); }
  .notice[data-tone="error"] { border-color: #e6c2be; background: var(--danger-wash); color: var(--danger); }
}

@layer components {
  .page-intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
  .page-intro p { color: var(--gold); font: 650 10px/1.3 var(--font-data); letter-spacing: .14em; }
  .page-intro h2 { margin-top: 6px; font-size: 28px; line-height: 1.2; font-weight: 650; }
  .page-intro > div > span { display: block; margin-top: 7px; color: var(--ink-muted); }
  .page-intro-actions { flex: 0 0 auto; }
  .primary, .secondary, .danger, .row-action, .text-button {
    min-height: 36px; padding: 0 14px; border-radius: 6px; font-weight: 650;
    transition: transform 100ms var(--ease), background 140ms var(--ease), border-color 140ms var(--ease), color 140ms var(--ease);
  }
  .primary { border: 1px solid var(--leaf); background: var(--leaf); color: #fff; }
  .primary:hover { background: var(--leaf-deep); border-color: var(--leaf-deep); }
  .secondary { border: 1px solid var(--line); background: #fff; color: var(--ink-soft); }
  .secondary:hover { border-color: #bdc9bf; background: var(--ivory); color: var(--ink); }
  .danger { border: 1px solid transparent; background: transparent; color: var(--danger); }
  .primary:active, .secondary:active, .danger:active, .row-action:active { transform: scale(.975); }
  button:disabled { cursor: not-allowed; opacity: .48; }
  .summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
  .summary-card { position: relative; min-height: 114px; padding: 18px 18px 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); overflow: hidden; }
  .summary-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--sage); }
  .summary-card.urgent::before { background: var(--danger); }
  .summary-card.attention::before { background: var(--gold); }
  .summary-card.calm::before { background: var(--success); }
  .summary-card.quiet::before { background: #9da7a1; }
  .summary-card > span { display: block; color: var(--ink-soft); font-weight: 650; }
  .summary-card strong { display: block; margin-top: 8px; font: 600 27px/1.1 var(--font-data); font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
  .summary-card small { display: block; margin-top: 7px; }
  .summary-grid.compact .summary-card { min-height: 96px; padding-top: 15px; }
  .summary-grid.compact .summary-card strong { margin-top: 5px; font-size: 23px; }
  .surface { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); }
  .overview-layout { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(330px,.65fr); gap: 16px; }
  .surface > header, .task-board > header, .delivery-board > header { display: flex; align-items: center; justify-content: space-between; padding: 17px 18px; border-bottom: 1px solid var(--line-soft); }
  .surface > header p { color: var(--gold); font: 650 9px/1.2 var(--font-data); letter-spacing: .13em; }
  .surface > header h3 { margin-top: 4px; font-size: 17px; font-weight: 650; }
  .surface > header > span { color: var(--ink-muted); font: 600 12px/1 var(--font-data); }
  .text-button { min-height: auto; padding: 5px 0; border: 0; background: transparent; color: var(--leaf); font-size: 12px; }
  .task-list { display: grid; }
  .task-row { display: grid; grid-template-columns: 3px minmax(0,1fr) 40px 54px; align-items: center; gap: 14px; min-height: 72px; padding: 10px 18px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; text-align: left; }
  .task-row:last-child { border-bottom: 0; }
  .task-row:hover { background: #fafbf9; }
  .task-row i { width: 3px; height: 30px; border-radius: 2px; background: var(--sage); }
  .task-row.urgent i { background: var(--danger); }
  .task-row.attention i { background: var(--gold); }
  .task-row.calm i { background: var(--success); }
  .task-row span { display: grid; gap: 2px; }
  .task-row span strong { font-size: 14px; }
  .task-row span small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .task-row b { text-align: right; font: 650 19px/1 var(--font-data); }
  .task-row em { color: var(--leaf); font-size: 12px; font-style: normal; text-align: right; }
  .delivery-list { display: grid; }
  .delivery-list > button { display: grid; grid-template-columns: 118px minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 66px; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; text-align: left; }
  .delivery-list > button:hover { background: #fafbf9; }
  .delivery-list time { color: var(--ink-soft); font: 600 11px/1.35 var(--font-data); }
  .delivery-list button > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
  .delivery-list button > span:nth-child(2) small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .status-badge { display: inline-flex; align-items: center; width: fit-content; min-height: 24px; padding: 2px 8px; border-radius: 4px; background: #f0f3f0; color: #5d6962; font-size: 11px; font-weight: 650; white-space: nowrap; }
  .status-badge.pending_payment, .status-badge.inquiry-submitted { background: var(--warning-wash); color: var(--warning); }
  .status-badge.paid, .status-badge.making, .status-badge.ready, .status-badge.inquiry-contacted, .status-badge.inquiry-quoted { background: #f4f0e8; color: #7d633a; }
  .status-badge.shipped, .status-badge.completed, .status-badge.inquiry-closed, .status-badge.active { background: var(--success-wash); color: var(--success); }
  .status-badge.cancelled, .status-badge.refunded, .status-badge.inquiry-cancelled, .status-badge.inactive { background: #f1f2f1; color: #7c8580; }
  .status-badge.service { background: var(--sage-wash); color: var(--leaf); }
  .filter-bar.v4-filter { display: flex; align-items: end; gap: 10px; margin-bottom: 14px; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.72); }
  .v4-filter label { min-width: 140px; }
  .v4-filter .search-control { min-width: 270px; flex: 1 1 330px; }
  .v4-filter > button { margin-bottom: 0; }
  .filter-bar label > select { min-width: 150px; }
  .stage-tabs { display: flex; align-items: center; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
  .stage-tabs button { position: relative; min-height: 42px; padding: 0 14px; border: 0; background: transparent; color: var(--ink-muted); font-weight: 600; }
  .stage-tabs button::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: transparent; }
  .stage-tabs button[aria-selected="true"] { color: var(--leaf); }
  .stage-tabs button[aria-selected="true"]::after { background: var(--leaf); }
  .stage-tabs b { display: inline-block; min-width: 20px; margin-left: 3px; padding: 1px 5px; border-radius: 9px; background: var(--sage-wash); color: var(--leaf); font: 650 11px/1.5 var(--font-data); }
  .table-surface { overflow: hidden; }
  .table-wrap { width: 100%; overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; }
  th { height: 42px; padding: 0 13px; border-bottom: 1px solid var(--line); background: #fafbf9; color: var(--ink-muted); font-size: 11px; font-weight: 650; text-align: left; white-space: nowrap; }
  td { height: 60px; padding: 9px 13px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
  tbody tr:last-child td { border-bottom: 0; }
  tbody tr:hover td { background: #fbfcfa; }
  td > strong, td > small, .delivery-cell > strong, .delivery-cell > small, .evidence-cell > small, .money-cell > small, .request-brief > strong, .request-brief > small { display: block; }
  td > small, .delivery-cell small, .evidence-cell small, .money-cell small, .request-brief small { margin-top: 2px; color: var(--ink-muted); font-size: 11px; }
  .address-cell { min-width: 230px; max-width: 340px; color: var(--ink-soft); }
  .delivery-cell strong { font: 600 12px/1.35 var(--font-data); }
  .money-cell { font: 650 13px/1.4 var(--font-data); font-variant-numeric: tabular-nums; }
  .request-brief { display: block; min-width: 180px; max-width: 300px; }
  .product-cell, .manager-cell { display: flex; align-items: center; gap: 10px; min-width: 170px; }
  .record-media { flex: 0 0 38px; width: 38px; height: 38px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 5px; background: var(--mist); color: var(--ink-muted); font-size: 10px; }
  .record-media img { width: 100%; height: 100%; object-fit: cover; }
  .product-cell > span:last-child, .manager-cell > span:last-child { display: grid; gap: 1px; }
  .manager-avatar { flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--sage-wash); color: var(--leaf); font-weight: 700; }
  .stock-low { display: block; color: var(--warning); font-size: 10px; }
  .muted-row { opacity: .68; }
  .row-actions { display: flex; align-items: center; gap: 2px; white-space: nowrap; }
  .row-action { min-height: 30px; padding: 0 8px; border: 0; background: transparent; color: var(--leaf); font-size: 12px; }
  .row-action:hover { background: var(--sage-wash); }
  .row-action.danger { color: var(--danger); }
  .table-surface > footer { min-height: 42px; padding: 11px 14px; border-top: 1px solid var(--line-soft); color: var(--ink-muted); font-size: 12px; }
  .empty-state { min-height: 240px; display: grid; place-items: center; align-content: center; gap: 5px; color: var(--ink-muted); text-align: center; }
  .empty-state img { width: 150px; height: 90px; object-fit: contain; opacity: .74; }
  .empty-state strong { color: var(--ink-soft); }
  .empty-state span { font-size: 12px; }
}

@layer content {
  .content-navigation { margin: -2px 0 14px !important; padding: 0 !important; border: 0 !important; border-bottom: 1px solid var(--line) !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; }
  .content-navigation > div:first-child:empty { display: none; }
  .content-tabs { display: flex; gap: 4px; }
  .content-tabs button { position: relative; min-height: 42px; padding: 0 16px; border: 0; background: transparent; color: var(--ink-muted); font-weight: 600; }
  .content-tabs button::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: transparent; }
  .content-tabs button[aria-selected="true"] { color: var(--leaf); }
  .content-tabs button[aria-selected="true"]::after { background: var(--leaf); }
  .content-workspace, .studio-section { min-width: 0; }
  .studio-section { padding: 0; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; overflow: hidden; }
  .studio-heading { display: flex; align-items: center; justify-content: space-between; min-height: 74px; padding: 15px 18px; border-bottom: 1px solid var(--line-soft); }
  .studio-heading .section-kicker { color: var(--gold); font: 650 9px/1.2 var(--font-data); letter-spacing: .13em; }
  .studio-heading h2 { margin-top: 4px; font-size: 17px; }
  .studio-heading p:not(.section-kicker) { margin-top: 4px; color: var(--ink-muted); font-size: 12px; }
  .studio-heading > span { color: var(--ink-muted); font: 600 12px/1 var(--font-data); }
  .banner-card-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; padding: 16px; }
  .content-banner-card { min-width: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
  .content-banner-card > header { display: flex; justify-content: space-between; padding: 9px 11px; border-bottom: 1px solid var(--line-soft); }
  .banner-number { color: var(--gold); font: 700 11px/1 var(--font-data); }
  .banner-state { color: var(--ink-muted); font-size: 11px; }
  .banner-visual { position: relative; height: 180px; overflow: hidden; background: var(--mist); }
  .banner-visual img { width: 100%; height: 100%; object-fit: cover; }
  .banner-overlay { position: absolute; inset: auto 12px 12px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.34); }
  .banner-overlay small, .banner-overlay strong { display: block; }
  .banner-overlay strong { margin-top: 2px; font-size: 17px; }
  .image-action { position: absolute; right: 8px; top: 8px; z-index: 2; padding: 5px 8px; border-radius: 5px; background: rgba(255,255,255,.92); color: var(--leaf); font-size: 11px; font-weight: 650; }
  .image-action input { display: none; }
  .banner-fields { display: grid; gap: 9px; padding: 12px; }
  .banner-meta-fields { display: grid; grid-template-columns: 110px 1fr; gap: 8px; }
  .category-editor-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; padding: 14px; }
  .category-editor { display: grid; grid-template-columns: 128px minmax(0,1fr); min-height: 154px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
  .category-editor-photo { position: relative; min-height: 154px; background: var(--mist); }
  .category-editor-photo img { width: 100%; height: 100%; object-fit: cover; }
  .category-editor-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; align-content: start; padding: 12px; }
  .wide { grid-column: 1 / -1; }
  .form-footer { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
  .form-footer p { color: var(--ink-muted); font-size: 12px; }
  .content-post-layout { display: grid; grid-template-columns: minmax(0,1fr) 270px; gap: 14px; align-items: start; }
  .post-filter-bar { display: grid; grid-template-columns: 150px minmax(290px,1fr) minmax(250px,1fr) auto; gap: 10px; align-items: end; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); }
  .post-date-range { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 5px; }
  .post-date-range i { color: var(--ink-muted); font-style: normal; font-size: 11px; }
  .management-list { display: grid; }
  .management-record { display: grid; grid-template-columns: 46px minmax(0,1fr) auto; align-items: center; gap: 12px; min-height: 76px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
  .management-record:last-child { border-bottom: 0; }
  .case-thumb-error { display: grid; place-items: center; padding: 6px; background: var(--mist); color: var(--ink-muted); font-size: 10px; line-height: 1.35; text-align: center; }
  .record-body { min-width: 0; }
  .record-title { display: flex; align-items: center; gap: 8px; }
  .record-title h3 { min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .record-body > p { margin-top: 3px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .record-body > small { display: block; margin-top: 3px; font-size: 11px; }
  .visibility-badge { padding: 2px 6px; border-radius: 4px; font-size: 10px; }
  .visibility-badge.is-visible { background: var(--success-wash); color: var(--success); }
  .visibility-badge.is-hidden { background: #f1f2f1; color: var(--ink-muted); }
  .record-actions { display: flex; align-items: center; gap: 3px; }
  .record-actions button { min-height: 30px; padding: 0 8px; border: 0; background: transparent; color: var(--leaf); font-size: 11px; }
  .record-actions button:hover { background: var(--sage-wash); }
  .record-actions button.danger { color: var(--danger); }
  .content-phone-preview { position: sticky; top: 94px; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
  .preview-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
  .preview-heading .section-kicker { color: var(--gold); font: 650 9px/1.2 var(--font-data); letter-spacing: .12em; }
  .preview-heading h2 { margin-top: 3px; font-size: 15px; }
  .preview-heading > span { color: var(--ink-muted); font-size: 10px; }
  .phone-frame { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fafbf9; }
  .phone-status, .phone-brand { display: flex; justify-content: space-between; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); font-size: 9px; }
  .phone-brand { display: block; text-align: center; font-size: 12px; font-weight: 650; }
  .phone-feed { display: grid; gap: 8px; padding: 8px; }
  .phone-feed-card { padding: 7px; border: 1px solid var(--line-soft); border-radius: 6px; background: #fff; }
  .phone-feed-card > div { height: 84px; overflow: hidden; margin-bottom: 6px; background: var(--mist); }
  .phone-feed-card img { width: 100%; height: 100%; object-fit: cover; }
  .phone-feed-card strong { font-size: 11px; }
  .phone-feed-card p { margin-top: 2px; color: var(--ink-muted); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .phone-preview-nav { display: none; }
  .list-footer { display: flex; align-items: center; gap: 7px; min-height: 44px; padding: 9px 14px; border-top: 1px solid var(--line-soft); color: var(--ink-muted); font-size: 11px; }
  .list-footer button { min-width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
}

@layer overlays {
  dialog { padding: 0; border: 0; color: var(--ink); }
  dialog::backdrop { background: rgba(21,34,28,.22); backdrop-filter: blur(2px); }
  .side-drawer { position: fixed; inset: 0 0 0 auto; width: min(560px, 92vw); max-width: none; max-height: none; height: 100vh; margin: 0; border-left: 1px solid var(--line); background: #fff; box-shadow: -18px 0 48px rgba(20,38,29,.12); }
  .side-drawer[open] { animation: drawer-in 220ms var(--ease); }
  @keyframes drawer-in { from { transform: translateX(28px); opacity: .45; } to { transform: translateX(0); opacity: 1; } }
  .dialog-card { min-height: 100%; display: flex; flex-direction: column; padding: 0; background: #fff; }
  .dialog-card > header { position: sticky; top: 0; z-index: 3; min-height: 92px; display: flex; align-items: start; justify-content: space-between; gap: 20px; padding: 19px 22px 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
  .dialog-card .eyebrow { color: var(--gold); font: 650 9px/1.2 var(--font-data); letter-spacing: .13em; }
  .dialog-card > header h2 { margin-top: 5px; font-size: 22px; }
  .dialog-card > header .form-hint { margin-top: 5px; }
  .icon-button { flex: 0 0 auto; min-width: 48px; height: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink-muted); }
  .icon-button::after { content: "关闭"; font-size: 12px; }
  .drawer-editor-layout { display: block; }
  .dialog-card > .form-grid, .drawer-editor-layout > .form-grid, .drawer-section, .drawer-group, .permission-note, .order-status-field, .locked-hint, #productImagePreview { margin-inline: 22px; }
  .dialog-card > .form-grid, .drawer-editor-layout > .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; padding-block: 18px; }
  .dialog-card > .form-grid label, .drawer-editor-layout > .form-grid label { display: block; }
  .dialog-card > .form-grid label > input, .dialog-card > .form-grid label > select, .dialog-card > .form-grid label > textarea,
  .drawer-editor-layout > .form-grid label > input, .drawer-editor-layout > .form-grid label > select, .drawer-editor-layout > .form-grid label > textarea { margin-top: 5px; }
  fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
  fieldset legend { margin-bottom: 7px; color: var(--ink-muted); font-size: 12px; font-weight: 650; }
  .segmented-field, .radio-field { display: flex; flex-wrap: wrap; gap: 6px; }
  .segmented-field label, .radio-field label { position: relative; }
  .segmented-field input, .radio-field input { position: absolute; opacity: 0; pointer-events: none; }
  .segmented-field span, .radio-field span { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
  .segmented-field input:checked + span, .radio-field input:checked + span { border-color: var(--leaf); background: var(--sage-wash); color: var(--leaf); font-weight: 650; }
  .radio-field small { align-self: center; margin-left: 4px; }
  .upload-field .upload-box, .upload-tile { position: relative; display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; gap: 1px 10px; min-height: 70px; align-items: center; padding: 11px; border: 1px dashed #bdc9bf; border-radius: 7px; background: #fafbf9; }
  .upload-box b { grid-row: 1 / 3; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 5px; font-size: 18px; font-weight: 400; }
  .upload-box small { font-size: 10px; }
  .upload-field { position: relative; }
  .upload-field > input[type="file"], .upload-tile > input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
  .single-preview { margin-bottom: 16px; }
  .single-preview img { width: 110px; height: 110px; object-fit: cover; border: 1px solid var(--line); border-radius: 7px; }
  .drawer-live-preview { display: none !important; }
  .drawer-section, .drawer-group { padding-block: 18px; border-bottom: 1px solid var(--line-soft); }
  .drawer-section h3, .drawer-group h3 { margin-bottom: 12px; font-size: 15px; }
  .drawer-section-head { display: flex; align-items: center; justify-content: space-between; }
  .drawer-facts, .detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .drawer-facts span, .detail-list span { display: block; color: var(--ink-muted); font-size: 11px; }
  .drawer-facts strong, .detail-list strong { display: block; margin-top: 2px; }
  .drawer-facts > *, .detail-list > div { padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
  .drawer-timeline { display: flex; align-items: start; }
  .drawer-timeline > div { position: relative; flex: 1; padding-top: 17px; color: var(--ink-muted); font-size: 10px; }
  .drawer-timeline > div::before { content: ""; position: absolute; top: 5px; left: 0; right: 0; height: 1px; background: var(--line); }
  .drawer-timeline i { position: absolute; top: 1px; left: 0; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; background: #c7cec9; box-shadow: 0 0 0 1px #c7cec9; }
  .drawer-timeline .is-done { color: var(--leaf); }
  .drawer-timeline .is-done i { background: var(--leaf); box-shadow: 0 0 0 1px var(--leaf); }
  .drawer-timeline span, .drawer-timeline small { display: block; }
  .drawer-items { display: grid; gap: 8px; }
  .drawer-items article { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 9px; padding: 8px; border: 1px solid var(--line-soft); border-radius: 6px; }
  .drawer-items article img { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; }
  .drawer-items article span small { display: block; }
  .order-preview-list, .reference-grid > div { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
  .order-preview-list img, .reference-grid img { width: 74px; height: 74px; object-fit: cover; border: 1px solid var(--line); border-radius: 5px; }
  .reference-grid a span { display: none; }
  .order-status-field { display: block; padding-top: 16px; }
  .order-status-field select { margin-top: 5px; }
  .locked-hint { margin-top: 8px; padding: 9px 11px; border-radius: 6px; background: var(--mist); color: var(--ink-muted); font-size: 11px; }
  .linked-product-preview { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
  .linked-product-preview > span { display: grid; flex: 1; }
  .permission-matrix { margin-top: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--mist); }
  .permission-matrix > p { margin: 4px 0 10px; color: var(--ink-muted); font-size: 11px; }
  .permission-matrix > label { display: flex; align-items: start; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
  .permission-matrix input { width: 16px; height: 16px; }
  .permission-matrix label span { display: grid; }
  .permission-matrix label small { margin-top: 2px; }
  .editor-toolbar { display: flex; gap: 4px; margin-top: 5px; padding: 6px; border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; background: var(--mist); }
  .editor-toolbar select { width: 100px; height: 30px; }
  .editor-toolbar button { height: 30px; border: 0; border-radius: 4px; background: #fff; font-size: 11px; }
  .editor-field textarea { margin-top: 0 !important; border-radius: 0 0 6px 6px; }
  .counted-field { position: relative; }
  .counted-field > small, .editor-field > small { display: block; margin-top: 3px; text-align: right; }
  .dialog-actions { position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 13px 22px; border-top: 1px solid var(--line); background: rgba(255,255,255,.97); }
  .dialog-actions .dialog-spacer { flex: 1; }
  .dialog-actions .primary { margin-left: auto; min-width: 112px; }
  .side-drawer.is-readonly .upload-tile, .side-drawer.is-readonly .locked-hint { display: none; }
  #commentsDialog { width: min(620px,90vw); max-height: 76vh; border-radius: 12px; box-shadow: 0 18px 54px rgba(20,38,29,.16); }
  #commentsDialog .dialog-card { min-height: auto; }
  #commentsList { padding: 16px 20px; }
  #commentsList article { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
}

@layer components {
  .login-shell { position: relative; min-height: 100vh; display: grid; grid-template-columns: minmax(520px,1.15fr) minmax(420px,.85fr); padding-bottom: 46px; background: var(--ivory); }
  .login-art { position: relative; display: flex; flex-direction: column; justify-content: center; padding: 10vw; overflow: hidden; background: #eef3ee; }
  .login-art::after { content: ""; position: absolute; right: -20px; bottom: -20px; width: 440px; height: 660px; background: url("./assets/v4/brand-branch.png") center/contain no-repeat; opacity: .22; }
  .login-art .eyebrow { position: relative; z-index: 1; color: var(--gold); font: 650 10px/1.2 var(--font-data); letter-spacing: .18em; }
  .login-art h1 { position: relative; z-index: 1; margin-top: 18px; font-size: clamp(38px,4vw,62px); font-weight: 550; line-height: 1.18; }
  .login-art > p:last-child { position: relative; z-index: 1; max-width: 480px; margin-top: 22px; color: var(--ink-soft); font-size: 16px; }
  .login-card { align-self: center; justify-self: center; width: min(390px,75%); padding: 28px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
  .login-card .eyebrow { color: var(--gold); font: 650 10px/1.2 var(--font-data); letter-spacing: .15em; }
  .login-card h2 { margin: 7px 0 24px; font-size: 24px; }
  .login-card label { display: grid; gap: 6px; margin-bottom: 14px; font-weight: 600; }
  .login-card input { height: 44px; }
  .login-card .primary { width: 100%; height: 44px; margin-top: 8px; }
  .form-error { min-height: 20px; color: var(--danger); font-size: 12px; }
  .file-mode-notice { margin-bottom: 16px; padding: 12px; border-radius: 7px; background: var(--warning-wash); color: var(--warning); }
  .file-mode-notice span { display: block; margin-top: 3px; font-size: 11px; }
  .site-filing { color: var(--ink-muted); font-size: 12px; line-height: 1.5; text-align: center; }
  .site-filing a { color: inherit; text-decoration: none; }
  .site-filing a:hover, .site-filing a:focus-visible { color: var(--leaf); text-decoration: underline; }
  .site-filing .public-security-filing { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; }
  .public-security-filing-icon { display: block; width: 15px; height: 17px; flex: 0 0 auto; object-fit: contain; }
  .login-filing { position: absolute; right: 0; bottom: 15px; left: 0; z-index: 2; }
  .app-filing { margin-top: auto; padding: 18px 24px 24px; border-top: 1px solid var(--line-soft); }
}

@layer responsive {
  @media (max-width: 1380px) {
    body { min-width: 1024px; }
    .app-shell { grid-template-columns: 192px minmax(0,1fr); }
    .sidebar { width: 192px; }
    .summary-card { padding-inline: 14px; }
    .content-post-layout { grid-template-columns: minmax(0,1fr) 230px; }
    th, td { padding-inline: 10px; }
  }
  @media (max-width: 1100px) {
    body { min-width: 0; }
    .app-shell { grid-template-columns: 72px minmax(0,1fr); }
    .sidebar { width: 72px; padding-inline: 8px; }
    .brand { min-height: 72px; padding-inline: 4px; }
    .brand > div span { font-size: 18px; }
    .brand small, .brand > img, .sidebar nav button span, .logout { display: none; }
    .sidebar nav button { grid-template-columns: 1fr; justify-items: center; padding: 6px; }
    .workspace { grid-column: 2; }
    .view { padding-inline: 20px; }
    .topbar { padding-inline: 20px; }
    .overview-layout { grid-template-columns: 1fr; }
    .content-post-layout { grid-template-columns: 1fr; }
    .content-phone-preview { display: none; }
  }
  @media (max-width: 620px) {
    .topbar { height: 64px; padding-inline: 14px; }
    .topbar > div:first-child > p, .top-actions .sync-pill, .top-actions .notification-button, .operator small { display: none; }
    .topbar h1 { margin: 0; font-size: 18px; white-space: nowrap; }
    .top-actions { min-width: 0; }
    .operator { min-width: 104px; min-height: 34px; padding-inline: 9px; }
    .view { padding: 20px 14px 34px; }
    .page-intro { align-items: start; gap: 12px; margin-bottom: 18px; }
    .page-intro h2 { font-size: 24px; }
    .page-intro > div > span { font-size: 12px; }
    .summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
    .summary-card { min-height: 104px; padding: 15px 13px 13px; }
    .summary-card strong { font-size: 24px; }
    .task-row { grid-template-columns: 3px minmax(0,1fr) 28px 48px; gap: 8px; padding-inline: 12px; }
    .surface > header, .task-board > header, .delivery-board > header { padding-inline: 14px; }
    .filter-grid { grid-template-columns: 1fr; }
    .side-drawer { width: 100vw; }
    .dialog-card > header { min-height: 84px; padding-inline: 18px; }
    .dialog-card > .form-grid, .drawer-editor-layout > .form-grid, .drawer-section, .drawer-group, .permission-note, .order-status-field, .locked-hint, #productImagePreview { margin-inline: 18px; }
    .dialog-card > .form-grid, .drawer-editor-layout > .form-grid { grid-template-columns: 1fr; }
    .dialog-actions { padding-inline: 18px; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  }
}

/* Keep the existing login design usable on phone-sized viewports. */
@layer responsive {
  @media (max-width: 760px) {
    .login-shell { grid-template-columns: minmax(0, 1fr); align-content: start; gap: 24px; padding-bottom: 28px; }
    .login-art { min-width: 0; padding: 32px 24px; }
    .login-art::after { width: 180px; height: 270px; right: -10px; bottom: -36px; }
    .login-art h1 { margin-top: 14px; font-size: 32px; }
    .login-art > p:last-child { margin-top: 16px; font-size: 14px; }
    .login-card { width: calc(100% - 32px); max-width: 390px; min-width: 0; padding: 24px; }
    .login-card input { font-size: 16px; }
  }
}
