/* BrightCarz Inventory Admin — full-width panel */

:root,
[data-theme="classic"] {
  /* Classic — navy + magenta (default) */
  --brand-red: #c8102e;
  --brand-magenta: #d4145a;
  --brand-blue: #0a2a5c;
  --brand-blue-mid: #1a4a8c;
  --brand-blue-bright: #2d6bb8;
  --brand-star: #e31c3d;
  --tint-rgb: 10, 42, 92;
  --accent-rgb: 212, 20, 90;
  --sidebar-0: #0a2a5c;
  --sidebar-1: #123a72;
  --sidebar-2: #1a4a8c;
  --sidebar-deep: #061a3a;
  --glow-mid: 45, 107, 184;

  --shell: #ffffff;
  --surface: #f3f6fb;
  --surface-2: #e7edf6;
  --ink: #0a2a5c;
  --ink-soft: #4a5d7a;
  --ink-mute: #7a8ba3;
  --line: rgba(var(--tint-rgb), 0.08);
  --accent: var(--brand-magenta);
  --accent-soft: #fce4ec;
  --ok: #0f7a45;
  --ok-soft: #e6f6ee;
  --warn: #c45c12;
  --warn-soft: #fff1e6;
  --info: var(--brand-blue-mid);
  --info-soft: #e4eef9;
  --shadow-card: 0 8px 24px rgba(var(--tint-rgb), 0.07);
  --radius-card: 16px;
  --radius-pill: 999px;
  --sidebar-w: 120px;
  --font: "Manrope", sans-serif;
  --display: "Sora", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Ocean — teal + coral */
[data-theme="ocean"] {
  --brand-red: #c2410c;
  --brand-magenta: #e85d4c;
  --brand-blue: #0b4f5c;
  --brand-blue-mid: #0f6a7a;
  --brand-blue-bright: #1494a8;
  --brand-star: #e85d4c;
  --tint-rgb: 11, 79, 92;
  --accent-rgb: 232, 93, 76;
  --sidebar-0: #083d48;
  --sidebar-1: #0b4f5c;
  --sidebar-2: #0f6a7a;
  --sidebar-deep: #042830;
  --glow-mid: 20, 148, 168;
  --surface: #f2f8f9;
  --surface-2: #e3eef1;
  --ink: #0b4f5c;
  --ink-soft: #4a6b73;
  --ink-mute: #7a9399;
  --accent-soft: #fde8e4;
  --info-soft: #e0f3f6;
}

/* Graphite — charcoal + amber */
[data-theme="graphite"] {
  --brand-red: #b45309;
  --brand-magenta: #d97706;
  --brand-blue: #1f2937;
  --brand-blue-mid: #374151;
  --brand-blue-bright: #4b5563;
  --brand-star: #d97706;
  --tint-rgb: 31, 41, 55;
  --accent-rgb: 217, 119, 6;
  --sidebar-0: #111827;
  --sidebar-1: #1f2937;
  --sidebar-2: #374151;
  --sidebar-deep: #030712;
  --glow-mid: 75, 85, 99;
  --surface: #f4f5f7;
  --surface-2: #e5e7eb;
  --ink: #1f2937;
  --ink-soft: #4b5563;
  --ink-mute: #6b7280;
  --accent-soft: #fef3c7;
  --info-soft: #e5e7eb;
}

/* Forest — deep green + gold */
[data-theme="forest"] {
  --brand-red: #a16207;
  --brand-magenta: #ca8a04;
  --brand-blue: #14532d;
  --brand-blue-mid: #166534;
  --brand-blue-bright: #15803d;
  --brand-star: #ca8a04;
  --tint-rgb: 20, 83, 45;
  --accent-rgb: 202, 138, 4;
  --sidebar-0: #0f3d22;
  --sidebar-1: #14532d;
  --sidebar-2: #166534;
  --sidebar-deep: #052e16;
  --glow-mid: 21, 128, 61;
  --surface: #f3f7f4;
  --surface-2: #e4ede6;
  --ink: #14532d;
  --ink-soft: #3f6b4f;
  --ink-mute: #6b8a75;
  --accent-soft: #fef9c3;
  --info-soft: #dcfce7;
}

/* Steel — slate + electric blue */
[data-theme="steel"] {
  --brand-red: #1d4ed8;
  --brand-magenta: #2563eb;
  --brand-blue: #243447;
  --brand-blue-mid: #334155;
  --brand-blue-bright: #475569;
  --brand-star: #2563eb;
  --tint-rgb: 36, 52, 71;
  --accent-rgb: 37, 99, 235;
  --sidebar-0: #1a2736;
  --sidebar-1: #243447;
  --sidebar-2: #334155;
  --sidebar-deep: #0f172a;
  --glow-mid: 59, 130, 246;
  --surface: #f4f6f9;
  --surface-2: #e8edf3;
  --ink: #243447;
  --ink-soft: #475569;
  --ink-mute: #64748b;
  --accent-soft: #dbeafe;
  --info-soft: #e2e8f0;
}

/* Crimson — wine + rose */
[data-theme="crimson"] {
  --brand-red: #9f1239;
  --brand-magenta: #e11d48;
  --brand-blue: #4a0e1f;
  --brand-blue-mid: #7f1d35;
  --brand-blue-bright: #9f1239;
  --brand-star: #e11d48;
  --tint-rgb: 74, 14, 31;
  --accent-rgb: 225, 29, 72;
  --sidebar-0: #3b0a18;
  --sidebar-1: #4a0e1f;
  --sidebar-2: #7f1d35;
  --sidebar-deep: #1f040c;
  --glow-mid: 244, 63, 94;
  --surface: #faf4f6;
  --surface-2: #f1e4e8;
  --ink: #4a0e1f;
  --ink-soft: #6b3a48;
  --ink-mute: #94707a;
  --accent-soft: #ffe4e6;
  --info-soft: #fce7f3;
}

/* Midnight — near-black + cyan */
[data-theme="midnight"] {
  --brand-red: #0891b2;
  --brand-magenta: #22d3ee;
  --brand-blue: #0b1220;
  --brand-blue-mid: #1e293b;
  --brand-blue-bright: #334155;
  --brand-star: #22d3ee;
  --tint-rgb: 11, 18, 32;
  --accent-rgb: 34, 211, 238;
  --sidebar-0: #060a12;
  --sidebar-1: #0b1220;
  --sidebar-2: #1e293b;
  --sidebar-deep: #020617;
  --glow-mid: 6, 182, 212;
  --surface: #f1f5f9;
  --surface-2: #e2e8f0;
  --ink: #0b1220;
  --ink-soft: #334155;
  --ink-mute: #64748b;
  --accent-soft: #cffafe;
  --info-soft: #e0f2fe;
}

/* Copper — espresso + copper */
[data-theme="copper"] {
  --brand-red: #c2410c;
  --brand-magenta: #ea580c;
  --brand-blue: #2c1810;
  --brand-blue-mid: #5c3420;
  --brand-blue-bright: #7c4a2d;
  --brand-star: #ea580c;
  --tint-rgb: 44, 24, 16;
  --accent-rgb: 234, 88, 12;
  --sidebar-0: #1c100a;
  --sidebar-1: #2c1810;
  --sidebar-2: #5c3420;
  --sidebar-deep: #120a06;
  --glow-mid: 249, 115, 22;
  --surface: #f7f3f0;
  --surface-2: #ebe3dc;
  --ink: #2c1810;
  --ink-soft: #6b4a3a;
  --ink-mute: #9a7d6c;
  --accent-soft: #ffedd5;
  --info-soft: #ffedd5;
}

/* Azure — sky blue + bright cyan */
[data-theme="azure"] {
  --brand-red: #0369a1;
  --brand-magenta: #0284c7;
  --brand-blue: #0c4a6e;
  --brand-blue-mid: #0369a1;
  --brand-blue-bright: #0ea5e9;
  --brand-star: #0284c7;
  --tint-rgb: 12, 74, 110;
  --accent-rgb: 2, 132, 199;
  --sidebar-0: #0a3a57;
  --sidebar-1: #0c4a6e;
  --sidebar-2: #0369a1;
  --sidebar-deep: #082f49;
  --glow-mid: 14, 165, 233;
  --surface: #f0f9ff;
  --surface-2: #e0f2fe;
  --ink: #0c4a6e;
  --ink-soft: #3d6f8c;
  --ink-mute: #6b93a8;
  --accent-soft: #e0f2fe;
  --info-soft: #e0f2fe;
}

/* Ink Teal — slate + teal */
[data-theme="ink"] {
  --brand-red: #0f766e;
  --brand-magenta: #14b8a6;
  --brand-blue: #0f172a;
  --brand-blue-mid: #1e293b;
  --brand-blue-bright: #334155;
  --brand-star: #14b8a6;
  --tint-rgb: 15, 23, 42;
  --accent-rgb: 20, 184, 166;
  --sidebar-0: #020617;
  --sidebar-1: #0f172a;
  --sidebar-2: #1e293b;
  --sidebar-deep: #01040f;
  --glow-mid: 45, 212, 191;
  --surface: #f8fafc;
  --surface-2: #e2e8f0;
  --ink: #0f172a;
  --ink-soft: #334155;
  --ink-mute: #64748b;
  --accent-soft: #ccfbf1;
  --info-soft: #e2e8f0;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface);
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.is-hidden,
[hidden] {
  display: none !important;
}

.welcome-block.is-hidden,
.welcome-block[hidden] {
  display: none !important;
  margin: 0;
  padding: 0;
  height: 0;
  overflow: hidden;
}

/* Full-width shell */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  background: var(--shell);
  overflow: hidden;
}

/* Compact left sidebar — scrolls when items overflow */
.sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 6px 10px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--sidebar-0) 0%, var(--sidebar-1) 55%, var(--sidebar-2) 100%);
  color: #fff;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

.sidebar-brand {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  flex-shrink: 0;
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  background: #fff;
}

.side-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.side-nav-scroll {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  padding: 0 2px 4px 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  /* Skote-like thin scrollbar (Firefox) */
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.side-nav-scroll:hover {
  scrollbar-color: rgba(162, 173, 183, 0.65) transparent;
}

/* Skote-like thin scrollbar (Chromium / Safari) */
.side-nav-scroll::-webkit-scrollbar {
  width: 6px;
}

.side-nav-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.side-nav-scroll::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 7px;
}

.side-nav-scroll:hover::-webkit-scrollbar-thumb,
.side-nav-scroll:focus-within::-webkit-scrollbar-thumb {
  background: rgba(162, 173, 183, 0.65);
}

.side-nav-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(162, 173, 183, 0.85);
}

.side-nav-foot {
  flex-shrink: 0;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.nav-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
  flex-shrink: 0;
}

.nav-item:hover,
a.nav-item:hover,
a.nav-item:not(.btn):hover {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.nav-item.is-active,
a.nav-item.is-active,
a.nav-item.is-active:hover {
  color: #fff !important;
}

.nav-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease);
}

.nav-icon svg,
.nav-icon i {
  width: 26px;
  height: 26px;
  font-size: 26px;
  line-height: 1;
  display: block;
}

.nav-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-align: center;
  line-height: 1.15;
  max-width: 108px;
}

.nav-item.is-active .nav-icon {
  background: var(--brand-magenta);
  color: #fff;
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.45);
}

/* Scale nav denser on shorter desktop viewports only */
@media (max-height: 820px) and (min-width: 821px) {
  .sidebar {
    gap: 6px;
    padding: 8px 5px;
  }

  .sidebar-brand {
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .nav-icon {
    width: 44px;
    height: 44px;
  }

  .nav-icon svg,
  .nav-icon i {
    width: 24px;
    height: 24px;
    font-size: 24px;
  }

  .nav-item {
    padding: 6px 2px;
  }

  .nav-label {
    font-size: 11px;
  }
}

@media (max-height: 700px) and (min-width: 821px) {
  .nav-label {
    display: none;
  }

  .nav-item {
    padding: 5px 2px;
  }

  .nav-icon {
    width: 42px;
    height: 42px;
  }

  .nav-icon svg,
  .nav-icon i {
    width: 22px;
    height: 22px;
    font-size: 22px;
  }
}

/* Main */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 28px;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  flex-shrink: 0;
}

.topbar-brand-text {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
}

.product-name {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand-blue);
}

.product-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand-magenta);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Page tabs — full-width strip under the header */
.top-menu {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 20px;
  background: color-mix(in srgb, var(--brand-blue) 8%, var(--surface));
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--brand-blue) 14%, var(--line));
  border-radius: 0;
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 48px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--tint-rgb), 0.25) transparent;
  flex-shrink: 0;
}

.top-menu::-webkit-scrollbar {
  height: 3px;
}

.top-menu::-webkit-scrollbar-thumb {
  background: rgba(var(--tint-rgb), 0.25);
  border-radius: 999px;
}

.top-menu:empty {
  display: none;
}

.top-menu-btn,
.top-menu-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid color-mix(in srgb, var(--brand-blue) 10%, transparent);
  border-radius: 8px;
  font-family: var(--display);
  font-size: 0.92rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--brand-blue);
  white-space: nowrap;
  text-decoration: none;
  background: #fff;
  box-shadow: none;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.top-menu-btn::after,
.top-menu-link::after {
  content: none;
}

.top-menu-btn:hover,
.top-menu-link:hover {
  color: var(--brand-blue);
  background: var(--info-soft);
  border-color: color-mix(in srgb, var(--brand-blue) 22%, transparent);
}

.top-menu .top-menu-btn.is-active,
.top-menu .top-menu-link.is-active {
  color: #fff !important;
  background: var(--brand-magenta) !important;
  border-color: var(--brand-magenta) !important;
  box-shadow: none;
  outline: none;
  font-weight: 700;
}

.top-menu .top-menu-btn.is-active:hover,
.top-menu .top-menu-link.is-active:hover {
  color: #fff !important;
  background: var(--brand-magenta) !important;
  border-color: var(--brand-magenta) !important;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
  flex-shrink: 0;
  overflow: visible;
}

.topbar .icon-btn {
  width: 32px;
  height: 32px;
}

.topbar .icon-btn svg {
  width: 16px;
  height: 16px;
}

.topbar .avatar {
  width: 30px;
  height: 30px;
  font-size: 0.68rem;
}

.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink-soft);
  overflow: visible;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  background: var(--surface);
  color: var(--brand-blue);
}

.notif-dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-magenta);
  border: 2px solid #fff;
  z-index: 2;
}

.notif-count {
  position: absolute;
  top: -2px;
  right: -4px;
  z-index: 3;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--brand-magenta);
  color: #fff !important;
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(var(--accent-rgb), 0.35);
  pointer-events: none;
}

.notif-menu {
  position: relative;
  overflow: visible;
}

.notif-menu .icon-btn {
  overflow: visible;
}

.notif-menu.is-open .icon-btn {
  background: var(--surface);
  color: var(--brand-blue);
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 50;
  width: min(340px, calc(100vw - 24px));
  padding: 8px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(var(--tint-rgb), 0.16);
  animation: rise 0.2s var(--ease) both;
}

