/* ============================================
   机具档案 CRM · Premium Design System
   锚点：高端农机品牌服务台 × 精密仪表面板
   纸感底 + 墨绿 + 黄铜 · 克制阴影 · 强字阶
   ============================================ */
:root {
  /* color */
  --bg: #f2efe8;
  --bg-elev: #faf8f3;
  --paper: #ffffff;
  --ink: #121812;
  --ink-2: #2a332a;
  --muted: #6d766d;
  --faint: #9aa39a;
  --line: #e4e0d6;
  --line-strong: #d2ccbe;

  --accent: #1a4d38;
  --accent-2: #256348;
  --accent-soft: #e4efe8;
  --accent-ink: #0d2f20;

  --brass: #9a7b3f;
  --brass-soft: #f3ecd9;
  --brass-line: #e0d2b0;

  --warn: #8a5a12;
  --warn-bg: #f7ecd6;
  --danger: #9c2f2f;
  --danger-bg: #f8e6e4;
  --ok: #1f6b3a;
  --ok-bg: #e3f2e6;

  --shadow-xs: 0 1px 2px rgba(18, 24, 18, 0.04);
  --shadow-sm: 0 2px 8px rgba(18, 24, 18, 0.05);
  --shadow: 0 12px 36px rgba(18, 24, 18, 0.07);
  --shadow-lg: 0 24px 64px rgba(18, 24, 18, 0.12);

  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;

  --font: "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "Cascadia Code", "SF Mono", Consolas, monospace;

  --sidebar-w: 248px;
  --topbar-h: 68px;
  --container: 1240px;
  --gutter: 28px;
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 100% -10%, rgba(154, 123, 63, 0.06), transparent 55%),
    radial-gradient(900px 400px at -10% 0%, rgba(26, 77, 56, 0.05), transparent 50%),
    var(--bg);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
::selection { background: rgba(26, 77, 56, 0.14); }
img { max-width: 100%; }

/* ========== Shell ========== */
.web .shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}
.web .sidebar {
  background:
    linear-gradient(180deg, #101912 0%, #0c130e 100%);
  color: #cfd9cf;
  padding: 26px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 8px 6px;
}
.side-brand .mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  color: #f3f8f4;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 20px rgba(26, 77, 56, 0.45), inset 0 1px 0 rgba(255,255,255,.2);
}
.side-brand .txt { display: grid; line-height: 1.15; }
.side-brand .txt strong {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #f4f7f3;
}
.side-brand .txt span {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #8a9a8c;
  margin-top: 3px;
}
.side-section {
  padding: 0 12px 8px;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #637365;
  font-weight: 700;
}
.web .side-nav { display: grid; gap: 4px; }
.web .side-nav a {
  position: relative;
  color: #b7c5b7;
  text-decoration: none;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 550;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, color 0.15s ease;
}
.web .side-nav a:hover { background: rgba(255, 255, 255, 0.06); color: #eef4ee; }
.web .side-nav a.active {
  background: linear-gradient(90deg, rgba(37, 99, 72, 0.45), rgba(37, 99, 72, 0.12));
  color: #fff;
  font-weight: 650;
}
.web .side-nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #d4b56e, #8f7340);
}
.web .side-foot {
  margin-top: auto;
  padding: 14px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12px;
  color: #8a9a8c;
}
.web .side-foot strong {
  display: block;
  color: #e8efe8;
  font-size: 13px;
  margin-bottom: 3px;
}
.web .main {
  min-width: 0;
  background:
    radial-gradient(1000px 360px at 100% 0%, rgba(154, 123, 63, 0.05), transparent 45%),
    var(--bg);
}
.web .container.wide { width: min(var(--container), calc(100% - 56px)); margin: 0 auto 64px; }

/* ========== Topbar ========== */
.topbar {
  height: var(--topbar-h);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 0 36px;
  border-bottom: 1px solid rgba(210, 204, 190, 0.7);
  background: rgba(250, 248, 243, 0.88);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}
.brand span { color: var(--accent); }
.nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.nav a {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 9px;
  font-weight: 550;
}
.nav a:hover { background: rgba(18, 24, 18, 0.04); color: var(--ink); }
.nav a.active {
  color: var(--accent);
  font-weight: 700;
  background: var(--accent-soft);
}

