/* =====================================================================
   AdsLogic SMS — design system
   Brand: AdsLogic orange #FE5802 on deep ink #0B0F19
   ===================================================================== */

:root {
  --brand: #fe5802;
  --brand-600: #e44d00;
  --brand-700: #c24100;
  --brand-50: #fff4ed;
  --brand-100: #ffe4d3;
  --brand-rgb: 254, 88, 2;

  --ink: #0b0f19;
  --ink-2: #111827;
  --ink-3: #1b2232;

  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --text: #0f172a;
  --text-2: #475467;
  --muted: #8a93a6;
  --border: #e7e9ef;
  --border-strong: #d6dae3;

  --success: #12b76a;
  --success-50: #ecfdf3;
  --danger: #f04438;
  --danger-50: #fef3f2;
  --warning: #f79009;
  --warning-50: #fffaeb;
  --info: #2e90fa;
  --info-50: #eff8ff;
  --violet: #7a5af8;
  --violet-50: #f4f3ff;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18);

  --sb-w: 264px;
  --topbar-h: 64px;
  --bn-h: 64px;

  --bs-primary: var(--brand);
  --bs-primary-rgb: var(--brand-rgb);
  --bs-link-color: var(--brand-600);
  --bs-link-color-rgb: 228, 77, 0;
  --bs-link-hover-color: var(--brand-700);
  --bs-body-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-border-radius: var(--radius-sm);
  --bs-focus-ring-color: rgba(var(--brand-rgb), .25);
}

[data-bs-theme="dark"] {
  --bg: #0b0f19;
  --surface: #121826;
  --surface-2: #171e2e;
  --text: #eef1f6;
  --text-2: #b3bccb;
  --muted: #7d889c;
  --border: #232b3d;
  --border-strong: #2e3850;
  --brand-50: rgba(254, 88, 2, .12);
  --brand-100: rgba(254, 88, 2, .22);
  --success-50: rgba(18, 183, 106, .12);
  --danger-50: rgba(240, 68, 56, .12);
  --warning-50: rgba(247, 144, 9, .12);
  --info-50: rgba(46, 144, 250, .12);
  --violet-50: rgba(122, 90, 248, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-secondary-bg: var(--surface-2);
  --bs-tertiary-bg: var(--surface-2);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--bs-body-font-family);
  background: var(--bg);
  color: var(--text);
  font-size: .925rem;
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }
h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.text-muted { color: var(--muted) !important; }
.small, small { font-size: .82em; }
.fw-semibold { font-weight: 600 !important; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
::selection { background: rgba(var(--brand-rgb), .2); }

/* ---------------------------------------------------------------- Sidebar */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sb-w);
  background: var(--ink);
  color: #aab3c5; z-index: 1045;
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, .04);
  transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
