:root {
  --ink: #17212b;
  --muted: #64748b;
  --line: #dbe2ea;
  --ground: #f4f6f9;
  --panel: #ffffff;
  --nav: #102a35;
  --nav-hover: #1a3b49;
  --nav-ink: #cfe0e4;
  --teal: #0a7d78;
  --teal-deep: #075f5b;
  --teal-soft: #e6f4f2;
  --blue: #1665a7;
  --orange: #b56000;
  --red: #b42318;
  --green: #177245;
  --radius: 9px;
  --shadow: 0 1px 2px rgba(16, 42, 53, .06), 0 8px 24px rgba(16, 42, 53, .05);
  --brand-background-image: radial-gradient(circle at 15% 10%, #1d4b55, transparent 45%), radial-gradient(circle at 85% 90%, #0d5f5a, transparent 42%);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--ground);
  font-family: "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: var(--blue); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.danger-text { color: var(--red) !important; }
h1, h2, h3, h4 { letter-spacing: -.01em; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(140deg, #14b8a6, #0a7d78); color: #fff;
  font-weight: 800; font-size: 19px; box-shadow: 0 4px 12px rgba(10, 125, 120, .28);
  flex: 0 0 auto;
}
.brand-logo {
  width: 38px; height: 38px; border-radius: 9px; object-fit: contain;
  flex: 0 0 auto; background: rgba(255, 255, 255, .08);
}
.brand strong { display: block; font-size: 15px; line-height: 1.2; }
.brand small { display: block; font-size: 11px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }

/* ---------- Auth ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .95fr) minmax(420px, 1.05fr); }
.auth-aside {
  background-color: var(--nav);
  background-image: linear-gradient(rgba(10, 35, 45, .55), rgba(10, 35, 45, .8)), var(--brand-background-image);
  background-size: cover;
  background-position: center;
  color: #eef7f6; padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column;
  justify-content: space-between; gap: 40px; position: relative; overflow: hidden;
}
.auth-aside::after {
  content: ""; position: absolute; inset: auto -120px -160px auto; width: 420px; height: 420px;
  border: 1px solid rgba(255,255,255,.09); border-radius: 50%; box-shadow: 0 0 0 60px rgba(255,255,255,.03), 0 0 0 120px rgba(255,255,255,.02);
}
.auth-aside .brand small { color: #9fc0c4; }
.auth-hero h1 { font-size: clamp(30px, 3.4vw, 46px); line-height: 1.12; margin: 0 0 18px; max-width: 520px; font-weight: 750; }
.auth-hero p { color: #b9d2d5; max-width: 470px; margin: 0 0 26px; font-size: 15px; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.auth-points li { display: flex; gap: 10px; align-items: center; color: #d7e8e9; font-size: 14px; }
.auth-points li::before { content: "✓"; color: #2dd4bf; font-weight: 800; }
.auth-footer { color: #8fb0b4; letter-spacing: .08em; font-size: 11px; text-transform: uppercase; }
.auth-main { display: grid; place-items: center; padding: 32px 24px; }
.auth-card { width: min(100%, 520px); }
.brand-mobile { display: none; margin-bottom: 22px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: #e9eef3; padding: 4px; border-radius: 9px; margin-bottom: 24px; }
.auth-tab { border: 0; background: transparent; padding: 10px; border-radius: 7px; font-weight: 650; color: #54687b; }
.auth-tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16,42,53,.12); }
.auth-form { display: grid; gap: 14px; }
.auth-form h2 { margin: 0; font-size: 26px; }
.auth-form > p { margin: -8px 0 6px; }
.auth-form label { font-size: 12px; font-weight: 650; color: #3f5264; }
.auth-form input, .auth-form select { margin-top: 6px; }
.auth-form .btn { margin-top: 6px; }
.auth-hint, .auth-legal { color: var(--muted); font-size: 12px; text-align: center; }
.auth-legal { margin-top: 22px; }
.auth-result { border: 1px solid #b7dfd9; background: var(--teal-soft); color: #075f5b; padding: 16px; border-radius: var(--radius); }
.auth-result h3 { margin: 0 0 6px; }
.auth-result p { margin: 0; font-size: 13px; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Form primitives ---------- */
label { display: grid; gap: 6px; font-size: 12px; font-weight: 650; color: #3f5264; }
input, select, textarea {
  width: 100%; min-height: 40px; border: 1px solid #c3ced9; background: #fff; border-radius: 7px;
  padding: 8px 11px; outline: none; transition: border-color .15s, box-shadow .15s; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(10,125,120,.14); }
input::placeholder, textarea::placeholder { color: #93a2b1; }
textarea { min-height: 78px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%); background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 15px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
.span-2 { grid-column: span 2; }
.span-full { grid-column: 1 / -1; }
.form-error { background: #fdecea; border: 1px solid #f2b8b2; color: #8e2119; padding: 10px 12px; border-radius: 7px; font-size: 13px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.input-with-button { display: flex; gap: 8px; align-items: center; }
.input-with-button input { flex: 1; }
.field-hint { font-weight: 400; color: var(--muted); font-size: 11px; line-height: 1.35; }
.customer-picker { position: relative; display: flex; gap: 8px; align-items: center; }
.customer-picker input { flex: 1; min-width: 0; }
.customer-picker .btn { flex: 0 0 auto; }
.suggestions {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 14px 34px rgba(16, 42, 53, .18); max-height: 300px; overflow: auto;
}
.suggestion-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px;
  width: 100%; border: 0; border-bottom: 1px solid #eef2f5; background: #fff;
  padding: 9px 12px; text-align: left;
}
.suggestion-item:last-of-type { border-bottom: 0; }
.suggestion-item:hover { background: #f4fbfa; }
.suggestion-code {
  grid-row: span 2; align-self: center; font-family: ui-monospace, Consolas, monospace;
  font-weight: 700; font-size: 11.5px; color: var(--teal-deep);
}
.suggestion-main { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.suggestion-meta { color: var(--muted); font-size: 11.5px; }
.suggestion-empty { padding: 11px 12px; font-size: 12.5px; color: var(--muted); }
.suggestion-empty.small { border-top: 1px solid #eef2f5; }
#customerDialog { width: min(780px, calc(100vw - 32px)); }
.branding-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.branding-preview {
  margin: 14px 0; border: 1px dashed #c3ced9; border-radius: 9px;
  background: #f8fafb; display: grid; place-items: center; overflow: hidden;
}
.logo-preview { height: 180px; }
.logo-preview img { max-width: 160px; max-height: 160px; object-fit: contain; }
.background-preview { aspect-ratio: 16 / 9; }
.background-preview img { width: 100%; height: 100%; object-fit: cover; }
.branding-empty { color: var(--muted); font-size: 12px; padding: 20px; text-align: center; }
.branding-grid .form-card { display: flex; flex-direction: column; }
.branding-grid .form-actions { margin-top: auto; }
.customer-table { table-layout: fixed; min-width: 760px; }
.customer-table th:nth-child(1), .customer-table td:nth-child(1) { width: 145px; }
.customer-table th:nth-child(4), .customer-table td:nth-child(4) { width: 68px; }
.customer-table th:nth-child(5), .customer-table td:nth-child(5) { width: 115px; }
.customer-table th:nth-child(6), .customer-table td:nth-child(6) { width: 72px; }
.customer-table th:nth-child(7), .customer-table td:nth-child(7) { width: 125px; }
.customer-table td.customer-name, .customer-table td.customer-contact { white-space: normal; overflow-wrap: anywhere; }
.customer-table td.customer-name strong { font-weight: 650; }

/* ---------- Buttons ---------- */
.btn {
  min-height: 40px; border-radius: 7px; border: 1px solid transparent; padding: 8px 15px;
  font-weight: 650; background: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--teal); color: #fff; box-shadow: 0 4px 12px rgba(10,125,120,.2); }
.btn.primary:hover:not(:disabled) { background: var(--teal-deep); }
.btn.secondary { border-color: #bdc9d4; color: #304657; background: #fff; }
.btn.secondary:hover:not(:disabled) { background: #f2f6f8; }
.btn.danger { border-color: #e2a39d; color: var(--red); background: #fff; }
.btn.danger:hover:not(:disabled) { background: #fff5f4; }
.btn.small { min-height: 30px; padding: 4px 9px; font-size: 12px; }
.btn.block { width: 100%; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); background: #fff; border-radius: 7px; color: #405361; font-weight: 700; display: inline-grid; place-items: center; }
.icon-button:hover { background: #f4f7f9; }
.link-button { border: 0; background: transparent; color: var(--blue); font-size: 12px; font-weight: 650; padding: 0; }
.link-button:hover { text-decoration: underline; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- App layout ---------- */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar {
  background-color: var(--nav);
  background-image: linear-gradient(rgba(10, 42, 53, .9), rgba(10, 42, 53, .96)), var(--brand-background-image);
  background-size: cover;
  background-position: center;
  color: var(--nav-ink); display: flex; flex-direction: column;
  padding: 18px 14px 14px; position: sticky; top: 0; height: 100vh; z-index: 30;
}
.sidebar-brand { color: #fff; padding: 2px 8px 22px; }
.sidebar-brand small { color: #8fb0b4; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { color: #7d9ba1; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; border: 0; background: transparent;
  color: #d3e2e5; border-radius: 7px; padding: 9px 10px; text-align: left; font-size: 13.5px; font-weight: 500;
}
.nav-item:hover { background: var(--nav-hover); color: #fff; }
.nav-item.active { background: #17424f; color: #fff; box-shadow: inset 2px 0 0 #2dd4bf; }
.nav-icon { width: 20px; text-align: center; color: #5eead4; font-weight: 700; font-size: 15px; }
.sidebar-bottom { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.09); display: grid; gap: 8px; }
.profile-button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: rgba(255,255,255,.06); border-radius: 8px; padding: 9px; color: #fff; text-align: left; }
.profile-button:hover { background: rgba(255,255,255,.1); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #0f766e; display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; }
.profile-text { min-width: 0; flex: 1; }
.profile-text strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-text small { display: block; color: #9db9bd; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chevron { color: #9db9bd; }
.profile-menu { background: #17424f; border: 1px solid #2a5560; border-radius: 8px; padding: 5px; display: grid; gap: 2px; }
.profile-menu button { border: 0; background: transparent; color: #e6f1f2; text-align: left; padding: 8px 10px; border-radius: 5px; font-size: 13px; }
.profile-menu button:hover { background: #22525f; }
.server-badge { display: flex; align-items: center; gap: 7px; color: #8fb0b4; font-size: 11px; padding: 4px 8px 0; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,.15); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 66px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px;
  padding: 0 28px; position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; font-size: 19px; font-weight: 700; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; }
.pending-pill { background: #fff4e0; color: #935500; }
.content { padding: 26px 28px 60px; max-width: 1560px; width: 100%; margin: 0 auto; }
.mobile-only { display: none; }
.view { display: none; }
.view.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page-heading h2 { margin: 0; font-size: 23px; }
.page-heading p { margin: 4px 0 0; color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 15px; }
.section-title { margin: 0 0 16px; font-size: 15px; }
.panel-pad { padding: 16px 18px; }
.form-card { padding: 20px; }
.split > .card.form-card { overflow: visible; }
.form-card .section-title { padding: 0; }
.notice { border-radius: 8px; padding: 12px 14px; background: #edf5fb; border: 1px solid #cfe3f2; border-left: 3px solid var(--blue); color: #345269; margin-bottom: 16px; font-size: 13px; }
.notice.warning { background: #fff7e8; border-color: #f0dcb5; border-left-color: var(--orange); color: #6c4a1d; }
.empty { color: var(--muted); padding: 26px 18px; text-align: center; }

/* ---------- Dashboard ---------- */
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric-grid.small { grid-template-columns: repeat(4, minmax(120px, 1fr)); margin-bottom: 16px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden; }
.metric::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--teal); }
.metric[data-tone="blue"]::before { background: var(--blue); }
.metric[data-tone="orange"]::before { background: var(--orange); }
.metric[data-tone="red"]::before { background: var(--red); }
.metric .label { color: var(--muted); font-size: 12px; }
.metric strong { display: block; font-size: 29px; line-height: 1.1; margin-top: 7px; font-variant-numeric: tabular-nums; }
.metric small { color: var(--muted); font-size: 11px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }
.location-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid #eef2f5; }
.location-row:last-child { border-bottom: 0; }
.location-row strong { font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: #eef2f5; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, #14b8a6, #0a7d78); border-radius: 4px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; border-top: 1px solid #edf1f5; text-align: left; vertical-align: middle; white-space: nowrap; }
th { background: #f8fafb; color: #53677a; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; border-top: 0; }
td { font-size: 13px; }
tbody tr:hover { background: #fbfcfd; }
.row-action { border: 0; background: transparent; color: var(--blue); padding: 0; text-align: left; font-weight: 600; }
.row-action:hover { text-decoration: underline; }
.cell-sub { color: var(--muted); font-size: 11.5px; }
.table-empty { padding: 26px; text-align: center; color: var(--muted); }

/* ---------- Pills / badges ---------- */
.pill { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.pill.in-stock, .pill.active { background: #dcf3e8; color: #136b41; }
.pill.sold { background: #e8eef3; color: #435867; }
.pill.loan, .pill.rent, .pill.pending { background: #fff0d8; color: #935500; }
.pill.display { background: #e9e7fb; color: #5b46a0; }
.pill.defective, .pill.unresolved, .pill.rejected { background: #fbe4e1; color: #9e2820; }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--teal-soft); color: var(--teal-deep); font-size: 12px; font-weight: 700; }

/* ---------- Filters / forms ---------- */
.filter-bar { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(140px, 1fr)) auto; gap: 12px; align-items: end; margin-bottom: 16px; }
.filter-bar.compact { grid-template-columns: minmax(180px, 260px) auto auto; justify-content: start; }
.summary-strip { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fbfcfd; }
.summary-pill { background: #eef4f6; border-radius: 5px; padding: 4px 8px; font-size: 12px; color: #3c5565; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.pager button { min-height: 30px; padding: 3px 10px; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.pager button:disabled { opacity: .45; }

/* ---------- Serial picker ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(340px, .88fr); gap: 20px; align-items: start; }
.serial-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 10px; max-height: 520px; overflow: auto; }
.serial-choice { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 11px 12px; display: grid; gap: 2px; }
.serial-choice:hover { border-color: #97c9c5; background: #f4fbfa; }
.serial-choice.selected { border-color: var(--teal); background: var(--teal-soft); box-shadow: 0 0 0 2px rgba(10,125,120,.12); }
.serial-choice strong { font-size: 13px; }
.serial-choice span { color: var(--muted); font-size: 11.5px; }
.detail-head { display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 14px; }
.detail-head h3 { margin: 0; font-size: 18px; }
.detail-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 16px; }
.detail-list span { display: block; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
.detail-list strong { display: block; font-weight: 600; overflow-wrap: anywhere; }
.timeline { list-style: none; padding: 0; margin: 12px 0 0; }
.timeline li { position: relative; padding: 0 0 14px 18px; border-left: 2px solid #d3e1e4; margin-left: 5px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; width: 8px; height: 8px; background: var(--teal); border-radius: 50%; position: absolute; left: -5px; top: 5px; }
.timeline strong { display: block; font-size: 13px; }
.timeline span { display: block; color: var(--muted); font-size: 12px; }

/* ---------- Tabs / reports ---------- */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: #e9eef3; border-radius: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { border: 0; background: transparent; padding: 8px 14px; border-radius: 6px; font-weight: 650; color: #54687b; font-size: 13px; }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16,42,53,.12); }
.report-panel { display: block; }

/* ---------- Users ---------- */
.users-split { grid-template-columns: minmax(0, 1fr); margin-bottom: 20px; }
.user-form-grid { grid-template-columns: repeat(5, minmax(140px, 1fr)); }
.pending-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid #f0dcb5; background: #fffaf0; border-radius: 8px; padding: 11px 14px; margin-bottom: 10px; }
.pending-card:last-child { margin-bottom: 0; }
.pending-card strong { display: block; }
.pending-card span { color: var(--muted); font-size: 12px; }
.invites-card { margin-top: 20px; }
.invite-form { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)) auto; gap: 12px; align-items: end; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.code-cell { font-family: ui-monospace, Consolas, monospace; font-weight: 700; letter-spacing: .04em; }
.role-select { min-width: 150px; min-height: 32px; padding: 4px 26px 4px 8px; font-size: 12px; background-position: calc(100% - 14px) 13px, calc(100% - 9px) 13px; }
.user-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Import ---------- */
.import-result { margin-top: 16px; border: 1px solid #b7dfd9; background: var(--teal-soft); border-radius: 8px; padding: 14px; font-size: 13px; }
.import-result ul { margin: 8px 0 0; padding-left: 18px; }

/* ---------- Dialogs ---------- */
dialog { border: 0; padding: 0; border-radius: 10px; width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 40px); box-shadow: 0 24px 70px rgba(11,25,35,.34); background: #fff; color: var(--ink); }
dialog.narrow { width: min(520px, calc(100vw - 32px)); }
dialog.wide { width: min(1240px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 25, 35, .55); backdrop-filter: blur(2px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.dialog-head h3 { margin: 0; font-size: 17px; }
.dialog-body { padding: 18px; overflow: auto; max-height: calc(100vh - 190px); display: grid; gap: 12px; }
.dialog-body .form-grid { gap: 12px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.report-canvas-wrap { overflow: auto; background: #eef2f5; padding: 12px; border-radius: 6px; }
#reportCanvas { display: block; width: 100%; height: auto; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.14); }

/* ---------- Toast ---------- */
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; padding: 12px 16px; background: #102a35; color: #fff; border-radius: 8px; max-width: min(440px, calc(100vw - 44px)); box-shadow: 0 14px 34px rgba(16,42,53,.3); font-size: 13px; }
.toast.error { background: #8e2119; }
.toast.success { background: #0b5d43; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid, .split, .users-split { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .invite-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .brand-mobile { display: flex; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 264px; transform: translateX(-100%); transition: transform .2s ease; height: 100dvh; }
  .app-shell.sidebar-open .sidebar { transform: none; box-shadow: 12px 0 40px rgba(0,0,0,.25); }
  .mobile-only { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 50px; }
  .topbar-right .today { display: none; }
}
@media (max-width: 640px) {
  .metric-grid, .metric-grid.small, .form-grid, .form-grid.two, .filter-bar, .filter-bar.compact, .invite-form, .detail-list { grid-template-columns: 1fr; }
  .span-2, .span-full { grid-column: auto; }
  .page-heading { display: block; }
  .page-heading .btn, .page-heading .button-row { margin-top: 12px; }
  .card-head { flex-wrap: wrap; }
  th, td { padding: 8px 10px; }
  .auth-main { padding: 20px 16px; }
  .serial-grid { grid-template-columns: 1fr; }
  .customer-picker { flex-wrap: wrap; }
  .customer-picker .btn { width: 100%; }
  .suggestions { position: static; margin-top: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