/* ========== Layout helpers ========== */
.container {
  width: min(1120px, calc(100% - 48px));
  margin: 32px auto 64px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.page-head h2 {
  margin: 6px 0 8px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 720;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.page-head .desc {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  max-width: 560px;
  line-height: 1.65;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin: 8px 0 14px;
}
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass);
  font-weight: 800;
}
.kicker::before {
  content: "";
  width: 18px;
  height: 1px;
  background: linear-gradient(90deg, var(--brass), transparent);
}
.toolbar { margin-bottom: 18px; }
.filter-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  width: 100%;
}
.filter-form .f { display: grid; gap: 6px; min-width: 128px; }
.filter-form .f.grow { flex: 1; min-width: 220px; }
.filter-form label,
label {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 7px;
}
.filter-form input,
.filter-form select { min-height: 44px; border-radius: var(--r-sm); background: var(--paper); }
.filter-form .btn { min-height: 44px; }
.toolbar .search {
  display: flex;
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.toolbar .search input {
  border: none;
  border-radius: 0;
  min-width: 240px;
  background: transparent;
  box-shadow: none;
}
.toolbar .search input:focus { outline: none; box-shadow: none; }
.toolbar .search .btn { border-radius: 0; min-height: 44px; }

/* ========== Cards ========== */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px 26px;
  position: relative;
}
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-pad { padding: 22px 26px; }
.card h1, .card h2, .card h3 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}
.card h3 {
  font-size: 14px;
  font-weight: 750;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card h3::before {
  content: "";
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brass), var(--accent));
}
.muted { color: var(--muted); font-size: 13px; }
.faint { color: var(--faint); font-size: 12px; }

.hero {
  display: grid;
  grid-template-columns: 1.45fr 0.85fr;
  gap: 18px;
  margin-bottom: 24px;
}
.hero-card {
  background:
    radial-gradient(ellipse at 90% 0%, rgba(212, 181, 110, 0.22), transparent 42%),
    linear-gradient(135deg, #0f2a1d 0%, #1a4d38 48%, #245f45 100%);
  color: #f2f7f3;
  border: none;
  border-radius: var(--r-xl);
  padding: 32px 34px;
  box-shadow: var(--shadow-lg);
}
.hero-card .kicker { color: #d4b56e; }
.hero-card .kicker::before { background: #d4b56e; }
.hero-card h2 {
  margin: 8px 0 10px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.03em;
}
.hero-card p { margin: 0; opacity: 0.92; font-size: 14px; line-height: 1.7; max-width: 520px; }
.hero-card .row { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.hero-card .btn {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}
.hero-card .btn.secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--r-sm);
  padding: 0 20px;
  min-height: 44px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 18px rgba(26, 77, 56, 0.22);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}
.btn:hover { box-shadow: 0 10px 24px rgba(26, 77, 56, 0.28); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.secondary {
  background: var(--paper);
  color: var(--ink-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-xs);
}
.btn.secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  box-shadow: none;
}
.btn.ghost:hover { background: rgba(18, 24, 18, 0.04); color: var(--ink); }
.btn.danger {
  background: linear-gradient(180deg, #b03d3d, var(--danger));
  box-shadow: 0 6px 18px rgba(156, 47, 47, 0.2);
}
.btn.small { min-height: 34px; padding: 0 13px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; }

/* ========== Forms ========== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
}
.form-grid .full { grid-column: 1 / -1; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--bg-elev);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input:hover, select:hover, textarea:hover { border-color: #c2bba8; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26, 77, 56, 0.1);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { min-height: 96px; resize: vertical; }

/* ========== Table ========== */
table, .desktop-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
th, td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13.5px;
  vertical-align: middle;
}
th {
  background: linear-gradient(180deg, #f7f4ed, #f1ede4);
  color: var(--muted);
  font-weight: 750;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: #fcfaf5; }
tr:last-child td { border-bottom: none; }
td strong { font-weight: 700; }
td a { font-weight: 650; }

/* ========== Pills ========== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: 0.03em;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}
.pill.gray { background: #f0ede5; color: var(--muted); border-color: var(--line); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.brass { background: var(--brass-soft); color: var(--brass); border-color: var(--brass-line); }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ========== Stats ========== */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brass), transparent 75%);
  opacity: 0.7;
}
.stat .lbl {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.stat .num {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat .num.danger { color: var(--danger); }
.stat .sub { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* ========== Misc blocks ========== */
.stack { display: grid; gap: 16px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #efc8c6;
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13.5px;
  font-weight: 550;
}
.warnbar {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid #ead8b3;
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.6;
}
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(26, 77, 56, 0.1), transparent 45%),
    radial-gradient(ellipse at 90% 100%, rgba(154, 123, 63, 0.1), transparent 40%),
    var(--bg);
}
.login-card {
  width: min(420px, 100%);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 36px;
}
.machine-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 18px;
  background: var(--bg-elev);
}
.machine-card + .machine-card { margin-top: 12px; }
.meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 8px;
}
.empty {
  color: var(--muted);
  padding: 40px 16px;
  text-align: center;
  font-size: 13.5px;
  background: linear-gradient(180deg, #fcfaf5, transparent);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
}
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.right { text-align: right; }

/* ========== Progress timeline ========== */
.progress-list { display: grid; gap: 0; }
.pstep {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 4px 12px;
}
.pstep::before {
  content: "";
  grid-row: 1 / span 2;
  width: 12px;
  height: 12px;
  margin: 6px auto 0;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--line-strong);
  box-shadow: 0 0 0 3px var(--paper);
  z-index: 1;
}
.pstep:not(:last-child)::after {
  content: "";
  grid-column: 1;
  justify-self: center;
  width: 2px;
  height: calc(100% - 8px);
  margin-bottom: -100%;
  background: var(--line);
}
.pstep.checked::before {
  background: linear-gradient(180deg, var(--brass), var(--accent));
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.pstep .t { display: block; font-weight: 750; font-size: 14px; color: var(--ink); }
.pstep .d { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; padding-bottom: 18px; }
.pstep label {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
  cursor: pointer;
  margin: 0;
}
.pstep input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--accent);
}
.pstep form { grid-column: 2; }