.sb-brand { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 14px 18px; }
.sb-logo { display: flex; align-items: center; gap: 12px; color: #fff; min-width: 0; }
.sb-logo:hover { color: #fff; }
.sb-logo img { width: 42px; height: 42px; object-fit: contain; flex: none; filter: drop-shadow(0 4px 10px rgba(var(--brand-rgb), .35)); }
.sb-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sb-brand-text strong { font-size: 1.05rem; letter-spacing: -.02em; }
.sb-brand-text strong em { font-style: normal; color: var(--brand); }
.sb-brand-text small { color: #8791a6; font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; margin-top: 2px; }
.sb-close { background: rgba(255, 255, 255, .06); border: 0; color: #fff; width: 36px; height: 36px; border-radius: 10px; }

.sb-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 12px 16px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .12) transparent; }
.sb-scroll::-webkit-scrollbar { width: 6px; }
.sb-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .1); border-radius: 6px; }
.sb-nav { list-style: none; margin: 0; padding: 0; }
.sb-section { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: #5d6779; padding: 18px 12px 6px; }
.sb-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin: 2px 0;
  color: #b4bccb; border-radius: 10px; font-weight: 500; font-size: .9rem;
  transition: background .15s, color .15s;
  position: relative;
}
.sb-link i { font-size: 1.1rem; width: 22px; text-align: center; opacity: .85; }
.sb-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sb-link.active { background: var(--brand); color: #fff; }
.sb-link.active i { opacity: 1; }
.sb-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .06); }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: rgba(255, 255, 255, .04); }
.sb-user-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.sb-user-text strong { color: #fff; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-text small { color: #8791a6; font-size: .72rem; }
.sb-logout { color: #8791a6; padding: 6px 8px; border-radius: 8px; }
.sb-logout:hover { color: #fff; background: rgba(240, 68, 56, .25); }
.sb-backdrop { position: fixed; inset: 0; background: rgba(11, 15, 25, .55); backdrop-filter: blur(2px); z-index: 1040; opacity: 0; visibility: hidden; transition: opacity .25s; }


.avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; font-weight: 700; font-size: .85rem;
}

/* ---------------------------------------------------------------- Main / topbar */
.main { margin-left: var(--sb-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1030; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: rgba(244, 245, 248, .85); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
[data-bs-theme="dark"] .topbar { background: rgba(11, 15, 25, .82); }
.topbar-title { font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.topbar-search {
  align-items: center; gap: 8px; flex: 1; max-width: 460px; height: 40px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.topbar-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .12); }
.topbar-search i { color: var(--muted); }
.topbar-search input { border: 0; outline: 0; background: transparent; flex: 1; color: var(--text); font-size: .9rem; min-width: 0; }
.topbar-search kbd { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); font-size: .7rem; padding: 1px 6px; border-radius: 6px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px; background: transparent; color: var(--text-2); font-size: 1.2rem;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.user-chip { display: flex; align-items: center; gap: 8px; background: transparent; border: 0; color: var(--text); font-weight: 600; font-size: .88rem; padding: 4px 6px; border-radius: 12px; }
.user-chip:hover { background: var(--surface); }

.content { padding: 24px; flex: 1; width: 100%; max-width: 1600px; }
.app-footer { display: flex; justify-content: space-between; padding: 16px 24px; color: var(--muted); font-size: .78rem; }

.imp-banner { background: var(--violet); color: #fff; padding: 8px 24px; font-size: .88rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.5rem; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: .88rem; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: .78rem; margin-bottom: 4px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand); }
.crumbs i { font-size: .6rem; color: var(--muted); }

/* ---------------------------------------------------------------- Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; border-radius: 10px; font-size: .88rem; padding: .5rem .9rem; white-space: nowrap; }
.btn-sm { padding: .32rem .65rem; font-size: .8rem; border-radius: 8px; }
.btn-lg { padding: .75rem 1.2rem; font-size: 1rem; border-radius: 12px; }
.btn-brand, .btn-primary {
  --bs-btn-color: #fff; --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600);
  --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700);
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); --bs-btn-disabled-color: #fff;
  --bs-btn-focus-shadow-rgb: var(--brand-rgb);
  box-shadow: 0 4px 12px -4px rgba(var(--brand-rgb), .55);
}
.btn-light {
  --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--border-strong); --bs-btn-color: var(--text);
  --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-border-color: var(--border-strong); --bs-btn-hover-color: var(--text);
  --bs-btn-active-bg: var(--surface-2); --bs-btn-active-border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}
.btn-outline-brand { --bs-btn-color: var(--brand-600); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-hover-color: #fff; }
.btn-soft { background: var(--brand-50); color: var(--brand-600); border: 1px solid transparent; }
.btn-soft:hover { background: var(--brand-100); color: var(--brand-700); }
.btn-icon { width: 34px; height: 34px; padding: 0; }
.btn-sm.btn-icon { width: 30px; height: 30px; }

.bg-brand { background: var(--brand) !important; color: #fff; }
.text-brand { color: var(--brand) !important; }
.text-profit { color: var(--success) !important; }
.text-loss { color: var(--danger) !important; }

/* ---------------------------------------------------------------- Cards */
.card {
  --bs-card-bg: var(--surface); --bs-card-border-color: var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border);
  background: var(--surface);
}
.card-header {
  background: transparent; border-bottom: 1px solid var(--border); padding: 14px 18px;
  font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.card-header .card-title { margin: 0; font-size: .98rem; display: flex; align-items: center; gap: 8px; }
.card-header .card-title i { color: var(--brand); }
.card-body { padding: 18px; }
.card-footer { background: var(--surface-2); border-top: 1px solid var(--border); padding: 12px 18px; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi {
  display: flex; gap: 14px; align-items: flex-start; padding: 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text);
  transition: transform .15s, box-shadow .15s; position: relative; overflow: hidden; min-width: 0;
}
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: var(--text); }
.kpi-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; flex: none; }
.kpi-body { min-width: 0; }
.kpi-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 1.4rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.kpi-brand .kpi-icon { background: var(--brand-50); color: var(--brand); }
.kpi-success .kpi-icon { background: var(--success-50); color: var(--success); }
.kpi-danger .kpi-icon { background: var(--danger-50); color: var(--danger); }
.kpi-warning .kpi-icon { background: var(--warning-50); color: var(--warning); }
.kpi-info .kpi-icon { background: var(--info-50); color: var(--info); }
.kpi-violet .kpi-icon { background: var(--violet-50); color: var(--violet); }
.kpi-hero { background: var(--ink); border-color: transparent; color: #fff; }
.kpi-hero .kpi-label { color: #aab3c5; }
.kpi-hero .kpi-sub { color: #8791a6; }
.kpi-hero .kpi-icon { background: rgba(var(--brand-rgb), .18); color: var(--brand); }

/* soft badges */
.badge { font-weight: 600; border-radius: 7px; padding: .35em .6em; }
.badge-soft { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.bs-brand { background: var(--brand-50); color: var(--brand-600); }
.bs-success { background: var(--success-50); color: var(--success); }
.bs-danger { background: var(--danger-50); color: var(--danger); }
.bs-warning { background: var(--warning-50); color: #b54708; }
.bs-info { background: var(--info-50); color: var(--info); }
.bs-violet { background: var(--violet-50); color: var(--violet); }
.bs-muted { background: var(--surface-2); color: var(--muted); }
[data-bs-theme="dark"] .bs-warning { color: var(--warning); }

.badge-status { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; padding: 3px 9px 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-received { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.st-testing { background: var(--info-50); color: var(--info); }
.st-repair { background: var(--warning-50); color: #b54708; }
.st-ready { background: var(--success-50); color: var(--success); }
.st-sold { background: var(--brand-50); color: var(--brand-600); }
.st-returned { background: var(--violet-50); color: var(--violet); }
.st-scrapped { background: var(--danger-50); color: var(--danger); }
.st-active { background: var(--success-50); color: var(--success); }
.st-suspended, .st-expired { background: var(--danger-50); color: var(--danger); }
.st-expiring { background: var(--warning-50); color: #b54708; }
[data-bs-theme="dark"] .st-repair, [data-bs-theme="dark"] .st-expiring { color: var(--warning); }

/* ---------------------------------------------------------------- Forms */
.form-label { font-weight: 600; font-size: .8rem; color: var(--text-2); margin-bottom: 5px; }
.form-control, .form-select {
  border-radius: 10px; border-color: var(--border-strong); background-color: var(--surface);
  color: var(--text); padding: .55rem .8rem; font-size: .9rem; min-height: 42px;
}
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .12); background-color: var(--surface); color: var(--text); }
.form-control::placeholder { color: #a5adbd; }
.form-control-lg { min-height: 50px; font-size: 1rem; border-radius: 12px; }
.form-control-sm, .form-select-sm { min-height: 34px; padding: .3rem .6rem; font-size: .82rem; border-radius: 8px; }
.input-group-text { background: var(--surface-2); border-color: var(--border-strong); color: var(--muted); border-radius: 10px; font-size: .85rem; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .15); border-color: var(--brand); }
.form-text { color: var(--muted); font-size: .76rem; }
.req::after { content: " *"; color: var(--danger); }
.form-section { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 8px 0 12px; display: flex; align-items: center; gap: 10px; }
.form-section::after { content: ""; height: 1px; flex: 1; background: var(--border); }
.sticky-actions.card { flex-direction: row; margin-bottom: 0; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--border); padding: 12px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; border-radius: 0 0 var(--radius) var(--radius); }

/* Tom select (wrapper keeps the .form-select look) */
.ts-wrapper.form-select, .ts-wrapper.form-control { min-height: 42px; border-radius: 10px; border: 1px solid var(--border-strong); background-color: var(--surface); padding: 0 2rem 0 0; display: flex; align-items: center; }
.ts-wrapper.form-select.focus, .ts-wrapper.form-control.focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .12); }
.ts-wrapper .ts-control { border: 0 !important; box-shadow: none !important; background: transparent !important; color: var(--text) !important; padding: .55rem .8rem !important; font-size: .9rem; min-height: 0; }
.ts-dropdown { border-radius: 10px; border-color: var(--border); box-shadow: var(--shadow-lg); background: var(--surface); color: var(--text); z-index: 1060; }
.ts-dropdown .active { background: var(--brand-50); color: var(--text); }
.ts-dropdown .option, .ts-dropdown .no-results { padding: 8px 12px; }
.ts-control input { color: var(--text) !important; }

/* ---------------------------------------------------------------- Filter bar */
.filter-bar { padding: 12px; margin-bottom: 16px; }
.filter-top { display: flex; gap: 8px; align-items: center; }
.filter-search { position: relative; flex: 1; min-width: 0; }
.filter-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.filter-search .form-control { padding-left: 36px; }
.filter-more { padding-top: 12px; }
.filter-more .form-label { font-size: .74rem; }
.filter-toggle .badge { margin-left: 2px; }
.date-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 4px 12px; font-size: .78rem; font-weight: 600; }
.chip:hover, .chip.active { border-color: var(--brand); color: var(--brand-600); background: var(--brand-50); }
.status-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.status-tabs::-webkit-scrollbar { display: none; }
.status-tabs a { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: .82rem; font-weight: 600; }
.status-tabs a .count { background: var(--surface-2); border-radius: 999px; padding: 0 7px; font-size: .72rem; color: var(--muted); }
.status-tabs a.active { background: var(--ink); border-color: var(--ink); color: #fff; }
[data-bs-theme="dark"] .status-tabs a.active { background: var(--brand); border-color: var(--brand); }
.status-tabs a.active .count { background: rgba(255, 255, 255, .16); color: #fff; }

/* ---------------------------------------------------------------- Tables */
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--border); margin: 0; font-size: .87rem; }
.table > :not(caption) > * > * { padding: .75rem .9rem; vertical-align: middle; }
.table thead th { font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table thead th:first-child { border-top-left-radius: 0; }
.table tbody tr { transition: background .12s; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: rgba(var(--brand-rgb), .035); }
.table tfoot td, .table tfoot th { background: var(--surface-2); font-weight: 700; }
.table .num, .table .text-end { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td .sub { display: block; color: var(--muted); font-size: .76rem; margin-top: 1px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.row-link { cursor: pointer; }
.code { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.code:hover { color: var(--brand); }

/* ---------------------------------------------------------------- Pager */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager-info { color: var(--muted); font-size: .8rem; }
.pagination { --bs-pagination-color: var(--text-2); --bs-pagination-bg: var(--surface); --bs-pagination-border-color: var(--border); --bs-pagination-hover-bg: var(--surface-2); --bs-pagination-hover-color: var(--text); --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); --bs-pagination-disabled-bg: var(--surface); --bs-pagination-focus-box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .2); }
.page-link { border-radius: 8px !important; margin: 0 2px; min-width: 32px; text-align: center; }

/* ---------------------------------------------------------------- Misc */
.alert { border-radius: 12px; border: 1px solid transparent; display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; }
.alert > i { font-size: 1.1rem; line-height: 1.3; }
.alert-dismissible { padding-right: 3rem; }
.alert-success { background: var(--success-50); color: #067647; border-color: rgba(18, 183, 106, .25); }
.alert-danger { background: var(--danger-50); color: #b42318; border-color: rgba(240, 68, 56, .25); }
.alert-warning { background: var(--warning-50); color: #93370d; border-color: rgba(247, 144, 9, .3); }
.alert-info { background: var(--info-50); color: #175cd3; border-color: rgba(46, 144, 250, .25); }
[data-bs-theme="dark"] .alert-success { color: #6ce9a6; }
[data-bs-theme="dark"] .alert-danger { color: #fda29b; }
[data-bs-theme="dark"] .alert-warning { color: #fec84b; }
[data-bs-theme="dark"] .alert-info { color: #84caff; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .empty-icon { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; display: flex; align-items: center; justify-content: center; background: var(--brand-50); color: var(--brand); font-size: 1.7rem; }
.empty-state h6, .empty-state h5 { color: var(--text); margin-bottom: 4px; }
.empty-state p { font-size: .86rem; margin-bottom: 14px; }

.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px 18px; }
.dl-grid dt { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.dl-grid dd { margin: 2px 0 0; font-weight: 600; word-break: break-word; }

.cost-sheet { display: flex; flex-direction: column; }
.cost-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: .88rem; gap: 12px; }
.cost-row span:first-child { color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.cost-row span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }
.cost-row.minus span:last-child { color: var(--success); }
.cost-row.total { border-bottom: 0; border-top: 2px solid var(--text); margin-top: 4px; padding-top: 12px; font-size: 1.02rem; }
.cost-row.total span { font-weight: 800 !important; color: var(--text) !important; }
.cost-row.profit span:last-child { font-weight: 800; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: -4px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 1px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand); }
.timeline .tl-title { font-weight: 600; font-size: .88rem; }
.timeline .tl-meta { font-size: .76rem; color: var(--muted); }

.nav-tabs-modern { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.nav-tabs-modern::-webkit-scrollbar { display: none; }
.nav-tabs-modern .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; padding: 12px 14px; white-space: nowrap; font-size: .88rem; border-radius: 0; background: none; }
.nav-tabs-modern .nav-link.active { color: var(--brand-600); border-bottom-color: var(--brand); }
.nav-tabs-modern .nav-link .badge { margin-left: 4px; }

.dropdown-menu { border-radius: 12px; border-color: var(--border); padding: 6px; font-size: .88rem; background: var(--surface); }
.dropdown-item { border-radius: 8px; padding: 8px 10px; display: flex; align-items: center; gap: 10px; color: var(--text); }
.dropdown-item i { color: var(--muted); width: 18px; }
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item:active { background: var(--brand); color: #fff; }
.dropdown-header { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }

.modal-content { border-radius: 18px; border: 0; background: var(--surface); }
.modal-header { border-bottom-color: var(--border); padding: 16px 20px; }
.modal-footer { border-top-color: var(--border); }
.modal-title { font-weight: 700; font-size: 1.05rem; }

.progress { height: 8px; border-radius: 99px; background: var(--surface-2); }
.progress-bar { background: var(--brand); }

.result-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 1050; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto; margin-top: 6px; }
.result-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border); }
.result-item:last-child { border-bottom: 0; }
.result-item:hover, .result-item.hl { background: var(--brand-50); }
.result-item .r-title { font-weight: 600; font-size: .88rem; }
.result-item .r-sub { font-size: .76rem; color: var(--muted); }

.summary-box { background: var(--surface-2); border-radius: 12px; padding: 14px; }
.summary-line { display: flex; justify-content: space-between; padding: 5px 0; font-size: .9rem; }
.summary-line.big { font-size: 1.25rem; font-weight: 800; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; }

.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 240px; }

.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); color: var(--text); }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: var(--surface-2); color: var(--text); }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .lr-sub { font-size: .76rem; color: var(--muted); }
.lr-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: none; background: var(--brand-50); color: var(--brand); }

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

/* ---------------------------------------------------------------- Bottom nav (mobile) */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
  height: calc(var(--bn-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; align-items: stretch; justify-content: space-around;
  box-shadow: 0 -6px 24px -12px rgba(16, 24, 40, .2);
}
.bottom-nav a, .bottom-nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: .68rem; font-weight: 600; background: none; border: 0; padding: 0;
}
.bottom-nav i { font-size: 1.3rem; }
.bottom-nav a.active { color: var(--brand); }
.bottom-nav .bn-fab {
  flex: none; width: 56px; height: 56px; border-radius: 18px; margin-top: -18px; align-self: flex-start;
  background: var(--brand); color: #fff;
  box-shadow: 0 10px 22px -6px rgba(var(--brand-rgb), .7);
}
.bottom-nav .bn-fab i { font-size: 1.5rem; }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1399.98px) {
  .kpi-value { font-size: 1.25rem; }
}
@media (max-width: 1199.98px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-102%); width: min(86vw, 300px); }
  body.sb-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.sb-open .sb-backdrop { opacity: 1; visibility: visible; }
  body.sb-open { overflow: hidden; }
  .main { margin-left: 0; }
  .topbar { padding: 0 10px 0 6px; height: 58px; }
  .content { padding: 16px 14px calc(var(--bn-h) + 24px + env(safe-area-inset-bottom)); }
  .app-footer { display: none; }
  .imp-banner { padding: 8px 14px; }
}
@media (max-width: 767.98px) {
  body { font-size: .9rem; }
  .page-head { margin-bottom: 14px; align-items: flex-start; }
  .page-head h1 { font-size: 1.25rem; }
  .page-actions { width: 100%; }
  .page-actions > .btn, .page-actions > form, .page-actions > .dropdown { flex: 1 1 auto; }
  .page-actions > form .btn, .page-actions > .dropdown > .btn { width: 100%; }
  .kpi-grid { gap: 10px; }
  .kpi { padding: 14px; gap: 10px; flex-direction: column; }
  .kpi-icon { width: 36px; height: 36px; font-size: 1.05rem; border-radius: 10px; }
  .kpi-value { font-size: 1.1rem; }
  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; }
  .form-control, .form-select, .ts-control, .ts-control input { font-size: 16px !important; } /* prevents iOS zoom */
  .filter-bar { padding: 10px; }
  .filter-top .btn span { display: none; }
  .filter-top .btn { padding: .5rem .7rem; }
  .chart-box { height: 230px; }
  .sticky-actions { position: fixed; left: 0; right: 0; bottom: calc(var(--bn-h) + env(safe-area-inset-bottom)); border-radius: 0; box-shadow: 0 -6px 20px -12px rgba(0, 0, 0, .25); }
  .sticky-actions .btn { flex: 1; }
  .has-sticky-actions { padding-bottom: 76px; }
  .dl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Tables → cards */
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tbody tr { padding: 12px 14px; border-bottom: 1px solid var(--border); position: relative; }
  .table-cards > :not(caption) > * > * { padding: 3px 0; border: 0; }
  .table-cards td { display: block; position: relative; text-align: right !important; min-height: 24px; padding-left: 42% !important; }
  .table-cards td::before { content: attr(data-label); position: absolute; left: 0; top: 3px; max-width: 40%; color: var(--muted); font-size: .74rem; font-weight: 600; text-align: left; }
  .table-cards td .sub { text-align: right; }
  .table-cards td.td-main { display: block; text-align: left !important; padding: 0 92px 6px 0 !important; }
  .table-cards td.td-main .sub { text-align: left; }
  .table-cards td.td-main::before { display: none; }
  .table-cards td.td-badge { position: absolute; top: 12px; right: 14px; width: auto; padding: 0 !important; }
  .table-cards td.td-badge::before { display: none; }
  .table-cards td.td-actions { padding: 8px 0 0 !important; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
  .table-cards td.td-actions::before { display: none; }
  .table-cards td:empty, .table-cards td.td-hide-m { display: none; }
  .table-cards tfoot { display: block; }
  .table-cards tfoot tr { display: flex; flex-wrap: wrap; justify-content: space-between; padding: 10px 14px; }
  .table-cards tfoot td, .table-cards tfoot th { display: block; width: auto; padding: 2px 0; background: transparent; }
  .table-cards tfoot td:empty, .table-cards tfoot th:empty { display: none; }
}
@media (max-width: 400px) {
  .kpi-value { font-size: 1rem; }
  .content { padding-left: 10px; padding-right: 10px; }
}

/* ---------------------------------------------------------------- Print */
@media print {
  .sidebar, .topbar, .bottom-nav, .sb-backdrop, .filter-bar, .page-actions, .no-print, .pager, .app-footer, .imp-banner, .alert, .btn { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; max-width: none; }
  .card { box-shadow: none !important; border-color: #ddd !important; break-inside: avoid; }
  body { background: #fff !important; color: #000 !important; font-size: 12px; }
  .table thead th { background: #f2f2f2 !important; color: #333 !important; }
  .print-only { display: block !important; }
  a { color: #000 !important; }
}
.print-only { display: none; }