.notif-dropdown-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.notif-dropdown-head strong {
  display: block;
  font-size: 0.9rem;
  color: var(--brand-blue);
}

.notif-dropdown-head span {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--ink-mute);
}

.notif-clear-btn {
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand-magenta);
}

.notif-clear-btn:hover {
  background: var(--accent-soft);
}

.notif-dropdown-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(360px, calc(100vh - 160px));
  overflow-y: auto;
  scrollbar-width: thin;
}

.notif-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 0.84rem;
}

.notif-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  text-align: left;
  transition: background 0.15s var(--ease);
}

.notif-item:hover {
  background: var(--surface);
}

.notif-item.is-unread {
  background: rgba(var(--accent-rgb), 0.06);
}

.notif-item-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  flex-shrink: 0;
}

.notif-item-icon svg {
  width: 16px;
  height: 16px;
}

.notif-item-icon.tone-rose { background: var(--accent-soft); color: var(--brand-magenta); }
.notif-item-icon.tone-amber { background: var(--warn-soft); color: var(--warn); }
.notif-item-icon.tone-green { background: var(--ok-soft); color: var(--ok); }
.notif-item-icon.tone-blue { background: var(--info-soft); color: var(--brand-blue); }

.notif-item strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand-blue);
}

.notif-item p {
  margin: 2px 0 0;
  font-size: 0.74rem;
  color: var(--ink-soft);
  line-height: 1.35;
}

.notif-item time {
  display: block;
  margin-top: 4px;
  font-size: 0.68rem;
  color: var(--ink-mute);
}

.notif-popup-host {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.notif-popup {
  pointer-events: auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 14px 14px 14px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-magenta);
  box-shadow: 0 16px 36px rgba(var(--tint-rgb), 0.18);
  animation: notif-slide-in 0.35s var(--ease) both;
}

.notif-popup.is-leaving {
  animation: notif-slide-out 0.28s var(--ease) both;
}

.notif-popup.tone-amber { border-left-color: var(--warn); }
.notif-popup.tone-green { border-left-color: var(--ok); }
.notif-popup.tone-blue { border-left-color: var(--brand-blue-mid); }
.notif-popup.tone-rose { border-left-color: var(--brand-magenta); }

.notif-popup-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
}

.notif-popup-icon svg {
  width: 17px;
  height: 17px;
}

.notif-popup-icon.tone-rose { background: var(--accent-soft); color: var(--brand-magenta); }
.notif-popup-icon.tone-amber { background: var(--warn-soft); color: var(--warn); }
.notif-popup-icon.tone-green { background: var(--ok-soft); color: var(--ok); }
.notif-popup-icon.tone-blue { background: var(--info-soft); color: var(--brand-blue); }

.notif-popup-copy strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 750;
  color: var(--brand-blue);
}

.notif-popup-copy p {
  margin: 3px 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.35;
}

.notif-popup-close {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--ink-mute);
}

.notif-popup-close:hover {
  background: var(--surface);
  color: var(--brand-blue);
}

.notif-popup-close svg {
  width: 14px;
  height: 14px;
}

@keyframes notif-slide-in {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes notif-slide-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(24px);
  }
}

@media (max-width: 820px) {
  .notif-popup-host {
    top: auto;
    bottom: 20px;
    right: 16px;
    left: 16px;
    width: auto;
  }
}

/* Topbar theme menu */
.theme-menu {
  position: relative;
}

.theme-menu.is-open .icon-btn {
  background: var(--surface);
  color: var(--brand-blue);
}

.theme-menu-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-magenta);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.2);
}

.theme-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 200;
  width: min(300px, calc(100vw - 24px));
  padding: 8px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(var(--tint-rgb), 0.16);
  animation: rise 0.2s var(--ease) both;
  pointer-events: auto;
}

.theme-dropdown[hidden] {
  display: none !important;
}

.theme-dropdown-head {
  padding: 10px 12px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.theme-dropdown-head strong {
  display: block;
  font-size: 0.9rem;
  color: var(--brand-blue);
}

.theme-dropdown-head span {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--ink-mute);
}

.theme-dropdown-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(420px, calc(100vh - 140px));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--tint-rgb), 0.28) transparent;
}

.theme-menu-item {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.15s var(--ease);
}

.theme-menu-item:hover {
  background: var(--surface);
}

.theme-menu-item.is-active {
  background: var(--accent-soft);
}

.theme-menu-swatch {
  display: grid;
  grid-template-columns: 1.2fr 0.7fr 0.7fr;
  width: 36px;
  height: 22px;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(var(--tint-rgb), 0.12);
  flex-shrink: 0;
}

.theme-menu-swatch span {
  display: block;
}

.theme-menu-copy strong {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--brand-blue);
}

.theme-menu-copy span {
  display: block;
  margin-top: 1px;
  font-size: 0.7rem;
  color: var(--ink-mute);
  line-height: 1.25;
}

.theme-menu-check {
  width: 16px;
  height: 16px;
  color: var(--brand-magenta);
  opacity: 0;
}

.theme-menu-item.is-active .theme-menu-check {
  opacity: 1;
}

.avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--brand-blue), var(--brand-blue-mid));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.avatar-sm {
  width: 42px;
  height: 42px;
  font-size: 0.8rem;
}

/* User avatar dropdown */
.user-menu {
  position: relative;
}

.avatar-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 2px;
  border-radius: var(--radius-pill);
  transition: background 0.2s var(--ease);
}

.avatar-btn:hover,
.user-menu.is-open .avatar-btn {
  background: var(--surface);
}

.avatar-caret {
  width: 14px;
  height: 14px;
  color: var(--ink-mute);
  transition: transform 0.2s var(--ease);
}

.user-menu.is-open .avatar-caret {
  transform: rotate(180deg);
  color: var(--brand-magenta);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 50;
  width: 280px;
  padding: 8px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(var(--tint-rgb), 0.16);
  animation: rise 0.2s var(--ease) both;
}

.user-dropdown-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 10px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.user-dropdown-head strong {
  display: block;
  font-size: 0.9rem;
  color: var(--brand-blue);
}

.user-dropdown-head span {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-mute);
  margin-top: 2px;
  word-break: break-all;
}

.user-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--ink-soft);
  text-align: left;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.user-dropdown-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--brand-blue-mid);
}

.user-dropdown-item:hover {
  background: var(--surface);
  color: var(--brand-blue);
}

.user-dropdown-item.is-danger {
  color: var(--brand-magenta);
}

.user-dropdown-item.is-danger svg {
  color: var(--brand-magenta);
}

.user-dropdown-item.is-danger:hover {
  background: var(--accent-soft);
}

.user-dropdown-sep {
  height: 1px;
  margin: 4px 8px;
  background: var(--line);
}

/* Profile page */
.profile-view {
  animation: rise 0.4s var(--ease) both;
}

.profile-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  align-items: start;
}

.profile-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  position: sticky;
  top: 0;
}

.profile-cover {
  height: 88px;
  background: linear-gradient(120deg, var(--brand-blue) 0%, var(--brand-blue-mid) 50%, var(--brand-magenta) 130%);
}

.profile-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 18px 18px;
  margin-top: -36px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--brand-blue), var(--brand-blue-mid));
  color: #fff;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
  border: 4px solid #fff;
  box-shadow: 0 8px 20px rgba(var(--tint-rgb), 0.2);
  margin-bottom: 10px;
}

.profile-identity h3 {
  margin: 0 0 2px;
  font-family: var(--display);
  font-size: 1.1rem;
  color: var(--brand-blue);
}

.profile-role {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: var(--ink-mute);
  font-weight: 600;
}

.profile-badge {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 0.72rem;
  font-weight: 750;
}

.profile-meta-list {
  list-style: none;
  margin: 0;
  padding: 0 18px 18px;
  border-top: 1px solid var(--line);
}

.profile-meta-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.profile-meta-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.profile-meta-list span {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
}

.profile-meta-list strong {
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--brand-blue);
  word-break: break-word;
}

.profile-forms {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.company-logo-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.company-logo-preview {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink-mute);
  font-size: 1.5rem;
}

.company-logo-preview .company-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #fff;
}

.company-logo-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.company-logo-hint {
  margin: 0;
  font-size: 0.78rem;
}

.profile-tabs-content .tab-panel {
  padding-bottom: 8px;
}

.profile-card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 22px 18px 18px;
}

.profile-avatar-lg {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--brand-blue), var(--brand-blue-mid));
  color: #fff;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  border: 4px solid #fff;
  box-shadow: 0 8px 20px rgba(var(--tint-rgb), 0.2);
  margin-bottom: 12px;
}

.profile-avatar-lg .profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-card-body h3 {
  margin: 0 0 2px;
  font-family: var(--display);
  font-size: 1.1rem;
  color: var(--brand-blue);
}

.profile-meta {
  width: 100%;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.profile-meta > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-meta span {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
}

.profile-meta strong {
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--brand-blue);
  word-break: break-word;
}

.profile-tabs-panel {
  min-width: 0;
}

.profile-tabs-wrap {
  position: relative;
}

.profile-tabs-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 180px;
  color: var(--ink-mute);
}

.profile-tabs-loader[hidden],
.profile-tabs-content[hidden] {
  display: none !important;
}

.profile-tab-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.profile-form-compact .form-group {
  margin-bottom: 0;
}

#profQuickLaunch.tab-panel.active {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ql-setup-intro {
  margin: 0 0 14px;
  font-size: 0.84rem;
  line-height: 1.45;
}

.ql-setup-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(280px, 1.1fr);
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.ql-setup-section {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.ql-setup-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 0.86rem;
  font-weight: 750;
  color: var(--brand-blue);
}

.ql-setup-heading i {
  color: var(--accent);
  font-size: 1.15rem;
  line-height: 1;
  display: inline-block;
}

.ql-order-list,
.ql-available-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ql-order-empty {
  list-style: none;
  margin: 0;
  padding: 22px 12px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 0.82rem;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.ql-order-empty.ql-order-error {
  color: var(--brand-red);
  border-color: color-mix(in srgb, var(--brand-red) 30%, #fff);
  background: var(--accent-soft);
}

.ql-order-item,
.ql-available-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.ql-order-item {
  cursor: default;
}

.ql-drag-handle {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: var(--ink-mute);
  cursor: grab;
  background: var(--surface);
}

.ql-drag-handle:active {
  cursor: grabbing;
}

.ql-item-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}

.ql-item-icon i {
  font-size: 18px;
  line-height: 1;
  width: auto;
  height: auto;
  display: inline-block;
  color: inherit;
}

.ql-item-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ql-item-name {
  min-width: 0;
  flex: 1;
  font-size: 0.84rem;
  font-weight: 650;
  color: var(--brand-blue);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ql-item-menu {
  font-size: 0.72rem;
  color: var(--ink-mute);
  font-weight: 600;
}

.ql-order-item .btn-remove-from-launcher {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--ink-mute);
}

.ql-order-item .btn-remove-from-launcher:hover {
  color: var(--brand-red);
  border-color: color-mix(in srgb, var(--brand-red) 35%, #fff);
  background: var(--accent-soft);
}

.ql-acc {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.ql-acc + .ql-acc {
  margin-top: 8px;
}

.ql-acc-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: var(--brand-blue);
}

.ql-acc-head:hover {
  background: var(--surface);
}

.ql-acc-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.84rem;
  font-weight: 750;
}

.ql-acc-title .ql-item-icon {
  width: 28px;
  height: 28px;
}

.ql-drag-handle i,
.ql-acc-head .chev i,
.btn-remove-from-launcher i,
.btn-add-to-launcher i {
  font-size: 16px;
  line-height: 1;
  display: inline-block;
}

.ql-acc-head .chev {
  display: grid;
  place-items: center;
  color: var(--ink-mute);
  transition: transform 0.18s var(--ease);
}

.ql-acc.open .ql-acc-head .chev {
  transform: rotate(90deg);
}

.ql-acc:not(.open) .ql-acc-body {
  display: none;
}

.ql-acc-body {
  padding: 0 10px 10px;
}

.ql-available-item.quick-launch-available-in-launcher {
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok) 22%, #fff);
}

.btn-add-to-launcher {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, #fff);
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
}

.btn-add-to-launcher:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.ql-in-badge {
  flex: 0 0 auto;
  font-size: 0.7rem;
}

.gu-mirror.ql-order-item {
  list-style: none;
  box-shadow: var(--shadow-card);
}

@media (max-width: 980px) {
  .ql-setup-grid {
    grid-template-columns: 1fr;
  }
}

.company-page-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px 32px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.company-page-foot .company-record-log {
  margin: 0 auto 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.company-page-foot .company-record-log[hidden] {
  display: none !important;
}

.company-page-foot .profile-tab-foot {
  display: flex;
  justify-content: flex-end;
  margin-left: auto;
}

.company-entry-card .company-editor-panel {
  padding: 16px 18px 18px;
}
.company-entry-card .profile-tabs-wrap {
  padding: 0;
}

.company-addplace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.company-addplace-head p {
  margin: 0;
}

.profile-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

.profile-panel-head {
  margin-bottom: 16px;
}

.profile-panel-head h3 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 1.05rem;
  color: var(--brand-blue);
}

.profile-panel-head p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-mute);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-full {
  grid-column: 1 / -1;
}

.field span {
  font-size: 0.75rem;
  font-weight: 750;
  color: var(--brand-blue);
  letter-spacing: 0.02em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.field textarea {
  resize: vertical;
  min-height: 84px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand-magenta);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.pref-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 14px;
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
}

.pref-row strong {
  display: block;
  font-size: 0.9rem;
  color: var(--brand-blue);
  margin-bottom: 2px;
}

.pref-row span {
  font-size: 0.78rem;
  color: var(--ink-mute);
}

.pref-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-magenta);
  flex-shrink: 0;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--brand-blue);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 650;
  box-shadow: 0 12px 28px rgba(var(--tint-rgb), 0.28);
  animation: rise 0.25s var(--ease) both;
}

/* Content */
.content {
  flex: 1;
  overflow: auto;
  padding: 20px 28px 32px;
  background: linear-gradient(180deg, #f7f9fc 0%, #ffffff 120px);
  scrollbar-width: thin;
  scrollbar-color: #c5d0e0 transparent;
}

.welcome-block {
  margin-bottom: 18px;
  padding: 22px 24px;
  border-radius: var(--radius-card);
  background: linear-gradient(120deg, var(--brand-blue) 0%, var(--brand-blue-mid) 48%, var(--brand-magenta) 140%);
  color: #fff;
  box-shadow: 0 14px 36px rgba(var(--tint-rgb), 0.22);
  animation: rise 0.45s var(--ease) both;
}

.welcome-block .hero-copy h1 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: clamp(1.45rem, 2.2vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
}

.welcome-block .hero-copy p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.95rem;
}

.page-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  animation: rise 0.45s var(--ease) 0.05s both;
}

.page-heading h2 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand-blue);
}

.page-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  background: var(--brand-magenta);
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  box-shadow: 0 10px 22px rgba(var(--accent-rgb), 0.28);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
  flex-shrink: 0;
}

.primary-btn svg {
  width: 16px;
  height: 16px;
}

