/* =====================================================================
   JM IMPEX — admin design system
   Graphite sidebar, cool paper workspace, sapphire for action and focus.
   Money and carats use tabular figures so columns line up.
   ===================================================================== */

:root {
    --ink: #1b1f24;
    --ink-2: #262c33;
    --ink-3: #343b44;
    --steel: #5b6672;
    --steel-2: #8a94a0;
    --line: #e1e5ea;
    --line-2: #eef1f4;
    --paper: #f3f5f7;
    --card: #ffffff;
    --sapphire: #0b6eb4;
    --sapphire-600: #095a93;
    --sapphire-50: #e7f4fc;
    --ice: #d8ecf8;
    --pos: #1b7a4b;
    --pos-50: #e6f4ec;
    --neg: #b3261e;
    --neg-50: #fbeceb;
    --amber: #a8690f;
    --amber-50: #fbf1e1;

    --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --sidebar-w: 248px;
    --sidebar-w-collapsed: 72px;
    --topbar-h: 64px;
}

/* ---------------------------------------------------------------- base */

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 14.5px;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); color: var(--ink); letter-spacing: -0.01em; }

a { color: var(--sapphire); }
a:hover { color: var(--sapphire-600); }

.num, .table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono-id { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: 0.01em; }
.text-pos { color: var(--pos) !important; }
.text-neg { color: var(--neg) !important; }
.text-steel { color: var(--steel) !important; }
.small-note { color: var(--steel); font-size: 12.5px; }

:focus-visible { outline: 2px solid var(--sapphire); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------------------------------------------------------------- shell */

.app { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--ink);
    color: #c9d1da;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: width .2s ease, transform .2s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--topbar-h);
    padding: 0 18px;
    text-decoration: none;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}
