/* ============================================================
   钥库 · 郭师傅开锁
   ============================================================ */
:root {
  --ink: #111a27;
  --ink-2: #172335;
  --ink-3: #223149;
  --ink-soft: #2c3d55;
  --cream: #f4f1e9;
  --cream-deep: #ece7da;
  --paper: #fffdf8;
  --paper-2: #faf8f1;
  --line: #e5dfd1;
  --line-soft: #eee9dd;
  --text: #202630;
  --text-soft: #4f5661;
  --muted: #7a7f88;
  --muted-2: #a2a5ab;
  --brass: #c9a45c;
  --brass-2: #b28a43;
  --brass-soft: #f3e7cf;
  --brass-pale: #fbf6eb;
  --green: #2f7d5d;
  --green-bg: #e9f4ee;
  --green-2: #3f9b74;
  --red: #b84a3e;
  --red-bg: #fbece9;
  --amber: #9f6a21;
  --amber-bg: #fdf1df;
  --blue: #356b8f;
  --blue-bg: #ecf3f8;
  --shadow-sm: 0 1px 2px rgba(24, 30, 40, .04);
  --shadow-md: 0 10px 28px rgba(24, 30, 40, .07);
  --shadow-lg: 0 26px 60px rgba(17, 26, 39, .18);
  --radius: 18px;
  --radius-sm: 11px;
  --sidebar-w: 254px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --serif: "Iowan Old Style", "Songti SC", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
::selection { background: var(--brass-soft); color: var(--ink); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #cdc6b6; border-radius: 99px; border: 2px solid var(--cream); }
::-webkit-scrollbar-track { background: transparent; }

.boot-screen {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: var(--ink); color: #e9e0cd; z-index: 100;
}
.boot-screen p { font-size: 13px; letter-spacing: 2px; color: #a99f8c; }
.boot-mark { filter: drop-shadow(0 8px 24px rgba(201, 164, 92, .25)); animation: floaty 2.4s ease-in-out infinite; }
.noscript { position: fixed; inset: 0; background: var(--cream); display: grid; place-items: center; z-index: 999; }

@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid rgba(32, 38, 48, .15);
  border-top-color: var(--brass-2);
  animation: spin .8s linear infinite;
  display: inline-block;
}
.spinner-light { border-color: rgba(255, 255, 255, .16); border-top-color: var(--brass); }
.loading-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 320px; color: var(--muted); }
.loading-state .spinner { width: 26px; height: 26px; }

/* ---------------- generic ---------------- */
.muted { color: var(--muted); }
.text-soft { color: var(--text-soft); }
.brand-text { color: var(--brass-2); }
.danger-text { color: var(--red); }
.success-text { color: var(--green); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.hide { display: none !important; }
.mobile-only { display: none !important; }
.desktop-only { display: block; }
.ico { display: inline-block; vertical-align: -3px; flex: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid transparent; background: transparent;
  font-size: 13.5px; font-weight: 600; letter-spacing: .2px;
  white-space: nowrap; transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(180deg, #d2ae64, var(--brass)); color: #181d25; box-shadow: 0 6px 16px rgba(180, 139, 67, .22); }
.btn-primary:hover { background: linear-gradient(180deg, #dab875, #c7a158); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-3); }
.btn-secondary { background: var(--paper); border-color: var(--line); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { border-color: #cfc4ac; background: #fffefb; }
.btn.btn-dark { background: var(--ink); color: #fff; border-color: var(--ink); box-shadow: var(--shadow-sm); }
.btn.btn-dark:hover { background: var(--ink-3); border-color: var(--ink-3); }
.btn-ghost { color: var(--text-soft); }
.btn-ghost:hover { background: rgba(24, 30, 40, .055); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #a63f34; }
.btn-danger-ghost { color: var(--red); border-color: #edcfc9; background: #fff8f6; }
.btn-danger-ghost:hover { background: var(--red-bg); }
.btn-sm { min-height: 32px; padding: 0 11px; border-radius: 8px; font-size: 12.5px; gap: 5px; }
.btn-block { width: 100%; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 14.5px; border-radius: 12px; }
.btn .spinner { width: 15px; height: 15px; border-width: 1.6px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--muted); transition: all .15s ease;
}
.icon-btn:hover { background: rgba(24, 30, 40, .06); color: var(--text); }
.icon-btn.danger:hover { background: var(--red-bg); color: var(--red); }
.text-link { color: var(--brass-2); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; }
.text-link:hover { color: #8f6b2a; }

/* ---------------- forms ---------------- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .field > .field-label {
  font-size: 12.5px; font-weight: 600; color: var(--text-soft); letter-spacing: .2px;
  display: flex; align-items: center; gap: 5px;
}
.required::after { content: "*"; color: var(--red); font-weight: 700; }
.input, .select, .textarea {
  width: 100%; min-height: 42px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; padding: 9px 12px; font-size: 13.5px; color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  outline: none;
}
.input::placeholder, .textarea::placeholder { color: #b0b2b6; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brass); box-shadow: 0 0 0 3px rgba(201, 164, 92, .16); background: #fffefb;
}
.textarea { min-height: 86px; resize: vertical; line-height: 1.6; }
.select {
  appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237a7f88' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.input[readonly], .input:disabled { background: var(--paper-2); color: var(--muted); }
.field-hint { font-size: 11.5px; color: var(--muted-2); line-height: 1.5; }
.address-input-row { display: flex; align-items: stretch; gap: 7px; }
.address-input-row .input { flex: 1; min-width: 0; }
.address-locate { flex: none; min-height: 42px; border-radius: 10px; padding: 0 13px; }
.address-locate .spinner { width: 14px; height: 14px; border-width: 1.5px; }
@media (max-width: 680px) {
  .address-locate { padding: 0 10px; font-size: 12px; }
}
.field-error { font-size: 11.5px; color: var(--red); min-height: 0; }
.input-invalid { border-color: var(--red) !important; box-shadow: 0 0 0 3px rgba(184, 74, 62, .12) !important; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px 16px; }
.form-stack { display: flex; flex-direction: column; gap: 15px; }
.span-2 { grid-column: span 2; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 40px; }
.input-group .input-icon { position: absolute; right: 12px; color: var(--muted-2); pointer-events: none; }
.input-group .input-action { position: absolute; right: 5px; border: 0; background: none; color: var(--muted); padding: 7px; border-radius: 7px; }
.input-affix { position: relative; }
.input-affix .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.input-affix .input { padding-left: 38px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-soft); }
.check-row input { width: 16px; height: 16px; accent-color: var(--brass-2); }
.segmented { display: inline-flex; padding: 3px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; gap: 2px; }
.segmented button {
  min-height: 32px; padding: 0 13px; border: 0; border-radius: 7px; background: transparent;
  color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20, 26, 36, .1); }
.segmented.brass button.active { background: var(--brass); color: #171c24; }
.radio-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-pill { position: relative; }
.radio-pill input { position: absolute; opacity: 0; pointer-events: none; }
.radio-pill span {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 16px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; font-size: 13px; color: var(--text-soft); font-weight: 500; cursor: pointer;
  transition: all .15s ease;
}
.radio-pill input:checked + span { border-color: var(--brass); background: var(--brass-pale); color: #7d5c22; font-weight: 600; box-shadow: 0 0 0 2px rgba(201, 164, 92, .12); }

/* ---------------- badges / avatar ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; letter-spacing: .1px;
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--green-bg); color: var(--green); }
.badge-warning { background: var(--amber-bg); color: var(--amber); }
.badge-danger { background: var(--red-bg); color: var(--red); }
.badge-muted { background: #efede7; color: #7f8186; }
.badge-info { background: var(--blue-bg); color: var(--blue); }
.badge-brass { background: var(--brass-soft); color: #866325; }
.badge-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700;
}
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: #ece7db; color: #6c5a35; font-weight: 700; font-size: 13px;
  flex: none; border: 1px solid rgba(255,255,255,.15);
}
.avatar-sm { width: 28px; height: 28px; border-radius: 8px; font-size: 11.5px; }
.avatar-lg { width: 46px; height: 46px; border-radius: 13px; font-size: 18px; }
.avatar-admin { background: linear-gradient(145deg, #d7b876, var(--brass)); color: #241c0d; }
.avatar-locksmith { background: #e8e4da; color: #555b64; }
.user-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.user-cell .user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-cell .user-sub { font-size: 11px; color: var(--muted); }

/* ---------------- login ---------------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.06fr) minmax(420px, .94fr); background: var(--cream); }
.login-side {
  position: relative; overflow: hidden; display: flex; flex-direction: column;
  padding: 38px 46px; color: #f0e8d8;
  background:
    radial-gradient(120% 90% at 90% 10%, rgba(201, 164, 92, .22), transparent 50%),
    radial-gradient(90% 100% at 0% 100%, rgba(49, 76, 108, .36), transparent 60%),
    linear-gradient(145deg, #172232 0%, #101823 72%);
}
.login-side::before {
  content: ""; position: absolute; right: -120px; bottom: -150px; width: 520px; height: 520px;
  border: 1px solid rgba(201, 164, 92, .17); border-radius: 50%;
  box-shadow: 0 0 0 60px rgba(201, 164, 92, .035), 0 0 0 120px rgba(201, 164, 92, .02);
  pointer-events: none;
}
.login-side::after {
  content: ""; position: absolute; right: 2%; top: 27%; width: 430px; height: 430px;
  transform: rotate(-13deg); pointer-events: none; opacity: .35;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400' fill='none' stroke='%23c9a45c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='116' cy='252' r='68'/%3E%3Cpath d='M164 205 344 25M260 109l38 38M312 57l38 38'/%3E%3Ccircle cx='116' cy='252' r='19'/%3E%3C/svg%3E") center / contain no-repeat;
}
.login-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 2; }
.login-brand .login-brand-name { font-family: var(--serif); font-size: 21px; letter-spacing: 3px; color: #f0e7d6; }
.login-brand p { font-size: 9.5px; letter-spacing: 2px; color: #938d80; margin-top: 2px; }
.login-copy { margin: auto 0; position: relative; z-index: 2; max-width: 520px; padding: 46px 0 30px; }
.login-kicker { display: flex; align-items: center; gap: 9px; font-size: 10.5px; color: #b1a58f; letter-spacing: 2px; font-weight: 600; }
.login-kicker .line { width: 32px; height: 1px; background: var(--brass); }
.login-copy h1 { font-family: var(--serif); font-size: clamp(42px, 5.4vw, 64px); font-weight: 500; line-height: 1.18; letter-spacing: 3px; margin: 16px 0 16px; color: #f7efe0; }
.login-copy h1 em { font-style: normal; color: var(--brass); }
.login-copy > p { max-width: 400px; color: #a7a197; font-size: 13px; line-height: 1.8; }
.login-features { display: flex; gap: 24px; margin-top: 32px; flex-wrap: wrap; }
.login-feature { display: flex; align-items: flex-start; gap: 9px; }
.login-feature .f-ico { width: 30px; height: 30px; border-radius: 8px; border: 1px solid rgba(201,164,92,.24); background: rgba(201,164,92,.07); color: var(--brass); display: grid; place-items: center; flex: none; }
.login-feature strong { display: block; font-size: 11px; color: #ddd3c1; font-weight: 600; }
.login-feature span { display: block; font-size: 9.5px; color: #7f7d76; margin-top: 2px; }
.login-side-foot { display: flex; align-items: center; gap: 7px; font-size: 10.5px; color: #837f75; position: relative; z-index: 2; padding-top: 16px; }
.login-side-foot .ico { color: var(--brass-2); }
.login-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 34px 36px; position: relative; }
.login-card { width: 100%; max-width: 384px; }
.login-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 26px; }
.login-mobile-brand strong { font-family: var(--serif); font-size: 19px; letter-spacing: 2px; color: var(--ink); }
.login-card .welcome { font-size: 11px; color: var(--brass-2); letter-spacing: 2px; font-weight: 700; margin-bottom: 7px; }
.login-card h2 { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: 1px; color: var(--ink); }
.login-card .login-sub { color: var(--muted); font-size: 12px; margin: 7px 0 25px; line-height: 1.6; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form .field > label { font-size: 11.5px; }
.login-form .input { min-height: 47px; border-radius: 11px; background: rgba(255,255,255,.68); font-size: 14px; }
.login-form .input:focus { background: #fff; }
.login-form .input-affix .ico { color: #989b9f; }
.login-error { display: none; align-items: flex-start; gap: 7px; background: var(--red-bg); border: 1px solid #f0d2ca; color: var(--red); border-radius: 9px; padding: 9px 11px; font-size: 11.5px; line-height: 1.55; }
.login-error.show { display: flex; }
.login-form .btn-lg { margin-top: 4px; min-height: 47px; border-radius: 11px; font-size: 13.5px; }
.login-demo { margin-top: 24px; padding-top: 18px; border-top: 1px dashed #d8d0c0; }
.login-demo-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 10px; color: var(--muted-2); letter-spacing: .5px; }
.login-demo-head span { color: var(--muted); }
.login-demo-head button { border: 0; background: none; color: var(--brass-2); font-size: 10px; font-weight: 600; padding: 0; }
.demo-buttons { display: flex; gap: 7px; margin-top: 8px; }
.demo-btn { flex: 1; border: 1px solid var(--line); background: rgba(255,255,255,.5); border-radius: 9px; padding: 8px 9px; text-align: left; transition: all .15s ease; }
.demo-btn:hover { border-color: #d4c5a9; background: #fff; }
.demo-btn strong { display: block; font-size: 10.5px; font-weight: 600; color: var(--text-soft); }
.demo-btn span { display: block; font-size: 9px; color: var(--muted-2); margin-top: 1px; font-family: ui-monospace, Menlo, monospace; }
.login-security { display: flex; gap: 6px; align-items: center; justify-content: center; font-size: 9.5px; color: #aaa79d; margin-top: 18px; }
.login-security .ico { color: #b6a987; }
.login-copyright { position: absolute; bottom: 20px; font-size: 9.5px; color: #aaa69b; text-align: center; }
.top-user-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.55); border-radius: 10px; padding: 4px 9px 4px 5px; height: 38px; }
.top-user-chip:hover { background: #fff; border-color: #d6ccb8; }
.top-user-chip .top-user-meta { text-align: left; line-height: 1.2; }
.top-user-chip .top-user-meta strong { display: block; font-size: 11.5px; font-weight: 600; color: var(--text); }
.top-user-chip .top-user-meta span { font-size: 9px; color: var(--muted-2); }

@media (max-width: 860px) {
  .login-page { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .login-main { padding: 30px 22px 58px; min-height: 100vh; background: radial-gradient(100% 55% at 50% 0%, #ebe4d6, transparent 60%), var(--cream); }
  .login-card { max-width: 400px; padding-top: 10px; }
  .login-mobile-brand { display: flex; }
  .login-card h2 { font-size: 27px; }
  .login-copyright { bottom: 16px; }
}
@media (max-width: 380px) {
  .demo-buttons { flex-direction: column; }
  .login-main { padding-left: 16px; padding-right: 16px; }
}

/* ---------------- app shell ---------------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 50;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(201, 164, 92, .1), transparent 55%),
    linear-gradient(180deg, #172232 0%, #101823 100%);
  color: #d8d3c7; display: flex; flex-direction: column;
  padding: 0 15px 16px; border-right: 1px solid rgba(255,255,255,.04);
  overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 22px 7px 24px; }
.sidebar-brand .mark { flex: none; border-radius: 13px; overflow: hidden; box-shadow: 0 5px 18px rgba(0,0,0,.25); }
.sidebar-brand .brand-copy { min-width: 0; }
.sidebar-brand h1 { font-family: var(--serif); font-size: 19px; letter-spacing: 2.5px; color: #f0e6d2; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.sidebar-brand p { font-size: 10px; color: #8d887c; letter-spacing: 1.2px; margin-top: 3px; white-space: nowrap; }
.side-section-label { font-size: 10px; color: #77746b; letter-spacing: 2px; padding: 8px 12px 7px; font-weight: 600; }
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-link {
  position: relative; display: flex; align-items: center; gap: 11px;
  height: 42px; padding: 0 12px; border-radius: 10px;
  color: #a8a89f; font-size: 13.5px; font-weight: 500;
  transition: color .16s ease, background .16s ease;
}
.side-link .ico { color: #777d80; transition: color .16s ease; }
.side-link:hover { background: rgba(255,255,255,.045); color: #ebe4d4; }
.side-link:hover .ico { color: #d8c79f; }
.side-link.active { background: linear-gradient(90deg, rgba(201, 164, 92, .16), rgba(201, 164, 92, .06)); color: #f1e4c9; font-weight: 600; }
.side-link.active::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brass);
}
.side-link.active .ico { color: var(--brass); }
.side-link .side-badge {
  margin-left: auto; min-width: 18px; height: 18px; border-radius: 99px;
  background: rgba(201, 164, 92, .22); color: #e6cd9a; font-size: 10px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}
.sidebar-foot { margin-top: auto; padding-top: 16px; }
.shop-mini {
  border: 1px solid rgba(255,255,255,.07); border-radius: 12px;
  padding: 11px 12px; margin-bottom: 12px; background: rgba(255,255,255,.025);
}
.shop-mini .shop-name { font-size: 12px; color: #d3c7b0; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.shop-mini p { font-size: 10.5px; color: #85857d; line-height: 1.55; margin-top: 4px; }
.side-user {
  display: flex; align-items: center; gap: 9px; padding: 10px 9px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.side-user .user-meta { min-width: 0; flex: 1; }
.side-user .user-meta strong { display: block; color: #e8dfcd; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .user-meta span { display: block; color: #88877f; font-size: 10.5px; }
.side-user .side-user-actions { display: flex; gap: 1px; }
.side-user .icon-btn { color: #8d8c84; width: 30px; height: 30px; border-radius: 8px; }
.side-user .icon-btn:hover { background: rgba(255,255,255,.08); color: #eee5d4; }
.sidebar-scrim { display: none; }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; min-height: 82px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 14px 32px; background: rgba(244, 241, 233, .9);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(218, 211, 197, .6);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-title .eyebrow { font-size: 10.5px; letter-spacing: 1.8px; color: var(--muted-2); text-transform: uppercase; margin-bottom: 2px; }
.topbar-title h1 { font-size: 20px; font-family: var(--serif); letter-spacing: 1px; font-weight: 600; color: var(--ink); line-height: 1.25; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.top-date { text-align: right; line-height: 1.35; padding-right: 4px; }
.top-date strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.top-date span { font-size: 10.5px; color: var(--muted-2); }
.topbar .icon-btn { border: 1px solid var(--line); background: rgba(255,255,255,.55); color: var(--text-soft); width: 38px; height: 38px; }
.topbar .icon-btn:hover { background: #fff; border-color: #d6ccb8; }
.mobile-low-btn { display: none !important; position: relative; }
.mobile-low-count {
  position: absolute; top: 3px; right: 3px; min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 99px; background: var(--red); color: #fff; font-size: 8.5px;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
  border: 2px solid var(--cream);
}
.low-stock-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 11px;
  background: #fff9ee; border: 1px solid #ecdcc2; color: #946421; border-radius: 10px;
  font-size: 12px; font-weight: 600; transition: all .15s ease;
}
.low-stock-chip:hover { background: #fff4df; border-color: #e3c99c; }
.low-stock-chip[hidden] { display: none !important; }
[hidden] { display: none !important; }
.low-stock-chip .badge-count { background: #a26a24; }
.menu-btn { display: none; }
.page { width: 100%; max-width: 1440px; margin: 0 auto; padding: 26px 32px 48px; flex: 1; animation: fadeUp .22s ease; }
.bottom-nav { display: none; }

/* ---------------- page header ---------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head-main { min-width: 0; }
.page-head .eyebrow { font-size: 10.5px; color: var(--brass-2); letter-spacing: 2px; font-weight: 700; margin-bottom: 5px; }
.page-head h2 { font-family: var(--serif); font-size: 27px; letter-spacing: .5px; line-height: 1.22; font-weight: 600; color: var(--ink); }
.page-head p.page-sub { color: var(--muted); font-size: 12.5px; margin-top: 6px; line-height: 1.6; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted-2); margin-bottom: 12px; }
.breadcrumb a:hover { color: var(--brass-2); }
.breadcrumb .sep { color: #c7c2b7; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 24px 0 12px; }
.section-heading h3 { font-family: var(--serif); font-size: 18px; font-weight: 600; letter-spacing: .6px; }

/* ---------------- cards ---------------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 19px 22px 0; }
.card-head h3 { font-family: var(--serif); font-size: 17px; letter-spacing: .5px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.card-head p { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.card-head .ico { color: var(--brass-2); }
.card-body { padding: 18px 22px 22px; }
.card-divider { height: 1px; background: var(--line-soft); margin: 0 22px; }
.card-hover { transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.card-hover:hover { border-color: #d8cdb9; box-shadow: var(--shadow-md); }

/* ---------------- dashboard ---------------- */
.dash-hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 26px 28px;
  background:
    radial-gradient(110% 170% at 100% 0%, rgba(201, 164, 92, .24), transparent 48%),
    radial-gradient(90% 130% at 0% 100%, rgba(61, 85, 113, .45), transparent 55%),
    linear-gradient(120deg, #162132 0%, #111a27 62%, #1a2534 100%);
  color: #f0e9db; display: grid; grid-template-columns: 1fr auto; gap: 24px;
  align-items: center; box-shadow: 0 18px 42px rgba(17, 26, 39, .16);
}
.dash-hero::after {
  content: ""; position: absolute; right: -60px; top: -100px; width: 340px; height: 340px;
  border: 1px solid rgba(201, 164, 92, .17); border-radius: 50%;
  box-shadow: 0 0 0 42px rgba(201, 164, 92, .035), 0 0 0 86px rgba(201, 164, 92, .025);
  pointer-events: none;
}
.dash-hero-copy { position: relative; z-index: 1; min-width: 0; }
.hero-kicker { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: 1.8px; color: #b8aa8e; font-weight: 600; }
.hero-kicker .line { width: 24px; height: 1px; background: var(--brass); }
.dash-hero h2 { font-family: var(--serif); font-weight: 500; font-size: clamp(25px, 3vw, 34px); letter-spacing: 1px; line-height: 1.3; margin: 9px 0 8px; color: #faf3e5; }
.dash-hero h2 em { font-style: normal; color: var(--brass); }
.dash-hero p { color: #a8a69d; font-size: 12.5px; max-width: 560px; line-height: 1.7; }
.dash-hero-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 19px; }
.dash-hero-actions .btn-primary { box-shadow: 0 8px 22px rgba(201, 164, 92, .18); }
.dash-hero-actions .btn-ghost { color: #d3cbbb; border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.035); }
.dash-hero-actions .btn-ghost:hover { background: rgba(255,255,255,.08); }
.hero-side { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.hero-address {
  max-width: 255px; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04); display: flex; gap: 9px; align-items: flex-start;
}
.hero-address .ico { color: var(--brass); margin-top: 1px; }
.hero-address p { color: #b7b0a2; font-size: 11px; line-height: 1.6; }
.hero-address strong { display: block; color: #eee4d2; font-size: 12px; margin-bottom: 2px; }
.hero-tag { font-size: 10.5px; color: #908c83; letter-spacing: .8px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.kpi-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-card {
  position: relative; overflow: hidden; display: block; color: inherit;
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 19px 16px; min-height: 132px; box-shadow: var(--shadow-sm);
}
.kpi-link { cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.kpi-link:hover { transform: translateY(-2px); border-color: #d8ccb4; box-shadow: var(--shadow-md); }
.kpi-link:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.kpi-jump { margin-left: auto; display: inline-flex; align-items: center; color: var(--muted-2); transition: color .15s ease, transform .15s ease; }
.kpi-link:hover .kpi-jump { color: var(--brass-2); transform: translateX(2px); }
.kpi-card.accent-dark .kpi-jump { color: rgba(201, 164, 92, .62); }
.kpi-card.accent-dark.kpi-link:hover .kpi-jump { color: var(--brass); }
.kpi-card::after { content: ""; position: absolute; right: -18px; bottom: -26px; width: 80px; height: 80px; border-radius: 50%; background: var(--brass-pale); opacity: .6; }
.kpi-card.accent-dark { background: linear-gradient(140deg, #1b293c, #121c2a); border-color: #22334a; color: #ece4d4; }
.kpi-card.accent-dark::after { background: rgba(201, 164, 92, .13); }
.kpi-card.accent-dark .kpi-label { color: #a7a59d; }
.kpi-card.accent-dark .kpi-value { color: #f6eedf; }
.kpi-card.accent-dark .kpi-foot { color: #918e84; }
.kpi-card.accent-dark .kpi-icon { background: rgba(201, 164, 92, .14); color: var(--brass); }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; position: relative; z-index: 1; }
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: .2px; display: flex; align-items: center; gap: 6px; }
.kpi-icon { width: 32px; height: 32px; border-radius: 9px; background: var(--brass-pale); color: var(--brass-2); display: flex; align-items: center; justify-content: center; flex: none; }
.kpi-icon.green { background: var(--green-bg); color: var(--green); }
.kpi-icon.red { background: var(--red-bg); color: var(--red); }
.kpi-icon.blue { background: var(--blue-bg); color: var(--blue); }
.kpi-value { position: relative; z-index: 1; margin-top: 10px; font-size: 26px; font-weight: 650; letter-spacing: -.5px; line-height: 1.15; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.kpi-foot { position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--muted); font-size: 11px; min-height: 17px; }
.kpi-foot .up { color: var(--green); font-weight: 600; }
.kpi-foot .down { color: var(--red); font-weight: 600; }

.debt-alert {
  display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 16px;
  border: 1px solid #ecd7b7; border-radius: 13px;
  background: linear-gradient(90deg, #fff9ee, #fdf3e4);
  color: #7d5723; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.debt-alert:hover { border-color: #e3c598; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.debt-alert-ico {
  width: 35px; height: 35px; border-radius: 10px; flex: none;
  display: grid; place-items: center; background: #f8e7ce; color: #a86b1e;
}
.debt-alert-copy { flex: 1; min-width: 0; }
.debt-alert-copy strong { display: block; font-size: 12.5px; color: #6f4a17; font-weight: 650; }
.debt-alert-copy span { display: block; margin-top: 2px; font-size: 10.5px; color: #9b7a4b; }
.debt-alert-action {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  color: #9b651b; font-size: 11px; font-weight: 600;
}

.debt-warning-hero {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px;
  background: #fdf1ec; border: 1px solid #eccfc5; border-radius: 11px; margin-bottom: 12px;
}
.debt-warning-ico {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: grid; place-items: center; background: #f9dfd7; color: var(--red);
}
.debt-warning-hero strong { display: block; font-size: 14px; color: #74362c; font-weight: 650; }
.debt-warning-hero p { margin-top: 3px; font-size: 11.5px; color: #8f5b4f; }
.debt-warning-hero b { color: var(--red); font-size: 14px; }
.debt-warning-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.debt-warning-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; border-top: 1px solid var(--line-soft); }
.debt-warning-row:first-child { border-top: 0; }
.debt-warning-main { min-width: 0; }
.debt-warning-main strong { display: block; font-size: 11.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.debt-warning-main span { display: block; margin-top: 2px; font-size: 10px; color: var(--muted-2); }
.debt-warning-amount { color: var(--red); font-size: 12.5px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.debt-warning-more { padding: 8px 11px; border-top: 1px solid var(--line-soft); background: var(--paper-2); font-size: 10px; color: var(--muted); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 16px; margin-top: 16px; }
.dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.chart-legend { display: flex; align-items: center; gap: 13px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--brass); }
.legend-dot.profit { background: var(--green); }
.legend-dot.revenue { background: var(--brass); }
.chart-scroll { overflow-x: auto; padding-bottom: 2px; }
.chart-svg { display: block; width: 100%; height: auto; min-width: 540px; overflow: visible; }
.chart-svg text { font-family: var(--font); }
.chart-grid-line { stroke: #ece7db; stroke-width: 1; }
.chart-axis-label { fill: #969aa1; font-size: 10px; }
.chart-bar { fill: url(#barGrad); rx: 3; transition: opacity .15s ease; }
.chart-bar:hover { opacity: .8; }
.chart-line { fill: none; stroke: var(--green); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: #fff; stroke: var(--green); stroke-width: 2; }
.chart-empty { display: grid; place-items: center; min-height: 210px; color: var(--muted); font-size: 12px; }
.chart-caption { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0 22px; margin-top: -4px; color: var(--muted-2); font-size: 10.5px; }

.lowstock-list { display: flex; flex-direction: column; gap: 2px; }
.lowstock-item { display: flex; align-items: center; gap: 11px; padding: 11px 22px; border-top: 1px solid var(--line-soft); }
.lowstock-item:first-child { border-top: 0; }
.lowstock-main { min-width: 0; flex: 1; }
.lowstock-main strong { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lowstock-main span { font-size: 10.5px; color: var(--muted-2); }
.stock-meter { width: 58px; height: 5px; border-radius: 99px; background: #eee9dd; overflow: hidden; flex: none; }
.stock-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d7934d, #c45a45); }
.stock-low-count { font-size: 12px; color: var(--red); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stock-low-count small { color: var(--muted-2); font-weight: 500; font-size: 10px; }
.low-stock-empty { padding: 32px 22px; }
.low-stock-empty .empty-mini { color: var(--green); background: var(--green-bg); width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 10px; }
.low-stock-empty h4 { font-size: 13px; }
.low-stock-empty p { color: var(--muted); font-size: 11.5px; margin-top: 3px; }

.mini-order-list { display: flex; flex-direction: column; }
.mini-order {
  display: flex; align-items: center; gap: 12px; padding: 12px 22px;
  border-top: 1px solid var(--line-soft); transition: background .14s ease;
}
.mini-order:first-child { border-top: 0; }
.mini-order:hover { background: #fcfaf4; }
.mini-order-main { flex: 1; min-width: 0; }
.mini-order-main strong { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-order-main p { color: var(--muted); font-size: 10.5px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-order-amount { text-align: right; flex: none; }
.mini-order-amount strong { display: block; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.mini-order-amount span { display: block; font-size: 10px; color: var(--muted-2); margin-top: 2px; }
.mini-order .chev { color: #c1bdb4; flex: none; }

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; padding: 16px 22px 20px; }
.quick-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding: 13px; border-radius: 11px; border: 1px solid var(--line-soft);
  background: var(--paper-2); color: var(--text); text-align: left; transition: all .15s ease;
}
.quick-btn:hover { background: #fff; border-color: #d8ccb6; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.quick-btn .q-ico { width: 29px; height: 29px; border-radius: 8px; background: #fff; border: 1px solid var(--line); color: var(--brass-2); display: grid; place-items: center; }
.quick-btn strong { font-size: 12px; font-weight: 600; }
.quick-btn span { color: var(--muted-2); font-size: 10px; }
.shop-info-card { padding: 18px 22px 20px; }
.shop-info-card .shop-title { display: flex; align-items: center; gap: 10px; }
.shop-info-card .shop-title .ico { color: var(--brass-2); }
.shop-info-card h4 { font-family: var(--serif); font-size: 15px; letter-spacing: .5px; }
.shop-info-card .shop-lines { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.shop-info-card .shop-line { display: flex; gap: 8px; color: var(--muted); font-size: 11.5px; line-height: 1.55; }
.shop-info-card .shop-line .ico { margin-top: 2px; color: var(--brass-2); }

/* ---------------- filter / tables ---------------- */
.filter-card { padding: 14px 16px; margin-bottom: 15px; }
.filter-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.filter-row + .filter-row { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.search-box { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.search-box .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }
.search-box .input { padding-left: 37px; min-height: 40px; background: var(--paper-2); }
.filter-select { min-height: 40px; width: auto; min-width: 120px; background-color: var(--paper-2); }
.quick-dates { flex: 0 1 auto; flex-wrap: wrap; }
.quick-dates button { padding: 0 10px; font-size: 11.5px; }
.date-filter { display: flex; align-items: center; gap: 6px; }
.date-filter .input { min-height: 40px; background: var(--paper-2); width: 138px; padding: 6px 9px; font-size: 12px; }
.date-filter .sep { color: var(--muted-2); font-size: 11px; }
.filter-spacer { flex: 1; }
.filter-count { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-table th {
  background: #faf8f2; border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 11px; font-weight: 600; text-align: left;
  padding: 10px 14px; white-space: nowrap; letter-spacing: .2px;
}
.data-table th:first-child { border-top-left-radius: 10px; }
.data-table th:last-child { border-top-right-radius: 10px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--brass-2); background: #f6f1e6; }
th.sortable:focus-visible { outline: 2px solid var(--brass); outline-offset: -2px; }
th.sortable::after {
  content: '↕'; display: inline-block; margin-left: 5px;
  color: var(--muted-2); font-size: 9px; opacity: .55; transform: translateY(-1px);
}
th.sort-asc::after { content: '↑'; color: var(--brass-2); opacity: 1; }
th.sort-desc::after { content: '↓'; color: var(--brass-2); opacity: 1; }
th.no-sort { cursor: default; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; vertical-align: middle; color: var(--text-soft); }
.data-table tbody tr { transition: background .14s ease; }
.data-table tbody tr:hover { background: #fcfaf5; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .strong { color: var(--text); font-weight: 600; }
.data-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .actions { display: flex; align-items: center; gap: 3px; justify-content: flex-end; }
.data-table .row-link { cursor: pointer; }
.data-table .order-no { font-size: 11.5px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -.2px; }
.data-table .cell-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.data-table .cell-main strong { font-size: 12.5px; font-weight: 600; color: var(--text); }
.data-table .cell-main span { font-size: 10.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.data-table .subline { font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.table-card { overflow: hidden; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 11.5px; }
.pager { display: flex; align-items: center; gap: 3px; }
.pager-btn {
  min-width: 30px; height: 30px; border-radius: 7px; border: 1px solid transparent;
  background: transparent; color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; justify-content: center;
}
.pager-btn:hover:not(:disabled) { background: var(--paper-2); border-color: var(--line); }
.pager-btn.active { background: var(--ink); color: #fff; font-weight: 600; }
.pager-btn:disabled { opacity: .35; cursor: default; }
.table-empty { padding: 32px 20px; }

.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-right: 5px; vertical-align: 1px; }

/* ---------------- order form ---------------- */
.order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.order-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.order-side { position: sticky; top: 99px; display: flex; flex-direction: column; gap: 16px; }
.form-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: visible; }
.form-card-head { padding: 17px 20px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.form-card-head .head-title { display: flex; align-items: center; gap: 9px; }
.form-card-head .step-no {
  width: 24px; height: 24px; border-radius: 7px; background: var(--brass-soft); color: #876326;
  font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.form-card-head h3 { font-family: var(--serif); font-size: 16px; font-weight: 600; letter-spacing: .4px; }
.form-card-head p { color: var(--muted); font-size: 11px; margin-top: 2px; }
.form-card-body { padding: 16px 20px 20px; }
.form-section + .form-section { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--line); }
.form-section-title { font-size: 12px; font-weight: 700; letter-spacing: .5px; color: var(--text-soft); margin-bottom: 12px; display: flex; align-items: center; gap: 7px; }
.form-section-title::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: var(--brass); }
.form-actions { display: flex; gap: 9px; }
.form-actions .btn { flex: 1; }

.summary-card { background: linear-gradient(160deg, #1a2636, #111a27); border: 1px solid #22334a; color: #eee6d7; border-radius: var(--radius); overflow: hidden; box-shadow: 0 16px 34px rgba(17, 26, 39, .16); }
.summary-head { padding: 17px 19px 0; display: flex; align-items: center; justify-content: space-between; }
.summary-head h3 { font-family: var(--serif); font-size: 16px; letter-spacing: .5px; }
.summary-body { padding: 14px 19px 19px; }
.summary-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; color: #a4a39b; font-size: 12px; }
.summary-line strong { color: #f3ead8; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }
.summary-total { display: flex; align-items: baseline; justify-content: space-between; padding: 13px 0 12px; border-top: 1px solid rgba(255,255,255,.1); margin-top: 5px; }
.summary-total span { font-size: 12px; color: #b7b1a3; }
.summary-total strong { font-family: var(--serif); font-size: 29px; color: var(--brass); letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.summary-debt { display: flex; justify-content: space-between; align-items: center; padding: 9px 11px; border-radius: 9px; background: rgba(201, 164, 92, .08); border: 1px solid rgba(201, 164, 92, .18); color: #d8c49b; font-size: 11.5px; margin: 7px 0 13px; }
.summary-debt strong { font-size: 14px; color: #f0d6a4; font-variant-numeric: tabular-nums; }
.summary-debt.clear { background: rgba(89, 170, 130, .08); border-color: rgba(89, 170, 130, .18); color: #a5cbb8; }
.summary-debt.clear strong { color: #9ed1b8; }
.summary-note { color: #827f78; font-size: 10.5px; line-height: 1.6; margin-top: 9px; }
.pay-quick { display: flex; gap: 6px; margin-top: 6px; }
.pay-quick button { flex: 1; height: 29px; border-radius: 7px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); color: #bfb8a8; font-size: 10.5px; }
.pay-quick button:hover { background: rgba(255,255,255,.1); color: #fff; }
.mobile-submit-bar { display: none; }

/* product combo */
.combo { position: relative; }
.combo-input-wrap { position: relative; }
.combo-input-wrap .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }
.combo-input-wrap .input { padding-left: 38px; }
.combo-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40;
  background: #fff; border: 1px solid #ded6c6; border-radius: 11px;
  box-shadow: 0 18px 40px rgba(24, 30, 40, .16); max-height: 300px; overflow-y: auto; padding: 5px;
}
.combo-option {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border: 0; background: transparent; text-align: left; border-radius: 8px;
}
.combo-option:hover, .combo-option.active { background: var(--brass-pale); }
.combo-option .opt-main { flex: 1; min-width: 0; }
.combo-option .opt-main strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-option .opt-main span { display: block; color: var(--muted-2); font-size: 10.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-option .opt-side { text-align: right; flex: none; }
.combo-option .opt-side strong { display: block; color: var(--brass-2); font-size: 12px; }
.combo-option .opt-side span { display: block; color: var(--muted-2); font-size: 10px; }
.combo-thumb {
  width: 36px; height: 36px; border-radius: 8px; overflow: hidden; flex: none;
  border: 1px solid var(--line); background: var(--paper-2); display: block;
}
.combo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.combo-thumb-empty { display: grid; place-items: center; color: var(--brass-2); background: var(--brass-pale); }
.combo-empty { padding: 16px 12px; color: var(--muted); font-size: 12px; text-align: center; }
.combo-hint { padding: 8px 10px 5px; font-size: 10.5px; color: var(--muted-2); border-bottom: 1px solid var(--line-soft); margin-bottom: 3px; }

.item-list { display: flex; flex-direction: column; gap: 8px; }
.item-empty { border: 1px dashed #dcd3c1; border-radius: 11px; background: var(--paper-2); padding: 24px 16px; text-align: center; color: var(--muted); font-size: 12px; }
.item-empty .ico { color: var(--brass-2); margin-bottom: 7px; }
.line-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.line-item-main { flex: 1; min-width: 0; }
.line-item-main strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); }
.line-item-main span { display: block; font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; height: 32px; flex: none; }
.qty-stepper button { width: 28px; height: 30px; border: 0; background: var(--paper-2); color: var(--text-soft); font-size: 15px; display: grid; place-items: center; }
.qty-stepper button:hover { background: var(--brass-pale); }
.qty-stepper input { width: 38px; height: 30px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; font-size: 12px; font-weight: 600; outline: none; -moz-appearance: textfield; }
.qty-stepper input::-webkit-outer-spin-button, .qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.price-input { width: 82px; height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font-size: 12px; text-align: right; outline: none; flex: none; }
.price-input:focus { border-color: var(--brass); box-shadow: 0 0 0 2px rgba(201,164,92,.12); }
.line-total { width: 74px; text-align: right; flex: none; font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.line-remove { color: var(--muted-2); flex: none; width: 28px; height: 28px; border: 0; background: transparent; border-radius: 7px; display: grid; place-items: center; }
.line-remove:hover { background: var(--red-bg); color: var(--red); }
.line-stock { font-size: 10px; margin-top: 2px; }
.line-stock.low { color: var(--red); }
.item-summary-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 2px 0; border-top: 1px dashed var(--line); margin-top: 12px; }
.item-summary-row .sum-label { color: var(--muted); font-size: 11.5px; }
.item-summary-row .sum-value { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.item-summary-row .sum-value small { font-family: var(--font); font-size: 11px; color: var(--muted); font-weight: 400; }

/* upload */
.upload-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 9px; }
.file-attachments-block { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.file-attachment-list { display: flex; flex-direction: column; gap: 6px; }
.file-empty { padding: 6px 0; color: var(--muted-2); font-size: 11px; }
.file-attachment {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper-2);
}
.file-attachment.uploading { border-style: dashed; color: var(--muted); }
.file-attachment-icon {
  width: 29px; height: 29px; border-radius: 7px; flex: none;
  display: grid; place-items: center; color: var(--brass-2); background: #f7efdf;
}
.file-attachment-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.file-attachment-main strong { font-size: 11.5px; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-attachment-main span { font-size: 10px; color: var(--muted-2); }
.file-action {
  width: 27px; height: 27px; flex: none; border-radius: 6px; border: 0;
  display: grid; place-items: center; color: var(--muted); background: transparent;
  cursor: pointer; text-decoration: none;
}
.file-action:hover { color: var(--text); background: var(--paper); }
.file-remove:hover { color: var(--red); }
.file-upload-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-upload-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-upload-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-upload-btn:has(input:disabled) { opacity: .6; pointer-events: none; }
.upload-tile {
  position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden;
  border: 1px dashed #d5cbb9; background: var(--paper-2); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 10.5px;
  cursor: pointer; transition: all .15s ease;
}
.upload-tile:hover { border-color: var(--brass); background: var(--brass-pale); color: var(--brass-2); }
.upload-tile input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-tile .ico { color: var(--brass-2); }
.upload-tile.uploading::after {
  content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.72);
}
.upload-tile .upload-spin { position: absolute; z-index: 2; }
.upload-preview { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #eee; }
.upload-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upload-preview .photo-remove {
  position: absolute; top: 5px; right: 5px; z-index: 2; width: 24px; height: 24px;
  border-radius: 7px; border: 0; background: rgba(17, 26, 39, .72); color: #fff;
  display: grid; place-items: center; backdrop-filter: blur(4px);
}
.upload-preview .photo-remove:hover { background: var(--red); }
.upload-preview .photo-label { position: absolute; left: 5px; bottom: 5px; z-index: 2; font-size: 9px; background: rgba(17,26,39,.6); color: #fff; padding: 2px 6px; border-radius: 4px; }
.upload-caption { font-size: 10.5px; color: var(--muted-2); margin-top: 7px; }

/* ---------------- order detail ---------------- */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.detail-main-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.internal-parts-card .card-head { padding-bottom: 12px; }
.internal-tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border: 1px solid #e5ddcd; border-radius: 5px; background: var(--paper-2);
  color: var(--muted); font-size: 9.5px; white-space: nowrap;
}
.internal-parts-table { width: 100%; border-collapse: collapse; }
.internal-parts-table th { text-align: left; padding: 7px 9px; background: var(--paper-2); border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 600; color: var(--muted); }
.internal-parts-table td { padding: 9px; border-bottom: 1px solid var(--line-soft); font-size: 11px; color: var(--text-soft); }
.internal-parts-table td strong { color: var(--text); font-weight: 600; }
.internal-parts-table tr:last-child td { border-bottom: 0; }
.internal-parts-table .right { text-align: right; font-variant-numeric: tabular-nums; }
.internal-parts-hint { display: flex; align-items: center; gap: 5px; margin-top: 10px; color: var(--muted-2); font-size: 10px; }
.internal-parts-hint .ico { color: var(--green); }
.order-file-list { display: flex; flex-direction: column; gap: 7px; }
.order-files-card .file-attachment { background: var(--paper-2); }
.order-files-card .btn { min-height: 30px; padding: 0 10px; gap: 4px; font-size: 10.5px; }
.detail-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 99px; }
.detail-actions-card { padding: 14px; }
.detail-actions-card .btn + .btn { margin-top: 8px; }
.detail-actions-card .action-row { display: flex; gap: 7px; }
.detail-actions-card .action-row .btn { flex: 1; margin-top: 0; }
.warranty-sheet {
  position: relative; background: #fff; border: 1px solid #e3ddcf; border-radius: 6px;
  box-shadow: 0 16px 38px rgba(24, 30, 40, .08); padding: 32px 34px 26px;
}
.warranty-sheet::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--ink), var(--brass)); border-radius: 5px 5px 0 0; }
.warranty-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 15px; border-bottom: 2px solid var(--ink); }
.warranty-brand { display: flex; gap: 12px; align-items: center; }
.warranty-mark { width: 44px; height: 44px; border-radius: 11px; border: 1px solid #c5a565; color: #98702b; display: grid; place-items: center; font-family: var(--serif); font-size: 21px; font-weight: 700; }
.warranty-brand h3 { font-family: var(--serif); font-size: 22px; letter-spacing: 1.5px; font-weight: 600; color: var(--ink); }
.warranty-brand p { font-size: 10.5px; color: var(--muted); letter-spacing: .5px; margin-top: 2px; }
.warranty-title { text-align: right; }
.warranty-title h4 { font-family: var(--serif); font-size: 17px; letter-spacing: 5px; color: #98702b; font-weight: 600; }
.warranty-title p { font-size: 10px; color: var(--muted); margin-top: 3px; font-family: ui-monospace, Menlo, monospace; }
.warranty-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 18px; padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.warranty-meta .meta-item span { display: block; font-size: 10px; color: var(--muted-2); margin-bottom: 2px; }
.warranty-meta .meta-item strong { font-size: 12px; font-weight: 600; color: var(--text); word-break: break-all; }
.warranty-items { margin-top: 16px; }
.warranty-items table { width: 100%; border-collapse: collapse; }
.warranty-items th { background: #f7f4ec; font-size: 10.5px; color: var(--muted); text-align: left; padding: 7px 9px; border: 1px solid #e5dfd2; font-weight: 600; }
.warranty-items td { padding: 8px 9px; border: 1px solid #e5dfd2; font-size: 11.5px; vertical-align: top; }
.warranty-items .prod-cell strong { display: block; font-size: 12px; font-weight: 600; }
.warranty-items .prod-cell span { color: var(--muted-2); font-size: 10px; }
.warranty-service { margin-top: 16px; border: 1px solid #e0d9c9; border-radius: 8px; overflow: hidden; }
.warranty-service-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 13px; border-top: 1px solid #ece6d9; }
.warranty-service-row:first-child { border-top: 0; background: #f8f5ec; }
.warranty-service-row span { font-size: 10.5px; color: var(--muted); letter-spacing: .5px; }
.warranty-service-row strong { font-size: 14px; color: var(--text); font-weight: 600; }
.warranty-service-note { display: flex; gap: 14px; padding: 9px 13px; border-top: 1px dashed #ddd5c5; background: #fcfaf5; }
.warranty-service-note span { flex: none; font-size: 10.5px; color: var(--muted); letter-spacing: .5px; padding-top: 1px; }
.warranty-service-note p { font-size: 12px; line-height: 1.65; color: var(--text-soft); }
.warranty-totals { width: 280px; margin-left: auto; margin-top: 10px; }
.warranty-totals .w-line { display: flex; justify-content: space-between; padding: 4px 7px; font-size: 11.5px; color: var(--muted); }
.warranty-totals .w-line strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.warranty-totals .w-grand { border-top: 1px solid #d8d1c2; margin-top: 3px; padding-top: 7px; font-weight: 700; font-size: 13px; color: var(--text); }
.warranty-totals .w-grand.debt strong { color: var(--red); }
.warranty-photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.warranty-photo { width: 94px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); cursor: zoom-in; background: #eee; padding: 0; text-align: left; }
.warranty-photo img { width: 100%; height: 68px; object-fit: cover; display: block; }
.warranty-photo span { display: block; font-size: 9px; color: var(--muted-2); padding: 3px 5px; }
.warranty-terms { margin-top: 18px; border-top: 1px dashed #d8d2c5; padding-top: 10px; color: var(--muted); font-size: 10px; line-height: 1.75; }
.warranty-terms h5 { font-size: 10.5px; color: var(--text-soft); margin-bottom: 3px; }
.warranty-sign { display: flex; justify-content: space-between; gap: 20px; margin-top: 22px; font-size: 10.5px; color: var(--muted); }
.warranty-sign div { width: 44%; border-top: 1px solid #cfc8b8; padding-top: 5px; }
.warranty-print-note { font-size: 10px; color: var(--muted-2); text-align: center; margin-top: 12px; }

.detail-meta-card .card-body { padding: 15px 18px 18px; }
.meta-list { display: flex; flex-direction: column; gap: 10px; }
.meta-list-row { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; }
.meta-list-row span { color: var(--muted); }
.meta-list-row strong { color: var(--text); font-weight: 600; text-align: right; }
.timeline-card .card-body { padding-top: 10px; }
.timeline { position: relative; padding-left: 19px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; 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%; background: var(--paper); border: 2px solid var(--brass); box-shadow: 0 0 0 3px var(--paper); }
.timeline-item.create .timeline-dot { border-color: var(--green); }
.timeline-item.cancel .timeline-dot { border-color: var(--red); }
.timeline-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.timeline-head strong { font-size: 11.5px; font-weight: 600; color: var(--text); }
.timeline-head span { font-size: 9.5px; color: var(--muted-2); white-space: nowrap; }
.timeline-item p { font-size: 10.5px; color: var(--muted); margin-top: 3px; line-height: 1.6; }
.change-list { margin-top: 7px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--paper-2); overflow: hidden; }
.change-row { padding: 7px 9px; font-size: 10px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 2px; }
.change-row:first-child { border-top: 0; }
.change-row .change-field { color: var(--muted); font-weight: 600; }
.change-row .change-values { display: flex; gap: 5px; align-items: baseline; flex-wrap: wrap; color: var(--text-soft); }
.change-row .before { color: var(--muted-2); text-decoration: line-through; text-decoration-color: #c9c4b9; }
.change-row .after { color: var(--green); font-weight: 600; }
.change-arrow { color: var(--muted-2); }
.audit-more { margin-top: 7px; }
.audit-more summary { font-size: 10px; color: var(--brass-2); cursor: pointer; }
.audit-more .change-list { margin-top: 5px; }
.detail-status-line { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

/* ---------------- inventory ---------------- */
.inventory-layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 16px; align-items: start; }
.category-panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow-sm); position: sticky; top: 99px; max-height: calc(100vh - 120px); overflow-y: auto; }
.category-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 7px; }
.category-panel-head h3 { font-family: var(--serif); font-size: 14px; font-weight: 600; letter-spacing: .5px; }
.category-all {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 0 9px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-soft); font-size: 12px; text-align: left;
}
.category-all:hover { background: var(--paper-2); }
.category-all.active { background: var(--brass-pale); color: #77571f; font-weight: 600; }
.category-all .cat-count { margin-left: auto; color: var(--muted-2); font-size: 10px; }
.cat-node { user-select: none; }
.cat-row { display: flex; align-items: center; gap: 3px; border-radius: 8px; padding: 0 3px 0 0; }
.cat-row:hover { background: var(--paper-2); }
.cat-row.selected { background: var(--brass-pale); }
.cat-toggle { width: 22px; height: 30px; border: 0; background: transparent; color: var(--muted-2); display: grid; place-items: center; border-radius: 6px; flex: none; }
.cat-toggle:hover { color: var(--text); }
.cat-toggle .ico { transition: transform .15s ease; }
.cat-node.open > .cat-row .cat-toggle .ico { transform: rotate(90deg); }
.cat-label { flex: 1; min-width: 0; height: 30px; border: 0; background: transparent; text-align: left; font-size: 11.5px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.cat-row.selected .cat-label { color: #77571f; font-weight: 600; }
.cat-count { font-size: 9.5px; color: var(--muted-2); padding-right: 5px; flex: none; }
.cat-children { margin-left: 12px; padding-left: 5px; border-left: 1px solid #eee9de; display: none; }
.cat-node.open > .cat-children { display: block; }
.cat-empty { padding: 10px 9px; color: var(--muted-2); font-size: 10.5px; }

.inventory-main { min-width: 0; }
.inventory-toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 14px; }
.category-mobile-btn { display: none; }
.inventory-toolbar .search-box { max-width: 310px; }
.inv-summary-strip { display: flex; gap: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px 4px; margin-bottom: 14px; box-shadow: var(--shadow-sm); overflow-x: auto; }
.inv-stat { flex: 1; min-width: 118px; padding: 3px 16px; border-left: 1px solid var(--line-soft); position: relative; }
.inv-stat:first-child { border-left: 0; }
.inv-stat span { display: block; font-size: 10px; color: var(--muted-2); letter-spacing: .2px; }
.inv-stat strong { display: block; font-size: 17px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; color: var(--text); }
.inv-stat strong small { font-size: 10px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.inv-stat.alert strong { color: var(--red); }
.inv-stat-link {
  border: 0; border-left: 1px solid var(--line-soft); background: transparent;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease;
}
.inv-stat-link:first-child { border-left: 0; }
.inv-stat-link:hover { background: var(--brass-pale); box-shadow: inset 0 0 0 1px rgba(201, 164, 92, .14); border-radius: 9px; }
.inv-stat-link:focus-visible { outline: 2px solid var(--brass); outline-offset: -2px; border-radius: 9px; }
.inv-stat-jump {
  position: absolute !important; right: 10px; top: 10px; width: 14px; height: 14px;
  display: grid !important; place-items: center; color: var(--brass-2) !important;
  opacity: .62; transition: opacity .15s ease, transform .15s ease;
}
.inv-stat-link:hover .inv-stat-jump { opacity: 1; transform: translateX(1px); }
.product-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.product-cell .p-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--brass-pale); color: var(--brass-2); display: grid; place-items: center; flex: none; }
.product-thumb {
  width: 40px; height: 40px; border-radius: 9px; overflow: hidden; flex: none;
  border: 1px solid var(--line); background: var(--paper-2); padding: 0; cursor: zoom-in;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .18s ease; }
.product-thumb:hover img { transform: scale(1.08); }
.product-cell .p-main { min-width: 0; }
.product-cell .p-main strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); }
.product-cell .p-main span { display: block; font-size: 10px; color: var(--muted-2); font-family: ui-monospace, Menlo, monospace; margin-top: 1px; }
.stock-badge { display: inline-flex; align-items: baseline; gap: 3px; padding: 2px 7px; border-radius: 6px; background: var(--paper-2); font-weight: 650; font-size: 12.5px; color: var(--text); font-variant-numeric: tabular-nums; }
.stock-badge small { font-size: 9px; color: var(--muted-2); font-weight: 400; }
.stock-badge.low { background: var(--red-bg); color: var(--red); }
.stock-badge.low small { color: #c8857d; }
.category-path { color: var(--muted-2); font-size: 10px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }
.inv-price { font-variant-numeric: tabular-nums; }
.inv-price strong { font-weight: 600; color: var(--text); }
.inv-price span { display: block; color: var(--muted-2); font-size: 10px; }
.mobile-product-list { display: none; }

/* ---------------- purchases ---------------- */
.purchase-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
.purchase-form-card { position: sticky; top: 99px; }
.purchase-preview { margin-top: 13px; border: 1px dashed #ddd3c0; border-radius: 9px; background: var(--paper-2); padding: 10px 12px; }
.purchase-preview .pv-row { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--muted); padding: 2px 0; }
.purchase-preview .pv-row strong { color: var(--text); font-weight: 600; }
.purchase-preview .pv-title { font-size: 10px; color: var(--brass-2); font-weight: 600; letter-spacing: .5px; margin-bottom: 4px; }
.purchase-log-table .qty { font-weight: 650; color: var(--green); }
.purchase-summary-strip { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.purchase-summary-strip .p-sum { flex: 1; min-width: 150px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; box-shadow: var(--shadow-sm); }
.purchase-summary-strip .p-sum span { font-size: 10px; color: var(--muted-2); display: block; }
.purchase-summary-strip .p-sum strong { font-size: 18px; font-weight: 650; margin-top: 2px; display: block; font-variant-numeric: tabular-nums; }

/* ---------------- customers ---------------- */
.customer-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 15px; }
.customer-stat {
  position: relative; overflow: hidden; padding: 13px 16px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.customer-stat span { display: block; font-size: 10.5px; color: var(--muted); }
.customer-stat strong { display: block; font-size: 21px; font-weight: 650; margin-top: 3px; color: var(--text); font-variant-numeric: tabular-nums; }
.customer-stat strong small { font-size: 10px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.customer-stat i { position: absolute; right: 12px; top: 12px; color: var(--brass-2); opacity: .55; font-style: normal; }
.customer-stat.alert strong { color: var(--red); }
.customer-stat.alert i { color: var(--red); }
.referrer-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.referrer-cell > span:last-child { font-size: 10px; color: var(--muted-2); }
.mc-referrer { display: flex; align-items: center; gap: 4px; margin-top: 7px; color: var(--muted); font-size: 10.5px; }
.mc-referrer .ico { color: var(--brass-2); }
.linked-referrer {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-top: 2px; padding: 7px 9px; border-radius: 8px;
  background: #f1f8f4; border: 1px solid #d8e9df; color: #3d6b55;
  font-size: 10.5px;
}
.linked-referrer[hidden] { display: none !important; }
.linked-referrer-label { display: inline-flex; align-items: center; gap: 3px; color: #39725a; font-weight: 600; }
.linked-referrer strong { font-size: 11px; color: #2e5a46; }
.linked-referrer a { color: #356b8f; font-variant-numeric: tabular-nums; }
.linked-referrer-address { color: #719082; }
.customer-filter-tools { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.customer-filter-tools .filter-count { width: auto; }
.customer-phone { color: var(--text-soft); font-variant-numeric: tabular-nums; }
.customer-phone:hover { color: var(--brass-2); }
.customer-address { display: inline-block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; color: var(--text-soft); }
.mobile-customer-list { display: none; }
.mobile-customer-card { background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.mc-top { display: flex; align-items: flex-start; gap: 9px; }
.mc-main { min-width: 0; flex: 1; }
.mc-main strong { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-main span { display: block; font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.mc-address { display: flex; align-items: flex-start; gap: 5px; margin-top: 9px; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.mc-address .ico { color: var(--brass-2); margin-top: 1px; flex: none; }
.mc-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--muted-2); font-size: 10px; flex-wrap: wrap; }
.mc-debt { margin-top: 7px; padding: 5px 8px; border-radius: 6px; background: var(--red-bg); color: var(--red); font-size: 10.5px; font-weight: 600; }
.mc-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.mc-actions .btn { flex: 1; min-height: 31px; padding: 0 8px; }
@media (max-width: 960px) {
  .mobile-customer-list { display: flex !important; flex-direction: column; gap: 9px; padding: 12px; }
}
@media (max-width: 680px) {
  .customer-filter-tools { width: 100%; justify-content: space-between; }
  .customer-filter-tools .filter-count { width: auto; }
  .customer-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .customer-stat { padding: 11px 13px; border-radius: 12px; }
  .customer-stat strong { font-size: 19px; }
  .customer-stat i { right: 10px; top: 10px; }
}

/* ---------------- stats ---------------- */
.stats-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 15px; }
.stats-toolbar-left { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.preset-group { display: inline-flex; gap: 2px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.preset-btn { height: 32px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.preset-btn:hover { color: var(--text); }
.preset-btn.active { background: var(--ink); color: #fff; font-weight: 600; }
.custom-range { display: none; align-items: center; gap: 6px; }
.custom-range.show { display: flex; }
.custom-range .input { min-height: 38px; width: 132px; padding: 6px 8px; font-size: 11.5px; background: var(--paper); }
.stats-actions { display: flex; align-items: center; gap: 7px; }
.kpi-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 0; margin-bottom: 16px; }
.kpi-card.compact { min-height: 105px; padding: 14px 16px; }
.kpi-card.compact .kpi-value { font-size: 23px; margin-top: 6px; }
.kpi-card.compact .kpi-foot { margin-top: 5px; }
.stats-main-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(290px, 1fr); gap: 16px; margin-bottom: 16px; }
.stats-inventory-card .card-head { padding-bottom: 12px; }
.inv-detail-list { display: flex; flex-direction: column; }
.inv-detail-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 22px; border-top: 1px solid var(--line-soft); font-size: 11.5px; }
.inv-detail-row:first-child { border-top: 0; }
.inv-detail-row span { color: var(--muted); }
.inv-detail-row strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 0; padding: 0 18px; overflow-x: auto; }
.tab-btn { position: relative; height: 46px; padding: 0 13px; border: 0; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--ink); font-weight: 650; }
.tab-btn.active::after { content: ""; position: absolute; left: 11px; right: 11px; bottom: -1px; height: 2px; background: var(--brass); border-radius: 2px 2px 0 0; }
.tab-panel { padding: 4px 0 0; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--line-soft); }
.rank-row:first-child { border-top: 0; }
.rank-no { width: 22px; height: 22px; border-radius: 7px; background: var(--paper-2); color: var(--muted); display: grid; place-items: center; font-size: 10px; font-weight: 700; flex: none; }
.rank-no.top1 { background: var(--brass); color: #241c0d; }
.rank-no.top2 { background: #ddd7cb; color: #57503f; }
.rank-no.top3 { background: #e8d4be; color: #735436; }
.rank-main { flex: 1; min-width: 0; }
.rank-main strong { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-main span { display: block; font-size: 10px; color: var(--muted-2); margin-top: 2px; }
.rank-bar { height: 5px; border-radius: 99px; background: #eee9de; overflow: hidden; margin-top: 5px; max-width: 280px; }
.rank-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d7b775, var(--brass-2)); }
.rank-value { text-align: right; flex: none; min-width: 76px; }
.rank-value strong { display: block; font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
.rank-value span { display: block; font-size: 9.5px; color: var(--muted-2); margin-top: 2px; }
.perf-cell { display: flex; align-items: center; gap: 8px; }
.perf-bar { flex: 1; max-width: 96px; height: 5px; border-radius: 99px; background: #eee9de; overflow: hidden; }
.perf-bar i { display: block; height: 100%; border-radius: inherit; background: var(--green-2); }
.stats-export-note { color: var(--muted-2); font-size: 10.5px; margin-top: 10px; }

/* ---------------- category manager ---------------- */
.cat-manager { display: flex; flex-direction: column; gap: 16px; }
.cat-manager-form { border: 1px solid var(--line); border-radius: 11px; padding: 13px 14px; background: var(--paper-2); }
.cat-manager-form .form-grid { gap: 11px 12px; }
.cat-manager-form .btn { width: 100%; }
.cat-manage-list { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.cat-manage-row { display: flex; align-items: center; gap: 12px; padding: 10px 13px; border-top: 1px solid var(--line-soft); }
.cat-manage-row:first-child { border-top: 0; }
.cat-manage-main { flex: 1; min-width: 0; }
.cat-manage-main strong { display: block; font-size: 12px; font-weight: 600; color: var(--text); }
.cat-manage-main span { display: block; font-size: 10px; color: var(--muted-2); margin-top: 2px; }
.cat-manage-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.cat-manage-actions .text-link { font-size: 10.5px; font-weight: 500; }
@media (max-width: 680px) {
  .cat-manager-form .form-grid { grid-template-columns: 1fr; }
  .cat-manage-row { align-items: flex-start; flex-direction: column; gap: 7px; }
  .cat-manage-actions { width: 100%; justify-content: flex-end; }
}

/* ---------------- audit ---------------- */
.audit-list { display: flex; flex-direction: column; }
.audit-row { display: grid; grid-template-columns: 130px 100px minmax(0, 1fr) 100px; gap: 12px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line-soft); cursor: pointer; transition: background .14s ease; }
.audit-row:first-child { border-top: 0; }
.audit-row:hover { background: #fcfaf4; }
.audit-time { font-size: 10.5px; color: var(--muted); line-height: 1.5; }
.audit-time strong { display: block; color: var(--text-soft); font-weight: 600; font-size: 11px; }
.audit-actor { display: flex; align-items: center; gap: 7px; font-size: 11.5px; }
.audit-main { min-width: 0; }
.audit-main strong { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-main p { color: var(--muted); font-size: 10.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-action { text-align: right; }
.audit-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); margin-bottom: 14px; }
.audit-detail-head h4 { font-size: 15px; font-family: var(--serif); letter-spacing: .4px; }
.audit-detail-head span { font-size: 11px; color: var(--muted); }
.audit-detail-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.audit-detail-meta .meta-chip { font-size: 10.5px; color: var(--muted); background: var(--paper-2); border: 1px solid var(--line-soft); border-radius: 6px; padding: 4px 8px; }
.audit-summary-text { font-size: 12px; line-height: 1.7; color: var(--text-soft); padding: 11px 12px; border-radius: 9px; background: var(--paper-2); border: 1px solid var(--line-soft); }
.audit-changes { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; }
.audit-change-block { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.audit-change-block .change-title { padding: 7px 10px; background: var(--paper-2); font-size: 10.5px; font-weight: 600; color: var(--text-soft); display: flex; justify-content: space-between; }
.audit-change-block .change-body { padding: 9px 10px; font-size: 11px; color: var(--text-soft); display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.audit-change-block .before { color: var(--muted-2); text-decoration: line-through; text-decoration-color: #ccc7bd; }
.audit-change-block .after { color: var(--green); font-weight: 600; }
.audit-json { margin-top: 14px; }
.audit-json summary { font-size: 10.5px; color: var(--muted); cursor: pointer; }
.audit-json pre { margin-top: 8px; background: #16202e; color: #d8d2c5; padding: 12px; border-radius: 9px; font-size: 10px; overflow: auto; max-height: 260px; line-height: 1.6; }

/* ---------------- settings ---------------- */
.settings-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.settings-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.settings-nav-card .card-body { padding: 8px; }
.settings-nav-item { display: flex; align-items: center; gap: 9px; padding: 10px 11px; border-radius: 8px; font-size: 12px; color: var(--text-soft); }
.settings-nav-item:hover { background: var(--paper-2); }
.settings-nav-item .ico { color: var(--brass-2); }
.settings-nav-item.active { background: var(--brass-pale); color: #76571f; font-weight: 600; }
.settings-nav-item.danger { color: var(--red); }
.settings-nav-item.danger .ico { color: var(--red); }
.user-row { display: flex; align-items: center; gap: 11px; padding: 12px 20px; border-top: 1px solid var(--line-soft); }
.user-row:first-child { border-top: 0; }
.user-row .u-main { flex: 1; min-width: 0; }
.user-row .u-main strong { display: block; font-size: 12.5px; font-weight: 600; }
.user-row .u-main span { display: block; font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.user-row .u-side { display: flex; align-items: center; gap: 6px; flex: none; }
.role-tag { font-size: 10px; padding: 2px 7px; border-radius: 5px; background: var(--paper-2); border: 1px solid var(--line); color: var(--muted); font-style: normal; display: inline-flex; align-items: center; line-height: 1.4; }
.role-tag.admin { background: var(--brass-pale); border-color: #ead8b6; color: #7e5c22; }
.demo-banner { display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-radius: 11px; background: #fff8ea; border: 1px solid #ecdcc0; color: #7d5d29; font-size: 11.5px; line-height: 1.6; margin-bottom: 15px; }
.demo-banner .ico { margin-top: 1px; flex: none; color: #b0833b; }
.demo-banner strong { color: #664719; }
.settings-section-note { font-size: 11px; color: var(--muted); line-height: 1.65; }
.backup-box { border: 1px dashed #d9d0bf; background: var(--paper-2); border-radius: 10px; padding: 12px; font-size: 11px; color: var(--muted); line-height: 1.7; }
.backup-box code { font-size: 10px; background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--text-soft); }

/* ---------------- more page ---------------- */
.profile-hero { display: flex; align-items: center; gap: 15px; padding: 22px; background: linear-gradient(130deg, #1a2636, #111a27); border-radius: var(--radius); color: #eee6d7; position: relative; overflow: hidden; margin-bottom: 16px; }
.profile-hero::after { content: ""; position: absolute; right: -40px; top: -60px; width: 180px; height: 180px; border: 1px solid rgba(201,164,92,.18); border-radius: 50%; }
.profile-hero .avatar { width: 54px; height: 54px; border-radius: 15px; font-size: 22px; }
.profile-hero h2 { font-family: var(--serif); font-size: 22px; letter-spacing: .8px; }
.profile-hero p { color: #a9a69d; font-size: 11.5px; margin-top: 3px; }
.profile-hero .profile-badge { margin-left: auto; }
.more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.more-link { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; text-align: left; transition: all .15s ease; }
.more-link:hover { border-color: #d8ccb6; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.more-link .m-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--brass-pale); color: var(--brass-2); display: grid; place-items: center; flex: none; }
.more-link .m-main { flex: 1; min-width: 0; }
.more-link .m-main strong { display: block; font-size: 12.5px; font-weight: 600; }
.more-link .m-main span { display: block; font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.more-link .chev { color: #c5c0b6; flex: none; }
.more-logout { margin-top: 14px; }

/* ---------------- modals / toast / empty ---------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(12, 18, 27, .48);
  backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center;
  padding: 22px; opacity: 0; transition: opacity .18s ease;
}
.modal-overlay.open { opacity: 1; }
.modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 44px);
  background: var(--paper); border: 1px solid var(--line); border-radius: 17px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  transform: translateY(10px) scale(.99); transition: transform .18s ease;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-sm { max-width: 410px; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 980px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 19px 21px 0; }
.modal-head h3 { font-family: var(--serif); font-size: 18px; font-weight: 600; letter-spacing: .5px; }
.modal-head .modal-close { margin-top: -5px; margin-right: -5px; }
.modal-body { padding: 15px 21px 20px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 13px 21px; border-top: 1px solid var(--line-soft); background: #fcfaf5; border-radius: 0 0 17px 17px; flex-wrap: wrap; }
.modal-foot .btn-danger { margin-right: auto; }
.confirm-text { font-size: 13px; line-height: 1.75; color: var(--text-soft); }
.toast-root { position: fixed; right: 20px; bottom: 22px; z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: min(360px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 9px; padding: 11px 14px;
  background: #172231; color: #f1eadc; border: 1px solid rgba(255,255,255,.08);
  border-radius: 11px; box-shadow: 0 12px 30px rgba(17,26,39,.25);
  font-size: 12px; line-height: 1.55; opacity: 0; transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease; pointer-events: auto;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-ico { flex: none; margin-top: 1px; color: var(--brass); }
.toast-error .toast-ico { color: #f19a8f; }
.toast-info .toast-ico { color: #9cc8e2; }
.toast-success { border-left: 3px solid var(--brass); }
.toast-error { border-left: 3px solid #cf6559; }
.toast-info { border-left: 3px solid #6da9c9; }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 44px 22px; color: var(--muted); }
.empty-ico { width: 52px; height: 52px; border-radius: 14px; background: var(--paper-2); border: 1px solid var(--line); color: var(--brass-2); display: grid; place-items: center; margin-bottom: 12px; }
.empty-state h4 { font-size: 13.5px; color: var(--text); font-weight: 600; }
.empty-state p { font-size: 11.5px; line-height: 1.7; margin-top: 4px; max-width: 360px; white-space: pre-line; }
.empty-state .empty-action { margin-top: 14px; }
.empty-state .btn { margin-top: 12px; }
.error-state .empty-ico { color: var(--red); background: var(--red-bg); border-color: #f0d5cf; }
.photo-lightbox { position: fixed; inset: 0; z-index: 400; background: rgba(9,13,20,.86); display: flex; align-items: center; justify-content: center; padding: 24px; }
.photo-lightbox figure { margin: 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.photo-lightbox img { max-width: 92vw; max-height: 82vh; border-radius: 10px; box-shadow: 0 24px 60px rgba(0,0,0,.4); background: #fff; }
.photo-lightbox figcaption { color: #d9d4c9; font-size: 12px; letter-spacing: .5px; }
.photo-lightbox .lb-close { position: absolute; top: 18px; right: 18px; color: #fff; background: rgba(255,255,255,.12); border: 0; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.photo-lightbox .lb-close:hover { background: rgba(255,255,255,.2); }

/* 商品图片编辑 */
.product-photo-row { display: flex; align-items: flex-start; gap: 13px; flex-wrap: wrap; }
.product-photo-preview {
  width: 152px; aspect-ratio: 4 / 3; border-radius: 11px; overflow: hidden;
  border: 1px solid var(--line); background: var(--paper-2); flex: none;
}
.product-photo-preview.is-empty { border-style: dashed; display: grid; place-items: center; }
.product-photo-btn {
  position: relative; display: block; width: 100%; height: 100%; padding: 0;
  border: 0; background: #0e141b; cursor: zoom-in;
}
.product-photo-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-photo-btn > span {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 7px;
  display: flex; align-items: center; gap: 4px; justify-content: center;
  background: rgba(17,26,39,.7); color: #fff; font-size: 9.5px; letter-spacing: .3px;
}
.product-photo-placeholder { display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--muted-2); font-size: 10px; text-align: center; padding: 12px; }
.product-photo-actions { display: flex; flex-direction: column; gap: 7px; min-width: 128px; }
.product-photo-actions .btn { justify-content: flex-start; }
.product-photo-busy { display: flex; align-items: center; gap: 7px; min-height: 32px; font-size: 11px; color: var(--muted); }
.product-photo-busy .spinner { width: 15px; height: 15px; border-width: 1.5px; }
@media (max-width: 680px) {
  .product-photo-preview { width: 118px; }
  .product-photo-actions { min-width: 0; flex: 1; flex-direction: row; align-items: center; }
  .product-photo-actions .btn { flex: 1; }
}
.tag-list { display: flex; gap: 5px; flex-wrap: wrap; }

/* ---------------- responsive ---------------- */
@media (max-width: 1240px) {
  .page { padding: 24px 24px 44px; }
  .topbar { padding: 13px 24px; }
  .dash-grid { grid-template-columns: minmax(0, 1.45fr) minmax(290px, 1fr); }
  .kpi-grid { gap: 12px; }
  .kpi-card { padding: 16px; }
  .kpi-value { font-size: 23px; }
  .order-layout { grid-template-columns: minmax(0, 1fr) 310px; }
  .detail-layout { grid-template-columns: minmax(0, 1fr) 310px; }
  .purchase-layout { grid-template-columns: 340px minmax(0, 1fr); }
}

@media (max-width: 1080px) {
  :root { --sidebar-w: 230px; }
  .sidebar { padding-left: 12px; padding-right: 12px; }
  .sidebar-brand { padding-left: 4px; padding-right: 4px; }
  .inventory-layout { grid-template-columns: 205px minmax(0, 1fr); }
  .stats-main-grid { grid-template-columns: 1fr; }
  .kpi-grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-layout { grid-template-columns: 1fr; }
  .dashboard-grid, .dash-grid { grid-template-columns: 1fr; }
  .dash-col-right { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}

@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .24s cubic-bezier(.4,0,.2,1); width: 268px; box-shadow: 0 0 44px rgba(0,0,0,.3); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(10,15,23,.42); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .22s ease; }
  .sidebar-scrim.open { opacity: 1; pointer-events: auto; }
  .app-main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .topbar { min-height: 70px; padding: 10px 18px; }
  .topbar-title h1 { font-size: 18px; }
  .top-date { display: none; }
  .page { padding: 20px 18px 92px; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: rgba(255,253,248,.96); border-top: 1px solid var(--line);
    backdrop-filter: blur(14px); padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 28px rgba(24,30,40,.06);
  }
  .bottom-link {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 52px; border: 0; background: transparent; color: var(--muted);
    font-size: 9.5px; border-radius: 9px; position: relative;
  }
  .bottom-link .ico { color: #8c8e93; }
  .bottom-link.active { color: var(--ink); font-weight: 600; }
  .bottom-link.active .ico { color: var(--brass-2); }
  .bottom-link.center-action { flex: 0 0 68px; margin-top: -19px; }
  .bottom-link.center-action .center-circle {
    width: 47px; height: 47px; border-radius: 15px;
    background: linear-gradient(150deg, #d4b16a, var(--brass)); color: #151b24;
    display: grid; place-items: center; box-shadow: 0 8px 20px rgba(179,139,67,.32);
    border: 3px solid var(--cream);
  }
  .bottom-link.center-action span { font-size: 9px; margin-top: 1px; }
  .page-head { margin-bottom: 18px; align-items: flex-start; flex-direction: column; gap: 13px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .page-head h2 { font-size: 24px; }
  .dash-hero { grid-template-columns: 1fr; padding: 22px; }
  .hero-side { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-col-right { grid-template-columns: 1fr; }
  .order-layout, .detail-layout { grid-template-columns: 1fr; }
  .order-layout { padding-bottom: 58px; }
  .order-side, .detail-side { position: static; }
  .order-side .summary-card { position: sticky; bottom: 76px; z-index: 20; }
  .mobile-submit-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: fixed; left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom));
    z-index: 38; padding: 9px 10px 9px 14px; border-radius: 14px;
    background: rgba(19, 30, 44, .97); color: #f1eadc; border: 1px solid #2b3b51;
    box-shadow: 0 14px 34px rgba(17, 26, 39, .28); backdrop-filter: blur(14px);
  }
  .mobile-submit-bar .msb-total { min-width: 0; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
  .mobile-submit-bar .msb-total span { font-size: 10px; color: #a6a196; }
  .mobile-submit-bar .msb-total strong { font-family: var(--serif); font-size: 22px; color: var(--brass); font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
  .mobile-submit-bar .msb-total small { display: block; width: 100%; font-size: 9px; color: #8f8b82; margin-top: -2px; }
  .mobile-submit-bar .btn { flex: none; min-height: 40px; padding: 0 15px; font-size: 12px; border-radius: 10px; }
  .purchase-layout { grid-template-columns: 1fr; }
  .purchase-form-card { position: static; }
  .inventory-layout { grid-template-columns: 1fr; }
  .category-panel { position: static; max-height: none; display: none; }
  .category-panel.mobile-open { display: block; }
  .inventory-toolbar .category-mobile-btn { display: inline-flex; }
  .topbar-actions .low-stock-chip { display: none; }
  .mobile-low-btn { display: inline-flex !important; }
  .mobile-only { display: block !important; }
  .desktop-only { display: none !important; }
  .table-card .desktop-table { display: none; }
  .mobile-order-list, .mobile-product-list { display: flex !important; flex-direction: column; gap: 9px; padding: 12px; }
  .detail-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .warranty-sheet { padding: 24px 22px; }
  .warranty-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-row { grid-template-columns: 92px minmax(0, 1fr) 74px; }
  .audit-actor { display: none; }
  .stats-toolbar { align-items: flex-start; flex-direction: column; }
  .stats-toolbar-left { width: 100%; }
  .toast-root { top: calc(76px + env(safe-area-inset-top)); bottom: auto; right: 12px; left: 12px; max-width: none; }
}

@media (max-width: 680px) {
  body { font-size: 13.5px; }
  .page { padding: 16px 13px 92px; }
  .topbar { padding: 9px 13px; min-height: 64px; }
  .topbar-title .eyebrow { display: none; }
  .topbar-title h1 { font-size: 17px; letter-spacing: .5px; }
  .topbar-actions .top-user-chip { display: none; }
  .topbar .icon-btn { width: 35px; height: 35px; }
  .page-head h2 { font-size: 22px; }
  .page-head p.page-sub { font-size: 11.5px; }
  .page-actions .btn { flex: 0 1 auto; }
  .dash-hero { border-radius: 17px; padding: 19px; }
  .dash-hero h2 { font-size: 24px; margin-top: 7px; }
  .dash-hero p { font-size: 11.5px; }
  .dash-hero-actions { margin-top: 15px; gap: 7px; }
  .dash-hero-actions .btn { min-height: 37px; padding: 0 13px; font-size: 12px; }
  .kpi-grid, .kpi-grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 11px; }
  .kpi-card { min-height: 112px; padding: 13px; border-radius: 13px; }
  .kpi-label { font-size: 10.5px; }
  .kpi-value { font-size: 21px; margin-top: 6px; }
  .kpi-icon { width: 27px; height: 27px; border-radius: 8px; }
  .kpi-foot { font-size: 9.5px; margin-top: 5px; }
  .dash-grid { gap: 11px; margin-top: 11px; }
  .dash-col { gap: 11px; }
  .card { border-radius: 14px; }
  .card-head { padding: 15px 15px 0; }
  .card-head h3 { font-size: 15px; }
  .card-body { padding: 14px 15px 16px; }
  .chart-caption { padding: 0 15px; }
  .lowstock-item { padding: 10px 15px; }
  .mini-order { padding: 10px 15px; }
  .mini-order-amount strong { font-size: 12px; }
  .quick-grid { padding: 12px 15px 16px; gap: 8px; }
  .quick-btn { padding: 11px; }
  .shop-info-card { padding: 15px; }
  .filter-card { padding: 11px; margin-bottom: 11px; border-radius: 13px; }
  .filter-row { gap: 7px; }
  .search-box { min-width: 100%; max-width: none; flex-basis: 100%; }
  .filter-select { flex: 1; min-width: 0; }
  .date-filter { width: 100%; }
  .date-filter .input { flex: 1; width: auto; }
  .filter-spacer { display: none; }
  .filter-count { width: 100%; }
  .table-foot { flex-wrap: wrap; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; gap: 13px; }
  .span-2 { grid-column: span 1; }
  .form-card-head { padding: 14px 15px 0; }
  .form-card-body { padding: 13px 15px 16px; }
  .form-card-head h3 { font-size: 15px; }
  .line-item { flex-wrap: wrap; gap: 8px; padding: 10px; }
  .line-item-main { flex-basis: calc(100% - 38px); }
  .line-item .qty-stepper { order: 3; }
  .line-item .price-input { order: 4; }
  .line-item .line-total { order: 5; flex: 1; text-align: left; padding-left: 2px; font-size: 13px; }
  .line-item .line-remove { order: 6; }
  .order-side .summary-card { position: static; }
  .summary-total strong { font-size: 26px; }
  .upload-grid { grid-template-columns: repeat(3, 1fr); }
  .warranty-sheet { padding: 20px 15px; border-radius: 5px; }
  .warranty-head { gap: 10px; }
  .warranty-brand h3 { font-size: 18px; }
  .warranty-brand p { font-size: 9px; }
  .warranty-mark { width: 36px; height: 36px; font-size: 17px; }
  .warranty-title h4 { font-size: 14px; letter-spacing: 3px; }
  .warranty-meta { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .warranty-items { overflow-x: auto; }
  .warranty-items table { min-width: 420px; }
  .warranty-totals { width: 100%; }
  .detail-side { grid-template-columns: 1fr; }
  .detail-actions-card { order: -1; }
  .inv-summary-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-radius: 13px; padding: 3px; overflow: visible; }
  .inv-stat { min-width: 0; padding: 8px 10px; border-left: 0; border-top: 1px solid var(--line-soft); }
  .inv-stat:nth-child(-n+3) { border-top: 0; }
  .inv-stat:nth-child(3n+1) { border-left: 0; }
  .inv-stat strong { font-size: 14.5px; white-space: nowrap; }
  .inv-stat span { font-size: 9px; }
  .inventory-toolbar { padding: 11px; }
  .inventory-toolbar .search-box { flex-basis: 100%; min-width: 0; max-width: none; }
  .stats-toolbar .preset-group { width: 100%; overflow-x: auto; }
  .preset-btn { flex: 1; padding: 0 8px; }
  .custom-range { width: 100%; }
  .custom-range .input { flex: 1; width: auto; }
  .stats-actions { width: 100%; }
  .stats-actions .btn { flex: 1; }
  .tabs { padding: 0 11px; }
  .tab-btn { height: 42px; padding: 0 10px; font-size: 12px; }
  .audit-row { padding: 10px 13px; gap: 8px; grid-template-columns: 80px minmax(0, 1fr); }
  .audit-action { display: none; }
  .audit-main p { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .more-grid { grid-template-columns: 1fr; }
  .profile-hero { padding: 17px; }
  .profile-hero h2 { font-size: 20px; }
  .modal-overlay { padding: 10px; align-items: flex-end; }
  .modal { max-height: calc(100vh - 20px); border-radius: 18px 18px 12px 12px; }
  .modal-head { padding: 16px 16px 0; }
  .modal-body { padding: 13px 16px 17px; }
  .modal-foot { padding: 11px 16px calc(11px + env(safe-area-inset-bottom)); border-radius: 0 0 12px 12px; }
  .toast-root { top: calc(70px + env(safe-area-inset-top)); bottom: auto; }
  .section-heading h3 { font-size: 16px; }
}

@media (max-width: 380px) {
  .kpi-grid, .kpi-grid-6 { grid-template-columns: 1fr; }
  .kpi-card { min-height: 96px; }
  .upload-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------- mobile list cards ---------------- */
.mobile-order-list, .mobile-product-list { display: none; }
.mobile-order-card { background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; }
.mobile-order-card:active { background: #f7f3e9; }
.mo-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.mo-customer { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mo-customer strong { font-size: 13px; font-weight: 600; }
.mo-customer span { display: block; color: var(--muted-2); font-size: 10px; margin-top: 1px; }
.mo-amount { text-align: right; flex: none; }
.mo-amount strong { display: block; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.mo-amount span { display: block; margin-top: 2px; }
.mo-items { margin-top: 8px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mo-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--muted-2); font-size: 10px; }
.mo-bottom .mo-badges { display: flex; gap: 4px; align-items: center; }
.mobile-product-card { background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.mp-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.mp-head { display: flex; align-items: flex-start; gap: 9px; min-width: 0; flex: 1; }
.mp-head > div { min-width: 0; }
.mp-thumb {
  width: 58px; height: 58px; border-radius: 10px; overflow: hidden; flex: none;
  border: 1px solid var(--line); background: var(--paper-2); padding: 0; display: block; cursor: zoom-in;
}
.mp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mp-thumb-empty { display: grid; place-items: center; color: var(--brass-2); background: var(--brass-pale); cursor: default; }
.mp-name { font-size: 13px; font-weight: 600; line-height: 1.4; }
.mp-sku { font-size: 10px; color: var(--muted-2); margin-top: 2px; font-family: ui-monospace, Menlo, monospace; }
.mp-cat { font-size: 10px; color: var(--muted-2); margin-top: 4px; }
.mp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); }
.mp-cell span { display: block; font-size: 9.5px; color: var(--muted-2); }
.mp-cell strong { display: block; font-size: 12.5px; font-weight: 650; margin-top: 1px; font-variant-numeric: tabular-nums; }
.mp-actions { display: flex; gap: 6px; margin-top: 10px; }
.mp-actions .btn { flex: 1; }