.primary-btn:hover {
  background: var(--brand-red);
  transform: translateY(-1px);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-card);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  animation: rise 0.45s var(--ease) both;
}

.stat-card:nth-child(1) { animation-delay: 0.06s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.14s; }
.stat-card:nth-child(4) { animation-delay: 0.18s; }

.stat-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-meta strong {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--brand-blue);
}

.stat-meta span {
  font-size: 0.78rem;
  color: var(--ink-mute);
  font-weight: 600;
}

.tone-rose { background: var(--accent-soft); color: var(--brand-magenta); }
.tone-blue { background: var(--info-soft); color: var(--brand-blue); }
.tone-green { background: var(--ok-soft); color: var(--ok); }
.tone-amber { background: var(--warn-soft); color: var(--warn); }

/* DataTable panel */
.table-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 18px 18px 10px;
  animation: rise 0.45s var(--ease) 0.12s both;
}

.table-panel-head {
  margin-bottom: 12px;
}

.table-panel-head h3 {
  margin: 0 0 2px;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-blue);
}

.table-panel-head p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-mute);
}

.table-wrap {
  overflow-x: auto;
}

/* DataTables skin */
table.dataTable {
  border-collapse: collapse !important;
  font-family: var(--font);
}

table.dataTable thead th {
  background: var(--surface) !important;
  color: var(--brand-blue) !important;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid rgba(var(--tint-rgb), 0.12) !important;
  padding: 12px 14px !important;
}

table.dataTable tbody td {
  padding: 12px 14px !important;
  border-bottom: 1px solid var(--line) !important;
  color: var(--ink-soft);
  font-size: 0.875rem;
  vertical-align: middle;
}

table.dataTable.no-footer {
  border-bottom: 0 !important;
}

table.dataTable tbody tr:hover td {
  background: #f8fbff !important;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  color: var(--ink-soft);
  font-size: 0.85rem;
  padding: 8px 4px;
}

.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 12px;
  margin-left: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--brand-magenta);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  margin: 0 6px;
}

.dataTables_wrapper .dataTables_paginate .pagination {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  margin: 0;
  padding: 2px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button,
.dataTables_wrapper .dataTables_paginate .page-item {
  display: inline-flex !important;
  margin: 0 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button,
.dataTables_wrapper .dataTables_paginate .page-link {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--brand-blue) !important;
  padding: 0 6px !important;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: none !important;
}

.dataTables_wrapper .dataTables_paginate .page-item.previous .page-link,
.dataTables_wrapper .dataTables_paginate .page-item.next .page-link,
.dataTables_wrapper .dataTables_paginate .paginate_button.previous,
.dataTables_wrapper .dataTables_paginate .paginate_button.next {
  min-width: 40px;
  padding: 0 8px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,
.dataTables_wrapper .dataTables_paginate .page-item.active .page-link,
.dataTables_wrapper .dataTables_paginate .paginate_button.current .page-link {
  background: var(--brand-magenta) !important;
  color: #fff !important;
  box-shadow: 0 2px 6px rgba(var(--accent-rgb), 0.22) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover,
.dataTables_wrapper .dataTables_paginate .page-item:not(.active):not(.disabled) .page-link:hover {
  background: #fff !important;
  color: var(--brand-magenta) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
.dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
  color: var(--ink-mute) !important;
  background: transparent !important;
  box-shadow: none !important;
  opacity: 0.55;
}

.status-chip {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: capitalize;
}

.status-chip.active { background: var(--ok-soft); color: var(--ok); }
.status-chip.low { background: var(--warn-soft); color: var(--warn); }
.status-chip.out { background: var(--accent-soft); color: var(--brand-magenta); }
.status-chip.pending { background: var(--info-soft); color: var(--brand-blue-mid); }
.status-chip.draft { background: var(--surface-2); color: var(--ink-soft); }

.col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right !important;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.row-action-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  transition:
    background 0.15s var(--ease),
    color 0.15s var(--ease),
    border-color 0.15s var(--ease),
    transform 0.15s var(--ease);
}

.row-action-btn svg {
  width: 15px;
  height: 15px;
}

.row-action-btn:hover {
  transform: translateY(-1px);
}

.row-action-btn.is-view:hover {
  color: var(--brand-blue);
  border-color: rgba(var(--tint-rgb), 0.28);
  background: var(--info-soft);
}

.row-action-btn.is-edit:hover {
  color: var(--brand-blue-mid);
  border-color: rgba(var(--tint-rgb), 0.28);
  background: var(--surface);
}

.row-action-btn.is-print:hover {
  color: var(--ok);
  border-color: rgba(15, 122, 69, 0.28);
  background: var(--ok-soft);
}

.row-action-btn.is-delete:hover {
  color: var(--brand-magenta);
  border-color: rgba(var(--accent-rgb), 0.35);
  background: var(--accent-soft);
}

/* Responsive */
@media (max-width: 1200px) {
  .topbar {
    gap: 12px;
    padding: 6px 20px;
    min-height: 44px;
  }

  .top-menu {
    padding: 0 16px;
  }

  .product-tag {
    display: none;
  }

  .top-menu-btn,
  .top-menu-link {
    padding: 7px 12px;
    font-size: 0.88rem;
  }
}

@media (max-width: 1100px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 960px) {
  .topbar {
    gap: 10px;
  }

  .topbar-brand-text {
    display: none;
  }

  .top-menu {
    padding: 0 16px;
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    height: auto;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .side-nav {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    width: auto;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    gap: 4px;
    overflow: visible;
  }

  .side-nav-scroll {
    flex: 1 1 auto;
    flex-direction: row;
    align-items: center;
    gap: 2px;
    padding: 2px 0;
    min-height: 0;
    height: auto;
    overflow-x: auto;
    overflow-y: hidden;
    touch-action: pan-x;
    scrollbar-width: none;
  }

  .side-nav-scroll::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .side-nav-foot {
    flex-shrink: 0;
    padding-top: 0;
    padding-left: 6px;
    border-top: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.14);
  }

  .nav-item {
    width: auto;
    min-width: 64px;
    max-width: none;
    flex: 0 0 auto;
    padding: 6px 8px;
  }

  .nav-label {
    display: block;
    font-size: 10px;
    max-width: none;
    white-space: nowrap;
  }

  .nav-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .nav-icon svg,
  .nav-icon i {
    width: 22px;
    height: 22px;
    font-size: 22px;
    display: block;
  }

  .topbar {
    padding: 6px 14px;
    min-height: 44px;
    gap: 8px;
    overflow: visible;
  }

  .topbar-actions {
    gap: 6px;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
  }

  .notif-count {
    top: -3px;
    right: -5px;
    min-width: 17px;
    height: 17px;
    font-size: 0.64rem;
  }

  .top-menu {
    padding: 0 12px;
  }

  .content {
    padding: 16px;
  }

  .page-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-card {
    position: static;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  /* Keep top menus inside the viewport on small screens */
  .main,
  .topbar,
  .topbar-actions,
  .user-menu,
  .theme-menu,
  .notif-menu {
    overflow: visible;
  }

  .user-dropdown,
  .theme-dropdown,
  .notif-dropdown {
    position: fixed;
    top: 64px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    max-height: min(70vh, calc(100vh - 80px));
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 120;
    box-shadow: 0 18px 40px rgba(var(--tint-rgb), 0.22);
  }

  .theme-dropdown-list,
  .notif-dropdown-list {
    max-height: none;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .row-actions {
    gap: 3px;
  }

  .row-action-btn {
    width: 30px;
    height: 30px;
  }

  .row-action-btn svg {
    width: 14px;
    height: 14px;
  }
}

@media (max-width: 560px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .sidebar-brand {
    display: none;
  }

  .nav-item {
    min-width: 58px;
    padding: 5px 6px;
  }

  .nav-icon {
    width: 38px;
    height: 38px;
  }

  .nav-icon svg,
  .nav-icon i {
    width: 20px;
    height: 20px;
    font-size: 20px;
  }

  .nav-label {
    font-size: 9.5px;
  }

  .top-menu-btn,
  .top-menu-link {
    padding: 6px 10px;
    font-size: 0.84rem;
  }

  .topbar-actions .icon-btn {
    width: 32px;
    height: 32px;
  }

  .user-dropdown,
  .theme-dropdown,
  .notif-dropdown {
    top: 58px;
    right: 10px;
    left: 10px;
    max-height: min(72vh, calc(100vh - 72px));
  }

  .row-actions {
    flex-wrap: nowrap;
  }
}

/* ——— Login (SaaS product auth) ——— */
body.login-body {
  overflow-x: hidden;
  overflow-y: auto;
  height: auto;
  min-height: 100%;
  background: #eef2f7;
}

.login-page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(var(--tint-rgb), 0.1) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(var(--accent-rgb), 0.06) 0%, transparent 50%),
    linear-gradient(180deg, #f4f7fb 0%, #e8eef6 100%);
}

.login-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.45;
  background-image: radial-gradient(rgba(var(--tint-rgb), 0.08) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: login-fade-up 0.55s var(--ease) both;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.login-logo-wrap {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(var(--tint-rgb), 0.08);
  box-shadow: 0 4px 14px rgba(var(--tint-rgb), 0.08);
  flex-shrink: 0;
}

.login-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.login-brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
}

.login-brand-name {
  margin: 0;
  font-family: "Manrope", var(--font), sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: var(--brand-blue);
}

.login-product {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink-mute);
}

.login-panel {
  background: #fff;
  border: 1px solid rgba(var(--tint-rgb), 0.1);
  border-radius: 18px;
  padding: 28px 28px 26px;
  box-shadow:
    0 1px 2px rgba(var(--tint-rgb), 0.04),
    0 18px 40px rgba(var(--tint-rgb), 0.08);
  animation: login-fade-up 0.55s var(--ease) 0.06s both;
}

.login-panel-head {
  margin-bottom: 22px;
}

.login-panel-head h1 {
  margin: 0 0 10px;
  font-family: "Manrope", var(--font), sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: var(--brand-blue);
}

.login-panel-head p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-mute);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-form .field {
  gap: 7px;
}

.login-form .field span {
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.login-form .field input {
  border-radius: 11px;
  padding: 12px 14px;
  background: #f7f9fc;
  border: 1px solid rgba(var(--tint-rgb), 0.12);
  font-size: 0.94rem;
}

.login-form .field input::placeholder {
  color: #9aa8bc;
}

.login-form .field input:focus {
  background: #fff;
  border-color: var(--brand-blue-mid);
  box-shadow: 0 0 0 3px rgba(var(--tint-rgb), 0.1);
}

.login-password-row {
  position: relative;
  display: flex;
  align-items: center;
}

.login-password-row input {
  width: 100%;
  padding-right: 46px;
}

.login-toggle-pw {
  position: absolute;
  right: 6px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--ink-mute);
  transition: color 0.2s, background 0.2s;
}

.login-toggle-pw:hover {
  color: var(--brand-blue);
  background: #fff;
}

.login-toggle-pw svg {
  width: 18px;
  height: 18px;
}

.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}

.login-remember input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand-magenta);
}

.login-link {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--brand-magenta);
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

.login-link:hover {
  color: var(--brand-red);
  text-decoration: underline;
}

.login-error {
  margin: 0;
  padding: 11px 12px;
  border-radius: 10px;
  background: #fde8ec;
  color: var(--brand-red);
  font-size: 0.86rem;
  font-weight: 650;
}

.login-submit {
  width: 100%;
  justify-content: center;
  margin-top: 2px;
  padding: 13px 18px;
  font-size: 0.95rem;
  border-radius: 11px;
  box-shadow: 0 8px 18px rgba(var(--accent-rgb), 0.22);
}

.login-submit:hover {
  transform: translateY(-1px);
}

.login-submit.is-loading {
  opacity: 0.75;
  pointer-events: none;
}

.login-footer {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-mute);
  animation: login-fade-up 0.55s var(--ease) 0.12s both;
}

@keyframes login-fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 480px) {
  .login-page {
    padding: 28px 16px 36px;
    align-items: flex-start;
    padding-top: 48px;
  }

  .login-panel {
    padding: 22px 18px 20px;
  }

  .login-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-shell,
  .login-panel,
  .login-footer {
    animation: none !important;
  }
}

/* ——— Release Updates ——— */
.releases-view {
  animation: rise 0.4s var(--ease) both;
}

.release-current {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
  padding: 22px 24px;
  border-radius: var(--radius-card);
  background: linear-gradient(125deg, var(--brand-blue) 0%, var(--brand-blue-mid) 55%, #9a1850 160%);
  color: #fff;
  box-shadow: 0 14px 36px rgba(var(--tint-rgb), 0.22);
  animation: rise 0.45s var(--ease) both;
}

.release-version-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.2;
}

.release-current-copy h3 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.release-current-copy p {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.45;
}

.release-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.release-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.74rem;
  font-weight: 700;
  color: #fff;
}

.release-current-aside {
  text-align: right;
}

.release-current-aside strong {
  display: block;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.release-current-aside span {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
}

.release-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  animation: rise 0.45s var(--ease) 0.05s both;
}

.release-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.release-search-field {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: min(240px, 70vw);
}

.release-search-field .release-search-ico {
  position: absolute;
  left: 12px;
  color: var(--ink-mute);
  display: grid;
  place-items: center;
  pointer-events: none;
}

.release-search-field .release-search-ico i {
  font-size: 1rem;
}

.release-search-field input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
  outline: none;
}

.release-search-field input:focus {
  border-color: var(--brand-blue-mid);
  box-shadow: 0 0 0 3px rgba(var(--tint-rgb), 0.1);
}

.release-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.release-filter {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
  transition: background 0.2s var(--ease), color 0.2s, border-color 0.2s;
}

.release-filter:hover {
  border-color: rgba(var(--accent-rgb), 0.35);
  color: var(--brand-blue);
}

.release-filter.is-active {
  background: var(--brand-magenta);
  border-color: var(--brand-magenta);
  color: #fff;
  box-shadow: 0 8px 18px rgba(var(--accent-rgb), 0.25);
}

.release-count {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--ink-mute);
  white-space: nowrap;
}

.release-timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-left: 18px;
}

.release-timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, var(--brand-magenta), rgba(var(--tint-rgb), 0.12));
  border-radius: 2px;
}

.release-entry {
  position: relative;
  padding: 20px 22px;
  border-radius: var(--radius-card);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  animation: rise 0.45s var(--ease) both;
}

.release-entry::before {
  content: "";
  position: absolute;
  left: -17px;
  top: 28px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--brand-magenta);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.release-entry.is-current {
  border-color: rgba(var(--accent-rgb), 0.28);
  box-shadow: 0 10px 28px rgba(var(--accent-rgb), 0.1);
}

.release-entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 10px;
}

.release-entry-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.release-entry-title-row h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--brand-blue);
  letter-spacing: -0.02em;
}

.release-type {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.release-type.major {
  background: var(--accent-soft);
  color: var(--brand-magenta);
}

.release-type.minor {
  background: var(--info-soft);
  color: var(--brand-blue-mid);
}

.release-type.patch {
  background: var(--ok-soft);
  color: var(--ok);
}

.release-entry-date {
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--ink-mute);
}