/* ========== Invoice ========== */
.invoice {
  background: linear-gradient(180deg, #fffdf7, #faf6ea);
  border: 1px solid var(--brass-line);
  border-radius: var(--r-md);
  padding: 24px 26px;
  font-family: "Songti SC", "SimSun", serif;
  line-height: 1.8;
  font-size: 13.5px;
  color: #2a2418;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.55), var(--shadow-sm);
}
.invoice .t {
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.32em;
  margin-bottom: 16px;
  color: #1a160e;
}
.invoice .line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px dotted #d4cbb0;
  padding: 5px 0;
}
.invoice .amount {
  margin-top: 16px;
  text-align: right;
  font-size: 18px;
  font-weight: 700;
  color: var(--danger);
  letter-spacing: 0.04em;
}

/* ========== Materials gallery ========== */
.mat-groups { display: grid; gap: 20px; }
.mat-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.mat-group-head .ic {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--brass-soft);
  border: 1px solid var(--brass-line);
  font-size: 14px;
}
.mat-group-head strong { font-size: 13.5px; letter-spacing: 0.02em; }
.mat-group-head .count {
  font-size: 11px;
  color: var(--faint);
  font-weight: 750;
  letter-spacing: 0.06em;
}
.mat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.mat-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.mat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}
.mat-card.empty {
  border-style: dashed;
  background: var(--bg-elev);
  pointer-events: none;
}
.mat-thumb {
  aspect-ratio: 4 / 3;
  background: linear-gradient(180deg, #f4f1ea, #ebe7de);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.mat-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mat-thumb .pdf-badge {
  display: grid;
  place-items: center;
  gap: 6px;
  color: var(--danger);
  font-weight: 800;
}
.mat-thumb .pdf-badge .fileicon {
  width: 44px;
  height: 52px;
  border-radius: 6px;
  background: #fff;
  border: 1.5px solid #e8c9c7;
  display: grid;
  place-items: center;
  font-size: 11px;
  letter-spacing: 0.06em;
  box-shadow: var(--shadow-xs);
}
.mat-thumb .empty-mark {
  color: var(--faint);
  font-size: 12px;
  font-weight: 650;
}
.mat-meta { padding: 10px 12px 12px; display: grid; gap: 3px; }
.mat-meta .name { font-size: 13px; font-weight: 750; line-height: 1.3; }
.mat-meta .sub { font-size: 11px; color: var(--faint); }
.mat-card.pdf-card .mat-thumb {
  background: linear-gradient(160deg, #fff7f6, #f8eceb);
}
.zoom-hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  font-size: 10px;
  background: rgba(18, 24, 18, 0.55);
  color: #fff;
  padding: 2px 6px;
  border-radius: 99px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.mat-card:hover .zoom-hint { opacity: 1; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 11, 0.84);
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lightbox.show { display: flex; }
.lightbox figure {
  margin: 0;
  max-width: min(960px, 96vw);
  max-height: 90vh;
  background: var(--paper);
  border-radius: var(--r-lg);
  padding: 12px 12px 10px;
  box-shadow: var(--shadow-lg);
}
.lightbox img {
  max-width: 100%;
  max-height: 75vh;
  display: block;
  border-radius: 10px;
  margin: 0 auto;
  object-fit: contain;
  background: #f0ede6;
}
.lightbox figcaption {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding-top: 10px;
}
.lightbox .close {
  position: absolute;
  top: 18px;
  right: 22px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}

/* ========== Drop upload ========== */
.drop-zone {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--bg-elev);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  min-height: 104px;
  display: grid;
  place-items: center;
  gap: 4px;
}
.drop-zone:hover { border-color: var(--accent); background: #fff; }
.drop-zone.dragover {
  border-color: var(--accent-2);
  background: var(--accent-soft);
  box-shadow: 0 0 0 4px rgba(26, 77, 56, 0.1);
}
.drop-zone.has-file {
  border-style: solid;
  border-color: #a8cbb4;
  background: #f3faf5;
}
.drop-zone .dz-icon { font-size: 20px; line-height: 1; color: var(--accent); }
.drop-zone .dz-name { font-size: 13px; font-weight: 750; color: var(--ink-2); }
.drop-zone .dz-hint { font-size: 11px; color: var(--faint); line-height: 1.4; }
.drop-zone .dz-file {
  font-size: 11.5px;
  color: var(--accent);
  font-weight: 700;
  word-break: break-all;
}
.drop-zone input[type="file"] { display: none; }
.drop-bulk {
  border: 1.5px dashed var(--accent);
  border-radius: var(--r-lg);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(26, 77, 56, 0.08), transparent 60%),
    linear-gradient(180deg, #f7fbf8, #fff);
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 14px;
}
.drop-bulk.dragover {
  background: var(--accent-soft);
  box-shadow: 0 0 0 4px rgba(26, 77, 56, 0.1);
}
.drop-bulk .dz-icon { font-size: 22px; color: var(--accent); }
.drop-bulk .dz-title { font-weight: 750; font-size: 15px; margin-top: 4px; }
.drop-bulk .dz-hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.drop-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* ========== Dashboard extras ========== */
.dash-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.dash-grid-2 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.bar-row {
  display: grid;
  grid-template-columns: 76px 1fr 48px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
}
.bar-track {
  height: 8px;
  border-radius: 99px;
  background: #ebe8df;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}
.bar-fill.warn { background: linear-gradient(90deg, #d4a24c, var(--brass)); }
.bar-fill.danger { background: linear-gradient(90deg, #c25a5a, var(--danger)); }
.bar-fill.ok { background: linear-gradient(90deg, #3d9b5c, var(--ok)); }
.mini-list { display: grid; gap: 10px; }
.mini-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.mini-item:last-child { border-bottom: none; padding-bottom: 0; }
.collect-ring {
  --p: 0;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), #ebe8df 0);
  display: grid;
  place-items: center;
  margin: 8px auto;
}
.collect-ring i {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--paper);
  display: grid;
  place-items: center;
  font-style: normal;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.03em;
}
.quick-links {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.quick-links a {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 16px 10px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--ink-2);
  font-weight: 650;
  font-size: 13px;
  box-shadow: var(--shadow-xs);
}
.quick-links a:hover { border-color: var(--brass-line); color: var(--accent); }
.quick-links .ic { font-size: 18px; }

/* ========== AI chat ========== */
.ai-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 14px; min-height: 70vh; }
.chat-card { display: flex; flex-direction: column; min-height: 68vh; }
.chat-log {
  flex: 1;
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 4px 2px 12px;
  align-content: start;
}
.bubble {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble.user { background: var(--accent-soft); justify-self: end; border-bottom-right-radius: 4px; }
.bubble.assistant {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  justify-self: start;
  border-bottom-left-radius: 4px;
}
.bubble.tool {
  justify-self: stretch;
  max-width: 100%;
  background: #faf8f2;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}
.chat-input { display: flex; gap: 8px; margin-top: 10px; }
.chat-input textarea { min-height: 52px; resize: none; }
.side-form { display: grid; gap: 12px; align-content: start; }
.quick { display: grid; gap: 8px; }
.quick button { text-align: left; }

/* ========== Responsive ========== */
@media (max-width: 1100px) {
  .drop-grid, .stats { grid-template-columns: repeat(2, 1fr); }
  .dash-grid, .dash-grid-2, .ai-wrap { grid-template-columns: 1fr; }
  .quick-links { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .web .shell { grid-template-columns: 1fr; }
  .web .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    z-index: 30;
    padding: 12px;
    gap: 10px;
  }
  .side-section, .web .side-foot { display: none; }
  .web .side-nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
  }
  .hero, .stats, .form-grid, .page-head { grid-template-columns: 1fr; }
  .page-head { display: grid; align-items: start; }
  .container, .container.wide { width: min(100% - 24px, 1120px); }
  .topbar { padding: 0 16px; }
  .drop-grid { grid-template-columns: 1fr; }
  .desktop-table thead { display: none; }
  .desktop-table, .desktop-table tbody, .desktop-table tr, .desktop-table td {
    display: block;
    width: 100%;
  }
  .desktop-table tr {
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
  }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr; }
}
