/* ── shadcn/ui tokens (light) ───────────────────────────────────────────── */
:root {
  --background:        #ffffff;
  --foreground:        #09090b;
  --card:              #ffffff;
  --card-tinted:       #fcfcfc;
  --card-foreground:   #09090b;
  --popover:           #ffffff;
  --muted:             #f4f4f5;
  --muted-foreground:  #71717a;
  --border:            #e4e4e7;
  --input:             #e4e4e7;
  --primary:           #18181b;
  --primary-fg:        #fafafa;
  --secondary:         #f4f4f5;
  --secondary-fg:      #18181b;
  --accent:            #f4f4f5;
  --accent-fg:         #18181b;
  --destructive:       #ef4444;
  --destructive-fg:    #fafafa;
  --ring:              #18181b;
  --radius:            0.1rem;

  /* Extra semantic */
  --success:           #16a34a;
  --warning:           #d97706;
  --info:              #2563eb;
  /* Extended palette */
  --purple:            #7c3aed;
  --pink:              #db2777;
  --teal:              #0d9488;
  --orange:            #ea580c;
  --indigo:            #4338ca;
  --rose:              #e11d48;
  --cyan:              #0891b2;
  --lime:              #65a30d;
  /* Neutrals */
  --slate:             #64748b;
  --zinc:              #71717a;
  --stone:             #78716c;
  --silver:            #94a3b8;
  /* Pastels */
  --pastel-blue:       #dbeafe;
  --pastel-green:      #dcfce7;
  --pastel-yellow:     #fef9c3;
  --pastel-red:        #fee2e2;
  --pastel-purple:     #ede9fe;
  --pastel-pink:       #fce7f3;
  --pastel-teal:       #ccfbf1;
  --pastel-orange:     #ffedd5;

  /* CN colors */
  --cn-muted-bg:       #fafafa;
  --cn-on-muted-bg:    #f1f1f1;
  --cn-border:         #e0e0e0;
  --cn-muted-text:     #71717a;

  /* Layout */
  --navbar-h:          40px;
  --sidebar-w:         200px;
  --font:              'Geist', ui-sans-serif, system-ui, sans-serif;
  --font-mono:         'Geist Mono', ui-monospace, monospace;
}

.ag-theme-quartz {
  --ag-font-size: 12px;
  --ag-wrapper-border: none;
  --ag-wrapper-border-radius: 0;
}

/* ── Base ───────────────────────────────────────────────────────────────── */
html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 12.5px;
  line-height: 1.45;
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── Scrollbars ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ══════════════════════════════════════════════════════════════════════════
   NAVBAR
══════════════════════════════════════════════════════════════════════════ */
.cn-navbar {
  height: var(--navbar-h);
  border-bottom: 1px solid var(--border);
  background: var(--background);
  display: flex;
  align-items: center;
  padding: 0 .875rem;
  gap: .5rem;
  position: sticky; top: 0; z-index: 50;
}

.cn-navbar .brand {
  display: flex; align-items: center; gap: .4rem;
  font-size: 13px; font-weight: 600; color: var(--foreground);
  margin-right: .5rem; flex-shrink: 0;
}
.cn-navbar .brand svg { width: 16px; height: 16px; }

.cn-navbar .divider { width: 1px; height: 18px; background: var(--border); margin: 0 .25rem; flex-shrink: 0; }

/* Breadcrumb in navbar */
.cn-navbar .nav-breadcrumb {
  display: flex; align-items: center; gap: .2rem;
  font-size: 12px; color: var(--muted-foreground);
}
.cn-navbar .nav-breadcrumb .crumb { color: var(--foreground); font-weight: 500; }
.cn-navbar .nav-breadcrumb i { font-size: 9px; }

/* Search */
.cn-navbar .nav-search {
  margin-left: auto;
  position: relative;
  width: 200px;
}
.cn-navbar .nav-search input {
  width: 100%; height: 26px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--muted); font-family: var(--font); font-size: 11.5px;
  padding: 0 .6rem 0 1.6rem; color: var(--foreground); outline: none;
}
.cn-navbar .nav-search input::placeholder { color: var(--muted-foreground); }
.cn-navbar .nav-search input:focus { border-color: var(--ring); background: var(--background); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 15%, transparent); }
.cn-navbar .nav-search .search-icon { position: absolute; left: .45rem; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); font-size: 11px; pointer-events: none; }

/* Kbd hint */
.cn-navbar .nav-search .kbd-hint {
  position: absolute; right: .4rem; top: 50%; transform: translateY(-50%);
  font-size: 9px; font-family: var(--font-mono);
  border: 1px solid var(--border); border-radius: 3px;
  padding: .05rem .25rem; color: var(--muted-foreground); background: var(--background);
}

/* Icon buttons */
.cn-navbar .icon-btn,
.icon-btn {
  width: 28px; height: 28px; border-radius: var(--radius);
  border: none; background: transparent; color: var(--muted-foreground);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 13px; flex-shrink: 0;
  transition: background .1s, color .1s;
  padding: 0;
}
.cn-navbar .icon-btn:hover,
.icon-btn:hover { background: var(--accent); color: var(--foreground); }

/* Avatar */
.cn-navbar .avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary); color: var(--primary-fg);
  font-size: 10px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; border: 1.5px solid var(--border);
}