.release-entry-summary {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.release-note-groups {
  display: grid;
  gap: 14px;
}

.release-note-group h4 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-blue);
}

.release-note-group ul {
  margin: 0;
  padding: 0 0 0 18px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.55;
}

.release-note-group li + li {
  margin-top: 4px;
}

.release-note-group.new h4 { color: var(--brand-magenta); }
.release-note-group.improved h4 { color: var(--brand-blue-mid); }
.release-note-group.fixed h4 { color: var(--ok); }

.release-build {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--ink-mute);
  font-weight: 650;
}

.release-build span strong {
  color: var(--brand-blue);
  font-weight: 750;
}

@media (max-width: 820px) {
  .release-current {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .release-current-aside {
    text-align: left;
  }

  .release-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .release-toolbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .release-search-field {
    flex: 1;
    min-width: 0;
  }

  .release-timeline {
    padding-left: 14px;
  }

  .release-entry::before {
    left: -13px;
  }
}

/* Appearance / theme picker */
.appearance-panel {
  margin: 0 0 18px;
  padding: 20px 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  animation: rise 0.4s var(--ease) both;
}

.appearance-panel-head {
  margin-bottom: 16px;
}

.appearance-panel-head h3 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-blue);
}

.appearance-panel-head p {
  margin: 0;
  color: var(--ink-mute);
  font-size: 0.88rem;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.theme-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.theme-card:hover {
  border-color: rgba(var(--accent-rgb), 0.35);
  transform: translateY(-1px);
}

.theme-card.is-active {
  border-color: var(--brand-magenta);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.14);
  background: #fff;
}

.theme-swatch {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 0.7fr;
  height: 36px;
  border-radius: 10px;
  overflow: hidden;
}

.theme-swatch span {
  display: block;
}

.theme-card-meta strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--brand-blue);
}

.theme-card-meta span {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--ink-mute);
  line-height: 1.3;
}

.profile-panel .theme-grid {
  margin-top: 4px;
}

.table-panel.is-dimmed {
  opacity: 0.55;
}

/* ========== Status pages (Access Denied, Error) ========== */
.status-page {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  overflow: hidden;
}
.status-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 15% 15%, rgba(var(--accent-rgb), 0.18), transparent 55%),
    radial-gradient(ellipse 60% 50% at 85% 85%, rgba(0, 123, 255, 0.14), transparent 50%),
    linear-gradient(145deg, var(--surface) 0%, var(--surface) 45%, var(--surface) 100%);
  pointer-events: none;
}
.status-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(26, 34, 56, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 34, 56, 0.035) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, black 25%, transparent 72%);
}
.status-card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 28px;
  box-shadow: 0 16px 48px rgba(var(--tint-rgb), 0.14);
  backdrop-filter: blur(12px);
  padding: 32px 32px 28px;
  text-align: center;
}
.status-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}
.status-brand .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}
.status-brand .brand-text {
  text-align: left;
}
.status-brand .brand-text strong {
  display: block;
  font-size: 15px;
  color: var(--ink);
}
.status-brand .brand-text span {
  display: block;
  font-size: 12px;
  color: var(--ink-mute);
}
.status-icon-wrap {
  position: relative;
  width: 112px;
  height: 112px;
  margin: 0 auto 18px;
}
.status-code {
  position: absolute;
  top: -8px;
  right: -10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--brand-red);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.status-icon {
  width: 100%;
  height: 100%;
  border-radius: 28px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent-soft) 0%, #fdecea 100%);
  border: 1px solid #f5c4bc;
  color: var(--brand-red);
  font-size: 52px;
  box-shadow: 0 14px 30px rgba(211, 47, 47, 0.12);
}
.access-denied-card h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 34px);
  line-height: 1.15;
  color: var(--ink);
}
.status-sub {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
}
.status-sub strong {
  color: var(--ink);
}
.status-hint {
  margin: 0 0 18px;
  color: var(--ink-mute);
  font-size: 13px;
  line-height: 1.5;
}
.status-meta {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  margin-bottom: 22px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  max-width: 100%;
}
.status-meta span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.status-meta code {
  font-size: 12px;
  color: var(--ink-soft);
  word-break: break-all;
}
.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.status-actions .btn {
  min-width: 148px;
}
@media (max-width: 560px) {
  .status-card {
    padding: 24px 18px 20px;
    border-radius: 22px;
  }
  .status-actions .btn {
    width: 100%;
    min-width: 0;
  }
}
.role-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.role-chip {
  border: 1px solid color-mix(in srgb, var(--brand-blue) 18%, #ffffff);
  background: #fff;
  color: var(--ink-soft);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s ease;
}
.role-chip.active, .role-chip:hover {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 42%, #fff);
  color: var(--brand-red);
}

/* ========== UI primitives ========== */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.page-head h1 { font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--ink-mute); font-size: 13.5px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px; font-weight: 650;
  cursor: pointer;
  transition: 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--brand-red); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--brand-red); color: #fff; }
.btn-info { background: var(--brand-blue); color: #fff; }
.btn-info:hover { background: var(--brand-blue-mid); color: #fff; }
.btn-success { background: var(--ok); color: #fff; }
.btn-success:hover { color: #fff; }
.btn-danger { background: var(--brand-red); color: #fff; }
.btn-danger:hover { color: #fff; }
.btn-outline {
  background: #fff; border-color: color-mix(in srgb, var(--brand-blue) 18%, #ffffff); color: var(--ink-soft);
}
.btn-outline:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, #fff); color: var(--brand-red); background: var(--accent-soft);
}
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 12px 18px; font-size: 14px; }
.btn .btn-ico {
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn .btn-ico svg,
.btn svg.btn-ico {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid; place-items: center;
  cursor: pointer; color: var(--ink-soft);
  position: relative;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 18px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute; right: -18px; top: -18px;
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--kpi-tint, var(--accent-soft));
  opacity: 0.85;
}
.kpi-label { font-size: 12px; color: var(--ink-mute); font-weight: 600; position: relative; }
.kpi-value { font-size: 28px; font-weight: 700; margin-top: 6px; position: relative; }
.kpi-meta { font-size: 12px; margin-top: 6px; color: var(--ok); position: relative; font-weight: 600; }
.kpi-meta.down { color: var(--brand-red); }

.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.panel-head h3 { font-size: 14.5px; font-weight: 700; }
.panel-head .muted { font-size: 12px; color: var(--ink-mute); font-weight: 500; }
.panel-body { padding: 18px; }
.panel-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--surface);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; position: relative; }
.form-group.span-2 { grid-column: span 2; }
.form-group.span-3 { grid-column: span 3; }
.form-group.span-4 { grid-column: span 4; }
.form-group > label, .form-label { font-size: 0.75rem; font-weight: 750; color: var(--brand-blue); letter-spacing: 0.02em; }
label .req { color: var(--brand-magenta); margin-left: 2px; }
.form-control, .form-select, textarea.form-control {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.form-control:focus, .form-select:focus, textarea.form-control:focus {
  border-color: var(--brand-magenta);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}
.form-control:disabled, .form-control[readonly] {
  background: var(--surface); color: var(--ink-soft);
}
.bf-datepicker.form-control[readonly] {
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.flatpickr-input.form-control {
  cursor: pointer;
}
.hint { font-size: 11.5px; color: var(--ink-mute); }

/* Bootstrap maxlength counter (MaxThreshold) */
.bf-maxlength-wrap {
  position: relative;
  display: block;
  width: 100%;
  overflow: visible;
}
.bf-maxlength-wrap > .form-control {
  width: 100%;
}
.bf-maxlength-wrap > .bootstrap-maxlength.bf-maxlength,
.bf-maxlength-wrap > .bf-maxlength {
  position: absolute !important;
  top: calc(100% + 4px) !important;
  right: 0 !important;
  left: auto !important;
  bottom: auto !important;
  margin: 0 !important;
  transform: none !important;
  max-width: 100%;
  white-space: nowrap;
  z-index: 20;
}
.form-group {
  overflow: visible;
}
.bf-maxlength {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  border-radius: 999px;
  pointer-events: none;
}
.bf-maxlength-warning {
  background: #fff4ec;
  color: #b45309;
  border: 1px solid #fcd9bd;
}
.bf-maxlength-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.section-banner {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px; font-weight: 650;
  margin: 4px 0 8px;
  grid-column: 1 / -1;
}
.section-banner.teal, .section-banner.amber {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 42%, #fff);
  color: var(--brand-red);
}

.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.filter-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr) auto auto;
  gap: 10px;
  margin-bottom: 14px;
  align-items: end;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 14px;
  box-shadow: var(--shadow-card);
}

.table-wrap { overflow-x: visible; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  color: #495057;
}
table.data th {
  text-align: left;
  padding: 12px 14px;
  background: var(--surface);
  color: var(--brand-blue);
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  border-bottom: 1px solid #dbe3ef;
  white-space: nowrap;
  vertical-align: middle;
}
table.data td {
  padding: 12px 14px;
  border-top: 1px solid #eff2f7;
  border-bottom: none;
  vertical-align: middle;
}
table.data tbody tr:hover { background: transparent; }
table.data tbody tr:hover td { background: #f8f9fa; }
table.data th.col-actions,
table.data td.col-actions,
table.data th:last-child,
table.data td.actions,
table.data td:has(.actions),
table.data td:has(.btn-icon) {
  width: 118px;
  min-width: 118px;
  text-align: center !important;
  white-space: nowrap;
}
table.data .actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  width: auto;
}
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  border: none;
  background: #eef2f7;
  color: #495057;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
  box-shadow: none;
}
.btn-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn-icon:hover {
  transform: none;
  box-shadow: none;
}
.btn-icon.view {
  color: #556ee6;
  background: rgba(85, 110, 230, 0.12);
}
.btn-icon.view:hover {
  color: #fff;
  background: #556ee6;
}
.btn-icon.edit {
  color: #f1b44c;
  background: rgba(241, 180, 76, 0.18);
}
.btn-icon.edit:hover {
  color: #fff;
  background: #f1b44c;
}
.btn-icon.delete {
  color: #f46a6a;
  background: rgba(244, 106, 106, 0.14);
}
.btn-icon.delete:hover {
  color: #fff;
  background: #f46a6a;
}
.btn-icon:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.16);
}

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  white-space: nowrap;
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.badge-success { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-info { background: var(--info-soft); color: var(--brand-blue-bright); }
.badge-danger { background: var(--accent-soft); color: var(--brand-red); }
.badge-muted { background: #eef2f7; color: var(--ink-mute); }
.badge-brand { background: var(--accent-soft); color: var(--brand-red); }

.tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  padding: 0 4px;
  background: var(--surface);
  border-radius: 12px 12px 0 0;
}
.tab {
  border: none; background: transparent;
  padding: 12px 14px;
  font-size: 13px; font-weight: 650;
  color: var(--ink-mute);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: #fff;
  border-radius: 10px 10px 0 0;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: rise 0.25s ease both; }

.po-status-tabs {
  margin: 0 0 12px;
  padding: 4px;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.po-status-tabs .tab {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
}
.po-status-tabs .tab:hover {
  background: #fff;
  color: var(--brand-blue);
}
.po-status-tabs .tab.active,
.po-status-tabs .tab.tab-tone-muted.active,
.po-status-tabs .tab.tab-tone-info.active,
.po-status-tabs .tab.tab-tone-success.active,
.po-status-tabs .tab.tab-tone-warn.active,
.po-status-tabs .tab.tab-tone-brand.active,
.po-status-tabs .tab.tab-tone-danger.active {
  color: #fff;
  background: var(--brand-magenta);
  border-color: var(--brand-magenta);
  border-bottom-color: var(--brand-magenta);
  box-shadow: 0 4px 10px rgba(var(--accent-rgb), 0.28);
}
.po-status-tabs .tab.tab-tone-info.active {
  background: var(--brand-blue-bright);
  border-color: var(--brand-blue-bright);
  box-shadow: 0 4px 10px rgba(45, 107, 184, 0.28);
}
.po-status-tabs .tab.tab-tone-success.active {
  background: var(--ok);
  border-color: var(--ok);
  box-shadow: 0 4px 10px rgba(15, 122, 69, 0.25);
}
.po-status-tabs .tab.tab-tone-warn.active {
  background: var(--warn);
  border-color: var(--warn);
  box-shadow: 0 4px 10px rgba(196, 92, 18, 0.25);
}
.po-status-tabs .tab.tab-tone-brand.active {
  background: var(--brand-magenta);
  border-color: var(--brand-magenta);
}
.po-status-tabs .tab.tab-tone-danger.active {
  background: var(--brand-red);
  border-color: var(--brand-red);
  box-shadow: 0 4px 10px rgba(200, 16, 46, 0.25);
}
.po-status-tabs .tab.tab-tone-muted.active {
  background: #64748b;
  border-color: #64748b;
  box-shadow: none;
}
.po-status-tabs .status-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.45em;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.35;
  background: #eef2f7;
  color: var(--ink-mute);
  vertical-align: middle;
}
.po-status-tabs .tab.active .status-count-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* ========== Purchase Entry (distinct from PO / GRN) ========== */
.pe-screen {
  --pe-teal: #0f766e;
  --pe-teal-dark: #0b5f59;
  --pe-teal-soft: #e6f7f5;
  --pe-teal-line: #b7e4de;
  --pe-teal-mid: #14b8a6;
  --pe-ink: #134e4a;
  position: relative;
  min-height: 280px;
}
.pe-screen .pe-page-head .pe-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pe-screen .pe-mode-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pe-teal-dark);
  background: var(--pe-teal-soft);
  border: 1px solid var(--pe-teal-line);
}
.pe-screen .pe-mode-toggle {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  margin: 0 0 14px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--pe-teal-line);
  background: var(--pe-teal-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}
.pe-screen .pe-mode-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--pe-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.pe-screen .pe-mode-btn:hover {
  color: var(--pe-teal-dark);
}
.pe-screen .pe-mode-btn.active {
  background: #fff;
  color: var(--pe-teal-dark);
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.14);
}
.pe-screen .pe-mode-btn:focus-visible {
  outline: 2px solid var(--pe-teal-mid);
  outline-offset: 1px;
}
.pe-screen .pe-page-sub {
  max-width: 42rem;
}
.pe-screen .pe-primary-btn {
  background: var(--pe-teal);
  border-color: var(--pe-teal);
}
.pe-screen .pe-primary-btn:hover,
.pe-screen .pe-primary-btn:focus {
  background: var(--pe-teal-dark);
  border-color: var(--pe-teal-dark);
}