.sidebar-brand:hover { color: #fff; }
.sidebar-brand img { width: 30px; height: 30px; flex-shrink: 0; }
.sidebar-brand .brand-word { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: 0.02em; white-space: nowrap; }
.sidebar-brand .brand-word span { font-weight: 400; color: #8f9aa6; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 10px 24px; scrollbar-width: thin; scrollbar-color: #3a424c transparent; }

.nav-group + .nav-group { margin-top: 18px; }
.nav-group-label {
    font-size: 11.5px;
    font-weight: 600;
    color: #7c8692;
    padding: 0 12px 6px;
    white-space: nowrap;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #c9d1da;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; color: #8f9aa6; }
.nav-item:hover { background: var(--ink-2); color: #fff; }
.nav-item:hover i { color: #fff; }
.nav-item.active { background: var(--ink-3); color: #fff; }
.nav-item.active i { color: #22a6ec; }
.nav-item.active::before {
    content: "";
    position: absolute;
    left: -10px; top: 8px; bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #22a6ec;
}

.sidebar-foot { padding: 12px 18px 16px; border-top: 1px solid rgba(255,255,255,.06); font-size: 12px; color: #6f7a86; white-space: nowrap; }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .2s ease; }

/* collapsed sidebar (desktop) */
html.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
html.sidebar-collapsed .app-main { margin-left: var(--sidebar-w-collapsed); }
html.sidebar-collapsed .brand-word,
html.sidebar-collapsed .nav-label,
html.sidebar-collapsed .nav-group-label,
html.sidebar-collapsed .sidebar-foot { display: none; }
html.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
html.sidebar-collapsed .nav-item { justify-content: center; padding: 10px 0; }
html.sidebar-collapsed .nav-group + .nav-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.06); }

/* ---------------------------------------------------------------- topbar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 28px;
    background: rgba(243,245,247,.92);
    backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--line);
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--steel);
    text-decoration: none;
    cursor: pointer;
    flex-shrink: 0;
}
.icon-btn:hover { background: var(--card); border-color: var(--line); color: var(--ink); }
.icon-btn.danger:hover { color: var(--neg); border-color: #f0c9c6; background: var(--neg-50); }

.topbar-crumb { font-size: 13px; color: var(--steel); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-crumb strong { color: var(--ink); font-weight: 600; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.user-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 10px 0 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--ink);
    font-weight: 500;
}
.user-menu-btn .avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--sapphire-50); color: var(--sapphire);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 12px; text-transform: uppercase;
}

.dropdown-menu { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(27,31,36,.12); padding: 6px; font-size: 14px; }
.dropdown-item { border-radius: 6px; padding: 7px 10px; display: flex; gap: 10px; align-items: center; }
.dropdown-item i { width: 16px; text-align: center; color: var(--steel); }
.dropdown-item:active { background: var(--sapphire); }
.dropdown-item.text-danger i { color: var(--neg); }

/* ---------------------------------------------------------------- page */

.page { padding: 26px 28px 56px; max-width: 1600px; width: 100%; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 24px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.page-head h1 { font-size: 26px; font-weight: 700; margin: 0; line-height: 1.15; }
.page-head .page-sub { color: var(--steel); margin: 6px 0 0; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--steel); text-decoration: none; margin-bottom: 8px; }
.back-link:hover { color: var(--ink); }

/* ---------------------------------------------------------------- panels */

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    min-width: 0;
}
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line-2);
}
.panel-head h2 { font-size: 16px; font-weight: 650; margin: 0; }
.panel-head .panel-note { font-size: 12.5px; color: var(--steel); margin: 2px 0 0; }
.panel-body { padding: 20px; }
.panel-body.flush { padding: 0; }
.panel-body.tight { padding: 12px 16px; }

/* KPI strip: one bordered panel divided into cells rather than a row of cards */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
}
.kpi { padding: 16px 20px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); margin: 0 -1px -1px 0; min-width: 0; }
.kpi-label { font-size: 12.5px; color: var(--steel); font-weight: 500; }
.kpi-value { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1.25; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value.sm { font-size: 19px; }
/* diamonds page: four counts, then three money tiles with $ and ₹ */
@media (min-width: 1100px) {
    .kpi-strip.kpi-inv { grid-template-columns: repeat(4, minmax(0, .7fr)) repeat(3, minmax(0, 1.3fr)); }
    .kpi-strip.kpi-inv .kpi { padding: 16px 16px; }
}
.kpi-strip.kpi-inv .kpi-note { white-space: normal; }
.kpi-inr { font-size: 14.5px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-note { font-size: 12px; color: var(--steel-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.feature { background: var(--ink); color: #fff; }
.kpi.feature .kpi-label, .kpi.feature .kpi-note { color: #a9b3be; }
.kpi.feature .kpi-value { color: #fff; }
.kpi.feature .kpi-value.text-pos { color: #7fd6a6 !important; }
.kpi.feature .kpi-value.text-neg { color: #f2a19b !important; }
.kpi.feature .kpi-inr { color: #e6ebf0; }
.kpi.feature .kpi-inr.text-pos { color: #7fd6a6 !important; }
.kpi.feature .kpi-inr.text-neg { color: #f2a19b !important; }

.section-title { font-size: 13.5px; font-weight: 600; color: var(--steel); margin: 26px 0 10px; }

/* definition list used for stock / diamond facts */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 20px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 12.5px; color: var(--steel); font-weight: 500; }
.facts dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* cost ladder on stock details */
.ledger { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ledger td { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.ledger td:last-child { text-align: right; font-weight: 600; white-space: nowrap; }
.ledger tr.total td { border-bottom: 0; border-top: 2px solid var(--ink); font-weight: 700; padding-top: 11px; }
.ledger tr.sub td { color: var(--steel); font-size: 13px; }

/* progress bar for recovery / sold share */
.meter { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--sapphire); border-radius: 99px; }
.meter.pos > span { background: var(--pos); }

/* ---------------------------------------------------------------- tags */

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
    background: var(--line-2);
    color: var(--steel);
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.tag.plain::before { display: none; }
.tag-available, .tag-paid, .tag-success, .tag-completed { background: var(--pos-50); color: var(--pos); }
.tag-hold, .tag-partial, .tag-in-process, .tag-processing { background: var(--amber-50); color: var(--amber); }
.tag-sold, .tag-failed, .tag-due { background: var(--neg-50); color: var(--neg); }
.tag-pending, .tag-new { background: var(--sapphire-50); color: var(--sapphire); }
.tag-open { background: var(--sapphire-50); color: var(--sapphire); }
.tag-closed, .tag-muted, .tag-contacted { background: var(--line-2); color: var(--steel); }

.stock-chip {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 6px;
    background: var(--ice);
    color: var(--ink);
    font-weight: 700;
    font-size: 12.5px;
    text-decoration: none;
    font-variant-numeric: tabular-nums;
}
a.stock-chip:hover { background: #bfe0f5; color: var(--ink); }

/* ---------------------------------------------------------------- buttons */

.btn { font-weight: 600; border-radius: 8px; font-size: 14px; padding: 7px 14px; display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.btn-sm { font-size: 13px; padding: 5px 11px; }
.btn-primary { background: var(--sapphire); border-color: var(--sapphire); }
.btn-primary:hover, .btn-primary:focus { background: var(--sapphire-600); border-color: var(--sapphire-600); }
.btn-dark { background: var(--ink); border-color: var(--ink); }
.btn-outline-secondary, .btn-light { background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.btn-outline-secondary:hover, .btn-light:hover { background: var(--line-2); border-color: #d3d9e0; color: var(--ink); }
.btn-success { background: var(--pos); border-color: var(--pos); }
.btn-danger { background: var(--neg); border-color: var(--neg); }
.btn-outline-danger { color: var(--neg); border-color: #e9b9b5; background: var(--card); }
.btn-outline-danger:hover { background: var(--neg); color: #fff; }

/* segmented control (USD / INR, status filters) */
.seg { display: inline-flex; padding: 3px; background: var(--line-2); border-radius: 9px; border: 1px solid var(--line); }
.seg button, .seg a {
    border: 0;
    background: transparent;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--steel);
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
}
.seg button.active, .seg a.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(27,31,36,.12); }

/* ---------------------------------------------------------------- forms */

.form-label { font-weight: 600; font-size: 13px; color: var(--ink); margin-bottom: 5px; }
.form-label .req { color: var(--neg); margin-left: 2px; }
.form-control, .form-select {
    border-color: #d4dae1;
    border-radius: 8px;
    font-size: 14px;
    padding: 7px 11px;
    background-color: var(--card);
}
.form-select { padding-right: 32px; }
.form-control:focus, .form-select:focus { border-color: var(--sapphire); box-shadow: 0 0 0 3px rgba(11,110,180,.16); }
.form-control[readonly], .form-control:disabled { background: var(--paper); color: var(--steel); }
.form-control-sm, .form-select-sm { font-size: 13px; padding-top: 5px; padding-bottom: 5px; }
.form-text { color: var(--steel); font-size: 12.5px; }
.input-group > .btn { border-color: #d4dae1; }
.input-group-text { background: var(--paper); border-color: #d4dae1; color: var(--steel); font-size: 13px; }
.form-check-input:checked { background-color: var(--sapphire); border-color: var(--sapphire); }
.field-validation-error, .text-danger.field-error { font-size: 12.5px; }
.input-validation-error { border-color: var(--neg) !important; }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }

.form-section { padding: 20px; border-bottom: 1px solid var(--line-2); }
.form-section:last-child { border-bottom: 0; }
.form-section h3 { font-size: 15px; font-weight: 650; margin: 0 0 4px; }
.form-section > p { color: var(--steel); font-size: 13px; margin: 0 0 16px; }
.form-foot {
    position: sticky;
    bottom: 0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    padding: 14px 20px;
    background: rgba(255,255,255,.96);
    border-top: 1px solid var(--line);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    z-index: 5;
}

/* live calculated figure next to inputs */
.calc-box { background: var(--paper); border: 1px dashed #cfd6de; border-radius: 10px; padding: 12px 14px; }
.calc-box .calc-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; padding: 3px 0; font-variant-numeric: tabular-nums; }
.calc-box .calc-row strong { font-weight: 700; }
.calc-2cur .calc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 14px; align-items: baseline; }
.calc-2cur { font-size: 13px; }
.calc-2cur .calc-row > span { white-space: nowrap; }
.calc-2cur .calc-row > strong { text-align: right; min-width: 0; white-space: nowrap; }
.calc-2cur .calc-row > strong:last-child { color: var(--steel); font-weight: 600; }
.calc-2cur .calc-row.total > strong:last-child { color: inherit; font-weight: 700; }
.calc-2cur .calc-row > strong.text-pos:last-child, .calc-2cur .calc-row > strong.text-neg:last-child { font-weight: 700; }
.calc-2cur .calc-head { font-size: 12px; color: var(--steel); border-bottom: 1px solid #cfd6de; padding-bottom: 6px; margin-bottom: 4px; }
.calc-2cur .calc-head > span:not(:first-child) { text-align: right; font-weight: 600; }
.calc-2cur .calc-head strong { color: var(--ink); margin-left: 4px; }
.calc-box .calc-row.total { border-top: 1px solid #cfd6de; margin-top: 4px; padding-top: 7px; font-size: 14.5px; }

/* filter bar above tables */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.filter-bar .form-select, .filter-bar .form-control { width: auto; min-width: 130px; max-width: 220px; }
.filter-bar .grow { flex: 1; }

/* ---------------------------------------------------------------- tables */

.table { margin: 0; font-size: 13.5px; color: var(--ink); --bs-table-hover-bg: #f6f8fb; }
.table > :not(caption) > * > * { padding: 10px 12px; border-bottom-color: var(--line-2); }
.table thead th {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--steel);
    background: #f8f9fb;
    border-bottom: 1px solid var(--line) !important;
    white-space: nowrap;
}
.table tfoot td { font-weight: 700; background: #f8f9fb; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.table tr.row-due td { background: #fdf6f5; }
.table-wrap { overflow-x: auto; }

/* expenses list on the stock page: scrolls inside the panel, headings and totals stay visible */
.exp-scroll { max-height: 520px; overflow-y: auto; }
/* side by side: the expenses panel takes the height of the cost panel on its left and scrolls inside */
@media (min-width: 992px) {
    .exp-col { position: relative; min-height: 420px; }
    .exp-col > .exp-panel { position: absolute; inset: 0 calc(var(--bs-gutter-x) * .5); display: flex; flex-direction: column; }
    .exp-panel .exp-scroll { flex: 1 1 0; min-height: 0; max-height: none; }
    .exp-panel > .empty-state { flex: 1 1 auto; }
}
.exp-scroll td:first-child { white-space: nowrap; }
.exp-scroll thead th { position: sticky; top: 0; z-index: 2; }
/* expenses total sits under the scrolling list, always visible */
.exp-foot { display: flex; gap: 24px; align-items: baseline; padding: 11px 16px; background: #f8f9fb; border-top: 1px solid var(--line); font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.exp-foot #expTotalLabel { flex: 1; }
.exp-filter .form-control { min-width: 180px; }

.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--paper); display: inline-flex; align-items: center; justify-content: center; color: var(--steel-2); border: 1px solid var(--line-2); }

.row-actions { display: inline-flex; gap: 2px; align-items: center; }
.row-actions .icon-btn { width: 32px; height: 32px; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 18px; padding: 6px 4px; font-size: 13px; }
.detail-grid span { color: var(--steel); display: block; font-size: 12px; }

/* DataTables */
.dataTables_wrapper { font-size: 13.5px; }
/* only the table scrolls sideways; search, buttons and paging stay in place */
.table-wrap:has(> .dataTables_wrapper) { overflow: visible; }
.dataTables_wrapper .dt-scroll { overflow-x: auto; width: 100%; }
.dataTables_wrapper .dt-top { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px; }
.dataTables_wrapper .dt-bottom { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line-2); }
.dataTables_wrapper .dataTables_filter { margin: 0; }
.dataTables_wrapper .dataTables_filter input { border: 1px solid #d4dae1; border-radius: 8px; padding: 6px 10px; margin-left: 6px; min-width: 220px; }
.dataTables_wrapper .dataTables_filter label { color: var(--steel); }
.dataTables_wrapper .dataTables_info { color: var(--steel); padding: 0 !important; }
.dataTables_wrapper .dataTables_paginate { padding: 0 !important; }
.dataTables_wrapper .pagination { margin: 0; gap: 3px; }
.dataTables_wrapper .page-link { border-radius: 7px !important; border: 1px solid var(--line); color: var(--ink); font-size: 13px; padding: 4px 10px; }
.dataTables_wrapper .page-item.active .page-link { background: var(--ink); border-color: var(--ink); color: #fff; }
.dataTables_wrapper .dataTables_length select { border-radius: 7px; border-color: #d4dae1; }
.dataTables_wrapper .dt-buttons .btn { padding: 5px 11px; font-size: 13px; background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.dataTables_wrapper .dt-buttons .btn:hover { background: var(--line-2); }
.dataTables_scrollBody { border-bottom: 0 !important; }
table.dataTable { margin: 0 !important; }
table.dataTable thead > tr > th.sorting::before, table.dataTable thead > tr > th.sorting::after { opacity: .25; }
table.dataTable td.dt-control::before { display: none !important; }
td.dt-control { cursor: pointer; text-align: center; color: var(--steel); width: 28px; }
tr.dt-hasChild td.dt-control i { transform: rotate(90deg); }
td.dt-control i { transition: transform .15s ease; }

/* ---------------------------------------------------------------- modals, toasts, loader */

.modal-content { border: 0; border-radius: var(--radius-lg); box-shadow: 0 24px 60px rgba(27,31,36,.22); }
.modal-header { border-bottom: 1px solid var(--line-2); padding: 16px 20px; }
.modal-title { font-size: 17px; font-weight: 700; font-family: var(--font-display); }
.modal-body { padding: 20px; }
.modal-footer { border-top: 1px solid var(--line-2); padding: 12px 20px; }

.pick-list { border: 1px solid var(--line); border-radius: 10px; max-height: 280px; overflow-y: auto; }
.pick-list label { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line-2); cursor: pointer; margin: 0; font-size: 13.5px; }
.pick-list label:last-child { border-bottom: 0; }
.pick-list label:hover { background: #f6f8fb; }
.pick-list .meta { margin-left: auto; color: var(--steel); font-variant-numeric: tabular-nums; }

.toast { border-radius: 10px; box-shadow: 0 12px 30px rgba(27,31,36,.2); font-size: 14px; min-width: 280px; }

.global-loader { position: fixed; inset: 0; background: rgba(27,31,36,.4); z-index: 19000; display: flex; align-items: center; justify-content: center; }
.global-loader.d-none { display: none !important; }
.global-loader-box { background: var(--card); color: var(--ink); border-radius: 12px; padding: 18px 26px; display: flex; gap: 14px; align-items: center; font-weight: 600; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.global-loader-box .spinner-border { color: var(--sapphire); width: 1.4rem; height: 1.4rem; border-width: .18em; }

.js-admin-tooltip { position: fixed; z-index: 30000; background: var(--ink); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 6px; pointer-events: none; opacity: 0; transition: opacity .12s; white-space: nowrap; }
.js-admin-tooltip.show { opacity: 1; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--steel); }
.empty-state h3 { font-size: 17px; color: var(--ink); margin: 10px 0 6px; }
.empty-state p { max-width: 46ch; margin: 0 auto 16px; }
.empty-state .empty-icon { width: 44px; height: 44px; opacity: .7; }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 10px; background: var(--sapphire-50); color: #0a4a78; font-size: 13.5px; margin-bottom: 16px; }
.notice i { margin-top: 3px; }
.notice.warn { background: var(--amber-50); color: #6e4609; }
.notice.danger { background: var(--neg-50); color: #7d1b15; }

/* import column chips */
.col-list { display: flex; flex-wrap: wrap; gap: 6px; counter-reset: col; }
.col-list span { counter-increment: col; font-size: 12.5px; padding: 3px 9px; border-radius: 6px; background: var(--paper); border: 1px solid var(--line); }
.col-list span::before { content: counter(col) ". "; color: var(--steel-2); }
.col-list span.req { border-color: #a9d6f2; background: var(--sapphire-50); }

.dropzone { border: 2px dashed #cdd5de; border-radius: 12px; padding: 28px 18px; text-align: center; color: var(--steel); cursor: pointer; background: var(--paper); }
.dropzone:hover, .dropzone.dragover { border-color: var(--sapphire); background: var(--sapphire-50); color: var(--sapphire); }
.dropzone i { font-size: 26px; display: block; margin-bottom: 8px; }
.dropzone .file-name { font-weight: 600; color: var(--ink); margin-top: 6px; }

/* ---------------------------------------------------------------- charts */

.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.legend-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--steel); margin-top: 10px; }
.legend-row i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------------------------------------------------------------- media manager */

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.media-tile { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); }
.media-tile.inactive { opacity: .45; }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; }
.media-tile-player { cursor: pointer; }
.media-player-placeholder { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: var(--ice); color: var(--sapphire); }
.media-player-placeholder i { font-size: 1.6rem; }
.media-player-placeholder span { font-size: .75rem; font-weight: 700; }
.media-type-badge { position: absolute; bottom: 8px; left: 8px; background: rgba(27,31,36,.7); color: #fff; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .7rem; }
.media-primary-badge { position: absolute; top: 8px; left: 8px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.media-hidden-badge { position: absolute; bottom: 8px; right: 8px; background: rgba(27,31,36,.75); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.media-tile-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.media-btn { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255,255,255,.94); display: flex; align-items: center; justify-content: center; font-size: .75rem; cursor: pointer; color: var(--steel); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.media-make-primary.is-primary { background: var(--ink); color: #fff; }
.media-delete { color: var(--neg); }
.viewer-360 { position: relative; width: 100%; aspect-ratio: 1; max-height: 65vh; margin: 0 auto; border-radius: 12px; overflow: hidden; background: var(--paper); cursor: grab; user-select: none; touch-action: pan-y pinch-zoom; }
.viewer-360.dragging { cursor: grabbing; }
.viewer-360 .viewer-frame { width: 100%; height: 100%; object-fit: contain; pointer-events: none; opacity: 0; transition: opacity .2s ease; }
.viewer-360 .viewer-frame.ready { opacity: 1; }
.viewer-360 .viewer-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--steel); font-size: .85rem; pointer-events: none; }
.viewer-360 .viewer-loading.hidden { display: none; }

/* ---------------------------------------------------------------- login */

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--paper); }
.login-art { position: relative; background: var(--ink); color: #dce6f2; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.login-art .brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 700; font-size: 20px; color: #fff; letter-spacing: .02em; }
.login-art .brand img { width: 34px; height: 34px; }
.login-art h2 { color: #fff; font-size: clamp(28px, 3.2vw, 42px); font-weight: 700; line-height: 1.1; max-width: 15ch; margin: 0 0 14px; }
.login-art p { color: #a9b3be; max-width: 44ch; margin: 0; }
.login-art .facet-bg { position: absolute; right: -120px; bottom: -120px; width: 520px; height: 520px; opacity: .14; }
.login-art .ledger-sample { font-variant-numeric: tabular-nums; font-size: 13px; color: #a9b3be; border-top: 1px solid rgba(255,255,255,.1); padding-top: 16px; display: grid; grid-template-columns: auto auto; gap: 4px 28px; max-width: 320px; position: relative; }
.login-art .ledger-sample b { color: #fff; font-weight: 600; text-align: right; }
.login-form-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 26px; font-weight: 700; margin: 0 0 6px; }
.login-card p.lead-in { color: var(--steel); margin: 0 0 26px; }
.login-card .form-control { padding: 10px 12px; font-size: 15px; }
.login-card .btn { width: 100%; padding: 10px; font-size: 15px; }

.denied-wrap { max-width: 440px; margin: 60px auto; text-align: center; }

/* ---------------------------------------------------------------- responsive */

.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; box-shadow: 0 0 40px rgba(0,0,0,.3); }
    html.sidebar-open-mobile .sidebar { transform: translateX(0); }
    html.sidebar-open-mobile .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(27,31,36,.45); z-index: 1035; }
    .app-main, html.sidebar-collapsed .app-main { margin-left: 0; }
    html.sidebar-collapsed .brand-word, html.sidebar-collapsed .nav-label, html.sidebar-collapsed .nav-group-label, html.sidebar-collapsed .sidebar-foot { display: initial; }
    html.sidebar-collapsed .nav-item { justify-content: flex-start; padding: 9px 12px; }
    html.sidebar-collapsed .sidebar-brand { justify-content: flex-start; padding: 0 18px; }
    .topbar { padding: 0 16px; }
    .page { padding: 20px 16px 48px; }
    .login-shell { grid-template-columns: 1fr; }
    .login-art { display: none; }
    #sidebarCollapse { display: none; }
}

@media (min-width: 992px) {
    #sidebarOpenMobile { display: none; }
}

@media (max-width: 575.98px) {
    .page-head h1 { font-size: 22px; }
    .kpi { padding: 12px 14px; }
    .kpi-value { font-size: 20px; }
    .filter-bar .form-select, .filter-bar .form-control { max-width: none; flex: 1 1 140px; }
    .dataTables_wrapper .dataTables_filter input { min-width: 0; width: 100%; margin-left: 0; }
    .dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_filter label { width: 100%; }
    .form-foot .btn { flex: 1; }
}

@media print {
    .sidebar, .topbar, .page-actions, .filter-bar, .row-actions, .dt-top, .dt-bottom { display: none !important; }
    .app-main { margin: 0 !important; }
    .panel { break-inside: avoid; }
}

.form-section-title { font-size: 13px; font-weight: 700; color: var(--steel); padding-top: 6px; border-top: 1px solid var(--line-2); }

/* dollars with rupees underneath (Fmt.Both) */
.v-usd { display: block; }
.v-inr { display: block; font-size: 11.5px; font-weight: 500; color: var(--steel); white-space: nowrap; }
.kpi-value .v-inr { font-family: inherit; }
.calc-row strong .v-usd, .calc-row strong .v-inr { text-align: right; }
.calc-row > strong:has(.v-usd) { text-align: right; }

/* cost recovery panel (diamond profit report) */
.recovery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.rec-tile { padding: 16px 20px; border-right: 1px solid var(--line-2); border-top: 1px solid var(--line-2); margin-right: -1px; min-width: 0; }
.rec-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.rec-split span { display: block; font-size: 12px; color: var(--steel); }
.rec-split strong { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.rec-split small { color: var(--steel); font-size: 11.5px; }
.kpi-strip.kpi-wrap .kpi-note, .rec-tile .kpi-note { white-space: normal; }
.kpi-strip.kpi-6 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
#soldTable td:first-child { white-space: nowrap; }

/* users page: stock checkboxes */
.stock-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; padding: 2px; }
.stock-pick { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; margin: 0; }
.stock-pick:has(input:checked) { border-color: var(--sapphire); background: #eef6fd; }
.stock-pick input { margin: 0; flex: none; }
