/* ==========================================================================
   SUPER ERP - corporate theme
   Deep navy + graphite + white with a cheetah amber accent.
   Animations are 150-300ms so the product feels faster, never slower.
   ========================================================================== */

:root {
    --navy-900: #0b1220;
    --navy-800: #0f1a2e;
    --navy-700: #16213e;
    --navy-600: #1e2c4f;
    --graphite: #1f2937;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --surface: #f6f8fb;
    --white: #ffffff;

    --amber-500: #e2a233;
    --amber-400: #f0b449;
    --amber-300: #f6c45a;
    --amber-soft: rgba(226, 162, 51, 0.12);

    --green-500: #12b76a;
    --red-500: #ef4444;
    --blue-500: #2e6fd9;
    --purple-500: #7c5cff;

    --sidebar-width: 268px;
    --sidebar-collapsed: 78px;
    --topbar-height: 62px;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;

    --shadow-sm: 0 1px 2px rgba(15, 26, 46, .06), 0 1px 3px rgba(15, 26, 46, .08);
    --shadow: 0 4px 16px rgba(15, 26, 46, .08);
    --shadow-lg: 0 18px 40px rgba(11, 18, 32, .18);

    --fast: 160ms cubic-bezier(.4, 0, .2, 1);
    --normal: 240ms cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--graphite);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-500); text-decoration: none; }
a:hover { color: var(--navy-700); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, .35); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, .6); }

/* ===================================================== login / auth screens */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    background: var(--navy-900);
}

.auth-brand {
    position: relative;
    overflow: hidden;
    color: var(--white);
    padding: 56px 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background:
        radial-gradient(1200px 500px at -10% 10%, rgba(226, 162, 51, .18), transparent 60%),
        linear-gradient(150deg, var(--navy-700) 0%, var(--navy-900) 70%);
}

.auth-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 18% 28%, rgba(246, 196, 90, .10) 0 12px, transparent 13px),
        radial-gradient(circle at 62% 18%, rgba(246, 196, 90, .08) 0 9px, transparent 10px),
        radial-gradient(circle at 82% 62%, rgba(246, 196, 90, .07) 0 14px, transparent 15px),
        radial-gradient(circle at 32% 78%, rgba(246, 196, 90, .06) 0 10px, transparent 11px);
    pointer-events: none;
}

.auth-logo { display: flex; align-items: center; gap: 16px; position: relative; z-index: 2; }
.auth-logo img { width: 74px; height: 74px; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .45)); }
.auth-logo .brand-name { font-size: 30px; font-weight: 700; letter-spacing: .18em; }
.auth-logo .brand-sub { color: var(--amber-300); font-size: 12.5px; letter-spacing: .22em; text-transform: uppercase; }

.auth-hero { position: relative; z-index: 2; }
.auth-hero h1 { font-size: 42px; line-height: 1.1; font-weight: 700; margin: 0 0 14px; }
.auth-hero h1 span { color: var(--amber-400); }
.auth-hero p { color: rgba(255, 255, 255, .72); font-size: 15.5px; max-width: 460px; }

.speed-lines { display: flex; flex-direction: column; gap: 9px; margin-top: 30px; }
.speed-lines i {
    display: block; height: 3px; border-radius: 99px;
    background: linear-gradient(90deg, var(--amber-400), transparent);
    animation: dash 1.5s var(--normal) infinite;
}
.speed-lines i:nth-child(1) { width: 180px; }
.speed-lines i:nth-child(2) { width: 120px; animation-delay: .15s; }
.speed-lines i:nth-child(3) { width: 150px; animation-delay: .3s; }

@keyframes dash {
    0% { transform: translateX(-14px); opacity: .25; }
    45% { opacity: 1; }
    100% { transform: translateX(20px); opacity: .25; }
}

