:root {
  --bg: #f2f1ec;
  --bg-deep: #eae8e1;
  --surface: #ffffff;
  --surface-soft: #f8f7f3;
  --ink: #1a1d19;
  --ink-soft: #3b4039;
  --muted: #74786e;
  --faint: #a4a89d;
  --line: #e7e4db;
  --line-strong: #d8d4c8;
  --accent: #f05a28;
  --accent-deep: #d94818;
  --accent-soft: #fff0e9;
  --lime: #d9ef67;
  --dark: #151916;
  --dark-2: #1e241f;
  --dark-3: #2a312a;
  --success: #3d7d51;
  --danger: #d74734;
  --shadow-sm: 0 1px 2px rgba(25, 29, 24, 0.04), 0 6px 18px rgba(25, 29, 24, 0.03);
  --shadow-md: 0 18px 50px rgba(25, 29, 24, 0.08);
  --radius: 18px;
  --radius-lg: 24px;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --font-num: "Bahnschrift", "DIN Alternate", "SF Pro Display", "Helvetica Neue", var(--font-sans);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% -10%, rgba(240, 90, 40, 0.055), transparent 34rem),
    radial-gradient(circle at 52% 105%, rgba(217, 239, 103, 0.09), transparent 30rem),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
button, input, select { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
svg { display: block; }
::selection { background: var(--lime); color: var(--ink); }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--faint);
  font-family: var(--font-num);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1.2;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 4px rgba(217, 239, 103, 0.12);
}

/* Layout */
.app { min-height: 100vh; }
.sidebar {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  display: flex;
  width: 236px;
  flex-direction: column;
  padding: 26px 18px 20px;
  overflow-y: auto;
  color: #f6f6f0;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.025), transparent 38%),
    var(--dark);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: 0;
  width: 140px;
  height: 220px;
  background: radial-gradient(circle at bottom right, rgba(240, 90, 40, 0.16), transparent 68%);
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 6px; }
.brand-mark {
  position: relative;
  display: grid;
  width: 39px;
  height: 39px;
  flex: none;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(240, 90, 40, 0.25);
}
.brand-mark span {
  position: relative;
  display: block;
  width: 19px;
  height: 4px;
  border-radius: 2px;
  background: var(--dark);
  transform: rotate(-22deg);
}
.brand-mark span::before,
.brand-mark span::after {
  content: "";
  position: absolute;
  left: 3px;
  height: 4px;
  border-radius: 2px;
  background: var(--dark);
}
.brand-mark span::before { top: -7px; width: 12px; }
.brand-mark span::after { bottom: -7px; width: 23px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 17px; letter-spacing: 0.03em; }
.brand-text em {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.36);
  font-family: var(--font-num);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.19em;
}
.nav-label {
  margin: 38px 12px 12px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
}
.main-nav { display: flex; flex-direction: column; gap: 5px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 13px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.58);
  cursor: pointer;
  text-align: left;
  transition: background 0.18s, color 0.18s, transform 0.18s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.055); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, 0.09); color: #fff; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-item .icon { width: 19px; height: 19px; opacity: 0.82; }
.nav-item.active .icon { color: var(--lime); opacity: 1; }
.nav-item span { font-size: 13.5px; font-weight: 500; }
.sidebar-spacer { flex: 1; min-height: 36px; }
.side-today {
  position: relative;
  z-index: 1;
  padding: 17px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}
.side-today-head {
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
}
.side-ton {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-top: 9px;
  font-family: var(--font-num);
}
.side-ton span { font-size: 30px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.side-ton small { color: rgba(255, 255, 255, 0.44); font-size: 11px; }
.side-sub { margin-top: 9px; color: rgba(255, 255, 255, 0.4); font-size: 10.5px; }
.sidebar-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 17px;
  padding: 0 4px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 10px;
}
.sidebar-foot .icon { width: 14px; height: 14px; }