.purchase-flow-banner {
  --flow-accent: var(--accent);
  --flow-accent-dark: var(--brand-red);
  --flow-accent-mid: #ff7a45;
  --flow-soft: var(--accent-soft);
  --flow-line: #ffd0bc;
  --flow-ink: var(--brand-red);
  --flow-glow: rgba(var(--accent-rgb), 0.14);
  --flow-bg-top: var(--accent-soft);

  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 14px;
  padding: 12px 16px;
  border-radius: var(--radius-card);
  border: 1px solid var(--flow-line);
  background:
    linear-gradient(120deg, var(--flow-glow), transparent 55%),
    linear-gradient(180deg, var(--flow-bg-top), #ffffff);
  box-shadow: var(--shadow-card);
}
.purchase-flow-banner--pe {
  --flow-accent: #0f766e;
  --flow-accent-dark: #0b5f59;
  --flow-accent-mid: #14b8a6;
  --flow-soft: #e6f7f5;
  --flow-line: #b7e4de;
  --flow-ink: #134e4a;
  --flow-glow: rgba(20, 184, 166, 0.14);
  --flow-bg-top: #f3fffd;
}
.purchase-flow-banner--grn {
  --flow-accent: var(--brand-blue-bright);
  --flow-accent-dark: #0056b3;
  --flow-accent-mid: #3b9bff;
  --flow-soft: var(--info-soft);
  --flow-line: #bfdbfe;
  --flow-ink: #0b3d74;
  --flow-glow: rgba(0, 123, 255, 0.14);
  --flow-bg-top: #f3f8ff;
}
.purchase-flow-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--flow-accent);
  color: #fff;
  font-size: 20px;
}
.purchase-flow-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.purchase-flow-copy strong {
  color: var(--flow-ink);
  font-size: 13.5px;
}
.purchase-flow-copy span {
  color: var(--ink-soft);
  font-size: 12.5px;
}
.purchase-flow-steps {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--flow-line);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.purchase-flow-steps i {
  color: var(--flow-accent-mid);
  font-size: 14px;
}
.purchase-flow-step-accent {
  color: var(--flow-accent-dark);
}

.pe-filter-panel {
  border-color: var(--pe-teal-line);
  background:
    linear-gradient(90deg, var(--pe-teal-soft) 0, var(--pe-teal-soft) 4px, #fff 4px);
}
.pe-filter-panel .admin-filter-head h3 {
  color: var(--pe-ink);
}

.pe-status-rail {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-card);
  border: 1px dashed var(--pe-teal-line);
  background: rgba(230, 247, 245, 0.55);
}
.pe-status-rail-label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pe-teal-dark);
}
.pe-status-tabs {
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: none;
  background: transparent;
  border-radius: 0;
  overflow: visible;
}
.pe-status-tabs .tab {
  flex: 0 0 auto;
  margin: 0;
  padding: 7px 12px;
  border: 1px solid var(--pe-teal-line);
  border-radius: 999px;
  border-bottom: 1px solid var(--pe-teal-line);
  background: #fff;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.pe-status-tabs .tab:hover {
  border-color: var(--pe-teal-mid);
  color: var(--pe-teal-dark);
  background: #fff;
}
.pe-status-tabs .tab.active,
.pe-status-tabs .tab.tab-tone-muted.active,
.pe-status-tabs .tab.tab-tone-info.active,
.pe-status-tabs .tab.tab-tone-success.active,
.pe-status-tabs .tab.tab-tone-warn.active,
.pe-status-tabs .tab.tab-tone-brand.active,
.pe-status-tabs .tab.tab-tone-danger.active {
  color: #fff;
  background: var(--pe-teal);
  border-color: var(--pe-teal);
  border-bottom-color: var(--pe-teal);
  border-radius: 999px;
}
.pe-status-tabs .tab.tab-tone-info.active { background: var(--brand-blue-bright); border-color: var(--brand-blue-bright); }
.pe-status-tabs .tab.tab-tone-success.active { background: var(--ok); border-color: var(--ok); }
.pe-status-tabs .tab.tab-tone-warn.active { background: var(--warn); border-color: var(--warn); }
.pe-status-tabs .tab.tab-tone-danger.active { background: var(--brand-red); border-color: var(--brand-red); }
.pe-status-tabs .tab.tab-tone-muted.active { background: #64748b; border-color: #64748b; }
.pe-status-tabs .status-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.45em;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.35;
  background: rgba(255, 255, 255, 0.22);
  color: inherit;
  vertical-align: middle;
}
.pe-status-tabs .tab:not(.active) .status-count-badge {
  background: var(--pe-teal-soft);
  color: var(--pe-teal-dark);
}
.pe-status-tabs .tab.active .status-count-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.pe-list-panel {
  border-color: var(--pe-teal-line);
  overflow: hidden;
}
.pe-list-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 0;
}
.pe-list-panel-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--pe-ink);
}
.pe-list-panel-hint {
  font-size: 12px;
  color: var(--ink-mute);
}
.pe-list-panel .admin-table-wrap {
  padding-top: 8px;
}
.pe-table thead th {
  background: var(--pe-teal-soft);
  color: var(--pe-ink);
}

.pe-entry-card .pe-entry-panel {
  border-color: var(--pe-teal-line);
}
.pe-entry-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--pe-teal-soft), #ffffff 70%);
  border: 1px solid var(--pe-teal-line);
}
.pe-entry-banner > i {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--pe-teal);
  color: #fff;
  font-size: 18px;
}
.pe-entry-banner strong {
  display: block;
  color: var(--pe-ink);
  font-size: 13px;
}
.pe-entry-banner span {
  display: block;
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 12.5px;
}
.pe-entry-section .po-entry-section-head {
  border-bottom-color: var(--pe-teal-line);
}
.pe-entry-section .po-entry-section-head h3 {
  color: var(--pe-teal-dark);
}
.pe-field-highlight {
  position: relative;
}
.pe-field-highlight > label {
  color: var(--pe-teal-dark) !important;
}
.pe-items-panel {
  border: 1px solid var(--pe-teal-line);
  border-radius: var(--radius-card);
  background: #fbfffe;
  padding: 10px 12px 12px;
  margin-top: 8px;
}
.pe-items-panel .po-items-head {
  align-items: flex-start;
}
.pe-items-panel .po-items-head h4 {
  color: var(--pe-ink);
}
.pe-items-hint {
  margin: 2px 0 0;
  font-size: 12px;
}
.pe-add-line-btn {
  background: var(--pe-teal);
  border-color: var(--pe-teal);
}
.pe-add-line-btn:hover,
.pe-add-line-btn:focus {
  background: var(--pe-teal-dark);
  border-color: var(--pe-teal-dark);
}
.pe-summary-bar {
  border-color: var(--pe-teal-line);
  background: linear-gradient(180deg, #f3fffd, #ffffff);
}
.pe-summary-bar .po-summary-total .po-summary-value {
  color: var(--pe-teal-dark);
}
.pe-status-actions {
  border-color: var(--pe-teal-line);
}

@media (max-width: 900px) {
  .purchase-flow-banner {
    flex-wrap: wrap;
  }
  .purchase-flow-steps {
    width: 100%;
    justify-content: center;
  }
  .pe-status-rail {
    flex-direction: column;
    align-items: stretch;
  }
}

.po-status-actions.tone-muted {
  background: #f1f4f8;
  border-color: #d5dde8;
}
.po-status-actions.tone-info {
  background: var(--info-soft);
  border-color: #bfdbfe;
}
.po-status-actions.tone-success {
  background: var(--ok-soft);
  border-color: #c8e6c9;
}
.po-status-actions.tone-warn {
  background: var(--warn-soft);
  border-color: #ffd8a8;
}
.po-status-actions.tone-brand {
  background: var(--accent-soft);
  border-color: #ffd0bf;
}
.po-status-actions.tone-danger {
  background: var(--accent-soft);
  border-color: #f5c2c0;
}

.status-step.current.tone-info::before {
  background: var(--brand-blue-bright);
  box-shadow: 0 0 0 1px var(--brand-blue-bright), 0 0 0 5px rgba(0, 123, 255, 0.18);
}
.status-step.current.tone-success::before {
  background: var(--ok);
  box-shadow: 0 0 0 1px var(--ok), 0 0 0 5px rgba(46, 125, 50, 0.18);
}
.status-step.current.tone-warn::before {
  background: var(--warn);
  box-shadow: 0 0 0 1px var(--warn), 0 0 0 5px rgba(237, 108, 2, 0.18);
}
.status-step.current.tone-brand::before {
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 0 5px rgba(var(--accent-rgb), 0.2);
}
.status-step.current.tone-danger::before {
  background: var(--brand-red);
  box-shadow: 0 0 0 1px var(--brand-red), 0 0 0 5px rgba(211, 47, 47, 0.18);
}
.status-step.current.tone-muted::before {
  background: var(--ink-mute);
  box-shadow: 0 0 0 1px var(--ink-mute), 0 0 0 5px rgba(139, 149, 165, 0.18);
}
.status-step.done.tone-info::before { background: var(--brand-blue-bright); box-shadow: 0 0 0 1px var(--brand-blue-bright); }
.status-step.done.tone-info::after { background: var(--brand-blue-bright); }
.status-step.done.tone-success::before { background: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
.status-step.done.tone-success::after { background: var(--ok); }
.status-step.done.tone-warn::before { background: var(--warn); box-shadow: 0 0 0 1px var(--warn); }
.status-step.done.tone-warn::after { background: var(--warn); }
.status-step.done.tone-brand::before { background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.status-step.done.tone-brand::after { background: var(--accent); }
.status-step.done.tone-danger::before { background: var(--brand-red); box-shadow: 0 0 0 1px var(--brand-red); }
.status-step.done.tone-danger::after { background: var(--brand-red); }
.status-step.done.tone-muted::before { background: var(--ink-mute); box-shadow: 0 0 0 1px var(--ink-mute); }
.status-step.done.tone-muted::after { background: var(--ink-mute); }

.status-pipeline {
  display: flex; gap: 0; overflow-x: auto; padding: 4px 0 10px;
}
.status-step {
  flex: 1; min-width: 100px;
  text-align: center; position: relative;
  padding: 10px 8px;
}
.status-step::before {
  content: "";
  width: 12px; height: 12px; border-radius: 50%;
  background: #d5dde8;
  display: block; margin: 0 auto 8px;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px #d5dde8;
  position: relative; z-index: 1;
}
.status-step::after {
  content: "";
  position: absolute; top: 15px; left: 50%; right: -50%;
  height: 2px; background: #d5dde8; z-index: 0;
}
.status-step:last-child::after { display: none; }
.status-step.done::before { background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.status-step.done::after { background: var(--accent); }
.status-step.current::before {
  background: var(--brand-blue);
  box-shadow: 0 0 0 1px var(--brand-blue), 0 0 0 5px rgba(var(--accent-rgb),0.2);
}
.status-step span,
.status-step .po-tl-label { font-size: 11px; font-weight: 650; color: var(--ink-mute); display: block; }
.status-step.done span,
.status-step.done .po-tl-label,
.status-step.current span,
.status-step.current .po-tl-label { color: var(--ink); }
.status-step.pending {
  opacity: 0.45;
}
.status-step.pending span,
.status-step.pending .po-tl-label { color: var(--ink-mute); }
.status-step small {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-mute);
  line-height: 1.3;
  white-space: nowrap;
}
.status-step .po-tl-date {
  margin-top: 6px;
}
.status-step .po-tl-time {
  margin-top: 1px;
  font-weight: 650;
  color: var(--ink-soft);
}
.status-step .po-tl-user {
  margin-top: 2px;
  opacity: 0.85;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.po-status-timeline {
  margin-bottom: 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e3e9f2;
}
.po-status-pipeline {
  padding: 2px 0 12px;
  overflow-x: auto;
}
.po-status-pipeline .status-step {
  min-width: 100px;
  padding-bottom: 14px;
}

.po-status-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.po-status-actions-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.po-status-actions-text strong {
  font-size: 13px;
  color: var(--ink);
}
.po-status-actions-text .muted {
  font-size: 12px;
}
.po-status-actions-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.box-plan { display: grid; gap: 10px; }
.box-card {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 14px; align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.box-card .qr {
  width: 64px; height: 64px;
  border-radius: 8px;
  background:
    repeating-linear-gradient(0deg, var(--brand-blue) 0 2px, transparent 2px 4px),
    repeating-linear-gradient(90deg, var(--brand-blue) 0 2px, transparent 2px 4px);
  background-size: 8px 8px;
  border: 1px solid var(--line);
}
.box-card h4 { font-size: 14px; margin-bottom: 2px; }
.box-card p { margin: 0; font-size: 12.5px; color: var(--ink-mute); }

.upload-zone {
  border: 1.5px dashed color-mix(in srgb, var(--brand-blue) 18%, #ffffff);
  border-radius: 12px;
  padding: 22px;
  text-align: center;
  background: var(--surface);
  color: var(--ink-mute);
  cursor: pointer;
}
.upload-zone strong { color: var(--accent); display: block; margin-bottom: 4px; }

.timeline { display: grid; gap: 12px; }
.timeline-item { display: grid; grid-template-columns: 16px 1fr; gap: 12px; }
.timeline-item .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); margin-top: 4px;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.timeline-item h4 { font-size: 13px; }
.timeline-item p { margin: 2px 0 0; font-size: 12px; color: var(--ink-mute); }

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: none;
  place-items: center;
  padding: 24px 16px;
  background: rgba(var(--tint-rgb), 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: modal-fade 0.22s var(--ease) both;
}
.modal-backdrop.open { display: grid; }
.modal-backdrop[hidden] { display: none !important; }
.modal {
  width: min(560px, 100%);
  max-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 28px 64px rgba(var(--tint-rgb), 0.28);
  overflow: hidden;
  animation: modal-rise 0.28s var(--ease) both;
}
.modal.lg, .modal.is-wide { width: min(720px, 100%); }
.modal.xl { width: min(980px, 100%); }
.modal.modal-sm { width: min(420px, 100%); }
.modal-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface) 0%, #fff 100%);
}
.modal-head:not(:has(.modal-head-icon)) {
  grid-template-columns: 1fr auto;
}
.modal-head-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--brand-magenta);
  flex-shrink: 0;
}
.modal-head-icon.is-danger {
  background: var(--accent-soft);
  color: var(--brand-magenta);
}
.modal-head-icon svg,
.modal-head-icon .bx {
  width: 20px;
  height: 20px;
  font-size: 20px;
  line-height: 1;
}
.modal-head-copy h2,
.modal-head h2,
.modal-head h3 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand-blue);
}
.modal-head-copy p,
.modal-head .drawer-id {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-mute);
  line-height: 1.4;
}
.modal-close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-mute);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: background 0.15s var(--ease), color 0.15s;
}
.modal-close:hover {
  background: var(--surface);
  color: var(--brand-blue);
}
.modal-close svg {
  width: 16px;
  height: 16px;
}
.modal-body .mb-3 { margin-bottom: 14px; }
.modal-body .form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 750;
  color: var(--brand-blue);
  letter-spacing: 0.02em;
}
.modal-body .form-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-body .form-check-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.flatpickr-calendar {
  z-index: 1300 !important;
}
.modal-body {
  padding: 18px 22px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--tint-rgb), 0.28) transparent;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.modal.is-view .modal-foot .btn-primary,
.modal.is-view .drawer-foot .btn-primary {
  display: none;
}
.modal.is-view .form-control,
.modal.is-view .form-select,
.drawer.is-view .form-control,
.drawer.is-view .form-select {
  background: var(--surface);
  color: var(--ink-soft);
  pointer-events: none;
}

