/* =========================================================
   衡算 · 进销存与内部成本利润核算系统
   Design system & application styles
   ========================================================= */

:root {
  --bg: #f3f5f2;
  --bg-soft: #eef2ee;
  --card: #ffffff;
  --ink: #14221b;
  --ink-2: #31423a;
  --muted: #6d7a72;
  --muted-2: #94a098;
  --line: #e2e8e2;
  --line-strong: #d3ddd5;
  --brand: #156b52;
  --brand-2: #1f8a67;
  --brand-deep: #0c2b21;
  --brand-soft: #e8f4ed;
  --gold: #c9a45c;
  --gold-soft: #f6efdf;
  --danger: #bf4a36;
  --danger-soft: #fbece8;
  --warn: #a96f16;
  --warn-soft: #fbf3e2;
  --blue: #2c6198;
  --blue-soft: #e9f1fa;
  --violet: #6a4c93;
  --violet-soft: #f0ebf8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(17, 38, 28, 0.04);
  --shadow: 0 1px 2px rgba(17, 38, 28, 0.04), 0 18px 40px -30px rgba(17, 38, 28, 0.4);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "STSong", "SimSun", serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background:
    radial-gradient(900px 420px at 82% -10%, rgba(201, 164, 92, 0.08), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
table { border-collapse: collapse; }
::selection { background: rgba(21, 107, 82, 0.16); }

.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.danger-text { color: var(--danger); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 12.5px; }

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
  vertical-align: -3px;
}

/* ============================== Login ============================== */

.login-view {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(520px, 0.92fr);
  min-height: 100vh;
  background: #f6f7f3;
}

.login-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 44px 56px 28px;
  color: #e7efe9;
  background:
    radial-gradient(720px 500px at 90% 15%, rgba(32, 138, 103, 0.22), transparent 65%),
    radial-gradient(620px 500px at -10% 92%, rgba(201, 164, 92, 0.13), transparent 60%),
    linear-gradient(152deg, #0d2b21 0%, #0a2119 55%, #071a14 100%);
  overflow: hidden;
}

.login-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 82%);
  pointer-events: none;
}

.login-glow {
  position: absolute;
  width: 460px;
  height: 460px;
  right: -190px;
  bottom: -190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 164, 92, 0.2), transparent 66%);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(145deg, #d8b56a, #b78d3f);
  color: #173128;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 700;
  box-shadow: 0 8px 24px -10px rgba(201, 164, 92, 0.65);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 20px; letter-spacing: 0.14em; font-weight: 700; }
.brand-text small { margin-top: 3px; font-size: 8.5px; letter-spacing: 0.24em; color: rgba(233, 242, 235, 0.48); }
.brand-light .brand-text strong { color: #f0f4ef; }

.login-copy { position: relative; margin-top: auto; padding-top: 64px; max-width: 640px; }
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}
.login-copy h1 {
  margin-top: 18px;
  font-family: var(--serif);
  font-size: clamp(42px, 4.4vw, 66px);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: 0.015em;
  color: #f3f1e7;
}
.login-lead {
  margin-top: 24px;
  max-width: 500px;
  font-size: 14.5px;
  line-height: 1.9;
  color: rgba(214, 229, 220, 0.62);
}

.login-features {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 52px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  max-width: 650px;
}
.login-feature {
  display: flex;
  gap: 14px;
  padding: 19px 20px;
  background: rgba(8, 30, 23, 0.5);
  backdrop-filter: blur(6px);
}
.login-feature > span {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--gold);
  padding-top: 1px;
}
.login-feature strong { display: block; font-size: 13.5px; color: #eaf1eb; font-weight: 600; }
.login-feature small { display: block; margin-top: 3px; font-size: 11.5px; color: rgba(206, 223, 212, 0.48); line-height: 1.55; }
.login-foot {
  position: relative;
  display: flex;
  justify-content: space-between;
  margin-top: 38px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: rgba(200, 219, 207, 0.32);
}

.login-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 48px;
  min-height: 100vh;
  background:
    radial-gradient(680px 420px at 100% 0%, rgba(21, 107, 82, 0.07), transparent 62%),
    #f7f8f4;
  overflow: hidden;
}