/* ══════════════════════════════════════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════════════════════════════════════ */
.cn-layout {
  display: flex;
  height: calc(100vh - var(--navbar-h));
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════════════════════════ */
.cn-sidebar {
  width: var(--sidebar-w);
  border-right: 1px solid var(--border);
  background: var(--background);
  overflow-y: auto;
  flex-shrink: 0;
  padding: .375rem .5rem;
}

.cn-sidebar .sidebar-group {
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: .25rem;
}

.cn-sidebar .sidebar-group.open .sidebar-group-label {
  padding-bottom: 0.55rem;
}

.cn-sidebar .sidebar-group:last-child { border-bottom: none; }

.cn-sidebar .sidebar-group-label {
  font-size: 10px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted-foreground);
  padding: .55rem .5rem .15rem;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  border-radius: calc(var(--radius) - 1px);
  transition: color .1s;
}
.cn-sidebar .sidebar-group-label:hover { color: var(--foreground); }
.cn-sidebar .sidebar-group-label::after {
  content: '\F282'; /* bi-chevron-right */
  font-family: 'bootstrap-icons';
  font-size: 10px; font-weight: 400; letter-spacing: 0;
  text-transform: none;
  transition: transform .15s;
  opacity: .6;
}
.cn-sidebar .sidebar-group.open > .sidebar-group-label::after {
  transform: rotate(90deg);
}

/* Items hidden by default; visible when group is open */
.cn-sidebar .sidebar-group > .sidebar-item { display: none; }
.cn-sidebar .sidebar-group.open > .sidebar-item { display: flex; }

.cn-sidebar .sidebar-item {
  display: flex; align-items: center; gap: .4rem;
  padding: .28rem .5rem; border-radius: calc(var(--radius) - 1px);
  font-size: 12.5px; color: var(--muted-foreground);
  cursor: pointer; transition: background .1s, color .1s;
  white-space: nowrap; overflow: hidden;
}
.cn-sidebar .sidebar-item:hover { background: var(--accent); color: var(--accent-fg); }
.cn-sidebar .sidebar-item.active { background: var(--secondary); color: var(--foreground); font-weight: 500; }
.cn-sidebar .sidebar-item i { font-size: 12px; flex-shrink: 0; }
.cn-sidebar .sidebar-item .item-badge {
  margin-left: auto; font-size: 10px; font-weight: 600;
  background: var(--muted); color: var(--muted-foreground);
  border-radius: 10px; padding: 0 .35rem; min-width: 16px; text-align: center;
}
.cn-sidebar .sidebar-item.active .item-badge { background: var(--border); }