@keyframes modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modal-rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Form panels open as centered modal popups (legacy drawer class names kept) */
@keyframes drawerIn {
  from { transform: translateY(12px) scale(0.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: none;
  place-items: center;
  padding: 24px 16px;
  box-sizing: border-box;
  background: rgba(var(--tint-rgb), 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: modal-fade 0.22s var(--ease) both;
}
.drawer-backdrop.open { display: grid; }
.drawer {
  width: min(560px, 100%);
  height: auto;
  max-height: min(88vh, 820px);
  min-height: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 28px 64px rgba(var(--tint-rgb), 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-rise 0.28s var(--ease) both;
  margin: 0 auto;
}
.drawer.lg { width: min(720px, 100%); }
.drawer.xl,
.admin-form-drawer.xl { width: min(980px, 100%); }
.drawer-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface) 0%, #fff 100%);
  flex-shrink: 0;
}
.drawer-head:not(:has(.modal-head-icon)) {
  grid-template-columns: 1fr auto;
}
.drawer-head-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}
.drawer-head-main h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand-blue);
}
.drawer-id {
  display: block;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-mute);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
}
.drawer-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.drawer-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-mute);
  font-size: 12px;
  font-weight: 600;
}
.drawer-nav-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.drawer-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.drawer-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-mute);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.15s var(--ease), color 0.15s;
}
.drawer-close:hover {
  background: var(--surface);
  color: var(--brand-blue);
}
.drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 8px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--tint-rgb), 0.28) transparent;
}
.drawer-section {
  padding: 14px 0;
  border-bottom: 1px solid #eef2f7;
}
.drawer-section:last-child { border-bottom: none; }
.drawer-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
}
.drawer-person {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.drawer-person .avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand-blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
}
.drawer-person strong {
  display: block;
  font-size: 14px;
}
.drawer-person span {
  display: block;
  font-size: 12px;
  color: var(--ink-mute);
}
.drawer-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}
.drawer-meta-item span {
  display: block;
  font-size: 11px;
  color: var(--ink-mute);
  font-weight: 600;
  margin-bottom: 2px;
}
.drawer-meta-item strong {
  font-size: 13px;
  color: var(--ink);
  font-weight: 650;
}
.drawer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.drawer-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}
.drawer-note {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  resize: vertical;
}
.drawer-timeline {
  display: grid;
  gap: 0;
}
.drawer-timeline-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  position: relative;
  padding-bottom: 16px;
}
.drawer-timeline-item:last-child { padding-bottom: 0; }
.drawer-timeline-item::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 14px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.drawer-timeline-item:last-child::before { display: none; }
.drawer-timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  margin-top: 2px;
  z-index: 1;
}
.drawer-timeline-item.done .drawer-timeline-dot {
  border-color: var(--ok);
  background: var(--ok);
}
.drawer-timeline-item.current .drawer-timeline-dot {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.15);
}
.drawer-timeline-body h4 {
  font-size: 13px;
  margin-bottom: 2px;
}
.drawer-timeline-body p {
  margin: 0;
  font-size: 12px;
  color: var(--ink-mute);
}
.drawer-foot {
  flex-shrink: 0;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #fff;
}
.drawer-foot .btn {
  min-width: 110px;
  justify-content: center;
}

@media (max-width: 900px) {
  .drawer-backdrop { padding: 12px; align-items: center; justify-content: center; }
  .drawer,
  .drawer.lg,
  .drawer.xl,
  .admin-form-drawer.xl {
    width: 100%;
    height: auto;
    max-height: min(90dvh, 90vh);
    border-radius: 16px;
    align-self: center;
  }
  .drawer-meta-grid { grid-template-columns: 1fr; }
}

.toast {
  position: fixed; right: 24px; bottom: 24px;
  background: var(--brand-blue); color: #fff;
  padding: 12px 16px; border-radius: 12px;
  box-shadow: 0 16px 48px rgba(var(--tint-rgb), 0.14);
  z-index: 200; display: none;
  font-size: 13px; font-weight: 600;
  border-left: 4px solid var(--accent);
}

.chart-bars {
  display: flex; align-items: flex-end; gap: 10px;
  height: 160px; padding-top: 10px;
}
.chart-bars .bar {
  flex: 1; border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #ff7a45, var(--accent));
  position: relative; min-height: 12px;
}
.chart-bars .bar span {
  position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: var(--ink-mute); font-weight: 600;
}

.mini-stat {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.mini-stat:last-child { border-bottom: none; }
.mini-stat strong { font-weight: 700; }

.prod-flow {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px;
}
.prod-flow a, .prod-flow .step-link {
  display: block; text-align: center;
  padding: 14px 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 12px; font-weight: 650;
  transition: 0.15s;
  cursor: pointer;
  box-shadow: var(--shadow-card);
}
.prod-flow a:hover, .prod-flow .step-link:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, #fff);
  background: var(--accent-soft);
  color: var(--brand-red);
}
.prod-flow .num {
  display: grid; place-items: center;
  width: 28px; height: 28px; margin: 0 auto 8px;
  border-radius: 8px;
  background: var(--brand-blue); color: #fff;
  font-size: 12px;
}

.check-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.check-row:not(.bf-switch) input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.bf-switch.bf-switch-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
  cursor: pointer;
}
.bf-switch-caption {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  flex: 1;
}
.pref-checks .bf-switch { margin-top: 0; }
.pref-checks .bf-switch + .bf-switch { margin-top: 10px; }

.pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  border: 1px solid color-mix(in srgb, var(--brand-blue) 18%, #ffffff);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12.5px; font-weight: 650;
  cursor: pointer;
}
.pill.active {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: #fff;
}

.list-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 10px;
}
.list-card:hover { border-color: color-mix(in srgb, var(--accent) 42%, #fff); background: #fffaf7; }
.list-card h4 { font-size: 14px; color: var(--brand-blue-bright); margin-bottom: 2px; }
.list-card p { margin: 0; font-size: 12px; color: var(--ink-mute); }

.mobile-toggle { display: none; }
.search-box { display: none; }

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .filter-bar { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .prod-flow { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  :root {
    --legacy-top-h: 56px;
    --legacy-bottom-nav-h: 78px;
  }

  .login-page.login-split { grid-template-columns: 1fr; }
  .login-visual { min-height: 240px; padding: 24px; }
  .app-stage { padding: 0; }
  .app-frame {
    border-radius: 0;
    min-height: 100vh;
    min-height: 100dvh;
  }

  /* Top bar: logo + menu | actions */
  .topnav {
    grid-template-columns: 1fr auto;
    column-gap: 8px;
    padding: 0 10px;
    height: var(--legacy-top-h);
  }
  .top-search { display: none !important; }
  .topnav-left { gap: 8px; }
  .topnav-brand {
    font-size: 14px;
    gap: 8px;
  }
  .topnav-brand .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }
  .topnav-brand span { font-size: 11px; opacity: 0.7; }
  .menu-chip {
    padding: 0;
    width: 36px;
    height: 36px;
    justify-content: center;
    border-radius: 10px;
    gap: 0;
  }
  .menu-chip-label { display: none; }
  .menu-chip-ico { font-size: 18px; line-height: 1; }
  .topnav-right { gap: 6px; }
  .company-pill {
    padding: 3px;
    gap: 0;
  }
  .company-pill #topUserLabel,
  .company-pill .user-menu-caret { display: none; }
  .user-menu-panel {
    position: fixed;
    top: calc(var(--legacy-top-h) + 8px);
    right: 10px;
    width: min(260px, calc(100vw - 20px));
  }
  .top-icon {
    width: 34px;
    height: 34px;
  }
  .notify-panel {
    position: fixed;
    top: calc(var(--legacy-top-h) + 8px);
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
  }

  /* Workspace + bottom nav */
  .workspace {
    position: relative;
    overflow: hidden;
    padding-bottom: var(--legacy-bottom-nav-h);
  }

  .icon-rail {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    height: var(--legacy-bottom-nav-h);
    flex-direction: row;
    justify-content: stretch;
    align-items: stretch;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
    gap: 2px;
    border-right: none;
    border-top: 1px solid var(--line);
    background: #fff;
    z-index: 45;
    box-shadow: 0 -6px 20px rgba(26, 34, 56, 0.08);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .icon-rail::-webkit-scrollbar { display: none; }
  .icon-rail .rail-spacer { display: none; }
  .rail-btn {
    flex: 1 1 0;
    width: auto;
    min-width: 52px;
    max-width: none;
    height: auto;
    border-radius: 12px;
    font-size: 15px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 5px 4px;
  }
  .rail-btn i {
    font-size: 1.15rem;
  }
  .rail-btn .tip {
    display: block !important;
    position: static !important;
    left: auto;
    top: auto;
    transform: none !important;
    background: transparent !important;
    color: inherit !important;
    font-size: 8.5px !important;
    font-weight: 650;
    padding: 0 !important;
    border-radius: 0;
    white-space: normal;
    line-height: 1.15;
    text-align: center;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
  }
  .rail-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
    box-shadow: none;
  }

  .menu-acc {
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 8px;
    overflow: hidden;
    background: #fff;
  }
  .menu-acc-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: none;
    background: var(--surface);
    padding: 12px 14px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
  }
  .menu-acc-head .chev {
    font-size: 11px;
    color: var(--ink-mute);
    transition: transform 0.2s ease;
  }
  .menu-acc.open .menu-acc-head {
    background: var(--accent-soft);
    color: var(--brand-red);
  }
  .menu-acc.open .menu-acc-head .chev { transform: rotate(90deg); }
  .menu-acc-body {
    display: none;
    padding: 6px;
    border-top: 1px solid var(--line);
  }
  .menu-acc.open .menu-acc-body { display: block; }

  .menu-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 34, 56, 0.45);
    z-index: 50;
    border: none;
    padding: 0;
    cursor: pointer;
  }
  .menu-backdrop.show { display: block; }

  .menu-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: auto;
    width: min(300px, 86vw);
    max-width: 300px;
    z-index: 55;
    opacity: 1;
    transform: translateX(-105%);
    pointer-events: none;
    box-shadow: 0 16px 48px rgba(var(--tint-rgb), 0.14);
    border-right: 1px solid var(--line);
    transition: transform 0.25s ease;
    padding-top: env(safe-area-inset-top, 0px);
  }
  .menu-panel.collapsed {
    width: min(300px, 86vw);
    min-width: 0;
    opacity: 1;
    transform: translateX(-105%);
    pointer-events: none;
  }
  .menu-panel.is-open {
    transform: translateX(0);
    pointer-events: auto;
    opacity: 1;
    overflow-y: auto;
  }

  .main {
    width: 100%;
    min-width: 0;
  }

  .content-bar {
    padding: 10px 12px 0;
  }
  .content-bar-actions { display: none; }
  .content {
    padding: 10px 12px calc(18px + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
  }
  .app-footer {
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    font-size: 11.5px;
  }
  .app-footer .footer-right {
    display: none;
  }

  .role-banner {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 12px;
    margin-bottom: 12px;
    gap: 8px;
  }
  .role-banner > div span { display: none; }
  .role-banner select { width: 100%; }

  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 12px;
  }
  .page-head h1 { font-size: 20px; }
  .page-head .btn-row {
    width: 100%;
  }
  .page-head .btn-row .btn {
    flex: 1;
    justify-content: center;
  }

  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 22px; }
  .form-grid, .filter-bar { grid-template-columns: 1fr; }
  .filter-bar { padding: 12px; }
  .prod-flow { grid-template-columns: 1fr 1fr; }
  .profile-layout { grid-template-columns: 1fr; }
  .status-pipeline { gap: 0; }
  .status-step { min-width: 84px; }

  /* Tables: DataTables Responsive — collapse columns, no horizontal scroll */
  .panel { overflow: hidden; }
  .panel > .table-wrap,
  .panel .dt-table-wrap,
  .admin-list-panel > .table-wrap,
  .admin-list-panel .admin-table-wrap,
  .admin-list-panel .dataTables_wrapper .dt-table-wrap {
    overflow-x: visible;
    overflow-y: visible;
    width: 100%;
    max-width: 100%;
  }
  .panel table.data,
  .panel table.dataTable,
  .admin-list-panel table.data,
  .admin-list-panel table.dataTable,
  .admin-list-panel table.admin-table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: auto !important;
  }
  .admin-list-panel {
    overflow: visible;
    min-width: 0;
  }
  table.data .actions {
    flex-wrap: nowrap;
  }

  .mobile-toggle { display: grid; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .topnav-brand {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .rail-btn {
    min-width: 48px;
    padding: 4px 2px;
    font-size: 14px;
  }
  .page-head .btn-row { flex-direction: column; }
  .page-head .btn-row .btn { width: 100%; }
}

/* ── Admin Tools: list, filters, drawer form, select2 ── */
.admin-filter-panel {
  margin-bottom: 14px;
  background: linear-gradient(180deg, var(--surface) 0%, #f3f6fa 100%);
  border: 1px solid #dbe3ef;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-card);
  overflow: visible;
}
.admin-filter-head {
  padding: 10px 16px;
  border-bottom: 1px solid #e3e9f2;
  background: rgba(255, 255, 255, 0.72);
}
.admin-filter-head h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-red);
}
.admin-filter-body {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px 16px;
}
.admin-filter-body .form-group {
  min-width: 200px;
  flex: 1;
  max-width: 280px;
  margin: 0;
}
.admin-filter-actions {
  flex: 0 0 auto;
  margin-left: auto;
  align-self: flex-end;
}
.admin-filter-actions .btn {
  white-space: nowrap;
}
.admin-filter-body .form-control {
  padding: 11px 12px;
  font-size: 0.9rem;
  border-radius: 12px;
}
.admin-filter-body .select2-container {
  width: 100% !important;
}
.admin-filter-body .select2-container--default .select2-selection--single {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.admin-filter-body .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 42px;
  padding-left: 12px;
  font-size: 0.9rem;
}
.admin-filter-body .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 42px;
  right: 8px;
}
.admin-filter-panel select.select2-hidden-accessible {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.admin-list-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.stock-summary-panel {
  margin-bottom: 14px;
}
.stock-tabs-panel > .tabs {
  margin-bottom: 0;
  padding: 0 14px;
  border-radius: 0;
}
.stock-summary-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px 0;
}
.stock-summary-totals {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
}
.stock-summary-totals strong {
  color: var(--ink);
  font-weight: 700;
}
.stock-summary-footer td {
  background: var(--surface);
  border-top: 1px solid #e3e9f2;
  font-size: 12px;
}
.admin-list-panel > .table-wrap {
  padding: 0;
}
.admin-list-panel .dataTables_wrapper .dt-toolbar {
  border-top: none;
  padding: 10px 14px;
}
.admin-list-panel .dataTables_wrapper .dt-footer {
  padding: 8px 14px;
}
.admin-list-panel .dataTables_wrapper .dataTables_length label,
.admin-list-panel .dataTables_wrapper .dataTables_filter label,
.admin-list-panel .dataTables_wrapper .dataTables_info {
  font-size: 12px;
}
.admin-list-panel .dataTables_wrapper .dataTables_length select,
.admin-list-panel .dataTables_wrapper .dataTables_filter input {
  height: 32px;
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
}
.admin-table thead th {
  padding: 8px 10px !important;
  font-size: 11px !important;
  line-height: 1.25;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #5a6478 !important;
}
.admin-table tbody td {
  padding: 7px 10px !important;
  font-size: 12px !important;
  line-height: 1.35;
  vertical-align: middle !important;
  position: relative;
}
.admin-table .cfg-value {
  padding-right: 4.5rem;
}
.admin-table td .bootstrap-maxlength,
.admin-table td .bf-maxlength,
.admin-table .bf-maxlength-wrap > .bootstrap-maxlength.bf-maxlength {
  z-index: 2;
}
.admin-table .col-sno {
  width: 40px !important;
  padding-left: 8px !important;
  padding-right: 8px !important;
  color: var(--ink-mute);
  text-align: center;
}
.admin-table .col-id,
.admin-table .col-order,
.admin-table .col-flag {
  white-space: nowrap;
  text-align: center;
}
.admin-table .col-date {
  white-space: nowrap;
}
.admin-list-panel .admin-table .col-code,
.admin-list-panel .admin-table .col-flag,
.admin-list-panel .admin-table .col-date,
.admin-list-panel .admin-table .col-user {
  width: 1% !important;
  white-space: nowrap;
  padding-left: 8px !important;
  padding-right: 8px !important;
}
.admin-list-panel .admin-table .col-code .admin-cell-ellipsis {
  max-width: 72px;
}
.admin-list-panel .admin-table .col-user .admin-cell-ellipsis {
  max-width: 88px;
}
.admin-table .col-actions {
  width: 72px !important;
}
.admin-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}
.admin-act-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-soft);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: 0.15s ease;
}
.admin-act-btn svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.admin-act-btn .bx {
  font-size: 14px;
  line-height: 1;
}
.admin-act-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.admin-act-btn-primary {
  border-color: #dbe3ef;
  color: var(--accent);
}
.admin-act-btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.admin-act-btn-danger:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.admin-act-btn-labeled {
  width: auto;
  min-height: 28px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.admin-table.role-permission-table .col-actions {
  width: 110px !important;
}
.role-module-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.admin-chip-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: center;
  max-width: 100%;
  overflow: hidden;
}
.admin-module-chip {
  display: inline-flex;
  align-items: center;
  max-width: 110px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
  background: var(--info-soft);
  color: var(--brand-blue-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.admin-module-chip-more {
  background: var(--accent-soft);
  color: var(--brand-red);
  max-width: none;
  flex-shrink: 0;
}
.admin-module-chip-select {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--brand-blue) 18%, #ffffff);
  background: #fff;
  color: var(--ink-soft);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  user-select: none;
}
.admin-module-chip-select input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.admin-module-chip-select:has(input:checked) {
  background: var(--ok-soft);
  border-color: #9fd4b0;
  color: var(--ok);
}
.admin-module-chip-select:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.65;
}
.admin-table .col-modules .admin-chip-row {
  max-width: 100%;
  flex-wrap: nowrap;
}
.admin-table.roles-table .col-actions {
  width: 96px !important;
}
.admin-table .badge {
  font-size: 10px;
  padding: 2px 7px;
  line-height: 1.3;
}
.admin-cell-ellipsis {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.admin-record-log {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-mute);
}