.auth-facts { display: flex; gap: 34px; position: relative; z-index: 2; flex-wrap: wrap; }
.auth-facts div span { display: block; color: var(--amber-300); font-size: 22px; font-weight: 700; }
.auth-facts div small { color: rgba(255, 255, 255, .6); text-transform: uppercase; letter-spacing: .12em; font-size: 10.5px; }

.auth-panel {
    background: var(--white);
    display: flex; align-items: center; justify-content: center;
    padding: 40px;
}
.auth-card { width: 100%; max-width: 400px; animation: rise var(--normal) both; }
.auth-card h2 { font-size: 25px; font-weight: 700; margin: 0 0 4px; color: var(--navy-800); }
.auth-card .muted { color: var(--slate-500); margin-bottom: 26px; }

@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 991px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { padding: 32px 26px; gap: 26px; }
    .auth-hero h1 { font-size: 30px; }
    .auth-facts { gap: 20px; }
}

/* ============================================================ app shell */
.app { min-height: 100vh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); z-index: 1040;
    background: linear-gradient(185deg, var(--navy-800), var(--navy-900));
    color: rgba(255, 255, 255, .78);
    display: flex; flex-direction: column;
    transition: width var(--normal), transform var(--normal);
    border-right: 1px solid rgba(255, 255, 255, .06);
}

.sidebar-head {
    height: var(--topbar-height); display: flex; align-items: center; gap: 12px;
    padding: 0 16px; border-bottom: 1px solid rgba(255, 255, 255, .07); flex: none;
}
.sidebar-head img { width: 36px; height: 36px; flex: none; }
.sidebar-head .name { color: var(--white); font-weight: 700; letter-spacing: .16em; font-size: 15px; }
.sidebar-head .tag { color: var(--amber-300); font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; }

.sidebar-scroll { overflow-y: auto; overflow-x: hidden; flex: 1; padding: 10px 8px 16px; }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .07); padding: 8px; flex: none; }

.nav-section { color: var(--slate-400); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; padding: 14px 12px 6px; }

.nav-item { position: relative; }
.nav-link,
.nav-toggle {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 9px 12px; border: 0; background: transparent; color: inherit;
    border-radius: var(--radius-sm); font-size: 13.5px; text-align: left; cursor: pointer;
    transition: background var(--fast), color var(--fast), transform var(--fast);
}
.nav-link i.fa-solid, .nav-toggle i.fa-solid { width: 18px; text-align: center; font-size: 14px; }
.nav-link:hover, .nav-toggle:hover { background: rgba(255, 255, 255, .07); color: var(--white); transform: translateX(2px); }
.nav-link.active { background: var(--amber-soft); color: var(--white); }
.nav-link.active::before {
    content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
    border-radius: 0 3px 3px 0; background: var(--amber-400);
}
.nav-toggle .chev { margin-left: auto; font-size: 10px; transition: transform var(--fast); }
.nav-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }

.nav-children { display: none; padding: 2px 0 6px 30px; }
.nav-children.open { display: block; animation: fade var(--fast) both; }
.nav-children a {
    display: block; padding: 6px 10px; color: rgba(255, 255, 255, .62);
    border-radius: 6px; font-size: 13px; transition: color var(--fast), background var(--fast);
}
.nav-children a:hover { color: var(--white); background: rgba(255, 255, 255, .06); }
.nav-children a.active { color: var(--amber-300); background: rgba(226, 162, 51, .10); }
.nav-children a[href*="/sales/orders"].active { color: #60a5fa; background: rgba(46, 111, 217, 0.18); font-weight: 600; }

.badge-count {
    margin-left: auto; background: var(--amber-500); color: #221703;
    border-radius: 99px; font-size: 10.5px; font-weight: 700; padding: 1px 7px;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* collapsed sidebar (desktop) */
body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
body.sidebar-collapsed .sidebar .label,
body.sidebar-collapsed .sidebar .nav-section,
body.sidebar-collapsed .sidebar .chev,
body.sidebar-collapsed .sidebar-head .brand-text { display: none; }
body.sidebar-collapsed .sidebar .nav-children { display: none !important; }
body.sidebar-collapsed .nav-link, body.sidebar-collapsed .nav-toggle { justify-content: center; }
body.sidebar-collapsed .main { margin-left: var(--sidebar-collapsed); }

.main { margin-left: var(--sidebar-width); transition: margin var(--normal); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    height: var(--topbar-height); background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--slate-200); position: sticky; top: 0; z-index: 1020;
    display: flex; align-items: center; gap: 12px; padding: 0 18px;
}

.icon-btn {
    width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent;
    background: transparent; color: var(--graphite); display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background var(--fast), color var(--fast), transform var(--fast);
}
.icon-btn:hover { background: var(--slate-100); color: var(--navy-700); }
.icon-btn:active { transform: scale(.94); }

.global-search {
    flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px;
    background: var(--slate-100); border: 1px solid transparent; border-radius: 10px;
    padding: 7px 12px; color: var(--slate-500); cursor: pointer;
    transition: border var(--fast), background var(--fast);
}
.global-search:hover { background: var(--white); border-color: var(--slate-200); box-shadow: var(--shadow-sm); }
.global-search kbd {
    margin-left: auto; background: var(--white); border: 1px solid var(--slate-200);
    border-radius: 5px; padding: 1px 6px; font-size: 11px; color: var(--slate-500);
}

.topbar-user { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; flex: none;
    background: linear-gradient(140deg, var(--amber-400), var(--amber-500));
    color: #22160a; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
}
.topbar-user .who { line-height: 1.15; }
.topbar-user .who strong { font-size: 13px; }
.topbar-user .who small { color: var(--slate-500); font-size: 11.5px; }

.notif-dot {
    position: absolute; top: 5px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 99px; background: var(--red-500); color: #fff; font-size: 10px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}

.content { padding: 20px 22px 40px; flex: 1; animation: pageIn var(--normal) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; }
.page-head h1 { font-size: 21px; font-weight: 700; margin: 0; color: var(--navy-800); }
.page-head .crumbs { color: var(--slate-500); font-size: 12.5px; margin-top: 3px; }
.page-head .crumbs a { color: var(--slate-500); }
.page-head .crumbs a:hover { color: var(--navy-700); }

/* ================================================================= cards */
.card-erp {
    background: var(--white); border: 1px solid var(--slate-200); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); overflow: hidden;
}
.card-erp + .card-erp { margin-top: 16px; }
.card-erp > .card-head {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 12px 16px; border-bottom: 1px solid var(--slate-200); background: #fcfdff;
}
.card-erp > .card-head h2, .card-erp > .card-head h3 { font-size: 14.5px; font-weight: 700; margin: 0; color: var(--navy-800); }
.card-erp > .card-body { padding: 16px; }
.card-erp > .card-foot { padding: 12px 16px; border-top: 1px solid var(--slate-200); background: #fcfdff; }

.kpi-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(214px, 1fr)); }
.kpi {
    background: var(--white); border: 1px solid var(--slate-200); border-radius: var(--radius);
    padding: 15px 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
    transition: transform var(--fast), box-shadow var(--fast);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi::after {
    content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px;
    border-radius: 50%; background: var(--amber-soft);
}
.kpi .kpi-label { color: var(--slate-500); font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; }
.kpi .kpi-value { font-size: 25px; font-weight: 700; color: var(--navy-800); line-height: 1.15; margin-top: 6px; }
.kpi .kpi-meta { font-size: 12px; color: var(--slate-500); margin-top: 4px; }
.kpi .kpi-icon {
    position: absolute; right: 14px; bottom: 12px; font-size: 20px; color: var(--amber-500); opacity: .75;
}
.kpi.kpi-danger .kpi-value { color: var(--red-500); }
.kpi.kpi-success .kpi-value { color: var(--green-500); }
.kpi.kpi-info .kpi-value { color: var(--blue-500); }

.trend-up { color: var(--green-500); font-weight: 600; }
.trend-down { color: var(--red-500); font-weight: 600; }

/* =============================================================== toolbar */
.toolbar {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    padding: 10px 12px; background: var(--white); border: 1px solid var(--slate-200);
    border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 14px;
}
.toolbar .spacer { flex: 1; }
.toolbar .btn { font-size: 13px; }
.toolbar-group { display: flex; gap: 6px; flex-wrap: wrap; }

.btn { border-radius: 9px; font-weight: 500; transition: transform var(--fast), box-shadow var(--fast), background var(--fast); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy-700); border-color: var(--navy-700); }
.btn-primary:hover { background: var(--navy-600); border-color: var(--navy-600); }
.btn-gold { background: linear-gradient(135deg, var(--amber-400), var(--amber-500)); border: 0; color: #22160a; font-weight: 600; }
.btn-gold:hover { filter: brightness(1.05); color: #22160a; }
.btn-outline-secondary { border-color: var(--slate-200); color: var(--graphite); background: #fff; }
.btn-outline-secondary:hover { background: var(--slate-100); color: var(--navy-700); border-color: var(--slate-200); }
.btn-sm { padding: .28rem .6rem; font-size: 12.5px; }

/* ================================================================ tables */
.table-wrap { overflow-x: auto; }
table.erp { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.erp thead th {
    background: var(--navy-700); color: #fff; font-weight: 600; font-size: 11.5px;
    text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px; white-space: nowrap;
    position: sticky; top: 0; z-index: 2;
}
table.erp thead th a { color: #fff; opacity: .92; }
table.erp thead th a:hover { color: var(--amber-300); }
table.erp tbody td { padding: 9px 12px; border-bottom: 1px solid var(--slate-200); vertical-align: middle; }
table.erp tbody tr { transition: background var(--fast); }
table.erp tbody tr:hover { background: #f8fbff; }
table.erp tbody tr.row-in { animation: fade var(--fast) both; }
table.erp tfoot td { padding: 10px 12px; font-weight: 700; background: var(--slate-100); border-top: 2px solid var(--slate-200); }
table.erp .num { text-align: right; font-variant-numeric: tabular-nums; }
table.erp .actions { white-space: nowrap; text-align: right; }
table.erp.compact tbody td { padding: 6px 10px; }

.empty-state { padding: 44px 20px; text-align: center; color: var(--slate-500); }
.empty-state i { font-size: 30px; color: var(--slate-400); margin-bottom: 10px; display: block; }

.badge-soft-success { background: rgba(18, 183, 106, .12); color: #07794a; }
.badge-soft-danger { background: rgba(239, 68, 68, .12); color: #b91c1c; }
.badge-soft-warning { background: rgba(226, 162, 51, .16); color: #92610d; }
.badge-soft-info { background: rgba(46, 111, 217, .12); color: #1d4ed8; }
.badge-soft-primary { background: rgba(30, 44, 79, .10); color: var(--navy-700); }
.badge-soft-secondary { background: rgba(100, 116, 139, .14); color: #475569; }
[class^="badge-soft-"] { border-radius: 99px; padding: .3em .68em; font-weight: 600; font-size: 11.5px; }

/* ================================================================= forms */
.form-label { font-size: 12.5px; font-weight: 600; color: #374151; margin-bottom: 4px; }
.form-control, .form-select {
    border-radius: 9px; border-color: var(--slate-200); font-size: 13.5px; padding: .44rem .7rem;
    transition: border-color var(--fast), box-shadow var(--fast);
}
.form-control:focus, .form-select:focus { border-color: var(--amber-400); box-shadow: 0 0 0 3px rgba(226, 162, 51, .16); }
.form-control-sm, .form-select-sm { font-size: 12.5px; padding: .28rem .55rem; }
.form-text { font-size: 11.5px; color: var(--slate-500); }
.is-invalid-msg { color: var(--red-500); font-size: 11.5px; margin-top: 3px; }
.required::after { content: " *"; color: var(--red-500); }

fieldset.section { border: 0; margin: 0 0 6px; padding: 0; }
fieldset.section > legend {
    font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    color: var(--slate-500); border-bottom: 1px solid var(--slate-200); padding-bottom: 6px; margin-bottom: 12px; float: none;
}

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.filter-bar .form-label { margin-bottom: 2px; }

/* ======================================================== command centre */
.cmd-backdrop {
    position: fixed; inset: 0; background: rgba(11, 18, 32, .55); backdrop-filter: blur(3px);
    z-index: 1080; display: none; align-items: flex-start; justify-content: center; padding-top: 90px;
}
.cmd-backdrop.open { display: flex; animation: fade var(--fast) both; }
.cmd-panel {
    width: min(680px, 94vw); background: var(--white); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); overflow: hidden; animation: rise var(--normal) both;
}
.cmd-input { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--slate-200); }
.cmd-input input { border: 0; outline: 0; font-size: 16px; width: 100%; }
.cmd-results { max-height: 62vh; overflow-y: auto; }
.cmd-group-label { padding: 9px 18px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--slate-400); }
.cmd-item {
    display: flex; gap: 12px; align-items: center; padding: 9px 18px; cursor: pointer;
    border-left: 3px solid transparent; transition: background var(--fast);
}
.cmd-item:hover, .cmd-item.active { background: var(--slate-100); border-left-color: var(--amber-400); }
.cmd-item .cmd-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--amber-soft); color: var(--amber-500); display: inline-flex; align-items: center; justify-content: center; }
.cmd-item small { color: var(--slate-500); }
.cmd-foot { padding: 8px 18px; border-top: 1px solid var(--slate-200); color: var(--slate-500); font-size: 11.5px; display: flex; gap: 14px; }

/* ================================================================ toasts */
.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 1090; display: flex; flex-direction: column; gap: 10px; }
.toast-erp {
    min-width: 280px; max-width: 380px; background: var(--white); border-left: 4px solid var(--blue-500);
    border-radius: 10px; box-shadow: var(--shadow-lg); padding: 12px 14px; display: flex; gap: 10px;
    animation: slideIn var(--normal) both;
}
.toast-erp.success { border-left-color: var(--green-500); }
.toast-erp.danger { border-left-color: var(--red-500); }
.toast-erp.warning { border-left-color: var(--amber-500); }
.toast-erp .t-title { font-weight: 600; font-size: 13px; }
.toast-erp .t-body { font-size: 12.5px; color: var(--slate-500); }
.toast-erp.hide { animation: slideOut var(--fast) both; }

@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes slideOut { to { opacity: 0; transform: translateX(24px); } }

/* ============================================================== skeleton */
.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #f7f9fc 37%, #eef2f7 63%); background-size: 400% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.spinner-inline { width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; display: inline-block; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.saving-bar { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: linear-gradient(90deg, var(--amber-400), var(--amber-500)); z-index: 2000; transition: width var(--normal); }

/* ============================================================ line items */
.line-table input.form-control, .line-table select.form-select { min-width: 84px; }
.line-table td { padding: 5px 6px !important; }
.line-table .item-cell { min-width: 230px; }
.line-table .drag { color: var(--slate-400); cursor: grab; }
.totals-box { display: grid; gap: 6px; }
.totals-box .row-line { display: flex; justify-content: space-between; gap: 20px; font-size: 13px; }
.totals-box .row-line.grand { border-top: 1px solid var(--slate-200); padding-top: 8px; font-size: 16px; font-weight: 700; color: var(--navy-800); }

.suggest-box {
    position: absolute; z-index: 1050; background: #fff; border: 1px solid var(--slate-200);
    border-radius: 10px; box-shadow: var(--shadow); max-height: 300px; overflow-y: auto; min-width: 320px;
}
.suggest-box div.opt { padding: 8px 12px; cursor: pointer; font-size: 13px; }
.suggest-box div.opt:hover, .suggest-box div.opt.active { background: var(--slate-100); }
.suggest-box .opt small { color: var(--slate-500); }

/* ============================================================= timeline */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--slate-200); }
.timeline .tl-item { position: relative; padding-bottom: 14px; }
.timeline .tl-item::before {
    content: ""; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%;
    background: var(--amber-400); box-shadow: 0 0 0 3px rgba(226, 162, 51, .18);
}
.timeline .tl-meta { color: var(--slate-500); font-size: 11.5px; }

/* ============================================================== chat ui */
.chat-shell { display: grid; grid-template-columns: 290px 1fr; min-height: 62vh; }
.chat-list { border-right: 1px solid var(--slate-200); overflow-y: auto; max-height: 70vh; }
.chat-list a { display: block; padding: 11px 14px; border-bottom: 1px solid var(--slate-100); color: var(--graphite); }
.chat-list a:hover, .chat-list a.active { background: var(--slate-100); }
.chat-body { display: flex; flex-direction: column; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; background: #fbfcfe; max-height: 58vh; }
.msg { max-width: 72%; margin-bottom: 10px; padding: 8px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--slate-200); font-size: 13px; }
.msg.mine { margin-left: auto; background: var(--navy-700); color: #fff; border-color: var(--navy-700); }
.msg .meta { font-size: 10.5px; opacity: .7; margin-top: 3px; }

/* ============================================================ calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell { min-height: 96px; border: 1px solid var(--slate-200); border-radius: 8px; padding: 6px; background: #fff; }
.cal-cell.other { background: var(--slate-100); color: var(--slate-400); }
.cal-cell.today { border-color: var(--amber-400); box-shadow: 0 0 0 2px rgba(226, 162, 51, .16); }
.cal-cell .d { font-size: 11.5px; font-weight: 700; color: var(--slate-500); }
.cal-ev { font-size: 11px; padding: 2px 5px; border-radius: 5px; background: var(--amber-soft); color: #7c5309; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev.task { background: rgba(46, 111, 217, .12); color: #1d4ed8; }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-head span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--slate-500); text-align: center; }

/* ============================================================== folders */
.folder-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.folder-card { border: 1px solid var(--slate-200); border-radius: var(--radius); padding: 14px; background: #fff; transition: transform var(--fast), box-shadow var(--fast); }
.folder-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.folder-card i { font-size: 22px; color: var(--amber-500); }

/* ========================================================== permissions */
.perm-table td, .perm-table th { font-size: 12.5px; }
.perm-table .form-check-input { cursor: pointer; }
.perm-module { font-weight: 600; color: var(--navy-800); }

/* =============================================================== mobile */
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(11, 18, 32, .5); z-index: 1030; display: none; }
.sidebar-backdrop.show { display: block; animation: fade var(--fast) both; }

@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    body.sidebar-open .sidebar { transform: none; }
    .main { margin-left: 0 !important; }
    .content { padding: 16px 14px 34px; }
    .global-search kbd { display: none; }
    .chat-shell { grid-template-columns: 1fr; }
    .chat-list { max-height: 210px; border-right: 0; border-bottom: 1px solid var(--slate-200); }
    .cal-cell { min-height: 74px; }
}

@media (max-width: 575px) {
    .page-head h1 { font-size: 18px; }
    .kpi .kpi-value { font-size: 21px; }
    .toolbar { gap: 6px; padding: 8px; }
    .topbar-user .who { display: none; }
}

/* ================================================================ print */
@media print {
    .sidebar, .topbar, .toolbar, .no-print, .sidebar-backdrop, .toast-stack { display: none !important; }
    .main { margin: 0 !important; }
    .content { padding: 0 !important; animation: none !important; }
    .card-erp { border: 0; box-shadow: none; }
    body { background: #fff; font-size: 12px; }
    table.erp thead th { background: #16213e !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    a[href]::after { content: ""; }
}

.print-doc { max-width: 900px; margin: 0 auto; background: #fff; padding: 26px; }
.print-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid var(--navy-700); padding-bottom: 14px; margin-bottom: 18px; }
.print-head .co-name { font-size: 20px; font-weight: 700; color: var(--navy-800); }
.print-head .doc-title { text-align: right; }
.print-head .doc-title h2 { margin: 0; font-size: 19px; color: var(--navy-700); letter-spacing: .05em; }
.print-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.print-meta .box { border: 1px solid var(--slate-200); border-radius: 8px; padding: 9px 12px; font-size: 12px; }
.print-meta .box b { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--slate-500); margin-bottom: 3px; }
.print-sign { display: flex; justify-content: space-between; margin-top: 42px; font-size: 12px; }
.print-sign div { text-align: center; border-top: 1px solid var(--slate-400); padding-top: 5px; min-width: 180px; }
.watermark-cancelled { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 90px; color: rgba(239, 68, 68, .12); transform: rotate(-24deg); font-weight: 800; pointer-events: none; }

/* ==========================================================================
   Due date reminder pop-up (home page)
   ========================================================================== */
.due-popup {
    border: 0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(11, 18, 32, .32);
}

.due-popup-head {
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 0;
    color: #fff;
    background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-600) 100%);
}

.due-popup-head.is-critical {
    background: linear-gradient(135deg, #7f1d1d 0%, var(--navy-700) 100%);
}

.due-popup-head .modal-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: .01em;
}

.due-popup-sub {
    font-size: 12.5px;
    opacity: .82;
}

.due-popup-bell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 12px;
    font-size: 18px;
    color: var(--amber-300);
    background: rgba(255, 255, 255, .1);
    animation: due-ring 1.6s ease-in-out 2;
}

/* A short nudge, then still: motion should draw the eye, not fidget. */
@keyframes due-ring {
    0%, 100% { transform: rotate(0deg); }
    20%      { transform: rotate(-13deg); }
    40%      { transform: rotate(11deg); }
    60%      { transform: rotate(-7deg); }
    80%      { transform: rotate(4deg); }
}

.due-group + .due-group { margin-top: 18px; }

.due-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 7px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line, #e3e7ee);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
}

.due-group-link {
    text-decoration: none;
    font-size: 11.5px;
    letter-spacing: .02em;
    color: var(--amber-500);
}

.due-group-link:hover { color: var(--amber-400); }

.due-list { list-style: none; margin: 0; padding: 0; }

.due-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 4px;
    border-bottom: 1px solid #f1f4f9;
}

.due-item:last-child { border-bottom: 0; }

.due-flag {
    width: 4px;
    align-self: stretch;
    border-radius: 3px;
    flex: 0 0 4px;
}

.due-flag-danger  { background: #dc3545; }
.due-flag-warning { background: var(--amber-400); }
.due-flag-success { background: #198754; }

.due-item-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1 1 auto;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.due-item-body:hover .due-item-title { color: var(--navy-700); text-decoration: underline; }

.due-item-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--graphite);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.due-item-detail {
    font-size: 11.5px;
    color: #7a8595;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.due-item-date {
    flex: 0 0 auto;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.due-item-label {
    display: block;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    opacity: .75;
}

.due-more {
    display: inline-block;
    margin-top: 7px;
    font-size: 12px;
    color: #64748b;
}

/* Used only when the Bootstrap bundle could not load (offline CDN). */
.due-popup-fallback {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1080;
    overflow-y: auto;
    background: rgba(11, 18, 32, .55);
}

@media (max-width: 575.98px) {
    .due-item { flex-wrap: wrap; }
    .due-item-date { text-align: left; padding-left: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .due-popup-bell { animation: none; }
}