.cn-sidebar .sidebar-separator {
  height: 1px; background: var(--border); margin: .375rem -.5rem;
}
/* Within-group divider — hidden when group is closed */
.cn-sidebar .sidebar-group > .sidebar-item-separator { display: none; }
.cn-sidebar .sidebar-group.open > .sidebar-item-separator {
  display: block;
  height: 1px; background: var(--border);
  margin: .2rem .25rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   MAIN
══════════════════════════════════════════════════════════════════════════ */
.cn-main {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

/* ── Page toolbar ──────────────────────────────────────────────────────── */
.cn-toolbar {
  border-bottom: 1px solid var(--border);
  padding: .45rem .875rem;
  display: flex; align-items: center; gap: .5rem;
  background: var(--background);
  flex-shrink: 0;
}
.cn-toolbar h1 { font-size: 13px; font-weight: 600; margin: 0; }
.cn-toolbar .toolbar-actions,
.cn-toolbar .cn-toolbar-actions { margin-left: auto; display: flex; gap: .35rem; align-items: center; }

/* ── Page content area ─────────────────────────────────────────────────── */
.cn-content { padding: .875rem; flex: 1; overflow: auto; }

/* ══════════════════════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════════════════════ */
.btn {
  font-family: var(--font); font-size: 12px; font-weight: 500;
  border-radius: var(--radius); padding: .25rem .625rem;
  height: 28px; display: inline-flex; align-items: center; gap: .3rem;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background .1s, box-shadow .1s;
  line-height: 1;
}
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.btn:disabled, .btn[disabled] { opacity: .4; cursor: not-allowed; pointer-events: none; }

.btn-default { background: var(--background); border-color: var(--border); color: var(--foreground); }
.btn-default:hover { background: var(--accent); }

.btn-primary { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary); color: var(--primary-fg); }

.btn-ghost { background: transparent; color: var(--foreground); border-color: transparent; }
.btn-ghost:hover { background: var(--accent); }

.btn-destructive { background: transparent; color: var(--destructive); border-color: var(--destructive); }
.btn-destructive:hover { background: var(--destructive); color: var(--destructive-fg); }

.btn-xs { height: 22px; font-size: 11px; padding: 0 .45rem; }
.btn-sm { height: 26px; font-size: 11.5px; padding: .2rem .55rem; }
.btn-lg { height: 46px; font-size: 15px; padding: .5rem 1.2rem; }
.btn-lg i { font-size: 15px; }
.btn i { font-size: 11px; }

/* ── Semantic Color Buttons ── */
.btn-success { background: transparent; color: var(--success); border-color: var(--success); }
.btn-success:hover { background-color: var(--success); color: #fff; }
.btn-warning { background: transparent; color: var(--warning); border-color: var(--warning); }
.btn-warning:hover { background-color: var(--warning); color: #fff; }
.btn-danger  { background: transparent; color: var(--destructive); border-color: var(--destructive); }
.btn-danger:hover  { background-color: var(--destructive); color: var(--destructive-fg); }
.btn-info    { background: transparent; color: var(--info); border-color: var(--info); }
.btn-info:hover    { background-color: var(--info); color: #fff; }
.btn-outline-success { background: transparent; color: var(--success); border-color: var(--success); }
.btn-outline-success:hover { background-color: var(--success); color: #fff; }
.btn-outline-warning { background: transparent; color: var(--warning); border-color: var(--warning); }
.btn-outline-warning:hover { background-color: var(--warning); color: #fff; }
.btn-outline-danger  { background: transparent; color: var(--destructive); border-color: var(--destructive); }
.btn-outline-danger:hover  { background-color: var(--destructive); color: #fff; }
.btn-outline-info    { background: transparent; color: var(--info); border-color: var(--info); }
.btn-outline-info:hover    { background-color: var(--info); color: #fff; }

/* ── Extended Palette ── */
.btn-purple { background: transparent; color: var(--purple); border-color: var(--purple); }
.btn-purple:hover { background-color: var(--purple); color: #fff; }
.btn-pink   { background: transparent; color: var(--pink);   border-color: var(--pink); }
.btn-pink:hover   { background-color: var(--pink); color: #fff; }
.btn-teal   { background: transparent; color: var(--teal);   border-color: var(--teal); }
.btn-teal:hover   { background-color: var(--teal); color: #fff; }
.btn-orange { background: transparent; color: var(--orange); border-color: var(--orange); }
.btn-orange:hover { background-color: var(--orange); color: #fff; }
.btn-indigo { background: transparent; color: var(--indigo); border-color: var(--indigo); }
.btn-indigo:hover { background-color: var(--indigo); color: #fff; }
.btn-rose   { background: transparent; color: var(--rose);   border-color: var(--rose); }
.btn-rose:hover   { background-color: var(--rose); color: #fff; }
.btn-cyan   { background: transparent; color: var(--cyan);   border-color: var(--cyan); }
.btn-cyan:hover   { background-color: var(--cyan); color: #fff; }
.btn-lime   { background: transparent; color: var(--lime);   border-color: var(--lime); }
.btn-lime:hover   { background-color: var(--lime); color: #fff; }
.btn-outline-purple { background: transparent; color: var(--purple); border-color: var(--purple); }
.btn-outline-purple:hover { background-color: var(--purple); color: #fff; }
.btn-outline-pink   { background: transparent; color: var(--pink);   border-color: var(--pink); }
.btn-outline-pink:hover   { background-color: var(--pink);   color: #fff; }
.btn-outline-teal   { background: transparent; color: var(--teal);   border-color: var(--teal); }
.btn-outline-teal:hover   { background-color: var(--teal);   color: #fff; }
.btn-outline-orange { background: transparent; color: var(--orange); border-color: var(--orange); }
.btn-outline-orange:hover { background-color: var(--orange); color: #fff; }
.btn-outline-indigo { background: transparent; color: var(--indigo); border-color: var(--indigo); }
.btn-outline-indigo:hover { background-color: var(--indigo); color: #fff; }
.btn-outline-rose   { background: transparent; color: var(--rose);   border-color: var(--rose); }
.btn-outline-rose:hover   { background-color: var(--rose);   color: #fff; }
.btn-outline-cyan   { background: transparent; color: var(--cyan);   border-color: var(--cyan); }
.btn-outline-cyan:hover   { background-color: var(--cyan);   color: #fff; }
.btn-outline-lime   { background: transparent; color: var(--lime);   border-color: var(--lime); }
.btn-outline-lime:hover   { background-color: var(--lime);   color: #fff; }

/* ── Neutral Buttons ── */
.btn-slate  { background-color: var(--slate);  color: #fff;     border-color: var(--slate); }
.btn-slate:hover  { background-color: #475569; border-color: #475569; }
.btn-zinc   { background-color: var(--zinc);   color: #fff;     border-color: var(--zinc); }
.btn-zinc:hover   { background-color: #52525b; border-color: #52525b; }
.btn-stone  { background-color: var(--stone);  color: #fff;     border-color: var(--stone); }
.btn-stone:hover  { background-color: #57534e; border-color: #57534e; }
.btn-silver { background-color: var(--silver); color: #1e293b;  border-color: var(--silver); }
.btn-silver:hover { background-color: #7b91a8; border-color: #7b91a8; }
.btn-outline-slate  { background: transparent; color: var(--slate);  border-color: var(--slate); }
.btn-outline-slate:hover  { background-color: var(--slate);  color: #fff; }
.btn-outline-zinc   { background: transparent; color: var(--zinc);   border-color: var(--zinc); }
.btn-outline-zinc:hover   { background-color: var(--zinc);   color: #fff; }
.btn-outline-stone  { background: transparent; color: var(--stone);  border-color: var(--stone); }
.btn-outline-stone:hover  { background-color: var(--stone);  color: #fff; }
.btn-outline-silver { background: transparent; color: var(--silver); border-color: var(--silver); }
.btn-outline-silver:hover { background-color: var(--silver); color: #1e293b; }

/* ── Pastel Buttons ── */
.btn-pastel-blue   { background-color: var(--pastel-blue);   color: #1d4ed8; border-color: #bfdbfe; }
.btn-pastel-blue:hover   { background-color: #bfdbfe; border-color: #93c5fd; }
.btn-pastel-green  { background-color: var(--pastel-green);  color: #15803d; border-color: #bbf7d0; }
.btn-pastel-green:hover  { background-color: #bbf7d0; border-color: #86efac; }
.btn-pastel-yellow { background-color: var(--pastel-yellow); color: #a16207; border-color: #fde68a; }
.btn-pastel-yellow:hover { background-color: #fef08a; border-color: #fcd34d; }
.btn-pastel-red    { background-color: var(--pastel-red);    color: #b91c1c; border-color: #fecaca; }
.btn-pastel-red:hover    { background-color: #fecaca; border-color: #fca5a5; }
.btn-pastel-purple { background-color: var(--pastel-purple); color: #6d28d9; border-color: #ddd6fe; }
.btn-pastel-purple:hover { background-color: #ddd6fe; border-color: #c4b5fd; }
.btn-pastel-pink   { background-color: var(--pastel-pink);   color: #be185d; border-color: #fbcfe8; }
.btn-pastel-pink:hover   { background-color: #fbcfe8; border-color: #f9a8d4; }
.btn-pastel-teal   { background-color: var(--pastel-teal);   color: #0f766e; border-color: #99f6e4; }
.btn-pastel-teal:hover   { background-color: #99f6e4; border-color: #5eead4; }
.btn-pastel-orange { background-color: var(--pastel-orange); color: #c2410c; border-color: #fed7aa; }
.btn-pastel-orange:hover { background-color: #fed7aa; border-color: #fdba74; }

/* ── Pastel Outline Buttons ── */
.btn-outline-pastel-blue   { background: transparent; color: #1d4ed8; border-color: #93c5fd; }
.btn-outline-pastel-blue:hover   { background-color: var(--pastel-blue);   border-color: #93c5fd; }
.btn-outline-pastel-green  { background: transparent; color: #15803d; border-color: #86efac; }
.btn-outline-pastel-green:hover  { background-color: var(--pastel-green);  border-color: #86efac; }
.btn-outline-pastel-yellow { background: transparent; color: #a16207; border-color: #fcd34d; }
.btn-outline-pastel-yellow:hover { background-color: var(--pastel-yellow); border-color: #fcd34d; }
.btn-outline-pastel-red    { background: transparent; color: #b91c1c; border-color: #fca5a5; }
.btn-outline-pastel-red:hover    { background-color: var(--pastel-red);    border-color: #fca5a5; }
.btn-outline-pastel-purple { background: transparent; color: #6d28d9; border-color: #c4b5fd; }
.btn-outline-pastel-purple:hover { background-color: var(--pastel-purple); border-color: #c4b5fd; }
.btn-outline-pastel-pink   { background: transparent; color: #be185d; border-color: #f9a8d4; }
.btn-outline-pastel-pink:hover   { background-color: var(--pastel-pink);   border-color: #f9a8d4; }
.btn-outline-pastel-teal   { background: transparent; color: #0f766e; border-color: #5eead4; }
.btn-outline-pastel-teal:hover   { background-color: var(--pastel-teal);   border-color: #5eead4; }
.btn-outline-pastel-orange { background: transparent; color: #c2410c; border-color: #fdba74; }
.btn-outline-pastel-orange:hover { background-color: var(--pastel-orange); border-color: #fdba74; }

/* ══════════════════════════════════════════════════════════════════════════
   BADGES / STATUS
══════════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: .2rem;
  font-family: var(--font); font-size: 10.5px; font-weight: 500;
  padding: .1rem .4rem; border-radius: calc(var(--radius) - 2px);
  white-space: nowrap; border: 1px solid transparent;
}
.badge-dot::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.badge-outline { background: transparent; border-color: var(--border); color: var(--muted-foreground); }
.badge-green  { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.badge-red    { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.badge-yellow { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-blue   { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-gray   { background: var(--muted); color: var(--muted-foreground); border-color: var(--border); }
.badge-purple { background: #faf5ff; color: #7c3aed; border-color: #ddd6fe; }

/* ══════════════════════════════════════════════════════════════════════════
   STAT CARDS
══════════════════════════════════════════════════════════════════════════ */
.stat-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); padding: .75rem .875rem;
}
.stat-card .stat-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .25rem; }
.stat-card .stat-label { font-size: 11px; font-weight: 500; color: var(--muted-foreground); }
.stat-card .stat-icon { color: var(--muted-foreground); font-size: 13px; }
.stat-card .stat-value { font-size: 20px; font-weight: 600; line-height: 1.2; color: var(--foreground); }
.stat-card .stat-meta { font-size: 10.5px; color: var(--muted-foreground); margin-top: .15rem; display: flex; align-items: center; gap: .25rem; }
.stat-card .stat-meta .up   { color: var(--success); }
.stat-card .stat-meta .down { color: var(--destructive); }

/* ══════════════════════════════════════════════════════════════════════════
   CARDS / PANELS
══════════════════════════════════════════════════════════════════════════ */
.cn-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.06), 0 0 0 0 transparent;
}
.cn-card-header {
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .5rem; min-height: 36px;
}
.cn-card-header h2 { font-size: 12.5px; font-weight: 600; margin: 0; }
.cn-card-header-title { font-size: 14px; font-weight: 600; color: var(--foreground); }
.cn-card-header .card-actions { margin-left: auto; display: flex; gap: .3rem; align-items: center; }
.cn-card-body { padding: .75rem; }
.cn-card-body.no-pad { padding: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   TABS
══════════════════════════════════════════════════════════════════════════ */
.cn-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  margin-bottom: .75rem;
}
.cn-tab {
  padding: .35rem .75rem; font-size: 12px; font-weight: 500;
  color: var(--muted-foreground); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .1s, border-color .1s; white-space: nowrap;
}
.cn-tab:hover { color: var(--foreground); }
.cn-tab.active { color: var(--foreground); border-bottom-color: var(--foreground); }

/* ══════════════════════════════════════════════════════════════════════════
   ALERTS
══════════════════════════════════════════════════════════════════════════ */

.alert-dismissible .btn-close {
  padding: 0.7rem 0.7rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   DENSE TABLE
══════════════════════════════════════════════════════════════════════════ */
.cn-table-wrap { overflow-x: auto; }

.cn-table {
  width: 100%; border-collapse: collapse;
  font-size: 12px; font-family: var(--font);
}

.cn-table thead th {
  padding: .3rem .6rem;
  font-size: 11px; font-weight: 500;
  color: var(--muted-foreground);
  background: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap; text-align: left;
  position: sticky; top: 0;
  user-select: none;
}
.cn-table thead th.sortable { cursor: pointer; }
.cn-table thead th.sortable:hover { color: var(--foreground); }
.cn-table thead th .sort-icon { font-size: 9px; margin-left: .15rem; opacity: .5; }
.cn-table thead th.sorted .sort-icon { opacity: 1; color: var(--foreground); }

.cn-table thead th:first-child { padding-left: .75rem; }
.cn-table thead th:last-child  { padding-right: .75rem; }

.cn-table tbody td {
  padding: .3rem .6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle; color: var(--foreground);
  white-space: nowrap;
}
.cn-table tbody td:first-child { padding-left: .75rem; }
.cn-table tbody td:last-child  { padding-right: .75rem; }
.cn-table tbody tr:last-child td { border-bottom: none; }
.cn-table tbody tr:hover td { background: var(--muted); }
.cn-table tbody tr.selected td { background: color-mix(in srgb, var(--primary) 5%, transparent); }

/* Mono cells */
.cn-table .mono { font-family: var(--font-mono); font-size: 11px; }
.cn-table .link-cell { color: var(--info); font-weight: 500; cursor: pointer; }
.cn-table .link-cell:hover { text-decoration: underline; }
.cn-table .num-cell { text-align: right; font-family: var(--font-mono); font-size: 11.5px; }
.cn-table td.num-cell { font-family: var(--font);}
.cn-table .muted-cell { color: var(--muted-foreground); font-size: 11px; }
.cn-table .actions-cell { gap: .25rem; }
.cn-table thead td, .cn-table thead th { font-family: var(--font); }

/* Checkbox col */
.cn-table .check-col { width: 28px; }
.cn-table input[type="checkbox"] {
  width: 12px; height: 12px; accent-color: var(--primary);
  cursor: pointer; border-radius: 2px;
}

/* Table footer / pagination */
.cn-table-footer {
  padding: .35rem .75rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: .5rem;
  font-size: 11px; color: var(--muted-foreground);
  background: var(--muted);
}
.cn-table-footer .pagination { margin-left: auto; display: flex; gap: .2rem; }
.cn-table-footer .page-btn {
  height: 22px; min-width: 22px; border-radius: calc(var(--radius) - 1px);
  border: 1px solid var(--border); background: var(--background);
  font-size: 11px; cursor: pointer; color: var(--foreground);
  display: flex; align-items: center; justify-content: center; padding: 0 .35rem;
}
.cn-table-footer .page-btn:hover { background: var(--accent); }
.cn-table-footer .page-btn.active { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.cn-table-footer .page-btn:disabled { opacity: .4; cursor: not-allowed; }

#product-detail-table tr {
  height: 39px;
}

/* ══════════════════════════════════════════════════════════════════════════
   FORM CONTROLS
══════════════════════════════════════════════════════════════════════════ */
.cn-label {
  display: block; font-size: 11.5px; font-weight: 500;
  color: var(--foreground); margin-bottom: .2rem;
}
.cn-label .required { color: var(--destructive); }

.cn-input {
  width: 100%; height: 28px; font-family: var(--font); font-size: 12px;
  border: 1px solid var(--input); border-radius: var(--radius);
  background: var(--background); color: var(--foreground);
  padding: 0 .6rem; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.cn-input:focus { border-color: var(--ring); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 15%, transparent); }
.cn-input:disabled, .cn-input[readonly] { background: var(--muted); color: var(--muted-foreground); cursor: not-allowed; }
textarea.cn-input { height: auto; padding: .4rem .6rem; resize: vertical; }
select.cn-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%2371717a'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .55rem center;
  padding-right: 1.75rem;
}

.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .5rem .75rem; margin-bottom: .5rem; }
.form-field { display: flex; flex-direction: column; }

/* Inline filter bar */
.filter-bar {
  display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
  padding: .45rem .75rem; border-bottom: 1px solid var(--border);
  background: var(--background);
}
.filter-bar .filter-search {
  position: relative; flex: 1; min-width: 140px; max-width: 240px;
}
.filter-bar .filter-search input {
  width: 100%; height: 26px; font-family: var(--font); font-size: 11.5px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--background); padding: 0 .6rem 0 1.6rem;
  color: var(--foreground); outline: none;
}
.filter-bar .filter-search input:focus { border-color: var(--ring); }
.filter-bar .filter-search i { position: absolute; left: .45rem; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); font-size: 11px; }
.filter-bar select {
  height: 26px; font-family: var(--font); font-size: 11.5px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--background); color: var(--foreground);
  padding: 0 1.5rem 0 .5rem; outline: none; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%2371717a'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .45rem center;
}
.filter-bar .filter-actions { margin-left: auto; display: flex; gap: .3rem; }
.selected-count { font-size: 11px; color: var(--muted-foreground); }

/* ══════════════════════════════════════════════════════════════════════════
   SELECT2
══════════════════════════════════════════════════════════════════════════ */

.select2-container--default .select2-selection--single {
  border: 1px solid var(--input);
}

/* ══════════════════════════════════════════════════════════════════════════
   MINI CHART (CSS only)
══════════════════════════════════════════════════════════════════════════ */
.sparkline { display: flex; align-items: flex-end; gap: 2px; height: 32px; }
.sparkline .bar {
  flex: 1; border-radius: 1px 1px 0 0;
  background: var(--border); transition: background .1s;
}
.sparkline .bar:hover { background: var(--muted-foreground); }
.sparkline .bar.hi { background: color-mix(in srgb, var(--foreground) 70%, transparent); }

/* ══════════════════════════════════════════════════════════════════════════
   ACTIVITY FEED
══════════════════════════════════════════════════════════════════════════ */
.activity-list { display: flex; flex-direction: column; }
.activity-entry {
  display: flex; gap: .5rem; align-items: flex-start;
  padding: .4rem .75rem; border-bottom: 1px solid var(--border);
  font-size: 11.5px;
}
.activity-entry:last-child { border-bottom: none; }
.activity-entry .av {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  font-size: 9px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center;
  margin-top: .1rem;
}
.activity-entry .av-content { flex: 1; }
.activity-entry .av-text { color: var(--foreground); line-height: 1.4; }
.activity-entry .av-text strong { font-weight: 600; }
.activity-entry .av-time { font-size: 10.5px; color: var(--muted-foreground); }
.activity-entry .av-link { color: var(--info); }

/* ══════════════════════════════════════════════════════════════════════════
   MISC UTILITIES
══════════════════════════════════════════════════════════════════════════ */
.divider-x { height: 1px; background: var(--border); }
.text-muted { color: var(--muted-foreground) !important; }
.font-mono  { font-family: var(--font-mono) !important; }
.text-right { text-align: right; }
.gap-1 { gap: .25rem; }
.grid-cols-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .625rem; }
.grid-cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .625rem; }
.grid-cols-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: .625rem; }
.mt-1 { margin-top: .25rem; }  .mt-2 { margin-top: .5rem; } .mt-3 { margin-top: .75rem; }
.mb-1 { margin-bottom: .25rem; } .mb-2 { margin-bottom: .5rem; } .mb-3 { margin-bottom: .75rem; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.flex-1 { flex: 1; } .gap-2 { gap: .5rem; }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 767.98px) {
  .cn-sidebar { display: none; }
  .cn-layout { height: auto; flex-direction: column; }
  .cn-main { height: auto; }
}

/* ══════════════════════════════════════════════════════════════════════════
   X-CLOAK (Alpine.js)
══════════════════════════════════════════════════════════════════════════ */
[x-cloak] { display: none !important; }

/* ══════════════════════════════════════════════════════════════════════════
   DENOMINATION GRID (pos_control: new_entry, close_entry, session_final_report)
══════════════════════════════════════════════════════════════════════════ */
.denom-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.denom-item { display: flex; flex-direction: column; gap: 3px; }
.denom-label { font-size: 13px; font-weight: 600; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .04em; }
.denom-input {
    height: 44px; font-size: 20px; font-weight: 500;
    font-family: var(--font-mono, monospace); text-align: center;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--background); color: var(--foreground);
    padding: 0 10px; width: 100%;
}
.denom-input[readonly] { background: var(--accent); color: var(--muted-foreground); cursor: default; }
.denom-input:not([readonly]):focus { outline: 2px solid var(--pink); outline-offset: 1px; }
.denom-total { font-size: 11.5px; font-weight: 500; font-family: var(--font-mono, monospace); text-align: right; color: var(--muted-foreground); padding-right: 4px; }
.denom-total.has-value { color: var(--pink); font-weight: 700; }
.total-bar {
    background: var(--foreground); color: var(--background);
    border-radius: var(--radius); padding: 18px 24px;
    display: flex; align-items: center; justify-content: space-between;
}
.total-bar-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; opacity: .7; }
.total-bar-value { font-size: 34px; font-weight: 700; font-family: var(--font-mono, monospace); }

/* ══════════════════════════════════════════════════════════════════════════
   POS SUMMARY LINES (pos_control: transaction_report, session_final_report)
══════════════════════════════════════════════════════════════════════════ */
.summary-line { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.summary-line:last-child { border-bottom: none; }
.summary-line-label { color: var(--muted-foreground); }
.summary-line-sub { color: var(--muted-foreground); font-size: 12px; padding-left: 20px; }
.summary-line-value { font-family: var(--font-mono, monospace); font-weight: 600; font-size: 15px; }
.summary-line-icon { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; margin-right: 10px; }
.icon-add { background: #dcfce7; color: #16a34a; }
.icon-sub { background: #fee2e2; color: #dc2626; }
.icon-neu { background: #e0e7ff; color: #4f46e5; }
.expected-box { background: var(--foreground); color: var(--background); border-radius: var(--radius); padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.diff-box { border-radius: var(--radius); padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; margin-top: 8px; border: 2px solid; }
.diff-ok   { border-color: #16a34a; background: #f0fdf4; color: #15803d; }
.diff-warn { border-color: #dc2626; background: #fef2f2; color: #b91c1c; }
.mono-lg   { font-family: var(--font-mono, monospace); font-size: 26px; font-weight: 700; }

/* ══════════════════════════════════════════════════════════════════════════
   DATATABLE CHILD ROWS (pos_control: location_sales_history)
══════════════════════════════════════════════════════════════════════════ */
td.dt-control { cursor: pointer; text-align: center; }
td.dt-control::before { content: '▶'; color: var(--primary); font-size: .8rem; }
tr.dt-hasChild td.dt-control::before { content: '▼'; color: var(--muted-foreground); }
.child-detail-box { padding: 12px 20px; background: var(--accent); border-top: 2px solid var(--border); }
.child-lines-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.child-lines-table th { background: var(--muted); padding: 6px 10px; font-weight: 600; }
.child-lines-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); }

/* ══════════════════════════════════════════════════════════════════════════
   LABELS PRINT — SEARCH RESULTS
══════════════════════════════════════════════════════════════════════════ */
.result-row { cursor: pointer; }
.result-row:hover td { background: var(--cn-hover-bg, #f5f5f5); }

/* ══════════════════════════════════════════════════════════════════════════
   CATEGORY TREE (magento1_bridge: create_magento1_case_protection_alpine)
══════════════════════════════════════════════════════════════════════════ */
.caret { cursor: pointer; user-select: none; }
.caret::before { font-family: "bootstrap-icons"; content: "\f285"; color: #4aa2ee; display: inline-block; margin-right: 6px; transition: transform 0.15s ease; }
.caret-down::before { transform: rotate(90deg); }
.nested { display: none; }
.nested.active { display: block; }
.wg-error { border-color: #dc3545 !important; }
.error-message { color: #dc3545; font-size: 0.875rem; margin-top: 0.25rem; }
.manufacturer-group { border: 2px solid var(--cn-border, #e0e0e0); border-radius: 8px; padding: 15px; margin-bottom: 15px; background: var(--cn-muted-bg, #fafafa); }
.manufacturer-group-header { display: flex; align-items: center; margin-bottom: 10px; }
.color-group { border-left: 3px solid #4aa2ee; padding-left: 12px; margin-left: 10px; margin-bottom: 10px; }
@keyframes blinker { from { opacity: 1; } to { opacity: 0; } }
.blink { color: #ef4444; font-size: 14px; animation: blinker 1.5s ease-in-out infinite alternate; }
.form-row .select2-container { width: 100% !important; }
.model-group{border: 1px solid var(--cn-border, #e0e0e0); padding: 5px 10px; background-color: var(--cn-on-muted-bg, #fafafa); margin-bottom: 10px; border-radius: var(--radius)}
a.color-set-add-btn {color: var(--cn-muted-text); background-color: var(--cn-border); padding: 4px 8px; border-radius: var(--radius);}
a.color-set-add-btn i {color: var(--cn-muted-text);}

/* ══════════════════════════════════════════════════════════════════════════
   PARTNER DETAIL — TABS
══════════════════════════════════════════════════════════════════════════ */
.tab-pane-partner { display: none; }
.tab-pane-partner.active { display: block; }

/* ══════════════════════════════════════════════════════════════════════════
   STOCK VALUE REPORT (warehouse)
══════════════════════════════════════════════════════════════════════════ */
.sv-stat-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); padding: .6rem .875rem .55rem; height: 80px; display: flex; flex-direction: column; justify-content: center; }
.sv-stat-label { font-size: 11px; font-weight: 500; color: var(--muted-foreground); display: flex; align-items: center; gap: .3rem; margin-bottom: .2rem; }
.sv-stat-label i { font-size: 12px; }
.sv-stat-value { font-size: 19px; font-weight: 600; line-height: 1.15; color: var(--foreground); }
.sv-stat-meta { font-size: 10.5px; color: var(--muted-foreground); margin-top: .1rem; }
.sv-sparkline-wrap { display: flex; align-items: flex-end; gap: 4px; height: 56px; padding: 0 .25rem; }
.sv-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; cursor: default; }
.sv-bar { width: 100%; max-width: 48px; border-radius: 2px 2px 0 0; background: var(--border); transition: background .1s; min-height: 3px; }
.sv-bar-col:hover .sv-bar { background: var(--muted-foreground); }
.sv-bar-label { font-size: 10px; color: var(--muted-foreground); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; text-align: center; padding: 0 2px; }
.sv-bar-col .sv-tooltip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--foreground); color: var(--primary-fg); font-size: 10.5px; border-radius: 4px; padding: .3rem .5rem; white-space: nowrap; z-index: 10; pointer-events: none; line-height: 1.5; text-align: left; }
.sv-bar-col .sv-tooltip::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 4px solid transparent; border-top-color: var(--foreground); }
.sv-bar-col:hover .sv-tooltip { display: block; font-size: 0.7rem}

/* ══════════════════════════════════════════════════════════════════════════
   INVOICING LINES TABLE (purchase_detail, sales_detail)
══════════════════════════════════════════════════════════════════════════ */
.lines-table td input[type="number"],
.lines-table td input[type="text"] { padding: 2px 4px !important; font-size: 11px !important; height: 26px !important; }
.lines-table td input[type="number"]::-webkit-inner-spin-button,
.lines-table td input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.lines-table td input[type="number"] { -moz-appearance: textfield; }
.lines-table thead th { position: sticky; top: 0; z-index: 2; background: #fff; }
.lines-table tbody tr { contain: style; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.skeleton-line { height: 18px; background: #e9ecef; border-radius: 3px; animation: pulse 1.2s ease-in-out infinite; }

/* ══════════════════════════════════════════════════════════════════════════
   ACC MESSAGING — file upload, message thread (acc_message_create/detail)
══════════════════════════════════════════════════════════════════════════ */
.file-drop-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 20px; text-align: center; cursor: pointer; transition: border-color .2s; }
.file-drop-zone:hover, .file-drop-zone.drag-over { border-color: var(--primary); background: var(--accent); }
.attachment-item { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; margin: 4px 0; background: var(--accent); border: 1px solid var(--border); border-radius: var(--radius); }
.attachment-item .file-info { flex: 1; }
.attachment-item .file-name { font-weight: 500; font-size: 13px; color: var(--foreground); }
.attachment-item .file-size { font-size: 11px; color: var(--muted-foreground); }
.attachment-item .remove-btn { color: var(--destructive, #dc3545); cursor: pointer; font-size: 1.2rem; margin-left: 10px; line-height: 1; }
.attachment-item .remove-btn:hover { opacity: .7; }
.attachment-limits { font-size: 12px; color: var(--muted-foreground); }

/* Message thread bubbles */
.msg-bubble { padding: 14px 18px; border-radius: var(--radius); }
.msg-employee { background: var(--accent); border-left: 3px solid var(--primary); }
.msg-accounting { background: #f0fdf4; border-left: 3px solid #16a34a; }
.msg-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.msg-author { font-weight: 600; font-size: 13px; color: var(--foreground); }
.msg-time { font-size: 11px; color: var(--muted-foreground); }
.msg-body { font-size: 14px; color: var(--foreground); line-height: 1.6; }
.msg-attachments { padding-top: 10px; border-top: 1px solid var(--border); }
.reply-area { border-top: 2px solid var(--border); padding-top: 20px; }

/* ══════════════════════════════════════════════════════════════════════════
   VACATION TRACKER — calendar grid (calendar_view_cn)
══════════════════════════════════════════════════════════════════════════ */
.vac-calendar-table { border-collapse: collapse; width: 100%; min-width: 800px; }
.vac-calendar-table th, .vac-calendar-table td { border-right: 1px solid var(--border); }
.vac-calendar-table thead th { background: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 6px 4px; text-align: center; border-bottom: 2px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 2; }
.vac-calendar-table tbody td { border-bottom: 1px solid var(--border); padding: 4px; }
.vac-calendar-table tbody tr:hover td { background: var(--accent); }
.vac-name-col { min-width: 120px; max-width: 160px; text-align: left !important; padding-left: 10px !important; }
.vac-day-col { width: 32px; min-width: 28px; text-align: center; }
.vac-today { background: color-mix(in srgb, var(--primary) 8%, transparent) !important; }
.vac-dayname { display: block; font-size: 9px; color: var(--muted-foreground); line-height: 1; }
.vac-daynum { display: block; font-size: 12px; font-weight: 600; }
.vac-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.vac-emp-link { font-size: 13px; font-weight: 500; color: var(--foreground); text-decoration: none; }
.vac-emp-link:hover { color: var(--primary); }
.vac-emp-loc { font-size: 11px; color: var(--muted-foreground); display: none; padding-left: 18px; }
.vac-emp-loc.visible { display: block; }
.vac-loc-toggle { width: 16px; height: 16px; border: none; background: none; padding: 0; cursor: pointer; color: var(--muted-foreground); display: flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 3px; }
.vac-loc-toggle:hover { background: var(--border); color: var(--foreground); }
.vac-loc-toggle i { font-size: 9px; transition: transform .15s; }
.vac-loc-toggle.open i { transform: rotate(90deg); }
.vac-loc-toggle-placeholder { width: 16px; flex-shrink: 0; display: inline-block; }