.role-permission-layout-panel {
  padding: 0;
  overflow: hidden;
}
.role-perm-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 420px;
}
.role-perm-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.role-perm-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}
.role-perm-nav-btn i {
  font-size: 16px;
  flex-shrink: 0;
}
.role-perm-nav-btn:hover {
  background: #fff;
  color: var(--brand-blue);
}
.role-perm-nav-btn.has-grants:not(.active) {
  background: var(--accent-soft);
  border-color: rgba(var(--accent-rgb), 0.22);
  color: var(--brand-magenta);
}
.role-perm-nav-btn.active {
  background: var(--brand-magenta);
  border-color: var(--brand-magenta);
  color: #fff;
  box-shadow: 0 4px 10px rgba(var(--accent-rgb), 0.24);
}
.role-perm-nav-count {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  color: inherit;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}
.role-perm-nav-btn.has-grants:not(.active) .role-perm-nav-count {
  background: var(--brand-magenta);
  color: #fff;
}
.role-perm-content {
  padding: 12px 14px 16px;
  min-width: 0;
}
.role-perm-pane {
  display: none;
}
.role-perm-pane.active {
  display: block;
}
.role-perm-crumb {
  margin-bottom: 10px;
  font-size: 12px;
}
.role-perm-table {
  table-layout: fixed;
  width: 100%;
}
.role-perm-table col.col-perm-all,
.role-perm-table col.col-perm-flag {
  width: 68px;
}
.role-perm-table col.col-perm-page {
  width: auto;
}
.role-perm-table thead th {
  white-space: nowrap;
  vertical-align: middle;
}
.role-perm-table thead th.col-perm-all,
.role-perm-table thead th.col-perm-flag,
.role-perm-table tbody td.col-perm-cell {
  width: 68px;
  min-width: 68px;
  max-width: 68px;
  text-align: center !important;
  vertical-align: middle !important;
  padding-left: 6px !important;
  padding-right: 6px !important;
}
.role-perm-table thead th.col-perm-page,
.role-perm-table tbody td.col-perm-page {
  text-align: left !important;
  vertical-align: middle !important;
}
.role-perm-table tbody tr.is-granted td {
  background: #fff7fa;
}
.role-perm-table tbody tr.is-granted td.col-perm-page {
  box-shadow: inset 3px 0 0 var(--brand-magenta);
  font-weight: 700;
  color: var(--brand-blue);
}
.role-perm-table tbody tr.is-granted-all td {
  background: #f4f7fc;
}
.role-perm-check {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0 auto;
  cursor: pointer;
}
.role-perm-check input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.role-perm-check-box {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid #c9d4e4;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.role-perm-check-box::after {
  content: "";
  display: block;
  width: 10px;
  height: 6px;
  margin: 5px auto 0;
  border: 2px solid #fff;
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg) scale(0);
  transition: transform 0.12s ease;
}
.role-perm-check:hover .role-perm-check-box {
  border-color: var(--brand-magenta);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}
.role-perm-check:has(input:checked) .role-perm-check-box,
.role-perm-check input:checked + .role-perm-check-box {
  background: var(--brand-magenta);
  border-color: var(--brand-magenta);
  box-shadow: 0 4px 10px rgba(var(--accent-rgb), 0.22);
}
.role-perm-check:has(input:checked) .role-perm-check-box::after,
.role-perm-check input:checked + .role-perm-check-box::after {
  transform: rotate(-45deg) scale(1);
}
.role-perm-check.is-all:hover .role-perm-check-box {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(var(--tint-rgb), 0.12);
}
.role-perm-check.is-all:has(input:checked) .role-perm-check-box,
.role-perm-check.is-all input:checked + .role-perm-check-box {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  box-shadow: 0 4px 10px rgba(var(--tint-rgb), 0.2);
}
.role-perm-check:has(input:disabled),
.role-perm-check input:disabled + .role-perm-check-box {
  cursor: default;
  opacity: 0.55;
}
.role-perm-check:has(input:focus-visible) .role-perm-check-box {
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.2);
}
.role-perm-table .page-name {
  font-weight: 500;
}
@media (max-width: 900px) {
  .role-perm-shell {
    grid-template-columns: 1fr;
  }
  .role-perm-nav {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .role-perm-nav-btn {
    width: auto;
    flex: 1 1 auto;
  }
}

.admin-form-drawer { width: min(560px, 100%); }
.admin-form-drawer.lg { width: min(720px, 100%); }
.admin-form-drawer.xl { width: min(980px, 100%); }

.po-entry-card .po-entry-panel {
  padding: 14px 16px 16px;
}
.po-entry-section {
  margin-bottom: 4px;
}
.po-entry-section-head {
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e3e9f2;
}
.po-entry-section-head h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.po-entry-card .admin-form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: start;
}
.po-entry-card .admin-form-grid .form-group {
  margin: 0;
  position: relative;
  z-index: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.po-entry-card .admin-form-grid .form-group.is-select2-open {
  z-index: 2;
}
.po-entry-card .admin-form-grid .form-group.span-2 {
  grid-column: span 2;
}
.po-entry-card .admin-form-grid > .form-group > label:not(.bf-switch) {
  display: block;
  font-size: 0.75rem;
  font-weight: 750;
  color: var(--brand-blue);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
  line-height: 1.2;
}
.po-entry-card .admin-form-grid .form-group-toggle {
  justify-content: flex-start;
  min-height: 52px;
}
.po-entry-card .admin-form-grid .form-group-toggle > label:not(.bf-switch) {
  margin-bottom: 6px;
}
.po-entry-card .admin-form-grid .bf-switch {
  display: inline-flex;
  align-items: center;
  margin: 0;
  width: fit-content;
  max-width: 100%;
}
.po-entry-card .form-control,
.po-entry-card .form-select,
.po-entry-card .select2-container--default .select2-selection--single {
  width: 100%;
  min-height: 40px;
  box-sizing: border-box;
  padding: 8px 12px;
  font-size: 0.86rem;
  line-height: 1.35;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.po-entry-card textarea.form-control {
  height: auto;
  min-height: 72px;
  padding: 10px 12px;
  line-height: 1.45;
  resize: vertical;
}
.po-entry-card .bf-maxlength-wrap {
  width: 100%;
}
.po-entry-card select.select2-hidden-accessible {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.po-entry-card .select2-container {
  display: block !important;
  width: 100% !important;
  max-width: 100%;
}
.po-entry-card .select2-container--default .select2-selection--single {
  display: flex;
  align-items: center;
  padding: 0;
}
.po-entry-card .select2-container--default .select2-selection--single .select2-selection__rendered {
  flex: 1 1 auto;
  line-height: 30px;
  padding-left: 10px;
  padding-right: 28px;
  font-size: 12.5px;
  color: var(--ink);
}
.po-entry-card .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--ink-mute);
}
.po-entry-card .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 30px;
  top: 1px;
  right: 6px;
}
.po-entry-card .select2-container--default .select2-selection--single .select2-selection__clear {
  margin-right: 18px;
  font-size: 14px;
  color: var(--ink-mute);
}
.po-entry-card .po-total-readonly {
  height: 32px;
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12.5px;
  box-sizing: border-box;
}
.po-items-panel {
  margin-top: 12px;
  border: 1px solid #dbe3ef;
  border-radius: var(--radius-card);
  background: #fff;
}
.po-items-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid #e3e9f2;
}
.po-items-head h4 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}
.po-items-table {
  margin: 0;
}
.po-items-table th,
.po-items-table td {
  vertical-align: middle;
  padding: 6px 8px;
  font-size: 12px;
}
.po-items-table .form-control,
.po-items-table .form-select {
  min-height: 30px;
  height: 30px;
  padding: 3px 8px;
  font-size: 12px;
  border-radius: 6px;
}
.po-items-table .select2-container--default .select2-selection--single {
  height: 30px;
  min-height: 30px;
  border-radius: 6px;
}
.po-items-table .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 28px;
  padding-left: 8px;
  font-size: 12px;
}
.po-items-table .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 28px;
  right: 4px;
}
.po-summary-bar {
  margin-top: 14px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid #dbe3ef;
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, var(--surface) 0%, #f3f6fa 100%);
}
.po-summary-inputs {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex: 0 1 auto;
}
.po-summary-inputs .form-group {
  margin: 0;
  min-width: 120px;
  max-width: 160px;
}
.po-summary-inputs label {
  display: block;
  font-size: 11px;
  font-weight: 650;
  color: var(--ink-soft);
  margin-bottom: 4px;
  line-height: 1.2;
}
.po-summary-totals {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 8px;
  flex: 1 1 auto;
  flex-wrap: wrap;
  margin-left: auto;
}
.po-summary-item {
  min-width: 110px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e3e9f2;
  text-align: right;
}
.po-summary-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 2px;
  line-height: 1.2;
}
.po-summary-value {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.po-summary-item.po-summary-total {
  min-width: 140px;
  border-color: color-mix(in srgb, var(--accent) 42%, #fff);
  background: #fff7f3;
}
.po-summary-item.po-summary-total .po-summary-label {
  color: var(--accent);
}
.po-summary-item.po-summary-total .po-summary-value {
  font-size: 18px;
  color: var(--accent);
}
.badge-warning { background: var(--warn-soft); color: var(--warn); }

.admin-record-log .badge {
  vertical-align: middle;
}

@media (max-width: 1100px) {
  .po-entry-card .admin-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  .po-entry-card .admin-form-grid {
    grid-template-columns: 1fr;
  }
  .po-entry-card .admin-form-grid .form-group.span-2 {
    grid-column: 1 / -1;
  }
  .po-entry-card .admin-form-grid .form-group-toggle {
    min-height: 0;
  }
  .po-summary-bar {
    flex-direction: column;
  }
  .po-summary-inputs,
  .po-summary-totals {
    width: 100%;
  }
  .po-summary-totals {
    margin-left: 0;
  }
  .po-summary-item {
    flex: 1 1 calc(50% - 8px);
  }
}
.admin-form-drawer .drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 22px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}
.admin-form-drawer .form-group {
  position: relative;
  z-index: 1;
}
.admin-form-drawer .form-group.is-select2-open {
  z-index: 2;
}
.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.admin-form-grid .form-group.span-2,
.admin-form-grid .form-group.span-full {
  grid-column: 1 / -1;
}
.admin-form-drawer label:not(.bf-switch) {
  font-size: 0.75rem;
  font-weight: 750;
  color: var(--brand-blue);
  letter-spacing: 0.02em;
  margin-bottom: 0;
}
.admin-form-drawer textarea.form-control {
  height: auto;
  min-height: 84px;
  resize: vertical;
}
.admin-form-drawer .check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

/* Toggle switch — admin form fields */
.bf-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  cursor: pointer;
  user-select: none;
}
.bf-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.bf-switch-track {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 999px;
  background: #c8ced8;
  transition: background 0.2s ease;
  overflow: hidden;
}
.bf-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(26, 34, 56, 0.2);
  transition: transform 0.2s ease;
}
.bf-switch input:checked + .bf-switch-track {
  background: var(--accent);
}
.bf-switch input:checked + .bf-switch-track::after {
  transform: translateX(20px);
}
.bf-switch-state {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  min-width: 56px;
}
.bf-switch input:checked ~ .bf-switch-state {
  color: var(--brand-red);
}
.bf-switch:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.65;
}
.bf-switch:has(input:focus-visible) .bf-switch-track {
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

/* Compact toggle variants — after base rules so checked transform is not overridden */
.bf-switch.bf-switch-sm {
  min-height: 28px;
  gap: 6px;
}
.bf-switch.bf-switch-sm .bf-switch-track {
  width: 32px;
  height: 18px;
}
.bf-switch.bf-switch-sm .bf-switch-track::after {
  width: 12px;
  height: 12px;
  top: 3px;
  left: 3px;
}
.bf-switch.bf-switch-sm input:checked + .bf-switch-track::after {
  transform: translateX(14px);
}
.bf-switch.bf-switch-sm .bf-switch-state {
  font-size: 11px;
  min-width: 36px;
}
.bf-switch.bf-switch-module {
  min-height: 24px;
  gap: 5px;
}
.bf-switch.bf-switch-module .bf-switch-state {
  display: none;
}
.bf-switch.bf-switch-module .bf-switch-caption {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.2;
}
.bf-switch.bf-switch-module .bf-switch-track {
  width: 28px;
  height: 16px;
}
.bf-switch.bf-switch-module .bf-switch-track::after {
  width: 10px;
  height: 10px;
  top: 3px;
  left: 3px;
}
.bf-switch.bf-switch-module input:checked + .bf-switch-track::after {
  transform: translateX(12px);
}

.drawer-foot.admin-form-foot {
  flex-shrink: 0;
  justify-content: space-between;
  align-items: center;
}
.drawer-foot.admin-form-foot .drawer-foot-actions {
  display: flex;
  gap: 10px;
}
body.admin-panel-open { overflow: hidden; }

/* Select2 — match Figma field controls */
.form-group > .select2-container,
.admin-form-grid .select2-container,
.admin-filter-body .select2-container,
.drawer .select2-container,
.modal .select2-container,
.admin-form-drawer .select2-container {
  width: 100% !important;
  font-size: 0.9rem;
}
body > .select2-container {
  z-index: 2200 !important;
}
.select2-container--default .select2-selection--single {
  min-height: 44px;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 42px;
  padding-left: 12px;
  padding-right: 28px;
  color: var(--ink);
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--ink-mute);
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 42px;
  right: 8px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--ink-mute) transparent transparent transparent;
  margin-top: -2px;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--brand-magenta);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
  outline: none;
}
.select2-dropdown {
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 28px 64px rgba(var(--tint-rgb), 0.18);
  overflow: hidden;
  z-index: 1205;
}
.select2-container--default .select2-results__option {
  padding: 10px 12px;
  font-size: 0.9rem;
}
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background-color: var(--brand-magenta);
}
.select2-container--default .select2-search--dropdown {
  padding: 8px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 0.9rem;
  background: var(--surface);
  outline: none;
}
.select2-container--default .select2-search--dropdown .select2-search__field:focus {
  border-color: var(--brand-magenta);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}
