:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #cbd5e1;
  --border-light: #e2e8f0;
  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --nav-bg: #0f172a;
  --nav-text: #e2e8f0;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.22);

  /* Legacy MSK_AMBAR visual cues refined for modern UI */
  --col-price-bg: #dcfce7;
  --col-price-fg: #14532d;
  --col-kk-bg: #fef9c3;
  --col-kk-fg: #713f12;
  --col-count-bg: #f5d0fe;
  --col-count-fg: #86198f;
  --col-stock-bg: #fb923c;
  --col-stock-zero-bg: #fed7aa;
  --col-stock-fg: #1c1917;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

/* Top Navbar */
.topbar {
  height: 52px;
  background: var(--nav-bg);
  color: var(--nav-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.4px;
  color: #fff;
}

.brand-badge {
  background: linear-gradient(135deg, #3b82f6, #f97316);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 7px 12px;
  border-radius: 6px;
  color: #cbd5e1;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-link.active {
  background: #2563eb;
  color: #fff;
}

.topbar-company {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #e2e8f0;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-company-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-company-tel {
  color: #93c5fd;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.16);
  flex-shrink: 0;
}

.topbar-company-tel:hover {
  background: rgba(59, 130, 246, 0.28);
  color: #fff;
}

@media (max-width: 1120px) {
  .topbar {
    height: auto;
    min-height: 52px;
    flex-wrap: wrap;
    padding: 6px 12px;
    gap: 6px 12px;
  }
  .topbar-company {
    order: 3;
    width: 100%;
    justify-content: center;
    font-size: 11.5px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.role-tag {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-alt);
  border-color: #94a3b8;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

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

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #15803d;
}

.btn-warning {
  background: #ea580c;
  border-color: #ea580c;
  color: #fff;
}

.btn-warning:hover {
  background: #c2410c;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: #cbd5e1;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 11.5px;
}

.btn-xs {
  padding: 2px 6px;
  font-size: 11px;
}

/* Main Container */
.page-wrap {
  padding: 12px 14px;
  max-width: 100%;
}

.page-wrap-constrained {
  padding: 18px 22px;
  max-width: 1440px;
  margin: 0 auto;
}

/* Toolbar & Filter Card */
.toolbar-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.toolbar-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 8px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.filter-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.stocks-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stocks-toolbar-right {
  margin-left: auto;
}

.actions-menu-wrap {
  position: relative;
}

.actions-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 36px;
  min-width: 195px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 5px;
  z-index: 65;
}

.actions-menu.open {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.actions-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}

.actions-menu-item:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.actions-menu-sep {
  height: 1px;
  background: var(--border-light);
  margin: 4px 2px;
}

.input,
.select {
  height: 31px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus,
.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.input-search {
  width: 240px;
  font-weight: 500;
}

.input-mini {
  width: 64px;
  text-align: center;
}

/* Stock Workspace Layout (Main Grid + Right Vehicle Category Sidebar) */
.stocks-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 178px;
  gap: 10px;
  align-items: start;
}

@media (max-width: 1024px) {
  .stocks-layout {
    grid-template-columns: 1fr;
  }

  .cat-sidebar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
}

.cat-sidebar {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 62px;
  max-height: calc(100vh - 76px);
  overflow-y: auto;
}

.cat-sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-subtle);
  padding: 4px 8px 6px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 4px;
}

.cat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}

.cat-btn:hover {
  background: var(--surface-alt);
}

.cat-btn.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.cat-btn .cat-count {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-weight: 600;
}

.cat-btn.active .cat-count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* High-Density Stock Table */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 210px);
}

.stock-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.stock-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #1e293b;
  color: #f8fafc;
  font-weight: 600;
  padding: 7px 6px;
  border-right: 1px solid #334155;
  border-bottom: 2px solid #0f172a;
  white-space: nowrap;
  text-align: center;
  user-select: none;
}

.stock-table th.text-left {
  text-align: left;
}

