/* TVC admin panel — shadcn/ui design system (new-york style, neutral palette) without React.
   Tokens follow shadcn's CSS variables; TVC cyan is the brand accent (focus ring, active marks). */
:root {
  --background: #ffffff; --foreground: #0a0a0a;
  --card: #ffffff; --card-foreground: #0a0a0a;
  --popover: #ffffff; --popover-foreground: #0a0a0a;
  --primary: #12161c; --primary-foreground: #fafafa;
  --secondary: #f4f4f5; --secondary-foreground: #18181b;
  --muted: #f4f4f5; --muted-foreground: #71717a;
  --accent: #f4f4f5; --accent-foreground: #18181b;
  --destructive: #dc2626; --destructive-soft: #fef2f2;
  --border: #e4e4e7; --input: #e4e4e7; --ring: #00838f;
  --sidebar: #fafafa; --sidebar-border: #e4e4e7; --sidebar-accent: #f0f0f1;
  --brand: #00e9f8; --brand-deep: #00838f; --brand-soft: #e0fbfd;
  --green: #16a34a; --blue: #2563eb; --amber: #d97706; --orange: #ea580c; --red: #dc2626; --gray: #71717a;
  --radius: 0.625rem;
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --font: Inter, "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; border-color: var(--border); }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--foreground); background: var(--background); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a.link, .prose a, dd a, p a, td a.u { color: var(--foreground); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: #a1a1aa; }
h1, h2, h3 { margin: 0; letter-spacing: -0.025em; }
h1 { font-size: 24px; font-weight: 600; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
small { display: block; color: var(--muted-foreground); font-size: 12px; }
small.inline { display: inline; }
.muted { color: var(--muted-foreground); margin: 4px 0 0; }
.small { font-size: 12.5px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.ic { flex: none; vertical-align: middle; }
.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; }
.green-t { color: var(--green); } .blue-t { color: var(--blue); } .red-t { color: var(--destructive); }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-line; }
:focus-visible { outline: none; }
code.secret { font: 600 13px/1 var(--mono); background: var(--muted); border: 1px dashed var(--brand-deep); padding: 5px 8px; border-radius: 6px; user-select: all; }
code.secret.block { display: block; padding: 12px; word-break: break-all; line-height: 1.5; }
kbd { font: 500 11px var(--mono); background: var(--muted); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; }

/* ── Layout: shadcn sidebar-07 (collapsible to icons) + inset ──────────── */
:root { --sb-width: 16rem; --sb-width-icon: 3rem; }
.sb-wrapper { display: flex; min-height: 100vh; background: var(--background); }
.sidebar { width: var(--sb-width); flex: none; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--sidebar); border-right: 1px solid var(--sidebar-border); transition: width .2s ease-linear; z-index: 40; }
.sb-header { padding: 8px; }
.sb-content { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.sb-group { padding: 8px; position: relative; }
.sb-group + .sb-group { padding-top: 0; }
.sb-label { height: 32px; display: flex; align-items: center; padding: 0 8px; font-size: 12px; font-weight: 500; color: rgb(10 10 10 / 0.7);
  white-space: nowrap; overflow: hidden; transition: margin .2s ease-linear, opacity .2s ease-linear; }
.sb-menu, .sb-sub { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sb-row { position: relative; display: flex; align-items: center; }
.sb-btn { display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 8px; border: 0; border-radius: calc(var(--radius) - 2px);
  background: transparent; color: var(--foreground); font: 400 14px var(--font); text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden;
  outline: none; transition: width .2s ease-linear, height .2s ease-linear, padding .2s ease-linear, background .1s; }
.sb-btn:hover, .sb-btn[aria-expanded="true"] { background: var(--sidebar-accent); }
.sb-btn:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
.sb-btn.active { background: var(--sidebar-accent); font-weight: 500; }
.sb-btn .ic { width: 16px; height: 16px; flex: none; }
.sb-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sb-btn > .sb-text:first-of-type { flex: 1; }
.sb-btn .nav-badge { margin-left: auto; }
.sb-row .sb-btn { padding-right: 32px; }
.sb-row .sb-btn:not(:has(+ .sb-chevron)) { padding-right: 8px; }
.sb-chevron { position: absolute; right: 4px; width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 4px; background: transparent;
  color: var(--muted-foreground); cursor: pointer; transition: transform .2s; }
.sb-chevron:hover { background: rgb(0 0 0 / 0.06); color: var(--foreground); }
.sb-item.open > .sb-row .sb-chevron { transform: rotate(90deg); }
.sb-sub { display: none; margin: 2px 0 2px 14px; padding: 2px 0 2px 10px; border-left: 1px solid var(--sidebar-border); gap: 2px; }
.sb-item.open > .sb-sub { display: flex; }
.sb-sub a { display: flex; align-items: center; height: 28px; padding: 0 8px; border-radius: calc(var(--radius) - 2px); font-size: 14px; color: rgb(10 10 10 / 0.8); white-space: nowrap; overflow: hidden; }
.sb-sub a:hover { background: var(--sidebar-accent); color: var(--foreground); }
.sb-sub a.active { background: var(--sidebar-accent); color: var(--foreground); font-weight: 500; }
.sb-btn-primary { background: var(--primary); color: var(--primary-foreground); font-weight: 500; box-shadow: var(--shadow-xs); }
.sb-btn-primary:hover, .sb-btn-primary[aria-expanded="true"] { background: #2a2f37; }
.sb-brand { display: flex; align-items: center; gap: 8px; height: 48px; padding: 8px; border-radius: calc(var(--radius) - 2px); overflow: hidden; }
.sb-brand:hover { background: var(--sidebar-accent); }
.sb-logo { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--primary); }
.sb-logo img { width: 18px; height: 18px; }
.sb-brand-text, .sb-user-text { display: grid; line-height: 1.25; flex: 1; }
.sb-brand-text b, .sb-user-text b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-brand-text small, .sb-user-text small { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-brand-text small { white-space: normal; line-height: 1.2; } /* the full company name wraps instead of being cut */
.sb-footer { padding: 8px; }
.sb-user { height: 48px; padding: 8px; }
/* Workspace switcher (sidebar header): the company everything on screen belongs to */
.sb-header[data-ui="dropdown"] { position: relative; }
button.sb-brand { width: 100%; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.sb-brand-chevron { flex: none; opacity: .6; display: grid; }
.workspace-menu { width: 280px; }
.workspace-menu .menu-item small { display: block; font-size: 12px; color: var(--muted-foreground); }
.workspace-menu .menu-item .avatar { width: 28px; height: 28px; font-size: 11px; }
.workspace-menu .menu-item.current { cursor: default; background: var(--accent); }
.workspace-menu .menu-item:disabled { opacity: 1; }
.workspace-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.workspace-option { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--background); color: var(--foreground); font: 14px var(--font); text-align: left; cursor: pointer; }
.workspace-option:hover, .workspace-option:focus-visible { background: var(--accent); outline: none; }
.workspace-option.current { border-color: var(--primary); }
.workspace-option b { display: block; font-weight: 600; }
.workspace-option small { font-size: 12px; color: var(--muted-foreground); }
.workspace-option .ic { color: var(--muted-foreground); }
.sb-user .sb-text:last-child { flex: none; opacity: .6; display: grid; }
.avatar.sq { border-radius: 8px; }
.sb-rail { position: absolute; top: 0; bottom: 0; right: -8px; width: 16px; border: 0; background: transparent; cursor: w-resize; padding: 0; z-index: 20; }
.sb-rail::after { content: ""; position: absolute; top: 0; bottom: 0; left: 7px; width: 2px; background: transparent; transition: background .15s; }
.sb-rail:hover::after { background: var(--sidebar-border); }
.sb-backdrop { display: none; }
.user-menu { width: 260px; }
.user-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px; }
.user-head b { display: block; font-size: 14px; font-weight: 600; }
.user-head small { font-size: 12px; }
.menu-popover form { margin: 0; }
.menu-item { display: flex; width: 100%; gap: 10px; align-items: center; padding: 7px 8px; border: 0; background: transparent; border-radius: 4px; font: 14px var(--font); cursor: pointer; text-align: left; color: var(--foreground); }
.menu-item:hover, .menu-item:focus-visible { background: var(--accent); outline: none; }
.menu-item .ic { width: 16px; height: 16px; color: var(--muted-foreground); }
.menu-item b { font-weight: 500; }

/* Collapsed to icons */
[data-sidebar="collapsed"] .sidebar { width: var(--sb-width-icon); }
[data-sidebar="collapsed"] .sidebar .sb-text, [data-sidebar="collapsed"] .sidebar .sb-chevron,
[data-sidebar="collapsed"] .sidebar .sb-sub, [data-sidebar="collapsed"] .sidebar .nav-badge { display: none; }
[data-sidebar="collapsed"] .sidebar .sb-label { margin-top: -32px; opacity: 0; pointer-events: none; }
[data-sidebar="collapsed"] .sidebar .sb-btn { width: 32px; height: 32px; padding: 8px; justify-content: center; }
[data-sidebar="collapsed"] .sidebar .sb-brand, [data-sidebar="collapsed"] .sidebar .sb-user { width: 32px; height: 32px; padding: 0; justify-content: center; }
[data-sidebar="collapsed"] .sidebar .sb-user .avatar { width: 32px; height: 32px; }
[data-sidebar="collapsed"] .sidebar .sb-content { overflow: visible; }
[data-sidebar="collapsed"] .sidebar .sb-group { padding: 8px; }
/* Tooltip (shadcn Tooltip) next to icons while collapsed */
[data-sidebar="collapsed"] .sidebar [data-tip] { position: relative; overflow: visible; }
[data-sidebar="collapsed"] .sidebar [data-tip]:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: var(--primary); color: var(--primary-foreground); font: 500 12px var(--font); padding: 6px 10px; border-radius: 6px; white-space: nowrap; z-index: 60;
  pointer-events: none; animation: fade-in .1s ease-out; }

/* SidebarInset */
.sb-inset { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--background); }
.inset-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px; height: 64px; flex: none; padding: 0 16px;
  background: rgb(255 255 255 / 0.85); backdrop-filter: blur(8px); transition: height .2s ease-linear; }