.main { min-height: 100vh; margin-left: 236px; }
.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 25px 36px 18px;
  background: linear-gradient(rgba(242, 241, 236, 0.94) 62%, rgba(242, 241, 236, 0.72));
  backdrop-filter: blur(14px);
}
.mobile-brand { display: none; }
.page-heading { min-width: 0; }
.page-heading h1 {
  font-size: clamp(24px, 2.2vw, 31px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.2;
}
.page-heading p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.today-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 39px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}
.today-pill .icon { width: 15px; height: 15px; color: var(--accent); }
.page-wrap { max-width: 1480px; padding: 4px 36px 48px; }
.server-banner {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 16px;
  padding: 13px 15px;
  border: 1px solid #f0c9bd;
  border-radius: 14px;
  background: #fff5f1;
}
.server-banner-icon {
  display: grid;
  width: 31px;
  height: 31px;
  flex: none;
  place-items: center;
  border-radius: 9px;
  background: #ffe4d9;
  color: var(--accent-deep);
  font-family: var(--font-num);
  font-size: 15px;
  font-weight: 700;
}
.server-banner > div { min-width: 0; flex: 1; }
.server-banner strong { display: block; color: var(--ink); font-size: 12px; font-weight: 600; }
.server-banner p { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.server-banner .btn { min-height: 34px; margin-left: auto; font-size: 11px; }
.page { display: none; animation: page-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); }
.page.active { display: block; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

/* Shared components */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.card-head h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.3;
}
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 25px;
  height: 21px;
  padding: 0 7px;
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 10.5px;
  font-weight: 600;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 39px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.16s, background 0.16s, border-color 0.16s, box-shadow 0.16s;
}
.btn:active { transform: scale(0.98); }
.btn .icon { width: 16px; height: 16px; stroke-width: 2.1; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(240, 90, 40, 0.22);
}
.btn-primary:hover { background: var(--accent-deep); box-shadow: 0 10px 24px rgba(240, 90, 40, 0.28); }
.btn-dark { background: var(--dark); color: #fff; }
.btn-dark:hover { background: var(--dark-2); }
.btn-ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
}
.btn-ghost:hover { background: var(--surface-soft); }
.btn-block { width: 100%; min-height: 48px; margin-top: 4px; font-size: 13.5px; }
.icon-btn {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.16s, color 0.16s;
}
.icon-btn:hover { background: var(--surface-soft); color: var(--ink); }
.icon-btn.danger:hover { background: #fdf0ed; color: var(--danger); }
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
}
.text-link .icon { width: 13px; height: 13px; stroke-width: 2.2; }
.text-link:hover { color: var(--accent-deep); }

/* Forms */
.field { display: flex; min-width: 0; flex-direction: column; gap: 8px; }
.field-label, .field > .field-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
}
.field-label em {
  color: var(--faint);
  font-size: 9.5px;
  font-style: normal;
  font-weight: 400;
}
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.input, .qty-control, .search-box, .period-picker {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  transition: border-color 0.16s, box-shadow 0.16s;
}
.input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border-radius: 11px;
  color: var(--ink);
  font-size: 13px;
  outline: none;
}
.input::placeholder { color: var(--faint); }
.input:focus, .qty-control:focus-within, .search-box:focus-within, .period-picker:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 90, 40, 0.1);
}
input[type="datetime-local"], input[type="month"], select { color-scheme: light; }
.form-grid { display: grid; gap: 16px; }
.form-grid.two { grid-template-columns: minmax(0, 1.18fr) minmax(150px, 0.82fr); }
.form-grid.note-row { grid-template-columns: minmax(0, 1fr) minmax(235px, 0.62fr); margin-top: 18px; align-items: stretch; }
.qty-control { display: flex; align-items: center; height: 46px; border-radius: 11px; overflow: hidden; }
.qty-control input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  text-align: center;
  font-family: var(--font-num);
  font-size: 17px;
  font-weight: 700;
  -moz-appearance: textfield;
}
.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }
.qty-btn {
  display: grid;
  width: 44px;
  height: 100%;
  flex: none;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.qty-btn:hover { background: var(--surface-soft); color: var(--ink); }
.qty-btn .icon { width: 15px; height: 15px; stroke-width: 2.2; }
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 37px;
  padding: 0 11px;
  border-radius: 10px;
  color: var(--faint);
}
.search-box input {
  width: 138px;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11.5px;
}
.search-box input::placeholder { color: var(--faint); }
.search-box .icon { width: 14px; height: 14px; }