.stock-table th.sortable {
  cursor: pointer;
}

.stock-table th.sortable:hover {
  background: #334155;
}

/* Frozen Left Columns */
.stock-table th.sticky-col-1,
.stock-table td.sticky-col-1 {
  position: sticky;
  left: 0;
  z-index: 12;
  min-width: 78px;
  max-width: 88px;
}

.stock-table th.sticky-col-2,
.stock-table td.sticky-col-2 {
  position: sticky;
  left: var(--sticky-col-2-left, 78px);
  z-index: 12;
  min-width: 260px;
  max-width: 340px;
  box-shadow: 2px 0 4px rgba(15, 23, 42, 0.08);
}

.stock-table.no-code-col th.sticky-col-2,
.stock-table.no-code-col td.sticky-col-2 {
  left: 0;
}

.stock-table th.sticky-col-1,
.stock-table th.sticky-col-2 {
  z-index: 20;
}

.stock-table td {
  padding: 5px 6px;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  background: #fff;
}

.stock-table tbody tr:nth-child(even) td {
  background: #f8fafc;
}

.stock-table tbody tr:hover td {
  background: #eff6ff !important;
}

/* Color-coded Legacy Columns */
.stock-table td.col-price {
  background: var(--col-price-bg) !important;
  color: var(--col-price-fg);
  font-weight: 600;
  text-align: right;
}

.stock-table td.col-kk {
  background: var(--col-kk-bg) !important;
  color: var(--col-kk-fg);
  text-align: center;
}

.stock-table td.col-count {
  background: var(--col-count-bg) !important;
  color: var(--col-count-fg);
  font-weight: 600;
  text-align: center;
}

.stock-table td.col-stock {
  background: var(--col-stock-bg) !important;
  color: var(--col-stock-fg);
  font-weight: 800;
  text-align: center;
  font-size: 12.5px;
}

.stock-table td.col-stock.zero {
  background: var(--col-stock-zero-bg) !important;
  color: #9a3412;
  font-weight: 600;
}

.stock-table td.num {
  text-align: center;
  min-width: 38px;
  font-variant-numeric: tabular-nums;
}

.stock-table td.depo-sep,
.stock-table th.depo-sep {
  border-left: 2px solid #94a3b8;
}

.stock-table td.desc-cell {
  font-weight: 600;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Inline Editable Cells */
.editable-cell {
  cursor: pointer;
  position: relative;
}

.editable-cell:hover {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.inline-input {
  width: 48px;
  padding: 2px 4px;
  border: 2px solid var(--primary);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  background: #fff;
  color: #0f172a;
}

/* Table Footer / Summary Bar */
.table-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-alt);
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-muted);
  gap: 8px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Column Chooser Popover */
.col-chooser-wrap {
  position: relative;
}

.col-chooser-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 36px;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  padding: 10px 12px;
}

.col-chooser-menu.open {
  display: block;
}

.col-chooser-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 10px;
  max-height: 320px;
  overflow-y: auto;
  margin: 8px 0;
}