[data-sidebar="collapsed"] .inset-header { height: 48px; }
.sb-trigger { width: 28px; height: 28px; margin-left: -4px; }
.v-sep { width: 1px; height: 16px; background: var(--border); margin: 0 4px 0 0; }
.breadcrumb ol { list-style: none; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; font-size: 14px; color: var(--muted-foreground); }
.breadcrumb a:hover { color: var(--foreground); }
.breadcrumb .crumb-sep { display: grid; }
.breadcrumb .crumb-sep .ic { width: 14px; height: 14px; }
.breadcrumb .crumb-page { color: var(--foreground); font-weight: 400; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { flex: 1; min-width: 0; padding: 4px 24px 40px; }

/* Small screens: the sidebar slides over the page (shadcn Sheet behaviour) */
@media (max-width: 767px) {
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .2s ease-out; width: 18rem; box-shadow: var(--shadow-lg); }
  [data-sidebar-mobile="open"] .sidebar { transform: none; }
  [data-sidebar-mobile="open"] .sb-backdrop { display: block; position: fixed; inset: 0; background: rgb(0 0 0 / 0.5); z-index: 35; }
  [data-sidebar="collapsed"] .sidebar { width: 18rem; }
  .sb-rail { display: none; }
  main { padding: 4px 16px 32px; }
  .crumb-group, .crumb-group + .crumb-sep { display: none; }
}

/* ── Button (shadcn) ───────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: calc(var(--radius) - 2px); border: 1px solid transparent; font: 500 14px var(--font); cursor: pointer; white-space: nowrap; background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-xs); transition: background .15s, color .15s, box-shadow .15s; text-decoration: none !important; user-select: none; }
.btn:hover { background: #2a2f37; }
.btn:focus-visible, .input:focus-visible, .select-trigger:focus-visible { box-shadow: 0 0 0 3px rgb(0 131 143 / 0.35); border-color: var(--ring); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn .ic { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); box-shadow: none; }
.btn-secondary:hover { background: #e9e9eb; }
.btn-outline { background: var(--background); color: var(--foreground); border-color: var(--input); }
.btn-outline:hover { background: var(--accent); }
.btn-ghost { background: transparent; color: var(--foreground); box-shadow: none; }
.btn-ghost:hover { background: var(--accent); }
.btn-destructive { background: var(--destructive); color: #fff; }
.btn-destructive:hover { background: #b91c1c; }
.btn-outline.danger, .btn-ghost.danger { color: var(--destructive); }
.btn-outline.danger:hover, .btn-ghost.danger:hover { background: var(--destructive-soft); }
.btn-link { background: transparent; box-shadow: none; color: var(--foreground); padding: 0; height: auto; text-decoration: underline !important; text-underline-offset: 4px; }
.btn-sm { height: 32px; padding: 0 12px; gap: 6px; font-size: 13px; }
.btn-lg { height: 40px; padding: 0 24px; }
.btn-block { width: 100%; }
.btn-icon, .icon-btn { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: calc(var(--radius) - 2px); border: 1px solid transparent; background: transparent; color: var(--foreground); cursor: pointer; }
.btn-icon:hover, .icon-btn:hover { background: var(--accent); }
.icon-btn.round { border-color: var(--input); background: var(--background); box-shadow: var(--shadow-xs); }
.icon-btn.disabled { opacity: .35; pointer-events: none; }
.icon-btn .ic { width: 16px; height: 16px; }
.btn .spinner { display: none; }
.htmx-request .btn .spinner, .btn.htmx-request .spinner { display: inline-block; }

/* ── Input, Textarea, Label ─────────────────────────────────── */
.field { display: block; margin: 0 0 16px; min-width: 0; }
.field > span, .label { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; line-height: 1; margin-bottom: 8px; color: var(--foreground); }
.field > span small { display: inline; font-weight: 400; }
.input, .field input:not([type=hidden]):not(.sr-only), .field textarea, .textarea {
  width: 100%; height: 36px; padding: 4px 12px; border: 1px solid var(--input); border-radius: calc(var(--radius) - 2px);
  background: transparent; font: 14px var(--font); color: var(--foreground); box-shadow: var(--shadow-xs); outline: none; transition: box-shadow .15s, border-color .15s; }