.login-receipt {
  position: absolute;
  top: 24px;
  right: 30px;
  width: 272px;
  padding: 18px 20px;
  background: #fffdf7;
  border: 1px solid #e9e2d1;
  border-radius: 4px;
  box-shadow: 0 24px 50px -30px rgba(34, 46, 36, 0.42);
  transform: rotate(2.5deg);
  color: #3d4a42;
  z-index: 1;
}
.login-receipt::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(120, 100, 60, 0.05) 0.6px, transparent 0.6px);
  background-size: 4px 4px;
  pointer-events: none;
}
.receipt-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 11px; border-bottom: 1px dashed #ddd3bf; }
.receipt-head span { font-family: var(--serif); font-size: 15px; font-weight: 700; color: #273a30; }
.receipt-head em { font-style: normal; font-size: 9px; letter-spacing: 0.12em; color: #a37f35; border: 1px solid #d9c79d; padding: 2px 6px; border-radius: 2px; }
.receipt-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 11.5px; color: #7b8178; }
.receipt-row strong { color: #2e3c34; font-weight: 600; }
.receipt-row.total { padding-top: 10px; font-size: 12.5px; color: #2e3c34; }
.receipt-row.total strong { font-size: 17px; color: #145f49; }
.receipt-dash { margin: 4px 0; border-top: 1px dashed #ddd3bf; }
.receipt-stamp {
  position: absolute;
  right: 18px;
  bottom: 42px;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 2px solid rgba(183, 70, 51, 0.55);
  border-radius: 50%;
  color: rgba(183, 70, 51, 0.72);
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  transform: rotate(-12deg);
}

.login-card {
  position: relative;
  z-index: 2;
  width: min(420px, 100%);
  margin-top: 136px;
  padding: 36px 36px 30px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(219, 227, 217, 0.9);
  border-radius: 24px;
  box-shadow: 0 30px 70px -45px rgba(20, 45, 31, 0.5);
  backdrop-filter: blur(14px);
}
.login-card .field input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 12.5px;
  outline: none;
  transition: 0.15s ease;
}
.login-card .field input::placeholder { color: #a5b0a9; }
.login-card .field input:focus {
  border-color: #96c2ae;
  box-shadow: 0 0 0 3px rgba(21, 107, 82, 0.09);
}
.login-card .btn-primary { height: 44px; }
.login-card h2 {
  margin-top: 10px;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #15271e;
}
.login-sub { margin-top: 7px; color: var(--muted); font-size: 12.5px; }
.login-card form { margin-top: 28px; display: flex; flex-direction: column; gap: 16px; }
.login-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 26px; }
.login-mobile-brand .brand-text strong { color: var(--brand-deep); }
.login-mobile-brand .brand-text small { color: var(--muted-2); }

.login-error {
  min-height: 0;
  margin-top: -2px;
  font-size: 12px;
  color: var(--danger);
}
.login-error:not(:empty) {
  min-height: 34px;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--danger-soft);
  border: 1px solid #f2d3cb;
}
.login-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 22px;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--muted-2);
}
.login-note .icon { width: 14px; height: 14px; margin-top: 1px; }

.demo-box { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.demo-title { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.demo-title span { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; color: var(--ink-2); }
.demo-title small { font-size: 10px; color: var(--muted-2); }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.demo-chip {
  text-align: left;
  padding: 9px 11px;
  background: #f7f9f5;
  border: 1px solid var(--line);
  border-radius: 9px;
  transition: 0.16s ease;
}
.demo-chip:hover { border-color: #b9d2c5; background: var(--brand-soft); transform: translateY(-1px); }
.demo-chip strong { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.demo-chip small { display: block; margin-top: 2px; font-size: 9.5px; color: var(--muted-2); }

/* ============================== Shell ============================== */

.app-view { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  z-index: 40;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: 252px;
  padding: 22px 14px 16px;
  color: #c9d8cf;
  background:
    radial-gradient(420px 320px at 100% 0%, rgba(31, 138, 103, 0.18), transparent 65%),
    linear-gradient(180deg, #0d2a20 0%, #0a2119 60%, #081b15 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 100% 44px;
  pointer-events: none;
}
.sidebar-head { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.sidebar .brand-mark { width: 38px; height: 38px; font-size: 21px; border-radius: 11px; }
.sidebar .brand-text strong { font-size: 17px; }
.sidebar .brand-text small { font-size: 7.5px; }
.sidebar .sidebar-close { display: none; color: #9fb6a8; }
.company-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 22px 6px 8px;
  padding: 10px 11px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}
.company-dot { width: 6px; height: 6px; border-radius: 50%; background: #59bd91; box-shadow: 0 0 0 3px rgba(89, 189, 145, 0.12); flex: none; }
.company-pill strong { display: block; font-size: 11.5px; font-weight: 600; color: #dfeae2; letter-spacing: 0.01em; }
.company-pill small { display: block; font-size: 9px; color: rgba(200, 220, 208, 0.4); margin-top: 1px; }

.nav { position: relative; flex: 1; overflow-y: auto; padding: 8px 0 16px; scrollbar-width: thin; }
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }
.nav-section { margin-top: 17px; }
.nav-section:first-child { margin-top: 6px; }
.nav-label {
  padding: 0 13px 7px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: rgba(196, 217, 204, 0.34);
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: rgba(211, 226, 216, 0.73);
  font-size: 12.5px;
  text-align: left;
  transition: 0.15s ease;
}
.nav-item .icon { width: 17px; height: 17px; opacity: 0.82; }
.nav-item:hover { background: rgba(255, 255, 255, 0.055); color: #f0f5f1; }
.nav-item.active { background: rgba(255, 255, 255, 0.085); color: #fff; font-weight: 600; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 2px;
  border-radius: 2px;
  background: var(--gold);
}
.nav-item.active .icon { color: var(--gold); opacity: 1; }
.nav-badge {
  margin-left: auto;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(201, 164, 92, 0.16);
  color: #e0c383;
  font-size: 9.5px;
  font-weight: 700;
}

.sidebar-foot { position: relative; padding: 12px 5px 0; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 4px 6px 10px; }
.sidebar-user .avatar { width: 31px; height: 31px; font-size: 12px; background: rgba(201, 164, 92, 0.16); color: #dfc17e; }
.sidebar-user strong { display: block; font-size: 11.5px; color: #e2ece5; font-weight: 600; }
.sidebar-user small { display: block; font-size: 9.5px; color: rgba(200, 220, 208, 0.4); }
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(206, 222, 211, 0.45);
  font-size: 11px;
  text-align: left;
}
.sidebar-logout:hover { background: rgba(255, 255, 255, 0.05); color: #f0d9d4; }
.sidebar-logout .icon { width: 15px; height: 15px; }

.sidebar-scrim { display: none; }

.app-main { width: calc(100% - 252px); margin-left: 252px; min-width: 0; }

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 66px;
  padding: 0 32px;
  background: rgba(243, 245, 242, 0.86);
  border-bottom: 1px solid rgba(220, 228, 219, 0.85);
  backdrop-filter: blur(14px);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted-2); }
.breadcrumb i { font-style: normal; color: #c2ccc4; }
.breadcrumb strong { color: var(--ink-2); font-weight: 600; }
.menu-btn { display: none; }
.today-chip {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.65);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.015em;
}
.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 35px;
  height: 35px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  transition: 0.15s ease;
}
.icon-btn:hover { background: #fff; border-color: var(--line); color: var(--ink); }
.notify-btn .notify-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d18b38;
  box-shadow: 0 0 0 2px var(--bg);
}
.user-menu-wrap { position: relative; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 7px 4px 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.user-chip:hover { background: #fff; border-color: var(--line); }
.avatar {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 700;
  flex: none;
}
.user-chip-text { display: flex; flex-direction: column; line-height: 1.2; }
.user-chip-text strong { font-size: 11.5px; font-weight: 600; }
.user-chip-text small { font-size: 9.5px; color: var(--muted-2); margin-top: 2px; }
.user-chip .chevron { width: 13px; height: 13px; color: var(--muted-2); }
.user-menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  right: 0;
  width: 190px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 45px -18px rgba(18, 40, 27, 0.3);
}
.user-menu-head { padding: 9px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-menu-head strong { display: block; font-size: 12px; }
.user-menu-head small { display: block; margin-top: 2px; font-size: 10px; color: var(--muted-2); }
.user-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font-size: 11.5px;
  text-align: left;
}
.user-menu button:hover { background: var(--bg-soft); }
.user-menu button.danger { color: var(--danger); }
.user-menu .icon { width: 15px; height: 15px; }

.page {
  max-width: 1540px;
  margin: 0 auto;
  padding: 30px 34px 60px;
  outline: none;
  animation: pageIn 0.28s ease both;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

/* ============================== Page header ============================== */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.page-head-left { min-width: 0; }
.page-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--brand);
  text-transform: uppercase;
}
.page-kicker::before { content: ""; width: 18px; height: 1px; background: var(--gold); }
.page-title {
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1.22;
  font-weight: 600;
  letter-spacing: 0.015em;
  color: #12251b;
}
.page-sub { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.page-head.compact { margin-bottom: 18px; }
.page-head.compact .page-title { font-size: 24px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 13px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 11.5px;
}
.back-link:hover { color: var(--brand); }
.back-link .icon { width: 15px; height: 15px; }
.doc-title-row { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.doc-title-row .page-title { font-family: var(--font); font-size: 26px; font-weight: 650; letter-spacing: 0; }
.doc-meta-line { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 7px; font-size: 11.5px; color: var(--muted); }

/* ============================== Buttons ============================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
  transition: 0.16s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover { border-color: #b9cbbf; background: #fbfcfa; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary {
  border-color: var(--brand);
  background: linear-gradient(180deg, #18785b, #126249);
  color: #fff;
  box-shadow: 0 8px 20px -12px rgba(18, 98, 73, 0.7);
}
.btn-primary:hover { border-color: #0f5a43; background: linear-gradient(180deg, #1a8061, #10674c); }
.btn-soft { border-color: transparent; background: var(--brand-soft); color: var(--brand); box-shadow: none; }
.btn-soft:hover { background: #dcefe5; border-color: transparent; }
.btn-gold { border-color: #dcc48f; background: var(--gold-soft); color: #8a6525; box-shadow: none; }
.btn-gold:hover { background: #f1e7cf; border-color: #d2b578; }
.btn-danger { border-color: #ecc9c1; background: #fff; color: var(--danger); box-shadow: none; }
.btn-danger:hover { background: var(--danger-soft); border-color: #e0ada2; }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: #fff; border-color: var(--line); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 11px; border-radius: 7px; }
.btn-sm .icon { width: 13px; height: 13px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-size: 11.5px;
  font-weight: 550;
}
.btn-link:hover { text-decoration: underline; }
.action-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ============================== Cards / grids ============================== */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}
.two-col > *, .three-col > *, .dashboard-grid > *, .detail-grid > *, .split-2 > *, .stack > *, .settings-panel { min-width: 0; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 21px 15px;
}
.card-head.bordered { border-bottom: 1px solid var(--line); }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 650; color: var(--ink); }
.card-title .icon { width: 16px; height: 16px; color: var(--brand); }
.card-sub { margin-top: 2px; font-size: 10.5px; color: var(--muted-2); }
.card-body { padding: 0 21px 21px; }
.card-body.pad { padding: 21px; }
.card-foot { padding: 13px 21px; border-top: 1px solid var(--line); background: #fbfcfa; border-radius: 0 0 var(--radius) var(--radius); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi-card {
  position: relative;
  min-width: 0;
  padding: 19px 20px 17px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kpi-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; color: var(--muted); }
.kpi-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand);
}
.kpi-icon.gold { background: var(--gold-soft); color: #997230; }
.kpi-icon.blue { background: var(--blue-soft); color: var(--blue); }
.kpi-icon.violet { background: var(--violet-soft); color: var(--violet); }
.kpi-icon.red { background: var(--danger-soft); color: var(--danger); }
.kpi-value {
  margin-top: 12px;
  font-size: clamp(23px, 2.1vw, 30px);
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.kpi-value small { margin-left: 3px; font-size: 11px; font-weight: 500; color: var(--muted-2); letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 10px; color: var(--muted-2); flex-wrap: wrap; }
.kpi-card.primary {
  color: #eef5f0;
  border-color: transparent;
  background:
    radial-gradient(260px 180px at 100% 0%, rgba(201, 164, 92, 0.2), transparent 65%),
    linear-gradient(145deg, #0f3a2b, #0a2a1f);
}
.kpi-card.primary .kpi-label { color: rgba(220, 235, 225, 0.6); }
.kpi-card.primary .kpi-value { color: #f7f6ef; }
.kpi-card.primary .kpi-foot { color: rgba(215, 232, 221, 0.48); }
.kpi-card.primary .kpi-icon { background: rgba(255, 255, 255, 0.08); color: #d8b56a; }
.kpi-card.primary::after {
  content: "";
  position: absolute;
  right: -36px;
  bottom: -60px;
  width: 160px;
  height: 160px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
}
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 2px 5px; border-radius: 5px; font-size: 9.5px; font-weight: 650; }
.delta.up { color: var(--brand); background: var(--brand-soft); }
.delta.down { color: var(--danger); background: var(--danger-soft); }
.delta.flat { color: var(--muted); background: var(--bg-soft); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.95fr) minmax(300px, 1fr); gap: 16px; margin-bottom: 16px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-12 { margin-bottom: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }

/* ============================== Chart ============================== */

.chart-card .card-head { padding-bottom: 4px; }
.chart-legend { display: flex; align-items: center; gap: 14px; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--muted); }
.legend-dot { width: 7px; height: 7px; border-radius: 2px; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-svg text { font-family: var(--font); }
.chart-empty { display: grid; place-items: center; height: 230px; color: var(--muted-2); font-size: 12px; }

/* ============================== Todo list ============================== */

.todo-list { display: flex; flex-direction: column; }
.todo-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.todo-item:first-child { border-top: 0; }
.todo-item:hover .todo-main strong { color: var(--brand); }
.todo-ico {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--warn-soft);
  color: var(--warn);
  flex: none;
}
.todo-ico.pay { background: var(--blue-soft); color: var(--blue); }
.todo-ico.stock { background: var(--danger-soft); color: var(--danger); }
.todo-main { min-width: 0; flex: 1; }
.todo-main strong { display: block; font-size: 11.5px; font-weight: 550; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo-main small { display: block; margin-top: 2px; font-size: 9.5px; color: var(--muted-2); }
.todo-amount { font-size: 11.5px; font-weight: 650; color: var(--ink); white-space: nowrap; }
.todo-empty { padding: 28px 0; text-align: center; color: var(--muted-2); font-size: 11px; }

/* ============================== Tables ============================== */

.table-wrap { width: 100%; overflow-x: auto; }
.table-wrap.flush { padding: 0; }
table.data {
  width: 100%;
  min-width: 680px;
  font-size: 12px;
}
table.data th {
  padding: 10px 14px;
  background: #f8faf7;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-align: left;
  white-space: nowrap;
}
table.data th:first-child { padding-left: 21px; }
table.data th:last-child { padding-right: 21px; }
table.data td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf1ec;
  vertical-align: middle;
  color: var(--ink-2);
}
table.data td:first-child { padding-left: 21px; }
table.data td:last-child { padding-right: 21px; }
table.data tbody tr { transition: background 0.12s ease; }
table.data tbody tr:hover { background: #fafcf9; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .right, table.data th.right { text-align: right; }
table.data .center, table.data th.center { text-align: center; }
table.data .strong { font-weight: 600; color: var(--ink); }
table.data .muted-cell { color: var(--muted); }
table.data.compact td { padding-top: 9px; padding-bottom: 9px; }
table.data tr.total-row td { background: #fbfcfa; border-top: 1px solid var(--line); font-weight: 650; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover { background: #f7faf6; }

.cell-main { display: flex; flex-direction: column; gap: 2px; min-width: 120px; }
.cell-main strong { font-size: 12px; font-weight: 550; color: var(--ink); }
.cell-main small { font-size: 9.5px; color: var(--muted-2); }
.cell-product { display: flex; align-items: center; gap: 9px; min-width: 180px; }
.product-thumb {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  flex: none;
  overflow: hidden;
}
.doc-link {
  border: 0;
  padding: 0;
  background: none;
  color: var(--brand);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: left;
}
.doc-link:hover { text-decoration: underline; }

.lead-link {
  display: inline-block;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--brand);
  font-size: 9.5px;
  font-weight: 400;
  vertical-align: bottom;
}
.lead-link:hover { text-decoration: underline; }
.leads-table { min-width: 980px; }
table.data.leads-table { min-width: 980px; table-layout: fixed; }
.leads-table th:nth-child(1) { width: 21%; }
.leads-table th:nth-child(2) { width: 15%; }
.leads-table th:nth-child(3) { width: 20%; }
.leads-table th:nth-child(4) { width: 12%; }
.leads-table th:nth-child(5) { width: 14%; }
.leads-table th:nth-child(6) { width: 8%; }
.leads-table th:nth-child(7) { width: 100px; }
.leads-table td { overflow: hidden; }
.leads-table td:last-child { overflow: visible; }
.leads-table .cell-product { min-width: 0; }
.leads-table .cell-main { max-width: 100%; }
.leads-table .cell-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leads-table .action-group { gap: 4px; flex-wrap: nowrap; }
.leads-table .action-group .btn { padding-left: 8px; padding-right: 8px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.pill::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.pill.no-dot::before { display: none; }
.pill-green { color: #1c6b50; background: #e6f4ec; }
.pill-amber { color: #946210; background: #fbf1dc; }
.pill-red { color: #ad4130; background: #fbece8; }
.pill-blue { color: #2c5e92; background: #e9f1f9; }
.pill-gray { color: #64726a; background: #eef1ee; }
.pill-violet { color: #65468a; background: #f1ebf8; }
.pill-gold { color: #8a6525; background: #f7efdd; }

.margin-bar { display: flex; align-items: center; gap: 8px; min-width: 100px; }
.margin-track { width: 48px; height: 4px; border-radius: 4px; background: #edf1ec; overflow: hidden; flex: none; }
.margin-fill { height: 100%; border-radius: 4px; background: var(--brand-2); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); background: #fbfcfa; flex-wrap: wrap; }
.pager-info { font-size: 10.5px; color: var(--muted-2); }
.pager-btns { display: flex; align-items: center; gap: 4px; }
.pager-btn {
  min-width: 28px; height: 28px; padding: 0 7px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; color: var(--muted); font-size: 10.5px;
}
.pager-btn:hover { border-color: #b9cbbf; color: var(--brand); }
.pager-btn.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.pager-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.progress { height: 5px; border-radius: 5px; background: #edf1ec; overflow: hidden; min-width: 60px; }
.progress > span { display: block; height: 100%; border-radius: 5px; background: var(--brand-2); }
.progress.gold > span { background: var(--gold); }

/* ============================== Toolbar / filters ============================== */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .count { font-size: 10.5px; color: var(--muted-2); margin-left: 3px; }
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 220px;
}
.search-box .icon { position: absolute; left: 11px; width: 15px; height: 15px; color: var(--muted-2); pointer-events: none; }
.search-box input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 33px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  font-size: 11.5px;
  outline: none;
}
.search-box input::placeholder { color: var(--muted-2); }
.search-box input:focus { border-color: #9fc7b5; background: #fff; box-shadow: 0 0 0 3px rgba(21, 107, 82, 0.08); }

select.select, input.input, textarea.textarea {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  outline: none;
  transition: 0.15s ease;
}
select.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236d7a72' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
select.select:focus, input.input:focus, textarea.textarea:focus { border-color: #96c2ae; box-shadow: 0 0 0 3px rgba(21, 107, 82, 0.08); }
select.select.sm, input.input.sm { height: 33px; font-size: 11px; }
textarea.textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; line-height: 1.6; }
input.input[readonly] { background: #f7f9f6; color: var(--muted); }

.chips { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.chip {
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}
.chip:hover { background: var(--bg-soft); color: var(--ink-2); }
.chip.active { background: #fff; border-color: var(--line); color: var(--brand); font-weight: 600; box-shadow: var(--shadow-sm); }

.tabs {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  position: relative;
  padding: 13px 12px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--brand); font-weight: 600; }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); }
.tab-badge { margin-left: 4px; font-size: 9px; color: var(--muted-2); }

/* ============================== Empty / loading ============================== */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 52px 20px;
  color: var(--muted-2);
  text-align: center;
}
.empty .empty-icon { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 14px; background: var(--bg-soft); color: #a4b1a9; }
.empty .empty-icon .icon { width: 23px; height: 23px; }
.empty strong { font-size: 12.5px; font-weight: 550; color: var(--muted); }
.empty small { font-size: 10.5px; }
.empty .btn { margin-top: 7px; }

.skeleton { background: linear-gradient(90deg, #eef2ed 25%, #f7f9f6 37%, #eef2ed 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.skel-line { height: 12px; margin-bottom: 10px; }
.skel-title { width: 160px; height: 28px; margin-bottom: 20px; }
.skel-card { height: 112px; border-radius: var(--radius); }
.skel-block { height: 260px; border-radius: var(--radius); }

/* ============================== Detail pages ============================== */

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(290px, 0.8fr); gap: 16px; align-items: start; }
.detail-side { display: flex; flex-direction: column; gap: 16px; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 20px; }
.meta-item label { display: block; font-size: 9.5px; color: var(--muted-2); letter-spacing: 0.04em; margin-bottom: 3px; }
.meta-item strong { display: block; font-size: 11.5px; font-weight: 550; color: var(--ink-2); word-break: break-word; }
.meta-item strong.big { font-size: 15px; font-weight: 650; color: var(--ink); }
.meta-grid.three { grid-template-columns: repeat(3, 1fr); }

.amount-hero { padding: 5px 0 2px; }
.amount-hero label { display: block; font-size: 9.5px; color: var(--muted-2); letter-spacing: 0.06em; }
.amount-hero strong { display: block; margin-top: 3px; font-size: 29px; font-weight: 650; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.amount-hero strong .rmb { font-size: 13px; font-weight: 500; color: var(--muted-2); margin-right: 3px; }

.totals { display: flex; flex-direction: column; gap: 8px; }
.totals .row { display: flex; justify-content: space-between; gap: 20px; font-size: 11.5px; color: var(--muted); }
.totals .row strong { color: var(--ink-2); font-weight: 550; font-variant-numeric: tabular-nums; }
.totals .row.grand { margin-top: 5px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink); }
.totals .row.grand strong { font-size: 18px; font-weight: 650; color: var(--brand); }

.timeline { position: relative; padding-left: 19px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 5px; bottom: 7px; width: 1px; background: var(--line); }
.timeline-item { position: relative; padding: 0 0 16px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -19px; top: 4px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #cdd8d0; background: #fff; }
.timeline-item.done .timeline-dot { border-color: var(--brand-2); background: var(--brand-soft); }
.timeline-item.current .timeline-dot { border-color: var(--gold); background: var(--gold-soft); }
.timeline-item.reject .timeline-dot { border-color: var(--danger); background: var(--danger-soft); }
.timeline-item strong { display: block; font-size: 11px; font-weight: 600; color: var(--ink-2); }
.timeline-item small { display: block; margin-top: 2px; font-size: 9.5px; color: var(--muted-2); line-height: 1.55; }

.detail-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.detail-actions .btn { flex: 1; min-width: 100px; }

.note-box { padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfa; font-size: 11px; color: var(--muted); line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.callout { display: flex; gap: 9px; padding: 11px 13px; border-radius: 9px; background: var(--warn-soft); border: 1px solid #efdfbc; color: #7d5b1c; font-size: 10.5px; line-height: 1.6; }
.callout .icon { width: 15px; height: 15px; margin-top: 1px; flex: none; }
.callout.info { background: var(--blue-soft); border-color: #cfe0f2; color: #2c5e92; }
.callout.danger { background: var(--danger-soft); border-color: #f0d0c9; color: #9f3b2c; }

/* ============================== Forms ============================== */

form.form { display: flex; flex-direction: column; gap: 0; }
.form-section { padding: 4px 0 18px; }
.form-section + .form-section { padding-top: 18px; border-top: 1px solid var(--line); }
.form-section-title { display: flex; align-items: center; gap: 7px; margin-bottom: 13px; font-size: 11.5px; font-weight: 650; color: var(--ink-2); }
.form-section-title .num-badge { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; background: var(--brand-soft); color: var(--brand); font-size: 9px; }
.form-section-title small { font-size: 9.5px; font-weight: 400; color: var(--muted-2); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 16px; }
.field-grid.three { grid-template-columns: repeat(3, 1fr); }
.field-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 10.5px; font-weight: 550; color: var(--ink-2); }
.field > span em { font-style: normal; color: var(--danger); margin-left: 2px; }
.field > span small { font-weight: 400; color: var(--muted-2); margin-left: 4px; }
.field.span-2 { grid-column: span 2; }
.field.span-3 { grid-column: span 3; }
.field.span-full { grid-column: 1 / -1; }
.field-hint { font-size: 9.5px; color: var(--muted-2); line-height: 1.5; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 6px; flex-wrap: wrap; }

.line-editor { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.line-table { width: 100%; border-collapse: collapse; min-width: 620px; }
.line-table th { padding: 8px 9px; background: #f8faf7; border-bottom: 1px solid var(--line); font-size: 9.5px; font-weight: 600; color: var(--muted); text-align: left; white-space: nowrap; }
.line-table td { padding: 7px 7px; border-bottom: 1px solid #eef2ed; vertical-align: middle; }
.line-table tr:last-child td { border-bottom: 0; }
.line-table .col-product { width: 42%; min-width: 200px; }
.line-table .col-qty { width: 13%; min-width: 76px; }
.line-table .col-price { width: 16%; min-width: 96px; }
.line-table .col-amount { width: 16%; min-width: 96px; text-align: right; }
.line-table .col-del { width: 40px; }
.line-table input, .line-table select { height: 33px; font-size: 11px; }
.line-table .amount-cell { text-align: right; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.line-table .stock-hint { display: block; margin-top: 2px; font-size: 9px; color: var(--muted-2); }
.line-empty { padding: 22px; text-align: center; color: var(--muted-2); font-size: 11px; }
.line-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; background: #fbfcfa; border-top: 1px solid var(--line); }
.line-add { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--brand); font-size: 11px; font-weight: 550; padding: 3px 4px; }
.line-add:hover { text-decoration: underline; }
.line-add .icon { width: 14px; height: 14px; }
.line-total { font-size: 11px; color: var(--muted); }

.form-totals { display: flex; justify-content: flex-end; margin-top: 13px; }
.form-totals .totals { width: 310px; max-width: 100%; }
.form-totals .input.sm { height: 32px; text-align: right; }

.check-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-2); }
.check-row input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--brand); }

/* ============================== Import ============================== */

.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 150px;
  padding: 24px;
  border: 1.5px dashed #cbd8cf;
  border-radius: 12px;
  background: #fbfcfa;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: 0.16s ease;
}
.file-drop:hover { border-color: var(--brand-2); background: var(--brand-soft); }
.file-drop .icon { width: 28px; height: 28px; color: var(--brand); }
.file-drop strong { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.file-drop small { font-size: 10px; color: var(--muted-2); }
.file-drop input { display: none; }
.import-result { margin-top: 14px; }
.import-result .callout { margin-top: 10px; }
.import-error-list {
  max-height: 190px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  border: 1px solid #f0d0c9;
  border-radius: 9px;
  background: #fffaf9;
}
.import-error-list li { padding: 7px 11px; border-top: 1px solid #f7e1dc; font-size: 10.5px; color: #8f3a2c; }
.import-error-list li:first-child { border-top: 0; }
.import-summary { display: flex; gap: 16px; align-items: baseline; padding: 12px 14px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); font-size: 12px; }
.import-summary strong { font-size: 20px; font-weight: 650; }

/* ============================== Modal ============================== */
.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(9, 25, 18, 0.48);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.16s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 40px 100px -30px rgba(8, 30, 20, 0.5);
  animation: modalIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  overflow: hidden;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal.modal-lg { width: min(980px, 100%); }
.modal.modal-md { width: min(760px, 100%); }
.modal.modal-sm { width: min(440px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--ink); }
.modal-head p { margin-top: 4px; font-size: 11px; color: var(--muted); }
.modal-close { margin: -3px -3px 0 0; }
.modal-body { padding: 21px 24px; overflow-y: auto; }
.modal-body.tight { padding-top: 16px; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); background: #fbfcfa; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }

/* ============================== Toast ============================== */

.toast-root {
  position: fixed;
  z-index: 200;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 250px;
  max-width: 380px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 18px 45px -18px rgba(15, 45, 28, 0.35);
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.55;
  animation: toastIn 0.24s ease both;
  pointer-events: auto;
}
.toast.out { animation: toastOut 0.2s ease both; }
.toast .icon { width: 17px; height: 17px; margin-top: 1px; color: var(--brand); flex: none; }
.toast.error { border-color: #f0d0c9; background: #fffaf9; }
.toast.error .icon { color: var(--danger); }
.toast.warn .icon { color: var(--warn); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(5px); } }

/* ============================== Report specific ============================== */

.report-hero {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.report-stat { padding: 20px 22px; background: #fff; }
.report-stat label { display: flex; align-items: center; gap: 5px; font-size: 9.5px; font-weight: 600; letter-spacing: 0.06em; color: var(--muted); }
.report-stat strong { display: block; margin-top: 9px; font-size: 25px; font-weight: 650; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.report-stat small { display: block; margin-top: 5px; font-size: 9.5px; color: var(--muted-2); }
.report-stat.accent { background: linear-gradient(145deg, #0f3a2b, #0b2b20); color: #fff; }
.report-stat.accent label { color: rgba(216, 233, 222, 0.56); }
.report-stat.accent strong { color: #f6f3e8; }
.report-stat.accent small { color: rgba(216, 233, 222, 0.42); }
.report-stat .neg { color: var(--danger); }
.report-stat.accent .neg { color: #f0a895; }

.pnl-table { width: 100%; font-size: 12px; }
.pnl-table td { padding: 10px 4px; border-bottom: 1px dashed #e8ede7; }
.pnl-table tr:last-child td { border-bottom: 0; }
.pnl-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 550; }
.pnl-table tr.indent td:first-child { padding-left: 16px; color: var(--muted); }
.pnl-table tr.sub td { font-weight: 650; color: var(--ink); border-top: 1px solid var(--line); }
.pnl-table tr.total td { padding-top: 15px; border-top: 2px solid var(--ink); font-size: 14px; font-weight: 700; }
.pnl-table tr.total td:last-child { color: var(--brand); font-size: 20px; }
.pnl-table .pct { margin-left: 6px; font-size: 9px; color: var(--muted-2); font-weight: 400; }

.waterfall { display: flex; align-items: stretch; height: 46px; border-radius: 10px; overflow: hidden; margin: 8px 0 12px; background: var(--bg-soft); }
.waterfall span { display: grid; place-items: center; min-width: 0; color: #fff; font-size: 9px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.wf-rev { background: #1b7759; }
.wf-cost { background: #8fb3a3; }
.wf-gross { background: #c9a45c; }
.wf-exp { background: #b9785e; }
.wf-reb { background: #3f8a6d; }
.wf-net { background: #0e3b2b; }

.aging-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.aging-card { padding: 14px 16px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.aging-card label { font-size: 9.5px; color: var(--muted); }
.aging-card strong { display: block; margin-top: 5px; font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.aging-card.warn { background: #fdfaf3; border-color: #efe2c5; }
.aging-card.bad { background: #fdf6f4; border-color: #f0d6cf; }

.date-range { display: flex; align-items: center; gap: 7px; }
.date-range input[type="date"] {
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-2);
  font-size: 10.5px;
  outline: none;
}
.date-range input[type="date"]:focus { border-color: #96c2ae; }
.date-range .sep { color: var(--muted-2); font-size: 10px; }
.quick-dates { display: flex; gap: 3px; }
.quick-dates .chip { border-color: var(--line); background: #fff; }
.quick-dates .chip:hover { border-color: #b9cbbf; background: var(--brand-soft); }

.ranking-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.ranking-row:first-child { border-top: 0; }
.rank-num { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--bg-soft); color: var(--muted); font-size: 9px; font-weight: 700; flex: none; }
.ranking-row:nth-child(1) .rank-num { background: var(--gold-soft); color: #8a6525; }
.rank-main { flex: 1; min-width: 0; }
.rank-main strong { display: block; font-size: 11px; font-weight: 550; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-main .progress { margin-top: 5px; height: 4px; }
.rank-value { font-size: 11.5px; font-weight: 650; white-space: nowrap; }

/* ============================== Settings / misc ============================== */

.settings-grid { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 3px; position: sticky; top: 88px; }
.settings-nav button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  text-align: left;
}
.settings-nav button:hover { background: #fff; color: var(--ink-2); }
.settings-nav button.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.settings-nav .icon { width: 15px; height: 15px; }
.settings-panel { min-height: 400px; }

.warehouse-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.warehouse-card { padding: 15px 16px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfa; }
.warehouse-card .wh-head { display: flex; align-items: center; justify-content: space-between; }
.warehouse-card strong { font-size: 12px; font-weight: 600; }
.warehouse-card small { display: block; margin-top: 3px; font-size: 9.5px; color: var(--muted-2); }
.warehouse-card .wh-value { margin-top: 10px; font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }

.info-list { display: flex; flex-direction: column; }
.info-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.info-row:last-child { border-bottom: 0; }
.info-row label { font-size: 11px; color: var(--muted); }
.info-row strong { font-size: 11.5px; font-weight: 550; color: var(--ink-2); text-align: right; }

/* ============================== Responsive ============================== */

@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); }
  .page { padding: 26px 26px 50px; }
  .topbar { padding: 0 24px; }
  .login-receipt { display: none; }
  .login-card { margin-top: 0; }
}

@media (max-height: 920px) and (min-width: 1281px) {
  .login-receipt { display: none; }
  .login-card { margin-top: 0; }
}

@media (max-width: 1080px) {
  .login-view { grid-template-columns: 1fr 500px; }
  .login-aside { padding: 36px 38px 24px; }
  .login-features { grid-template-columns: 1fr; margin-top: 34px; }
  .login-feature:nth-child(n+3) { display: none; }
  .login-copy h1 { font-size: 44px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-side { display: grid; grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .report-hero { grid-template-columns: repeat(2, 1fr); }
  .aging-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: 150px minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .login-view { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .login-panel { min-height: 100vh; padding: 30px 20px; }
  .login-mobile-brand { display: flex; }
  .login-card { padding: 30px 26px 26px; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    box-shadow: 20px 0 60px rgba(8, 25, 17, 0.3);
  }
  .app-view.sidebar-open .sidebar { transform: none; }
  .app-view.sidebar-open .sidebar-scrim {
    display: block;
    position: fixed;
    z-index: 35;
    inset: 0;
    background: rgba(8, 25, 17, 0.4);
    backdrop-filter: blur(2px);
  }
  .sidebar .sidebar-close { display: inline-grid; }
  .app-main { width: 100%; margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .topbar { height: 60px; padding: 0 18px; }
  .page { padding: 22px 18px 46px; }
  .today-chip { display: none; }
  .two-col, .split-2, .three-col { grid-template-columns: 1fr; }
  .kpi-grid { gap: 11px; }
  .kpi-card { padding: 16px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 13px; margin-bottom: 19px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .page-title { font-size: 26px; }
  .warehouse-cards { grid-template-columns: 1fr 1fr; }
  .modal-backdrop { padding: 10px; align-items: flex-end; }
  .modal { max-height: calc(100vh - 20px); border-radius: 18px 18px 14px 14px; }
  .field-grid.three, .field-grid.cols-4 { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; overflow-x: auto; position: static; padding-bottom: 6px; }
  .settings-nav button { white-space: nowrap; }
  .detail-side { grid-template-columns: 1fr; }
  .login-features { display: none; }
  .login-copy { padding-top: 30px; }
  .login-aside { min-height: auto; }
}

@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 22px; }
  .kpi-label { font-size: 9.5px; }
  .report-hero { grid-template-columns: 1fr 1fr; }
  .report-stat { padding: 15px 16px; }
  .report-stat strong { font-size: 20px; }
  .aging-grid { grid-template-columns: 1fr 1fr; }
  .user-chip-text { display: none; }
  .user-chip .chevron { display: none; }
  .topbar-right { gap: 6px; }
  .page-head { gap: 11px; }
  .page-title { font-size: 24px; }
  .toolbar { padding: 12px 15px; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .search-box { min-width: 0; flex: 1; }
  .card-head { padding: 15px 16px 12px; }
  .card-body { padding: 0 16px 16px; }
  .card-body.pad { padding: 16px; }
  table.data th:first-child, table.data td:first-child { padding-left: 16px; }
  table.data th:last-child, table.data td:last-child { padding-right: 16px; }
  .field-grid, .field-grid.three, .field-grid.cols-4 { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: auto; }
  .modal-head, .modal-body, .modal-foot { padding-left: 17px; padding-right: 17px; }
  .form-totals .totals { width: 100%; }
  .detail-side { gap: 12px; }
  .warehouse-cards { grid-template-columns: 1fr; }
  .login-card { padding: 26px 21px 22px; border-radius: 20px; }
  .login-card h2 { font-size: 30px; }
  .demo-grid { grid-template-columns: 1fr; }
  .toast-root { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; width: 100%; max-width: none; }
  .recent-sales { min-width: 0; }
  table.data.recent-sales { min-width: 0; }
  .recent-sales th:nth-child(4), .recent-sales td:nth-child(4),
  .recent-sales th:nth-child(5), .recent-sales td:nth-child(5) { display: none; }
  .recent-sales td:first-child { white-space: nowrap; }
  .recent-sales .doc-link { font-size: 10.5px; }
}

@media print {
  .sidebar, .topbar, .page-actions, .detail-actions, .toast-root, .modal-root { display: none !important; }
  .app-main { width: 100%; margin: 0; }
  .page { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ddd; }
  body { background: #fff; }
}