/* Records page */
.quick-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 344px;
  gap: 18px;
  align-items: stretch;
}
.quick-card { padding: 26px 27px 25px; }
.quick-card .card-head { margin-bottom: 21px; }
.auto-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}
.auto-badge .status-dot { width: 6px; height: 6px; background: var(--success); box-shadow: none; }
.plate-field { margin-top: 18px; }
.plate-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  max-height: 195px;
  padding: 2px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.plate-option {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 12px 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s, transform 0.16s;
}
.plate-option:hover { border-color: var(--line-strong); background: #fbfaf7; transform: translateY(-1px); }
.plate-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.plate-option input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.plate-radio {
  display: grid;
  width: 17px;
  height: 17px;
  flex: none;
  place-items: center;
  margin-top: 2px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
}
.plate-radio::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.16s;
}
.plate-option:has(input:checked) .plate-radio { border-color: var(--accent); }
.plate-option:has(input:checked) .plate-radio::after { background: var(--accent); }
.plate-option-main { min-width: 0; flex: 1; }
.plate-option-name {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plate-option-spec {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 10px;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plate-option-weight {
  margin-top: 7px;
  color: var(--ink-soft);
  font-family: var(--font-num);
  font-size: 10.5px;
}
.plate-option-weight b { color: var(--accent); font-size: 13px; }
.plate-empty {
  display: flex;
  grid-column: 1 / -1;
  min-height: 128px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
}
.plate-empty .icon { width: 28px; height: 28px; color: var(--faint); }
.plate-empty p { font-size: 11.5px; }
.cut-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
  padding: 13px 15px;
  border: 1px solid #f2d8cc;
  border-radius: 13px;
  background: linear-gradient(120deg, #fff8f4, #fff2eb);
}
.cut-total-copy > span { color: var(--muted); font-size: 10.5px; }
.cut-total-copy p {
  max-width: 135px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cut-total-value { display: flex; align-items: baseline; gap: 4px; flex: none; }
.cut-total-value strong {
  color: var(--accent);
  font-family: var(--font-num);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.cut-total-value small { color: var(--muted); font-size: 10px; }

/* Today card */
.today-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 26px 25px 22px;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.05);
  background:
    radial-gradient(circle at 105% -10%, rgba(240, 90, 40, 0.23), transparent 55%),
    radial-gradient(circle at -10% 105%, rgba(217, 239, 103, 0.08), transparent 50%),
    var(--dark);
  color: #f6f6f0;
  box-shadow: 0 20px 50px rgba(21, 25, 22, 0.16);
}
.today-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.15;
  background-image: linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, transparent, #000 55%);
  pointer-events: none;
}
.today-card > * { position: relative; z-index: 1; }
.today-card .eyebrow { color: rgba(255, 255, 255, 0.34); }
.today-card .card-head h2, .today-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.025em; }
.today-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.today-date { padding-top: 4px; color: rgba(255, 255, 255, 0.4); font-family: var(--font-num); font-size: 10px; }
.today-hero { padding: 29px 0 21px; }
.today-label { color: rgba(255, 255, 255, 0.46); font-size: 10.5px; }
.today-tons { display: flex; align-items: baseline; gap: 7px; margin-top: 4px; font-family: var(--font-num); }
.today-tons strong { font-size: clamp(38px, 4vw, 47px); font-weight: 700; letter-spacing: -0.055em; line-height: 1.15; }
.today-tons span { color: var(--lime); font-size: 12px; font-weight: 600; }
.today-meta { display: flex; align-items: center; gap: 10px; margin-top: 9px; color: rgba(255, 255, 255, 0.43); font-size: 10.5px; }
.today-meta b { color: rgba(255, 255, 255, 0.86); font-family: var(--font-num); font-size: 12px; font-weight: 500; }
.today-meta i { width: 1px; height: 10px; background: rgba(255, 255, 255, 0.18); }
.month-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}
.month-summary > div { display: flex; flex-direction: column; gap: 4px; }
.month-summary > div + div { padding-left: 15px; border-left: 1px solid rgba(255, 255, 255, 0.09); }
.month-summary span { color: rgba(255, 255, 255, 0.36); font-size: 9.5px; }
.month-summary strong { color: rgba(255, 255, 255, 0.84); font-size: 11px; font-weight: 400; }
.month-summary b { font-family: var(--font-num); font-size: 15px; font-weight: 600; }
.mini-chart { padding: 17px 0 3px; }
.mini-head { display: flex; align-items: center; justify-content: space-between; color: rgba(255, 255, 255, 0.36); font-size: 9.5px; }
.mini-bars { display: flex; height: 53px; align-items: flex-end; gap: 5px; margin-top: 11px; }
.mini-bar-wrap { display: flex; height: 100%; flex: 1; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.mini-bar {
  width: 100%;
  min-height: 3px;
  border-radius: 4px 4px 2px 2px;
  background: rgba(255, 255, 255, 0.13);
  transition: height 0.4s ease, background 0.16s;
}
.mini-bar.today { background: var(--accent); }
.mini-bar-wrap:hover .mini-bar { background: rgba(255, 255, 255, 0.32); }
.mini-bar-wrap:hover .mini-bar.today { background: var(--accent); }
.mini-day { color: rgba(255, 255, 255, 0.3); font-family: var(--font-num); font-size: 8px; }
.mini-day.today { color: var(--lime); }
.formula-tip {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: auto;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}
.formula-tip .icon { width: 19px; height: 19px; flex: none; color: var(--lime); opacity: 0.9; }
.formula-tip p { color: rgba(255, 255, 255, 0.57); font-size: 9.5px; line-height: 1.6; }
.formula-tip p span { color: rgba(255, 255, 255, 0.3); }

/* Record ledger */
.records-card { margin-top: 18px; padding: 24px 26px 14px; }
.records-head { align-items: center; margin-bottom: 17px; }
.table-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.filter-chips { display: flex; padding: 3px; border-radius: 10px; background: var(--surface-soft); }
.filter-chips button {
  height: 31px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10.5px;
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}
.filter-chips button:hover { color: var(--ink); }
.filter-chips button.active { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(25, 29, 24, 0.08); font-weight: 600; }
.record-table { margin: 0 -7px; }
.record-head, .record-row {
  display: grid;
  grid-template-columns: 122px minmax(120px, 1.1fr) 145px 64px 95px minmax(90px, 0.9fr) 34px;
  gap: 12px;
  align-items: center;
}
.record-head {
  padding: 0 7px 9px;
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.record-list { max-height: 430px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.record-row {
  min-height: 62px;
  padding: 9px 7px;
  border-top: 1px solid var(--line);
  transition: background 0.15s;
}
.record-row:hover { background: var(--surface-soft); }
.record-time { display: flex; flex-direction: column; gap: 1px; }
.record-time strong { font-family: var(--font-num); font-size: 11.5px; font-weight: 600; }
.record-time span { color: var(--faint); font-family: var(--font-num); font-size: 9px; }
.record-plate { display: flex; min-width: 0; align-items: center; gap: 9px; }
.plate-thumb {
  position: relative;
  display: grid;
  width: 31px;
  height: 31px;
  flex: none;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(145deg, #f7f4ec, #ebe7dc);
}
.plate-thumb::before, .plate-thumb::after {
  content: "";
  position: absolute;
  width: 17px;
  height: 5px;
  border: 1px solid #b7b1a2;
  border-radius: 1px;
  background: #faf8f2;
  transform: skewY(-16deg) rotate(-7deg);
}
.plate-thumb::before { top: 10px; left: 8px; }
.plate-thumb::after { top: 15px; left: 6px; background: #dfd9ca; }
.record-plate-name { min-width: 0; }
.record-plate-name strong { display: block; overflow: hidden; font-size: 11.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.record-plate-name span { display: block; overflow: hidden; color: var(--faint); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.record-spec { color: var(--muted); font-family: var(--font-num); font-size: 10.5px; letter-spacing: 0.01em; }
.record-spec b { color: var(--ink-soft); font-weight: 500; }
.record-qty { font-family: var(--font-num); font-size: 12px; font-weight: 600; }
.record-qty small { margin-left: 2px; color: var(--faint); font-family: var(--font-sans); font-size: 9px; font-weight: 400; }
.record-tons { color: var(--accent); font-family: var(--font-num); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.record-tons small { margin-left: 2px; color: var(--muted); font-family: var(--font-sans); font-size: 9px; font-weight: 400; }
.record-note { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.record-note.empty { color: var(--faint); }
.record-actions { display: flex; justify-content: flex-end; }
.record-actions .icon-btn { width: 29px; height: 29px; }
.record-actions .icon { width: 14px; height: 14px; }

/* Empty states */
.empty-state {
  display: flex;
  min-height: 210px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  color: var(--muted);
  text-align: center;
}
.empty-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 14px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  color: var(--faint);
}
.empty-icon .icon { width: 23px; height: 23px; }
.empty-state h3 { color: var(--ink-soft); font-size: 14px; font-weight: 600; }
.empty-state p { max-width: 280px; margin-top: 5px; font-size: 11px; line-height: 1.65; }
.empty-state .btn { margin-top: 14px; min-height: 35px; font-size: 11px; }

/* Library */
.library-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.mini-stat {
  position: relative;
  min-height: 98px;
  padding: 17px 19px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.mini-stat::after {
  content: "";
  position: absolute;
  right: -15px;
  bottom: -25px;
  width: 70px;
  height: 70px;
  border: 1px solid var(--line);
  border-radius: 50%;
}
.mini-stat > span { display: block; color: var(--muted); font-size: 10px; }
.mini-stat > strong {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 8px;
  font-family: var(--font-num);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
}
.mini-stat > strong small { color: var(--muted); font-family: var(--font-sans); font-size: 9px; font-weight: 400; }
.mini-stat > em { display: block; margin-top: 5px; color: var(--faint); font-size: 9px; font-style: normal; }
.mini-stat.accent { border-color: #f3d3c6; background: linear-gradient(135deg, #fff9f6, #fff3ec); }
.mini-stat.accent > strong { color: var(--accent); }
.library-card { padding: 25px 26px; }
.library-card .card-head { margin-bottom: 21px; }
.plate-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}
.plate-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 206px;
  padding: 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}
.plate-card:hover { border-color: var(--line-strong); background: #fff; box-shadow: 0 12px 28px rgba(25, 29, 24, 0.06); transform: translateY(-2px); }
.plate-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.plate-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 5px;
  background: #eef0e8;
  color: var(--ink-soft);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.plate-tag::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.plate-card-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.16s; }
.plate-card:hover .plate-card-actions, .plate-card:focus-within .plate-card-actions { opacity: 1; }
.plate-card-actions .icon-btn { width: 27px; height: 27px; }
.plate-card-actions .icon { width: 13px; height: 13px; }
.plate-card h3 { margin-top: 11px; font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.plate-dims {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-top: 7px;
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 10.5px;
}
.plate-dims b { color: var(--ink-soft); font-size: 14px; font-weight: 600; }
.plate-dims i { color: var(--faint); font-style: normal; font-size: 8px; }
.plate-weight-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 17px;
}
.plate-unit-weight { display: flex; align-items: baseline; gap: 3px; }
.plate-unit-weight strong { color: var(--accent); font-family: var(--font-num); font-size: 21px; font-weight: 700; letter-spacing: -0.03em; }
.plate-unit-weight small { color: var(--muted); font-size: 9px; }
.plate-weight-row > span { color: var(--faint); font-size: 9px; }
.plate-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}
.plate-usage { color: var(--faint); font-size: 9px; }
.plate-usage b { color: var(--ink-soft); font-family: var(--font-num); font-size: 10.5px; font-weight: 600; }
.cut-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
}
.cut-shortcut .icon { width: 12px; height: 12px; stroke-width: 2.2; }
.cut-shortcut:hover { color: var(--accent-deep); }
.plate-grid .empty-state { grid-column: 1 / -1; }

/* Stats */
.stats-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.segmented { display: flex; padding: 3px; border-radius: 10px; background: var(--surface-soft); }
.segmented button {
  height: 33px;
  padding: 0 15px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}
.segmented button.active { background: var(--dark); color: #fff; box-shadow: 0 3px 8px rgba(21, 25, 22, 0.16); font-weight: 600; }
.period-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 39px;
  padding: 0 11px;
  border-radius: 10px;
  color: var(--muted);
}
.period-picker .icon { width: 14px; height: 14px; color: var(--accent); }
.period-picker input, .period-picker select {
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-num);
  font-size: 11px;
  cursor: pointer;
}
.period-picker select { min-width: 82px; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; transform: none; }
.chart-legend { display: flex; align-items: center; gap: 15px; margin-left: auto; color: var(--muted); font-size: 9.5px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-bar { width: 9px; height: 9px; border-radius: 2px; background: var(--dark-2); }
.legend-line { position: relative; width: 15px; height: 2px; border-radius: 2px; background: var(--accent); }
.legend-line::after { content: ""; position: absolute; top: -3px; left: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi-card {
  position: relative;
  min-height: 124px;
  padding: 18px 19px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.kpi-card::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -32px;
  width: 92px;
  height: 92px;
  border: 1px solid var(--line);
  border-radius: 50%;
}
.kpi-card .kpi-icon {
  display: grid;
  width: 27px;
  height: 27px;
  margin-bottom: 11px;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink-soft);
}
.kpi-card .kpi-icon .icon { width: 14px; height: 14px; }
.kpi-card > span { color: var(--muted); font-size: 10px; }
.kpi-card > strong {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 2px;
  font-family: var(--font-num);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.2;
}
.kpi-card > strong small { color: var(--muted); font-family: var(--font-sans); font-size: 9px; font-weight: 400; }
.kpi-card.accent { border-color: #f3d3c6; background: linear-gradient(135deg, #fff9f6, #fff3ec); }
.kpi-card.accent .kpi-icon { background: #ffe2d6; color: var(--accent); }
.kpi-card.accent > strong { color: var(--accent); }
.kpi-card.dark { border-color: var(--dark); background: var(--dark); color: #fff; }
.kpi-card.dark::after { border-color: rgba(255, 255, 255, 0.12); }
.kpi-card.dark .kpi-icon { background: rgba(255, 255, 255, 0.08); color: var(--lime); }
.kpi-card.dark > span, .kpi-card.dark > strong small { color: rgba(255, 255, 255, 0.45); }
.kpi-card.dark > strong { color: #fff; }
.chart-card { padding: 24px 26px 20px; }
.chart-card .card-head { margin-bottom: 12px; }
.chart-note { color: var(--faint); font-size: 9.5px; padding-top: 5px; }
.chart-scroll { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.chart-canvas { min-width: 700px; }
.chart-canvas svg { width: 100%; height: 300px; overflow: visible; }
.chart-canvas .axis-label { fill: var(--faint); font-family: var(--font-num); font-size: 9px; }
.chart-canvas .axis-line { stroke: var(--line); stroke-width: 1; }
.chart-canvas .grid-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 5; }
.chart-canvas .bar { fill: var(--dark-2); opacity: 0.88; transition: opacity 0.16s; }
.chart-canvas .bar:hover { opacity: 1; }
.chart-canvas .line-path { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chart-canvas .area-path { fill: url(#areaGradient); }
.chart-canvas .dot { fill: #fff; stroke: var(--accent); stroke-width: 2; }
.chart-canvas .chart-empty { fill: var(--faint); font-size: 11px; }
.stats-bottom { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 16px; margin-top: 16px; }
.usage-card, .detail-card { padding: 23px 24px; }
.usage-card .card-head, .detail-card .card-head { margin-bottom: 17px; }
.usage-list { display: flex; flex-direction: column; gap: 17px; }
.usage-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 14px; }
.usage-name { display: flex; min-width: 0; align-items: center; gap: 8px; }
.usage-rank {
  display: grid;
  width: 20px;
  height: 20px;
  flex: none;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--faint);
  font-family: var(--font-num);
  font-size: 9px;
  font-weight: 600;
}
.usage-item:nth-child(1) .usage-rank { background: var(--accent); color: #fff; }
.usage-item:nth-child(2) .usage-rank { background: #ffe5da; color: var(--accent-deep); }
.usage-item:nth-child(3) .usage-rank { background: #f0efe8; color: var(--ink-soft); }
.usage-name strong { overflow: hidden; font-size: 11.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.usage-name small { flex: none; color: var(--faint); font-family: var(--font-num); font-size: 9px; }
.usage-value { display: flex; align-items: baseline; gap: 3px; font-family: var(--font-num); font-size: 11.5px; font-weight: 600; }
.usage-value small { color: var(--muted); font-family: var(--font-sans); font-size: 8.5px; font-weight: 400; }
.usage-track { grid-column: 1 / -1; height: 5px; overflow: hidden; border-radius: 99px; background: var(--surface-soft); }
.usage-fill { height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, var(--dark-2), #394139); }
.usage-item:nth-child(1) .usage-fill { background: linear-gradient(90deg, var(--accent), #ff8c5f); }
.stats-table { width: 100%; }
.stats-table-head, .stats-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 58px 74px 56px 66px;
  gap: 8px;
  align-items: center;
}
.stats-table-head { padding: 0 4px 8px; color: var(--faint); font-size: 9px; }
.stats-table-head span:nth-child(n+2), .stats-row span:nth-child(n+2) { text-align: right; }
.stats-rows { max-height: 310px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.stats-row { min-height: 40px; padding: 7px 4px; border-top: 1px solid var(--line); font-size: 10px; }
.stats-row .period-name { color: var(--ink-soft); font-weight: 500; }
.stats-row .period-name small { margin-left: 5px; color: var(--faint); font-size: 8px; font-weight: 400; }
.stats-row .num { color: var(--ink-soft); font-family: var(--font-num); font-size: 10.5px; }
.stats-row .tons { color: var(--accent); font-family: var(--font-num); font-size: 10.5px; font-weight: 600; }
.share-bar { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.share-track { width: 28px; height: 3px; overflow: hidden; border-radius: 99px; background: var(--surface-soft); }
.share-fill { height: 100%; border-radius: inherit; background: var(--accent); }
.stats-total {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 58px 74px 56px 66px;
  gap: 8px;
  padding: 11px 4px 0;
  border-top: 1.5px solid var(--ink);
  font-size: 10px;
  font-weight: 600;
}
.stats-total span:nth-child(n+2) { text-align: right; font-family: var(--font-num); }
.stats-total span:first-child { font-family: var(--font-sans); }

/* Modal */
.modal-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(17, 21, 18, 0.48);
  opacity: 0;
  visibility: hidden;
  backdrop-filter: blur(7px);
  transition: opacity 0.22s, visibility 0.22s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  padding: 25px 26px 24px;
  overflow-y: auto;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 32px 90px rgba(17, 21, 18, 0.3);
  transform: translateY(14px) scale(0.985);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-overlay.open .modal { transform: none; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 22px; }
.modal-head h3 { font-size: 20px; font-weight: 700; letter-spacing: -0.03em; }
.modal form { display: flex; flex-direction: column; gap: 16px; }
.material-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.material-chips button {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  font-size: 10.5px;
  transition: border-color 0.16s, background 0.16s, color 0.16s;
}
.material-chips button:hover { border-color: var(--line-strong); color: var(--ink); }
.material-chips button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
.dimension-inputs { display: grid; grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr) 14px minmax(0, 1fr); align-items: end; gap: 5px; }
.dimension-inputs label { display: flex; flex-direction: column; gap: 6px; }
.dimension-inputs label span { color: var(--faint); font-size: 9.5px; }
.dimension-inputs .input { height: 48px; padding: 0 10px; text-align: center; font-family: var(--font-num); font-size: 15px; font-weight: 600; }
.dimension-inputs .times { padding-bottom: 14px; color: var(--faint); text-align: center; font-size: 10px; }
.form-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 14px 16px;
  border: 1px solid #f2d8cc;
  border-radius: 12px;
  background: linear-gradient(120deg, #fff8f4, #fff2eb);
}
.form-preview > div { display: flex; flex-direction: column; gap: 2px; }
.form-preview > div > span { color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.form-preview small { color: var(--faint); font-size: 8.5px; }
.form-preview > strong { color: var(--accent); font-family: var(--font-num); font-size: 24px; font-weight: 700; letter-spacing: -0.03em; }
.form-preview > strong small { color: var(--muted); font-family: var(--font-sans); font-size: 9px; font-weight: 400; }
.form-error { min-height: 16px; margin: -7px 0 -4px; color: var(--danger); font-size: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; }
.modal-actions .btn { min-width: 92px; }
.density-field { max-width: 180px; }

/* Toast */
.toast {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: 30px;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100vw - 32px);
  padding: 11px 16px;
  border-radius: 11px;
  background: var(--dark);
  color: #fff;
  box-shadow: 0 16px 40px rgba(21, 25, 22, 0.25);
  font-size: 11.5px;
  opacity: 0;
  transform: translate(-50%, 12px);
  visibility: hidden;
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}
.toast::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--lime);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); visibility: visible; }
.toast.error::before { background: #ff6b57; }

.app-loading {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(240, 90, 40, 0.07), transparent 25rem),
    var(--bg);
  transition: opacity 0.24s, visibility 0.24s;
}
.app-loading.hidden { display: none; }
.loading-box {
  display: flex;
  width: 220px;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.loading-box .brand-mark { width: 46px; height: 46px; margin-bottom: 15px; border-radius: 14px; }
.loading-box .brand-mark span { width: 22px; }
.loading-box strong { font-size: 19px; letter-spacing: 0.02em; }
.loading-box p { margin-top: 5px; color: var(--muted); font-size: 10.5px; }
.loading-track {
  width: 132px;
  height: 3px;
  margin-top: 20px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--line-strong);
}
.loading-track i {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: loading-slide 1.15s ease-in-out infinite;
}
@keyframes loading-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(340%); }
}

.mobile-nav { display: none; }

/* Responsive */
@media (max-width: 1240px) {
  .quick-layout { grid-template-columns: minmax(0, 1fr) 315px; }
  .plate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-head, .record-row { grid-template-columns: 112px minmax(110px, 1.05fr) 128px 55px 86px minmax(80px, 0.8fr) 30px; gap: 9px; }
}
@media (max-width: 1080px) {
  .sidebar { width: 210px; padding-left: 14px; padding-right: 14px; }
  .main { margin-left: 210px; }
  .topbar { padding-left: 26px; padding-right: 26px; }
  .page-wrap { padding-left: 26px; padding-right: 26px; }
  .quick-layout { grid-template-columns: 1fr; }
  .today-card { display: grid; grid-template-columns: 1fr 1fr; gap: 0 26px; }
  .today-head { grid-column: 1 / -1; }
  .today-hero { padding-bottom: 15px; }
  .month-summary { border-top: 0; align-self: start; padding-top: 28px; }
  .mini-chart { padding-top: 5px; }
  .formula-tip { margin-top: 0; align-self: end; }
  .stats-bottom { grid-template-columns: 1fr; }
  .kpi-card { min-height: 116px; }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: 76px; }
  .topbar { padding: 15px 18px 13px; gap: 12px; }
  .mobile-brand { display: flex; align-items: center; gap: 9px; flex: none; font-size: 14px; font-weight: 700; letter-spacing: 0.02em; }
  .mobile-brand .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
  .mobile-brand .brand-mark span { width: 15px; height: 3px; }
  .mobile-brand .brand-mark span::before { top: -5px; width: 9px; height: 3px; }
  .mobile-brand .brand-mark span::after { bottom: -5px; width: 18px; height: 3px; }
  .page-heading { display: none; }
  .today-pill { display: none; }
  .topbar-actions { margin-left: auto; }
  .topbar-actions .btn { min-height: 36px; padding: 0 12px; font-size: 11px; }
  .page-wrap { padding: 2px 16px 28px; }
  .mobile-nav {
    position: fixed;
    z-index: 50;
    right: 12px;
    bottom: 12px;
    left: 12px;
    display: flex;
    justify-content: space-around;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom, 0px));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    background: rgba(21, 25, 22, 0.96);
    box-shadow: 0 16px 36px rgba(21, 25, 22, 0.25);
    backdrop-filter: blur(14px);
  }
  .mobile-nav button {
    display: flex;
    min-width: 74px;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 5px 10px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: rgba(255, 255, 255, 0.44);
    cursor: pointer;
    font-size: 9px;
  }
  .mobile-nav button.active { background: rgba(255, 255, 255, 0.08); color: #fff; }
  .mobile-nav button.active .icon { color: var(--lime); }
  .mobile-nav .icon { width: 19px; height: 19px; }
}
@media (max-width: 720px) {
  .quick-card, .library-card, .records-card, .chart-card, .usage-card, .detail-card { padding: 20px 17px; border-radius: 20px; }
  .today-card { display: flex; padding: 21px 20px; border-radius: 20px; }
  .today-head { display: flex; }
  .today-hero { padding: 24px 0 18px; }
  .month-summary { padding: 13px 0; }
  .mini-chart { padding-top: 16px; }
  .formula-tip { margin-top: 3px; }
  .form-grid.two, .form-grid.note-row { grid-template-columns: 1fr; }
  .plate-picker { grid-template-columns: 1fr; max-height: 232px; }
  .cut-total { min-height: 68px; }
  .cut-total-copy p { max-width: 190px; }
  .records-card { padding-bottom: 8px; }
  .records-head { align-items: flex-start; flex-direction: column; gap: 13px; }
  .table-tools { width: 100%; justify-content: space-between; }
  .filter-chips { flex: 1; }
  .filter-chips button { flex: 1; padding: 0 6px; }
  .search-box { flex: none; }
  .search-box input { width: 104px; }
  .record-head { display: none; }
  .record-row {
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    min-height: 0;
    padding: 13px 7px;
  }
  .record-time { grid-column: 1; grid-row: 3; flex-direction: row; align-items: center; gap: 7px; color: var(--faint); }
  .record-time strong { color: var(--muted); font-size: 9.5px; font-weight: 400; }
  .record-time span { font-size: 8.5px; }
  .record-plate { grid-column: 1; grid-row: 1; }
  .record-plate-name strong { font-size: 12.5px; }
  .record-spec { grid-column: 1; grid-row: 2; padding-left: 40px; font-size: 9.5px; }
  .record-qty { grid-column: 2; grid-row: 2; align-self: center; text-align: right; }
  .record-tons { grid-column: 2; grid-row: 1; align-self: center; font-size: 13.5px; text-align: right; }
  .record-note { display: none; }
  .record-actions { position: static; grid-column: 2; grid-row: 3; opacity: 1; }
  .record-actions .icon-btn { width: 27px; height: 27px; }
  .record-list { max-height: 520px; }
  .server-banner { align-items: flex-start; flex-wrap: wrap; }
  .server-banner > div { flex-basis: calc(100% - 46px); }
  .server-banner p { white-space: normal; }
  .server-banner .btn { margin-left: 44px; }
  .library-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .mini-stat { min-height: 92px; padding: 14px 15px; }
  .mini-stat > strong { font-size: 22px; }
  .library-card .card-head { flex-direction: column; }
  .library-card .table-tools { width: 100%; }
  .library-card .search-box { flex: 1; }
  .library-card .search-box input { width: 100%; }
  .plate-grid { grid-template-columns: 1fr; }
  .plate-card { min-height: 190px; }
  .plate-card-actions { opacity: 1; }
  .stats-toolbar { flex-wrap: wrap; padding: 12px; gap: 10px; }
  .segmented { flex: 1; }
  .segmented button { flex: 1; padding: 0 10px; }
  .period-picker { height: 37px; }
  .chart-legend { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { min-height: 112px; padding: 15px; }
  .kpi-card > strong { font-size: 23px; }
  .chart-card { padding-bottom: 13px; }
  .chart-canvas svg { height: 260px; }
  .usage-card, .detail-card { padding: 19px 17px; }
  .detail-card .chart-note { display: none; }
  .stats-table-head, .stats-row, .stats-total { grid-template-columns: minmax(70px, 1fr) 44px 58px 46px 54px; gap: 5px; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-height: 92vh; padding: 22px 19px calc(20px + env(safe-area-inset-bottom, 0px)); border-radius: 22px 22px 0 0; transform: translateY(30px); }
  .dimension-inputs { gap: 3px; }
  .density-field { max-width: 100%; }
  .toast { bottom: 88px; }
}
@media (max-width: 390px) {
  .page-wrap { padding-left: 12px; padding-right: 12px; }
  .topbar { padding-left: 13px; padding-right: 13px; }
  .topbar-actions .btn span { display: none; }
  .topbar-actions .btn { width: 38px; padding: 0; }
  .quick-card, .library-card, .records-card, .chart-card, .usage-card, .detail-card { padding-left: 14px; padding-right: 14px; }
  .today-card { padding-left: 18px; padding-right: 18px; }
  .kpi-card { padding: 13px; }
  .kpi-card > strong { font-size: 21px; }
  .stats-row .period-name small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
@media (hover: none) {
  .plate-card-actions { opacity: 1; }
}