.field textarea, .textarea { height: auto; min-height: 64px; padding: 8px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .field input::placeholder, .field textarea::placeholder, .textarea::placeholder { color: #a1a1aa; }
.field input:focus, .field textarea:focus, .input:focus, .textarea:focus { border-color: var(--ring); box-shadow: 0 0 0 3px rgb(0 131 143 / 0.25); }
.field input[readonly] { background: var(--muted); }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled .select-trigger, fieldset:disabled .datepicker-trigger { opacity: .6; pointer-events: none; }

/* ── Select (shadcn) ────────────────────────────────────────── */
.select { position: relative; width: 100%; }
.select-trigger { width: 100%; height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px 0 12px; border: 1px solid var(--input); border-radius: calc(var(--radius) - 2px); background: transparent; font: 14px var(--font); color: var(--foreground); box-shadow: var(--shadow-xs); cursor: pointer; text-align: left; }
.select-trigger[aria-expanded="true"] { border-color: var(--ring); box-shadow: 0 0 0 3px rgb(0 131 143 / 0.25); }
.select-trigger .select-value { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.select-trigger .select-value.placeholder { color: var(--muted-foreground); }
.select-trigger .ic { width: 16px; height: 16px; opacity: .5; }

/* Popover surface shared by Select, Combobox, Calendar, Dropdown menu */
.popover { position: fixed; z-index: 95; min-width: 8rem; max-height: min(320px, 60vh); overflow-y: auto; background: var(--popover); color: var(--popover-foreground); border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); box-shadow: var(--shadow-lg); padding: 4px; animation: pop-in .12s ease-out; }
.popover[hidden] { display: none; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.popover .opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; font-size: 14px; cursor: default; user-select: none; outline: none; }
.popover .opt[data-active="true"] { background: var(--accent); }
.popover .opt .check { margin-left: auto; width: 16px; height: 16px; visibility: hidden; }
.popover .opt[aria-selected="true"] .check { visibility: visible; }
.popover .opt small { display: inline; margin-left: 6px; }
.popover .opt-head { padding: 6px 8px 4px; font-size: 12px; font-weight: 500; color: var(--muted-foreground); }
.popover .opt-sep { height: 1px; margin: 4px -4px; background: var(--border); }
.popover .opt-new { color: var(--foreground); font-weight: 500; }
.popover .empty { padding: 18px 8px; text-align: center; color: var(--muted-foreground); font-size: 13px; }
.popover .cmd-search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; margin: -4px -4px 4px; border-bottom: 1px solid var(--border); }
.popover .cmd-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; box-shadow: none; padding: 0; background: transparent; font: 14px var(--font); color: var(--foreground); }
.popover .cmd-search input::placeholder { color: var(--muted-foreground); }
.popover .cmd-search .ic { width: 16px; height: 16px; opacity: .5; flex: none; }
.popover .opt { min-height: 32px; }
.popover hr { border: 0; border-top: 1px solid var(--border); margin: 4px -4px; }
.popover .group-label { padding: 6px 8px 2px; font-size: 12px; font-weight: 500; color: var(--muted-foreground); }

/* Dropdown menu (the sidebar's New) */
.menu-popover { width: 300px; max-height: 80vh; }
.menu-popover a { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 4px; outline: none; }
.menu-popover a:hover, .menu-popover a[data-active="true"] { background: var(--accent); }
.menu-popover a .ic { width: 16px; height: 16px; color: var(--muted-foreground); }
.menu-popover a b { display: block; font-weight: 500; font-size: 14px; }
.menu-popover a small { font-size: 12px; }

/* ── Calendar / date picker (shadcn) ────────────────────────── */
.datepicker { position: relative; width: 100%; }
.datepicker-trigger { width: 100%; justify-content: flex-start; font-weight: 400; padding: 0 12px; }
.datepicker-trigger .ic { opacity: .6; }
.datepicker-trigger .placeholder { color: var(--muted-foreground); }
.calendar { padding: 12px; width: 280px; max-height: none; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font-size: 14px; font-weight: 500; }
.cal-head .btn-icon { width: 28px; height: 28px; border: 1px solid var(--input); opacity: .7; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-grid .dow { font-size: 12px; color: var(--muted-foreground); text-align: center; padding: 4px 0; font-weight: 400; }
.cal-grid button { height: 34px; border: 0; background: transparent; border-radius: calc(var(--radius) - 4px); font: 14px var(--font); cursor: pointer; color: var(--foreground); }
.cal-grid button:hover { background: var(--accent); }
.cal-grid button.out { color: #a1a1aa; }
.cal-grid button.today { background: var(--accent); font-weight: 600; }
.cal-grid button.sel { background: var(--primary); color: var(--primary-foreground); }
.cal-grid button[data-active="true"] { box-shadow: inset 0 0 0 2px var(--ring); }
.cal-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }

/* ── Checkbox, ToggleGroup, Switch ──────────────────────────── */
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; user-select: none; }
.checkbox .box { width: 16px; height: 16px; flex: none; border: 1px solid #a1a1aa; border-radius: 4px; display: grid; place-items: center; background: var(--background); box-shadow: var(--shadow-xs); transition: background .1s, border-color .1s; }
.checkbox .box svg { width: 12px; height: 12px; color: var(--primary-foreground); opacity: 0; }
.checkbox input:checked + .box { background: var(--primary); border-color: var(--primary); }
.checkbox input:checked + .box svg { opacity: 1; }
.checkbox input:indeterminate + .box { background: var(--primary); border-color: var(--primary); }
.checkbox input:focus-visible + .box { box-shadow: 0 0 0 3px rgb(0 131 143 / 0.35); }
.check-line { display: flex; margin: 4px 0 12px; }
.toggle-group { display: inline-flex; flex-wrap: wrap; gap: 0; padding: 3px; background: var(--muted); border-radius: var(--radius); }
.toggle-group label { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: calc(var(--radius) - 3px); font-size: 13.5px; font-weight: 500; color: var(--muted-foreground); cursor: pointer; user-select: none; white-space: nowrap; }
.toggle-group label:hover { color: var(--foreground); }
.toggle-group label:has(input:checked) { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm); }
.toggle-group label:has(input:focus-visible) { box-shadow: 0 0 0 2px var(--ring); }
.toggle-group .dot { width: 7px; height: 7px; border-radius: 99px; background: var(--gray); }