.col-chooser-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.col-chooser-grid label:hover {
  background: var(--surface-alt);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-box {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 920px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-box > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-box.modal-sm {
  max-width: 520px;
}

.modal-box.modal-confirm {
  max-width: 420px;
  animation: modalPop 0.16s ease-out;
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(6px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.confirm-body {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 20px 20px 16px;
}

.confirm-icon {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  flex-shrink: 0;
}

.confirm-icon.danger {
  background: #fee2e2;
  color: #dc2626;
}

.confirm-icon.warning {
  background: #fef3c7;
  color: #d97706;
}

.confirm-icon.info {
  background: #dbeafe;
  color: #2563eb;
}

.confirm-title {
  margin: 0 0 6px;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text);
}

.confirm-message {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #0f172a;
  color: #fff;
}

.modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  padding: 10px 16px;
  background: var(--surface-alt);
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.form-grid-2 > * {
  min-width: 0;
}

@media (max-width: 820px) {
  .form-grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  min-width: 0;
}

.form-row .input,
.form-row .select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.form-row label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.form-inline-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.form-inline-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.form-inline-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.matrix-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin-top: 4px;
}

.matrix-table th,
.matrix-table td {
  padding: 4px 3px;
  text-align: center;
  border: 1px solid var(--border-light);
}

.matrix-table th:first-child,
.matrix-table td:first-child {
  width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix-table th {
  background: var(--surface-alt);
  font-size: 11.5px;
}

.matrix-table input {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0 2px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-weight: 600;
}

/* Dashboard & Devboard Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 12px;
  color: var(--text-subtle);
  font-weight: 600;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
  overflow: hidden;
}

.card-header {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 13.5px;
}

.card-body {
  padding: 14px 16px;
}

.dash-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 900px) {
  .dash-grid-2 {
    grid-template-columns: 1fr;
  }
}

.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 75px;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
  font-size: 12.5px;
}

.bar-track {
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  border-radius: 999px;
}

.bar-fill.orange {
  background: linear-gradient(90deg, #ea580c, #fb923c);
}

.bar-fill.green {
  background: linear-gradient(90deg, #16a34a, #4ade80);
}

/* Badges & Alerts */
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.badge-green {
  background: #dcfce7;
  color: #166534;
}

.badge-red {
  background: #fee2e2;
  color: #991b1b;
}

.badge-orange {
  background: #ffedd5;
  color: #9a3412;
}

.badge-blue {
  background: #dbeafe;
  color: #1e40af;
}

.badge-gray {
  background: #e2e8f0;
  color: #334155;
}

.alert {
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 10px;
}

.alert-error {
  background: var(--danger-soft);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-success {
  background: var(--success-soft);
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* Standard Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--surface-alt);
  border-bottom: 2px solid var(--border-light);
  color: var(--text-muted);
  font-weight: 700;
  white-space: nowrap;
}

.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

/* Toast */
#toast-container {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  font-size: 12.5px;
  font-weight: 600;
  animation: fadeInUp 0.2s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Login Page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #1e293b, #0f172a);
  padding: 20px;
}

.login-card {
  background: #fff;
  width: 100%;
  max-width: 390px;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.login-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.login-subtitle {
  color: var(--text-subtle);
  margin: 0 0 20px;
  font-size: 12.5px;
}

/* Hidden Columns Helper */
.col-hidden {
  display: none !important;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform 0.2s;
}

.toggle-switch input:checked+.toggle-slider {
  background: var(--primary);
}

.toggle-switch input:checked+.toggle-slider::before {
  transform: translateX(20px);
}

/* Print Styles */
@media print {

  .topbar,
  .toolbar-card,
  .cat-sidebar,
  .no-print,
  .table-footer .pagination {
    display: none !important;
  }

  .stocks-layout {
    display: block !important;
  }

  .table-scroll {
    max-height: none !important;
    overflow: visible !important;
  }

  .stock-table th,
  .stock-table td {
    position: static !important;
    font-size: 9px !important;
    padding: 3px 4px !important;
  }

  body {
    background: #fff !important;
  }
}

/* Mobile: disable horizontal sticky on Kod & Cinsi so full width scrolls smoothly */
@media (max-width: 768px) {
  .stock-table td.sticky-col-1,
  .stock-table td.sticky-col-2 {
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
  }
  .stock-table th.sticky-col-1,
  .stock-table th.sticky-col-2 {
    left: auto !important;
    z-index: 10 !important;
    box-shadow: none !important;
  }
}

/* Mobile Portrait Compact Typography */
@media (max-width: 640px) and (orientation: portrait) {
  .page-wrap { padding: 8px 6px; }
  .stock-table { font-size: 10px; }
  .stock-table th {
    font-size: 9.5px;
    padding: 5px 3px;
  }
  .stock-table td {
    padding: 4px 3px;
  }
  .stock-table th.sticky-col-1,
  .stock-table td.sticky-col-1 {
    min-width: 48px;
    max-width: 56px;
    font-size: 9.5px;
  }
  .stock-table th.sticky-col-2,
  .stock-table td.sticky-col-2 {
    min-width: 125px;
    max-width: 165px;
    font-size: 10px;
  }
  .stock-table td.col-price {
    font-size: 9.5px;
    padding: 4px 3px;
    letter-spacing: -0.2px;
  }
  .stock-table td.col-stock {
    font-size: 10.5px;
  }
  .stock-table td.num {
    min-width: 24px;
  }
  .stock-table .badge {
    font-size: 9px;
    padding: 1px 4px;
  }
  .stock-table .btn-xs {
    font-size: 9.5px;
    padding: 2px 4px;
  }
  .kpi-value {
    font-size: 18px;
  }
}

/* Single-Input Date Range Picker */
.drp-wrap { position: relative; display: inline-flex; align-items: center; }
.drp-input {
  width: 215px;
  cursor: pointer;
  background: #fff;
  padding-right: 26px;
}
.drp-clear {
  position: absolute;
  right: 6px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
}
.drp-clear:hover { color: #0f172a; }
.drp-popover {
  display: none;
  position: absolute;
  top: 36px;
  left: 0;
  z-index: 80;
  width: 276px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 10px;
}
.drp-popover.open { display: block; }
.drp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.drp-month-label { font-weight: 700; font-size: 13px; color: var(--text); }
.drp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-subtle);
  margin-bottom: 4px;
}
.drp-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.drp-day {
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}
.drp-day:hover { background: #e2e8f0; }
.drp-day.in-range { background: #dbeafe; color: #1e40af; border-radius: 0; }
.drp-day.selected { background: var(--primary); color: #fff; font-weight: 700; border-radius: 6px; }
.drp-day.today { box-shadow: inset 0 0 0 1px var(--primary); }
.drp-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}
.drp-hint {
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 6px;
}

/* Devboard Collapsible Log Groups */
.log-group-row {
  cursor: pointer;
  background: #f8fafc;
}
.log-group-row:hover {
  background: #eff6ff !important;
}
.log-group-row.expanded {
  background: #eff6ff;
}
.log-group-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: 4px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #334155;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}
.log-group-row.expanded .log-group-toggle {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.log-group-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}
.log-group-row.expanded .log-group-badge {
  background: #dbeafe;
  color: #1e40af;
}
.log-group-child {
  background: #fafcff;
}
.log-group-child td:first-child {
  border-left: 3px solid #93c5fd;
}

/* Devboard IP Geolocation Tag */
.ip-geo-tag {
  font-size: 11px;
  color: #475569;
  margin-top: 2px;
  line-height: 1.2;
}
.ip-geo-tag.ip-geo-private {
  color: #94a3b8;
}

/* Global HTMX Partial Loading Indicator */
.htmx-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(90deg, #2563eb 0%, #38bdf8 50%, #f97316 100%);
  background-size: 200% 100%;
  transition: opacity 0.15s ease;
}

.htmx-top-bar.active {
  opacity: 1;
  animation: htmxBarShimmer 1s linear infinite;
}

@keyframes htmxBarShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.htmx-loading-pill {
  position: fixed;
  top: 62px;
  left: 50%;
  transform: translate(-50%, -8px);
  z-index: 290;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.25);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.htmx-loading-pill.active {
  opacity: 1;
  transform: translate(-50%, 0);
}

.htmx-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-top-color: #38bdf8;
  border-radius: 50%;
  display: inline-block;
  animation: htmxSpin 0.7s linear infinite;
}

@keyframes htmxSpin {
  to { transform: rotate(360deg); }
}

.is-htmx-loading {
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* Undelivered customer sale indicator on warehouse slot cell */
.pending-star {
  color: #d97706;
  font-weight: 800;
  font-size: 10.5px;
  margin-left: 1px;
  vertical-align: super;
  cursor: help;
}