.drawer-backdrop.open .select2-container,
.modal-backdrop.open .select2-container { z-index: 2; }
body > .select2-container--open,
body > .select2-container .select2-dropdown,
.select2-dropdown {
  z-index: 1600 !important;
}

@media (max-width: 640px) {
  .admin-form-grid { grid-template-columns: 1fr; }
  .admin-filter-body .form-group { max-width: none; }
}

/* ========== App Launcher ========== */
.app-launcher-welcome {
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
  border-radius: var(--radius-card);
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-mid) 55%, #1e2844 100%);
  box-shadow: var(--shadow-card);
  color: #fff;
}
.app-launcher-welcome-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.08;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 18% 82%, rgba(255,255,255,0.18) 0%, transparent 52%),
    radial-gradient(circle at 82% 18%, rgba(var(--accent-rgb),0.22) 0%, transparent 42%);
}
.app-launcher-welcome-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  flex-wrap: wrap;
}
.app-launcher-greeting {
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: #fff;
}
.app-launcher-tagline {
  margin: 0 0 6px;
  font-size: 13px;
  color: rgba(255, 196, 140, 0.95);
}
.app-launcher-last-login {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  gap: 6px;
}
.app-launcher-welcome-side {
  display: flex;
  align-items: center;
  gap: 18px;
}
.app-launcher-clock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}
.app-launcher-clock i { font-size: 18px; }
.app-launcher-welcome-icon i {
  font-size: 3.2rem;
  color: rgba(255, 255, 255, 0.88);
}
.app-launcher-panel .panel-body { padding-top: 18px; }
.app-launcher-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.app-launcher-empty-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.app-launcher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 14px;
}
.app-launcher-loading,
.app-launcher-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 36px 20px;
}
.app-launcher-loading p,
.app-launcher-empty p { margin: 8px 0 0; }
.app-launcher-spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 10px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: bf-spin 0.8s linear infinite;
}
@keyframes bf-spin { to { transform: rotate(360deg); } }
.app-launcher-empty i {
  font-size: 2.5rem;
  color: var(--ink-mute);
  display: block;
  margin-bottom: 8px;
}
.app-launcher-empty h4 { margin: 0 0 6px; font-size: 15px; }
.app-launcher-empty .btn { margin-top: 12px; }
.app-launcher-error i { color: var(--brand-red); }
.app-launcher-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  aspect-ratio: 1 / 1;
  padding: 14px 10px;
  border-radius: 10px;
  background: linear-gradient(160deg, var(--brand-blue) 0%, #243456 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff !important;
  text-decoration: none !important;
  box-shadow: 0 4px 14px rgba(26, 34, 56, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.app-launcher-tile:hover {
  transform: translateY(-3px);
  border-color: rgba(var(--accent-rgb), 0.45);
  box-shadow: 0 10px 24px rgba(26, 34, 56, 0.24);
  color: #fff !important;
}
.app-launcher-tile-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-launcher-tile-icon i { font-size: 1.35rem; color: #fff; }
.app-launcher-tile-name {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
  color: #fff;
}
@media (max-width: 720px) {
  .app-launcher-welcome-side { width: 100%; justify-content: space-between; }
  .app-launcher-welcome-icon { display: none; }
}


/* Lock screen */
.lock-screen-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.lock-screen-overlay[hidden] { display: none !important; }
.lock-screen-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 34, 0.62);
  backdrop-filter: blur(6px);
}
.lock-screen-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(var(--tint-rgb), 0.14);
}
.lock-screen-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--brand-blue) 0%, #243456 100%);
  color: #fff;
}
.lock-screen-user strong {
  display: block;
  font-size: 15px;
  line-height: 1.3;
}
.lock-screen-user span {
  display: block;
  font-size: 12px;
  opacity: 0.88;
  margin-top: 2px;
}
.lock-screen-avatar,
.lock-screen-avatar-img {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  flex-shrink: 0;
}
.lock-screen-avatar {
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.16);
  font-size: 18px;
  font-weight: 800;
}
.lock-screen-avatar-img {
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.35);
}
.lock-screen-body {
  padding: 22px 20px 20px;
  text-align: center;
}
.lock-screen-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--brand-red);
  display: grid;
  place-items: center;
  font-size: 26px;
}
.lock-screen-body h3 {
  margin: 0 0 6px;
  font-size: 18px;
  color: var(--ink);
}
.lock-screen-timer,
.lock-screen-datetime {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--ink-mute);
}
.lock-screen-datetime {
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.lock-screen-msg {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-mute);
}
.lock-screen-password-wrap {
  text-align: left;
  margin-bottom: 12px;
}
.lock-screen-error {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--brand-red);
}
.lock-screen-error[hidden] { display: none !important; }
.lock-screen-signout {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--ink-mute);
}
.lock-screen-signout a {
  font-weight: 600;
  color: var(--brand-red);
  text-decoration: none;
}
.lock-screen-signout a:hover { text-decoration: underline; }

/* ── SweetAlert2: support error dialog ── */
.bf-swal-support-error,
.bf-swal-generic-error {
  border-radius: 20px !important;
  padding: 1.5rem 1.25rem 1.25rem !important;
  box-shadow: 0 16px 48px rgba(var(--tint-rgb), 0.14) !important;
}
.bf-swal-support-error .swal2-icon.swal2-error {
  margin: 0.5rem auto 1rem !important;
  border-color: #f5c2c7 !important;
  color: var(--brand-red) !important;
}
.bf-swal-support-error .swal2-icon.swal2-error [class^='swal2-x-mark-line'] {
  background-color: var(--brand-red) !important;
}
.bf-swal-support-error-title {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  color: var(--ink) !important;
  padding: 0 0.25rem !important;
}
.bf-swal-support-error-body {
  margin: 0.75rem 0 0 !important;
  padding: 0 0.25rem !important;
  text-align: left !important;
}
.bf-swal-error-lead {
  margin: 0 0 0.75rem;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.bf-swal-error-hint {
  margin: 0 0 0.65rem;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.bf-swal-error-id-wrap {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #f1c4c0;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff8f7 0%, var(--accent-soft) 100%);
}
.bf-swal-error-id {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px dashed #e8b4b0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.45;
  word-break: break-all;
  color: #9b1c1c;
}
.bf-swal-error-copy {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 78px;
  padding: 0 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.bf-swal-error-copy .bx {
  font-size: 15px;
  line-height: 1;
}
.bf-swal-error-copy:hover {
  background: var(--brand-red);
  border-color: var(--brand-red);
}
.bf-swal-error-copy.copied {
  background: var(--ok);
  border-color: var(--ok);
}
.bf-swal-btn-confirm {
  min-width: 120px !important;
  border-radius: 999px !important;
  font-weight: 600 !important;
  padding: 0.55rem 1.25rem !important;
}
@media (max-width: 480px) {
  .bf-swal-error-id-wrap {
    flex-direction: column;
  }
  .bf-swal-error-copy {
    width: 100%;
    min-height: 38px;
  }
}

/* ==========================================================================
   InvSmart app pages — Figma tokens (replaces BackFrame UI)
   ========================================================================== */

.content-host {
  flex: 1;
  min-width: 0;
  overflow: auto;
  padding: 20px 28px 32px;
  background: linear-gradient(180deg, var(--surface) 0%, #ffffff 120px);
  scrollbar-width: thin;
  scrollbar-color: #c5d0e0 transparent;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  animation: rise 0.45s var(--ease, ease) both;
}
.page-head h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand-blue);
}
.page-head .muted,
.muted {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  font-family: var(--font);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s var(--ease, ease), background 0.2s var(--ease, ease), border-color 0.2s ease, color 0.2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 22px rgba(var(--accent-rgb), 0.28);
}
.btn-primary:hover { background: var(--brand-red); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--brand-red); color: #fff; }
.btn-info { background: var(--brand-blue); color: #fff; }
.btn-info:hover { background: var(--brand-blue-mid); color: #fff; }
.btn-success { background: var(--ok); color: #fff; }
.btn-danger { background: var(--brand-red); color: #fff; }
.btn-outline {
  background: #fff;
  border-color: color-mix(in srgb, var(--brand-blue) 16%, #fff);
  color: var(--ink-soft);
}
.btn-outline:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, #fff);
  color: var(--brand-red);
  background: var(--accent-soft);
}
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-lg { padding: 12px 18px; font-size: 0.92rem; }
.btn .btn-ico {
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.panel,
.admin-list-panel,
.admin-filter-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.admin-list-panel { padding: 18px 18px 10px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-head h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-blue);
}
.panel-body { padding: 18px; }

.form-control, .form-select, textarea.form-control {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--ink);
  outline: none;
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.form-control:focus, .form-select:focus, textarea.form-control:focus {
  border-color: var(--brand-magenta);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.drawer.lg, .modal.lg, .modal.is-wide { width: min(720px, 100%); }
.drawer.xl, .admin-form-drawer.xl, .modal.xl { width: min(980px, 100%); }
.drawer-foot-actions { display: flex; gap: 8px; }

.tabs {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  padding: 0;
  background: transparent;
  border-radius: 0;
}
.tab {
  border: none;
  background: transparent;
  padding: 12px 14px 10px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink-mute);
  cursor: pointer;
  border-radius: 0;
  border-bottom: 2px solid transparent;
}
.tab.active {
  color: var(--brand-blue);
  border-bottom-color: var(--accent);
  background: transparent;
  box-shadow: none;
}
.po-status-tabs .tab.active {
  color: #fff;
  background: var(--brand-magenta);
  border-color: var(--brand-magenta);
}
.po-status-tabs .tab.tab-tone-info.active {
  background: var(--brand-blue-bright);
  border-color: var(--brand-blue-bright);
}
.po-status-tabs .tab.tab-tone-success.active {
  background: var(--ok);
  border-color: var(--ok);
}
.po-status-tabs .tab.tab-tone-warn.active {
  background: var(--warn);
  border-color: var(--warn);
}
.po-status-tabs .tab.tab-tone-danger.active {
  background: var(--brand-red);
  border-color: var(--brand-red);
}
.po-status-tabs .tab.tab-tone-muted.active {
  background: #64748b;
  border-color: #64748b;
}
.tab.tab-disabled,
.tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.app-launcher-welcome {
  background: linear-gradient(120deg, var(--brand-blue) 0%, var(--brand-blue-mid) 48%, var(--brand-magenta) 140%) !important;
  border-radius: var(--radius-card) !important;
  box-shadow: 0 14px 36px rgba(var(--tint-rgb), 0.22) !important;
}
.app-launcher-tagline { color: rgba(255, 255, 255, 0.82) !important; }
.app-launcher-tile {
  background: linear-gradient(160deg, var(--brand-blue) 0%, var(--brand-blue-mid) 100%) !important;
}
.app-launcher-tile:hover {
  border-color: rgba(var(--accent-rgb), 0.45) !important;
}

.status-bg {
  background:
    radial-gradient(ellipse 70% 55% at 15% 15%, rgba(var(--accent-rgb), 0.16), transparent 55%),
    radial-gradient(ellipse 60% 50% at 85% 85%, rgba(var(--tint-rgb), 0.12), transparent 50%),
    linear-gradient(145deg, var(--surface) 0%, #fff 45%, var(--surface) 100%) !important;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.88rem;
  transition: background 0.2s var(--ease), color 0.2s, border-color 0.2s;
}
.ghost-btn:hover {
  background: var(--surface);
  color: var(--brand-blue);
  border-color: rgba(var(--tint-rgb), 0.2);
}

.drawer-foot .btn-outline,
.modal-foot .btn-outline {
  border-radius: var(--radius-pill);
  padding: 11px 18px;
  font-weight: 700;
  border-color: var(--line);
  background: #fff;
  color: var(--ink-soft);
}
.drawer-foot .btn-outline:hover,
.modal-foot .btn-outline:hover {
  background: var(--surface);
  color: var(--brand-blue);
  border-color: rgba(var(--tint-rgb), 0.2);
}
.drawer-foot .btn-primary,
.modal-foot .btn-primary {
  border-radius: var(--radius-pill);
  padding: 11px 18px;
  font-weight: 700;
}

.modal-head > h3 {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}
.modal-head > h3 > .bx,
.modal-head > h3 > i {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--brand-magenta);
  font-size: 20px;
}

@media (max-width: 900px) {
  .content-host { padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .form-grid.cols-3, .form-grid.cols-2 { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .drawer-backdrop,
  .modal-backdrop {
    padding: 0;
    align-items: end;
  }
  .drawer,
  .drawer.lg,
  .drawer.xl,
  .admin-form-drawer,
  .admin-form-drawer.xl,
  .modal,
  .modal.lg,
  .modal.xl,
  .modal.modal-sm {
    width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
  }
}

@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