/* ── Dialog / AlertDialog (shadcn) ──────────────────────────── */
.dialog-overlay { position: fixed; inset: 0; z-index: 90; background: rgb(0 0 0 / 0.5); display: grid; place-items: center; padding: 16px; animation: fade-in .15s ease-out; }
.dialog-overlay[hidden] { display: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.dialog { width: 100%; max-width: 440px; background: var(--background); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 24px; animation: zoom-in .15s ease-out; }
@keyframes zoom-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.dialog h2 { font-size: 18px; margin-bottom: 8px; }
.dialog p { margin: 0; color: var(--muted-foreground); }
.dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

/* ── Toast (Sonner) ─────────────────────────────────────────── */
.toaster { position: fixed; z-index: 100; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; width: 356px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; background: var(--background); color: var(--foreground); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 500; animation: toast-in .25s cubic-bezier(.21,1.02,.73,1); transition: opacity .3s, transform .3s; }
.toast .ic { width: 18px; height: 18px; margin-top: 1px; }
.toast.ok .ic { color: var(--green); } .toast.error .ic { color: var(--destructive); }
.toast.leaving { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ── Card, Badge, Alert, Avatar, Separator, Progress ────────── */
.card { background: var(--card); color: var(--card-foreground); border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); box-shadow: var(--shadow-xs); padding: 20px 24px; margin-bottom: 16px; }
.card h3 { margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h3 { margin: 0; }
.card-head.pad { padding: 16px 20px 12px; margin: 0; border-bottom: 1px solid var(--border); }
.card-desc { color: var(--muted-foreground); font-size: 13.5px; margin: -6px 0 14px; }
.table-card { padding: 0; overflow: hidden; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--background); font-size: 12px; font-weight: 500; white-space: nowrap; line-height: 1.5; }
.pill i, .dot { width: 6px; height: 6px; border-radius: 99px; background: var(--gray); flex: none; }
.pill.green i, .dot.green { background: var(--green); } .pill.blue i, .dot.blue { background: var(--blue); }
.pill.amber i, .dot.amber { background: var(--amber); } .pill.orange i, .dot.orange { background: var(--orange); }
.pill.red i, .dot.red { background: var(--red); } .pill.ink i, .dot.ink { background: var(--primary); }
.pill.cyan i, .dot.cyan { background: var(--brand-deep); }
a.pill:hover { background: var(--accent); }
.tag { display: inline-flex; align-items: center; font: 600 12px var(--mono); background: var(--primary); color: var(--brand); padding: 2px 8px; border-radius: 6px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.alert { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 16px; font-size: 14px; background: var(--background); }
.alert > .ic { width: 16px; height: 16px; margin-top: 2px; }
.alert.error { color: var(--destructive); border-color: #fecaca; background: var(--destructive-soft); }
.alert.ok { color: #166534; border-color: #bbf7d0; background: #f0fdf4; }
.alert.warn { color: #92400e; border-color: #fde68a; background: #fffbeb; }
.alert.info { color: #1e40af; border-color: #bfdbfe; background: #eff6ff; }
.alert.big { font-size: 15px; }
.alert.inline { margin: 0; padding: 8px 12px; align-items: center; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.avatar { display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 99px; background: var(--muted); color: var(--foreground); font-weight: 600; font-size: 12px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.ink, .avatar.admin { background: var(--primary); color: var(--brand); }
.avatar.employee { background: #dbeafe; color: #1e40af; }
.avatar.hr { background: var(--brand-soft); color: var(--brand-deep); }
.avatar.grey { background: var(--muted); color: var(--muted-foreground); }
.progress { height: 6px; background: var(--muted); border-radius: 99px; overflow: hidden; margin-bottom: 4px; }
.progress i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.progress.big { height: 8px; margin: 4px 0 16px; }
.separator { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── Page header, KPIs, splits ──────────────────────────────── */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { max-width: 900px; }
.page-head .muted { font-size: 14px; }
.count { display: inline-flex; vertical-align: middle; font-size: 12px; font-weight: 600; border: 1px solid var(--border); border-radius: 6px; padding: 0 7px; margin-left: 8px; letter-spacing: 0; line-height: 22px; }
.split { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; align-items: start; }
.split.wide-left { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.stack { display: grid; gap: 8px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
form.inline { display: inline; margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpis.small { grid-template-columns: repeat(4, 170px); }
.kpi { position: relative; display: block; background: var(--card); border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); box-shadow: var(--shadow-xs); padding: 18px 20px; color: var(--foreground); transition: border-color .15s, box-shadow .15s; }
a.kpi:hover { border-color: #d4d4d8; box-shadow: var(--shadow-sm); }
.kpi span { color: var(--muted-foreground); font-weight: 500; font-size: 13.5px; }
.kpi b { display: block; font-size: 28px; font-weight: 600; letter-spacing: -0.03em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi > i, .kpi > .ic { position: absolute; top: 18px; right: 18px; }
.kpi > i { color: var(--muted-foreground); display: grid; }
.kpi > i .ic { width: 16px; height: 16px; }
.kpi > i.green { color: var(--green); } .kpi > i.blue { color: var(--blue); } .kpi > i.amber { color: var(--amber); }
.kpi > i.cyan { color: var(--brand-deep); } .kpi > i.red { color: var(--destructive); } .kpi > i.grey { color: var(--muted-foreground); }
.kpi.dark { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.kpi.dark span, .kpi.dark small { color: #a1a1aa; }
.kpi.dark > .ic { color: var(--brand); width: 16px; height: 16px; }
.quick { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-top: 8px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--foreground); transition: background .15s; }
.quick:hover { background: var(--accent); }
.quick > .ic:first-child { color: var(--brand-deep); width: 18px; height: 18px; }
.quick > .ic:last-child { color: var(--muted-foreground); width: 16px; height: 16px; }
.quick span { flex: 1; }
.quick b { font-weight: 500; }

/* ── List tools, data table ─────────────────────────────────── */
.tools { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tools .search { position: relative; display: flex; align-items: center; width: 320px; }
.tools .search .ic { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--muted-foreground); pointer-events: none; }
.tools .search input { width: 100%; height: 36px; padding: 4px 12px 4px 34px; border: 1px solid var(--input); border-radius: calc(var(--radius) - 2px); background: transparent; font: 14px var(--font); box-shadow: var(--shadow-xs); outline: none; }
.tools .search input:focus { border-color: var(--ring); box-shadow: 0 0 0 3px rgb(0 131 143 / 0.25); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--muted-foreground); height: 40px; padding: 0 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--background); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td small { margin-top: 1px; }
.table tr.link { cursor: pointer; }
.table tbody tr:hover td { background: rgb(244 244 245 / 0.6); }
.table tr.empty td { text-align: center; color: var(--muted-foreground); padding: 48px 12px; }
.table tr.empty:hover td { background: transparent; }
.table tr.row-error td { background: var(--destructive-soft); }
.table.compact td { padding: 8px 6px; }
.table .code { font: 500 13px var(--mono); white-space: nowrap; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .num-l { font-variant-numeric: tabular-nums; }
.table tfoot td { border-top: 1px solid var(--border); border-bottom: 0; background: rgb(244 244 245 / 0.5); }
.table .tick { padding: 0 0 0 12px; width: 40px; }
.table .tick label { display: flex; align-items: center; min-height: 44px; }
.table tr:has(input[name=ids]:checked) td { background: rgb(244 244 245 / 0.9); }
.who-cell { display: flex; align-items: center; gap: 10px; }
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 13.5px; }
.pager b { font-weight: 500; }
.select-bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 16px; background: var(--muted); border-bottom: 1px solid var(--border); }
.select-bar[hidden] { display: none; }
.select-bar b { font-weight: 500; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-card { max-width: 1000px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: 1 / -1; }
.field[hidden] { display: none; }
.field.check { display: flex; align-items: flex-end; padding-bottom: 8px; }
.form-with-photo { display: flex; gap: 20px; align-items: flex-start; }
.form-with-photo .form-grid { flex: 1; }
.form-with-photo .photo { width: 200px; border-radius: var(--radius); object-fit: cover; border: 1px solid var(--border); }
.upload-row { display: flex; gap: 12px; align-items: center; }
.drop { flex: 1; display: flex; align-items: center; gap: 14px; padding: 20px; border: 1px dashed #d4d4d8; border-radius: var(--radius); cursor: pointer; background: var(--background); transition: border-color .15s, background .15s; }
.drop:hover, .drop.dragging { border-color: var(--ring); background: rgb(224 251 253 / 0.4); }
.drop > .ic { color: var(--muted-foreground); width: 20px; height: 20px; }
.drop span b { font-weight: 500; }
.drop .file-name { margin-left: auto; font-size: 13px; color: var(--foreground); font-weight: 500; }

/* ── Profile / device hero, KV, timeline, thread ─────────────── */
.profile, .device-hero { display: flex; gap: 16px; align-items: center; }
.device-hero img, .device-hero .noimg { width: 96px; height: 96px; border-radius: var(--radius); object-fit: cover; background: var(--muted); display: grid; place-items: center; color: var(--muted-foreground); flex: none; border: 1px solid var(--border); }
.device-hero h2 { margin-top: 8px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 12px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted-foreground); display: flex; align-items: center; gap: 8px; }
.kv dt .ic { width: 15px; height: 15px; }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 1px solid var(--border); }
.timeline li { position: relative; padding: 0 0 14px 14px; }
.timeline li::before { content: ""; position: absolute; left: -21px; top: 6px; width: 9px; height: 9px; border-radius: 99px; background: var(--background); border: 2px solid var(--primary); }
.timeline li b { font-weight: 500; }
.timeline .chg { display: block; color: var(--muted-foreground); font-size: 13px; }
.thread { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 12px; }
.thread li { display: flex; gap: 10px; align-items: flex-start; }
.thread li > div { background: var(--muted); border-radius: var(--radius); padding: 10px 14px; max-width: 85%; }
.thread li.mine > div { background: var(--brand-soft); }
.thread li p { margin: 4px 0 0; }
.thread li.event { display: block; text-align: center; color: var(--muted-foreground); font-size: 12.5px; }
.thread li.event small { display: inline; }
.reply { display: grid; gap: 10px; }
.reply button { justify-self: end; }
.ticket-photo { max-width: 320px; border-radius: var(--radius); margin: 8px 0; display: block; border: 1px solid var(--border); }

/* ── Spreadsheet entry grid ─────────────────────────────────── */
.bulk { display: flex; flex-direction: column; }
.grid-wrap { background: var(--background); border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); box-shadow: var(--shadow-xs); overflow: auto; max-height: calc(100vh - 270px); }
.stack-form .grid-wrap { max-height: none; }
.grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; min-width: 100%; }
.grid th { position: sticky; top: 0; z-index: 2; background: var(--muted); text-align: left; font-size: 12.5px; font-weight: 500; color: var(--muted-foreground); padding: 0 10px; height: 36px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 0; height: 38px; background: var(--background); }
.grid td input { width: 100%; height: 37px; border: 0; padding: 0 10px; background: transparent; outline: none; font: 14px var(--font); color: var(--foreground); }
.grid td input:focus { box-shadow: inset 0 0 0 2px var(--ring); background: var(--background); }
.grid td input.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid td input::placeholder { color: #a1a1aa; }
.grid td input.unknown { color: var(--destructive); }
.grid .rn { position: sticky; left: 0; z-index: 1; background: var(--muted); text-align: center; color: var(--muted-foreground); font-size: 12px; }
.grid th.rn { z-index: 3; }
.grid .rn .rm { display: none; border: 0; background: none; color: var(--destructive); font-size: 18px; cursor: pointer; line-height: 1; }
.grid tr:hover .rn .rm { display: inline; }
.grid tr:hover .rn .n, .grid tr:hover .rn .mark { display: none; }
.grid .rn .mark { font-weight: 700; }
.grid tr.ok .rn .n, .grid tr.error .rn .n { display: none; }
.grid tr.ok td { background: #f0fdf4; } .grid tr.ok .mark { color: var(--green); }
.grid tr.error td { background: var(--destructive-soft); } .grid tr.error .mark { color: var(--destructive); }
.grid tr.info td { background: #eff6ff; }
.grid tr.locked td input { color: var(--muted-foreground); }
.grid tr.locked:hover .rn .mark { display: inline; }
.grid .st { font-size: 12.5px; padding: 0 10px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid tr.error .st { color: var(--destructive); } .grid tr.ok .st { color: var(--green); } .grid tr.info .st { color: var(--blue); }
.grid .hide { display: none; }
.problems { list-style: none; margin: 12px 0 0; padding: 12px 16px; background: var(--destructive-soft); border: 1px solid #fecaca; border-radius: var(--radius); color: #991b1b; columns: 2; column-gap: 32px; font-size: 13.5px; }
.problems li { break-inside: avoid; padding: 2px 0; }
.problems b { color: var(--destructive); margin-right: 6px; font-weight: 600; }
.bulk-foot { position: sticky; bottom: 0; display: flex; align-items: center; gap: 8px; padding: 14px 0 0; background: var(--background); }
.saved .done, .done-card { display: flex; align-items: center; gap: 16px; }
.done-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 99px; background: #dcfce7; color: var(--green); }

/* Receiving */
.receive-form { display: flex; gap: 8px; }
.receive-form .input { height: 40px; font-size: 15px; }
.receive-line .alert.inline { margin-top: 12px; }

/* ── Sign-in: shadcn login-04 ───────────────────────────────── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--muted); }
.login-wrap { width: 100%; max-width: 768px; display: flex; flex-direction: column; gap: 24px; }
.login-split { display: grid; grid-template-columns: 1fr 1fr; padding: 0; overflow: hidden; margin: 0; }
.login-form { display: flex; flex-direction: column; gap: 0; padding: 32px; }
.login-head { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 24px; }
.login-logo { margin-bottom: 12px; }
.login-head h1 { font-size: 24px; font-weight: 700; }
.login-head .muted { margin-top: 4px; text-wrap: balance; }
.label-row { justify-content: space-between; width: 100%; }
.forgot { font-size: 13px; font-weight: 400; color: var(--foreground); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: transparent; }
.forgot:hover { text-decoration-color: currentColor; }
.forgot-hint { margin: -6px 0 14px; }
.login-divider { position: relative; text-align: center; margin: 22px 0 12px; font-size: 13px; color: var(--muted-foreground); }
.login-divider::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--border); }
.login-divider span { position: relative; background: var(--card); padding: 0 8px; }
.login-art { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 32px; background: var(--primary); color: #fff; overflow: hidden; }
.login-art::after { content: ""; position: absolute; right: -140px; top: -140px; width: 380px; height: 380px; border-radius: 50%; background: radial-gradient(circle, rgb(0 233 248 / 0.3), transparent 65%); }
.login-art-logo { height: 24px; align-self: flex-start; position: relative; z-index: 1; }
.login-art-copy { position: relative; z-index: 1; }
.login-art h2 { font-size: 30px; font-weight: 300; line-height: 1.1; letter-spacing: -0.03em; margin-bottom: 20px; }
.login-art h2 b { font-weight: 700; }
.login-art ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 13px; color: #d4d4d8; }
.login-art li { display: flex; align-items: center; gap: 10px; }
.login-art li .ic { color: var(--brand); }
.login-terms { margin: 0; text-align: center; font-size: 12px; color: var(--muted-foreground); text-wrap: balance; }
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--muted); }
.card.narrow { width: 100%; max-width: 420px; padding: 28px; }
.card.narrow .muted { margin-bottom: 20px; }
@media (max-width: 767px) {
  .login-page { padding: 24px; }
  .login-split { grid-template-columns: 1fr; }
  .login-art { display: none; }
}

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split.wide-left { grid-template-columns: 1fr; }
  .form-grid, .form-grid.four, .form-grid.six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.nav-badge { font-style: normal; font-size: 11px; font-weight: 600; min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 6px; background: var(--primary); color: var(--primary-foreground); flex: none; }
.nav-badge.red { background: var(--destructive); }

/* Units & serials sub-rows (invoice review) */
.grid td.units-cell { padding: 0 6px; }
.units-btn { display: inline-flex; align-items: center; gap: 4px; width: 100%; height: 28px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--background); font: 500 12.5px var(--font); color: var(--foreground); cursor: pointer; white-space: nowrap; overflow: hidden; }
.units-btn:hover { background: var(--accent); }
.units-btn .ic { width: 14px; height: 14px; flex: none; transition: transform .15s; color: var(--muted-foreground); }
.units-btn[aria-expanded="true"] .ic { transform: rotate(90deg); }
.units-btn:disabled { border-color: transparent; background: transparent; color: var(--muted-foreground); cursor: default; font-weight: 400; }
.units-btn:disabled .ic { display: none; }
.units-btn.warn { border-color: var(--amber); color: #92400e; }
.grid tr.units-row td { height: auto; padding: 0; background: var(--muted); border-right: 0; }
.units-box { position: sticky; left: 0; max-width: calc(100vw - 340px); padding: 12px 14px 14px 56px; }
.units-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin-bottom: 10px; font-size: 13px; color: var(--muted-foreground); }
.units-head b { color: var(--foreground); font-weight: 600; }
.units-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.unit { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 4px 0 10px; border: 1px solid var(--input); border-radius: calc(var(--radius) - 2px); background: var(--background); }
.unit:focus-within { border-color: var(--ring); box-shadow: 0 0 0 3px rgb(0 131 143 / 0.2); }
.unit span { font-size: 12px; color: var(--muted-foreground); white-space: nowrap; }
.unit input { flex: 1; min-width: 0; height: 30px; border: 0; outline: 0; background: transparent; font: 500 13.5px var(--mono); color: var(--foreground); }
.unit input::placeholder { font-family: var(--font); font-weight: 400; color: #a1a1aa; }
.save-row { align-items: center; }
.save-summary { margin: 0 auto 0 0; font-size: 13.5px; color: var(--muted-foreground); }
.save-summary b { color: var(--foreground); font-weight: 600; }

/* Consumables */
.amber-t { color: var(--amber); }
.nav-badge.amber { background: var(--amber); }
.stock-hero { display: flex; gap: 28px; align-items: center; }
.stock-hero > div:first-child { display: grid; justify-items: start; }
.stock-qty { font-size: 44px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kv.compact { margin-top: 12px; grid-template-columns: 110px 1fr; gap: 6px 12px; }
.stock-actions .toggle-group { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 14px; }
.stock-actions .toggle-group label { justify-content: center; }
.tab-panel[hidden] { display: none; }
.tab-panel .muted { margin: 0 0 12px; }
.stock-alert { margin-bottom: 16px; } .stock-alert span { flex: 1; } .stock-alert:hover { background: #fef3c7; }
.retype { display: grid; gap: 8px; }
.retype-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.retype-row b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.retype-type { width: 150px; flex: none; } .retype-cat { width: 170px; flex: none; }
.receive-form .input.qty { width: 110px; flex: none; }

/* Receive: one row per unit */
.units-table { margin: 4px 0 0; }
.units-table td { padding: 6px 8px; }
.units-table tr.is-done td { background: rgb(240 253 244 / 0.6); }
.units-table .unit-input { height: 32px; font-family: var(--mono); font-size: 13.5px; }
.units-table .serial { font: 500 13.5px var(--mono); }
.units-table .sticker-link { margin-left: 8px; color: var(--muted-foreground); vertical-align: middle; }
.units-table .sticker-link:hover { color: var(--foreground); }
.unit-actions { display: flex; align-items: center; gap: 8px; padding-top: 12px; font-size: 13.5px; }

/* Companies: one tab per company on the Companies & letterheads page */
.company-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; margin: 0 0 16px; background: var(--muted); border-radius: var(--radius); width: fit-content; max-width: 100%; }
.company-tabs a { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: calc(var(--radius) - 3px); font-size: 13.5px; font-weight: 500; color: var(--muted-foreground); text-decoration: none; white-space: nowrap; }
.company-tabs a:hover { color: var(--foreground); }
.company-tabs a.active { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm); }
.company-tabs a.inactive { opacity: .6; }
.company-tag { display: inline-block; margin-top: 3px; font-family: var(--font); padding: 0 6px; border-radius: 5px; background: var(--muted); color: var(--muted-foreground); font-size: 11.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.field .static { margin: 0; min-height: 36px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.access-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px 12px; margin: 14px 0 6px; }
.access-box legend { padding: 0 6px; font-weight: 600; font-size: 13.5px; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 6px; }

/* ── Master lists: "＋ Add new" next to dropdown labels, quick-add dialog, master pages ── */
.add-link { margin-left: auto; display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 500; color: var(--brand-deep); white-space: nowrap; border-radius: 4px; padding: 2px 4px; margin-right: -4px; margin-top: -4px; margin-bottom: -4px; }
.add-link:hover { background: var(--brand-soft); text-decoration: underline; text-underline-offset: 3px; }
.add-link:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.add-link .ic { width: 13px; height: 13px; stroke-width: 2.2; }
.grid th .th-add { float: right; width: 20px; height: 20px; margin: 8px -4px 0 4px; padding: 0; display: inline-grid; place-items: center; border: 0; border-radius: 4px; background: transparent; color: var(--brand-deep); cursor: pointer; }
.grid th .th-add:hover { background: var(--brand-soft); }
.grid th .th-add .ic { width: 13px; height: 13px; stroke-width: 2.2; }
.popover .opt-new .ic { width: 14px; height: 14px; color: var(--brand-deep); }
.dialog.dialog-form { max-width: 560px; position: relative; max-height: calc(100vh - 32px); overflow-y: auto; }
.dialog-head { position: relative; padding-right: 32px; margin-bottom: 16px; }
.dialog-head h2 { margin: 0 0 6px; font-size: 18px; }
.dialog-head h2::first-letter { text-transform: uppercase; }
.dialog-head p { margin: 0; color: var(--muted-foreground); font-size: 13.5px; }
.dialog-x { position: absolute; top: -10px; right: -12px; width: 32px; height: 32px; color: var(--muted-foreground); }
.quick-form .form-grid { gap: 0 14px; }
.quick-form .field { margin-bottom: 14px; }
.dialog-form .dialog-actions { align-items: center; margin-top: 8px; }
.dialog-more { margin-right: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted-foreground); }
.dialog-more:hover { color: var(--foreground); text-decoration: underline; text-underline-offset: 3px; }
code.temp-pw { font: 600 14px/1 var(--mono); background: var(--background); border: 1px dashed var(--amber); padding: 4px 8px; border-radius: 6px; user-select: all; }
.master-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.master-card { display: flex; align-items: flex-start; gap: 14px; margin: 0; padding: 18px 20px; transition: border-color .15s, box-shadow .15s; }
.master-card:hover { border-color: #d4d4d8; box-shadow: var(--shadow-sm); }
.master-card > i { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 8px; background: var(--muted); color: var(--muted-foreground); }
.master-card > i.cyan { background: var(--brand-soft); color: var(--brand-deep); }
.master-card > i.blue { color: var(--blue); }
.master-card > span { flex: 1; min-width: 0; }
.master-card b { display: block; font-weight: 600; }
.master-card small { display: block; color: var(--muted-foreground); font-size: 13px; line-height: 1.45; margin-top: 2px; }
.master-card em { font-style: normal; font-weight: 600; font-size: 20px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.table tr.muted-row td { color: var(--muted-foreground); }
.row-actions { display: flex; justify-content: flex-end; align-items: center; gap: 2px; }
.row-actions form { display: inline; margin: 0; }
@media (max-width: 640px) {
  .dialog-form .form-grid.two { grid-template-columns: minmax(0, 1fr); }
  .dialog-form .form-grid.two .span2 { grid-column: auto; }
}

/* ── Sticker sheets: settings + live page preview ─────────────────────── */
.sheet-split { display: grid; grid-template-columns: minmax(340px, 5fr) minmax(0, 6fr); gap: 16px; align-items: start; }
.sheet-side { position: sticky; top: 16px; }
.sheet-settings .form-grid.four .field > span { white-space: nowrap; }
.sheet-note { margin: -4px 0 14px; }
.sheet-margins-row .field > span { font-weight: 400; color: var(--muted-foreground); }
.sheet-checks { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: 99px; background: var(--background); font: 500 12.5px var(--font, inherit); color: var(--foreground); cursor: pointer; white-space: nowrap; }
.chip:hover { background: var(--accent); }
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.sheet-summary { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted-foreground); margin-bottom: 10px; }
.sheet-summary b { color: var(--foreground); font-weight: 600; }
.sheet-warn { margin-bottom: 8px; font-size: 13px; }
.sheet-pages { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; padding: 16px; background: var(--muted); border-radius: var(--radius); max-height: 72vh; overflow: auto; }
.sheet-page-wrap { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 100%; }
.sheet-page-wrap figcaption { font-size: 12px; color: var(--muted-foreground); }
.sheet-page { position: relative; max-width: 100%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .18), 0 6px 18px -6px rgb(0 0 0 / .18); border-radius: 2px; }
.sheet-margin { position: absolute; border: 1px dashed rgb(0 131 143 / .45); pointer-events: none; }
.sheet-cell { position: absolute; border: 1px dashed #d4d4d8; border-radius: 1px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.sheet-cell.used { border: 1px solid rgb(0 0 0 / .14); }
.sheet-cell.used.outline { border-color: #8c8c8c; }
.sheet-cell.skipped { background: repeating-linear-gradient(135deg, #f4f4f5 0 4px, #e4e4e7 4px 8px); }
.sheet-cell img { width: 100%; height: 100%; display: block; image-rendering: auto; }
.sheet-cell .sheet-code { font: 600 10px var(--mono); color: #3f3f46; }
.sheet-cell[data-cell] { cursor: pointer; }
.sheet-cell[data-cell]:hover { box-shadow: inset 0 0 0 2px var(--ring); }
.sheet-cell .cell-no { position: absolute; right: 2px; top: 1px; font: 600 9px/1 var(--mono); font-style: normal; color: #71717a; background: rgb(255 255 255 / .85); padding: 1px 3px; border-radius: 3px; pointer-events: none; }
@media (max-width: 1100px) { .sheet-split { grid-template-columns: 1fr; } .sheet-side { position: static; } }

/* ── Notifications: bell in the header, its menu, and the full list ───────── */
.notif-bell { margin-left: auto; position: relative; }
.notif-bell .btn-icon { position: relative; }
.notif-count { position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; display: grid; place-items: center;
  border-radius: 99px; background: var(--destructive); color: #fff; font: 600 10px/1 var(--font, inherit); font-style: normal; box-shadow: 0 0 0 2px var(--background); }
.notif-menu { width: 380px; }
.notif-menu-head { display: flex; align-items: baseline; justify-content: space-between; padding: 6px 8px; }
.notif-menu-head b { font-size: 14px; font-weight: 600; }
.notif-menu a.notif { align-items: flex-start; }
.notif-menu a.notif b { white-space: normal; font-weight: 400; line-height: 1.35; }
.notif-menu a.notif.unread b { font-weight: 600; }
.notif-menu a.notif-all { justify-content: center; color: var(--brand-deep); }
.notif-dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 99px; background: transparent; flex: none; }
.notif.unread .notif-dot { background: var(--brand-deep); }
.notif.unread.warning .notif-dot { background: var(--amber); }
.notif.unread.urgent .notif-dot { background: var(--red); }
.notif-empty { margin: 0; padding: 18px 12px; color: var(--muted-foreground); font-size: 14px; text-align: center; list-style: none; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list .notif + .notif { border-top: 1px solid var(--border); }
.notif-list .notif a { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; color: inherit; text-decoration: none; }
.notif-list .notif a:hover { background: var(--accent); }
.notif-list .notif b { display: block; font-weight: 400; }
.notif-list .notif.unread b { font-weight: 600; }
.notif-list .notif small { margin-top: 2px; font-size: 13px; }
.notif-list .notif time { flex: none; color: var(--muted-foreground); font-size: 12px; white-space: nowrap; padding-top: 2px; }
.notif-list .notif:not(.unread) { color: var(--muted-foreground); }
.notif-prefs { margin-top: 20px; }
.notif-prefs h3 { margin: 0 0 4px; }
.notif-prefs-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.notif-prefs-row form { margin: 0; }

/* ── Stocktake: the scan box and its result ──────────────────────────────── */
.scan-card { margin-bottom: 16px; }
.scan-card .muted { margin-top: 10px; }
.scan-form { display: flex; gap: 10px; align-items: stretch; }
.scan-box { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 48px; border: 1px solid var(--input); border-radius: var(--radius); background: var(--background); }
.scan-box:focus-within { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 20%, transparent); }
.scan-box .ic { color: var(--brand-deep); flex: none; }
.scan-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 500 16px var(--mono); color: var(--foreground); }
.scan-box input::placeholder { font: 400 14px var(--font); color: var(--muted-foreground); }
.scan-form .btn { height: 48px; padding: 0 20px; }
.scan-result { margin-bottom: 16px; align-items: center; }
.field.checks { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
small.inline { display: inline; margin-left: 6px; font-weight: 400; }
.stocktake-foot { margin-top: 16px; }
.cancel-link { margin: 10px 0 0; text-align: right; }
.table td form { margin: 0; }

/* ── Reports ─────────────────────────────────────────────────────────────── */
.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; margin-bottom: 20px; }
.report-card { display: flex; align-items: center; gap: 14px; color: var(--foreground); transition: border-color .15s, box-shadow .15s; margin: 0; }
.report-card:hover { border-color: #d4d4d8; box-shadow: var(--shadow-sm); }
.report-card b { display: block; font-size: 15px; font-weight: 600; }
.report-card small { margin-top: 2px; font-size: 13px; line-height: 1.45; }
.report-card > .ic { color: var(--muted-foreground); flex: none; }
.report-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-deep); flex: none; }
.report-filters { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: flex-end; margin-bottom: 16px; }
.report-filters .field { margin-bottom: 8px; min-width: 170px; }
.report-filters .presets { margin-left: auto; }
.report-filters .presets > div { display: flex; gap: 8px; }
.report-title { margin: 4px 0 14px; }
.report-title h2 { margin: 0; font-size: 18px; }
.report-table { margin-bottom: 16px; }
.report-table .card-head small { white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.report-table .table td, .report-table .table th { white-space: nowrap; }
.report-table .table td:nth-child(2) { white-space: normal; min-width: 180px; }
.report-notes ul { margin: 0; padding-left: 18px; color: var(--muted-foreground); }
.report-notes li + li { margin-top: 6px; }
.table.compact th, .table.compact td { height: 36px; padding-top: 6px; padding-bottom: 6px; }

@media print {
  .sidebar, .sb-backdrop, .inset-header, .no-print, .page-head .icon-btn { display: none !important; }
  .sb-wrapper, .sb-inset, #main { display: block !important; margin: 0 !important; padding: 0 !important; max-width: none !important; }
  body { background: #fff; font-size: 11px; }
  .card { box-shadow: none !important; break-inside: auto; }
  .table-scroll { overflow: visible; }
  .report-table .table td, .report-table .table th { white-space: normal; padding: 4px 6px; height: auto; font-size: 10px; }
  .report-table { break-inside: auto; } tr { break-inside: avoid; } thead { display: table-header-group; }
  @page { size: A4 landscape; margin: 12mm; }
}

/* ── Employee exits ──────────────────────────────────────────────────────── */
.exit-summary .progress { margin: 8px 0 6px; }
.exit-group { margin-bottom: 16px; }
.exit-items { list-style: none; margin: 0; padding: 0; }
.exit-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 20px; }
.exit-item + .exit-item { border-top: 1px solid var(--border); }
.exit-item b a { font-family: var(--mono); font-size: 13px; }
.exit-tick { width: 26px; height: 26px; border-radius: 99px; display: grid; place-items: center; flex: none; background: #fffbeb; color: var(--amber); }
.exit-item.done .exit-tick { background: #f0fdf4; color: var(--green); }
.exit-item.done > .grow > b { color: var(--muted-foreground); font-weight: 500; }
.exit-done { color: var(--foreground); margin-top: 4px; }
.exit-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 0; }
.exit-actions input[name=note] { flex: 1; min-width: 200px; height: 32px; padding: 0 10px; border: 1px solid var(--input); border-radius: calc(var(--radius) - 2px); font: inherit; font-size: 13px; background: var(--background); }
.exit-actions .select { min-width: 200px; }
.print-only { display: none; }
.clearance .signatures { display: flex; justify-content: space-between; gap: 40px; margin-top: 60px; }
.clearance .signatures span { flex: 1; border-top: 1px solid #000; padding-top: 6px; text-align: center; font-size: 12px; }
@media print {
  .print-only { display: block !important; }
  .split { display: block !important; }
  .exit-item { padding: 8px 12px; }
}
.amber-t { color: var(--amber); }
.pad-form { padding: 12px 20px; border-bottom: 1px solid var(--border); }
.pad-form .scan-box, .pad-form .btn { height: 40px; }
.pad-form .scan-box input { font: 500 14px var(--mono); }

/* ── Audit log ───────────────────────────────────────────────────────────── */
.report-filters .search-field { min-width: 220px; }
.report-filters .search-field input { height: 36px; width: 100%; padding: 0 10px; border: 1px solid var(--input); border-radius: calc(var(--radius) - 2px); font: inherit; background: var(--background); }
.audit-table td { vertical-align: top; padding-top: 10px; padding-bottom: 10px; }
.audit-changes .chg { display: block; font-size: 13px; overflow-wrap: anywhere; }
.audit-changes .chg b { font-weight: 500; color: var(--muted-foreground); }
.audit-more { margin-left: 8px; font-size: 12px; color: var(--muted-foreground); }

/* ── Payments ────────────────────────────────────────────────────────────── */
.kpi.aging ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 3px; font-size: 12.5px; }
.kpi.aging li { display: flex; justify-content: space-between; gap: 8px; }
.kpi.aging li em { font-style: normal; color: var(--muted-foreground); }
.kpi.aging li b { display: inline; font-size: 12.5px; font-weight: 600; margin: 0; letter-spacing: 0; }
.settle { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.settle small { margin-top: 2px; }

/* ── Quotation comparison ────────────────────────────────────────────────── */
.rfq-compare th.num, .rfq-compare td.num { min-width: 170px; vertical-align: top; }
.rfq-compare th small { font-weight: 400; }
.rfq-compare td.lowest { background: #f0fdf4; }
.rfq-compare td.lowest, .rfq-compare td.lowest b { color: #166534; }
.rfq-compare th.chosen { color: var(--brand-deep); }
.rfq-compare tfoot form { margin: 0; display: flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.rfq-compare .reason { height: 32px; width: 170px; padding: 0 8px; border: 1px solid var(--input); border-radius: calc(var(--radius) - 2px); font: inherit; font-size: 12.5px; }
.rfq-links { display: block; margin-top: 6px; font-size: 12.5px; color: var(--muted-foreground); }
.inline-form { display: inline !important; }
.linklike { border: 0; background: none; padding: 0; font: inherit; color: var(--muted-foreground); cursor: pointer; text-decoration: underline; }
.rfq-prices { margin: 4px 0 16px; }
.rfq-prices input { width: 100%; height: 32px; padding: 0 8px; border: 1px solid var(--input); border-radius: calc(var(--radius) - 2px); font: inherit; background: var(--background); }
p.pad { padding: 0 20px 16px; margin: 0; }

/* Accounting export */
.report-filters .checks { display: flex; gap: 14px; align-items: center; min-height: 36px; flex-wrap: wrap; }
.report-filters.accounting .presets { display: flex; gap: 4px; flex-wrap: wrap; flex-basis: 100%; margin-left: 0; }
.table.vouchers tr:not(.group-end):not(.empty) td { border-bottom: 0; padding-bottom: 4px; }
.table.vouchers tr:not(.group-start):not(.empty) td { padding-top: 4px; }

/* Browser notifications: offered once right after signing in (push.js) */
.push-ask { position: fixed; z-index: 101; right: 24px; bottom: 24px; width: 356px; display: flex; gap: 12px; padding: 16px;
  background: var(--background); color: var(--foreground); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); animation: toast-in .25s cubic-bezier(.21,1.02,.73,1); }
.push-ask .push-ask-icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; background: var(--muted); }
.push-ask b { display: block; font-size: 14px; }
.push-ask p { margin: 4px 0 12px; font-size: 13px; color: var(--muted-foreground); }
.push-ask .push-ask-actions { display: flex; gap: 8px; }
@media (max-width: 640px) { .push-ask { left: 16px; right: 16px; width: auto; bottom: 16px; } }
