:root {
    /* ADYCORE brand palette (sampled from the logo) */
    --ady-navy: #0A1A3F;
    --ady-navy-2: #0D2A63;
    --ady-blue: #0B6BDE;
    --ady-bright: #1E90F5;
    --ady-cyan: #1CB5F0;
    --ady-gradient: linear-gradient(135deg, #0B6BDE 0%, #1E90F5 55%, #1CB5F0 100%);

    --sidebar-bg: var(--ady-navy);
    --sidebar-fg: #c9d7ee;
    --sidebar-active: var(--ady-blue);
    --brand: var(--ady-blue);
    --surface: #ffffff;
    --page-bg: #f2f6fc;
    --border: #e1e8f3;
    --muted: #64748b;

    /* Bootstrap overrides */
    --bs-primary: #0B6BDE;
    --bs-primary-rgb: 11, 107, 222;
    --bs-info: #1CB5F0;
    --bs-info-rgb: 28, 181, 240;
    --bs-link-color: #0B6BDE;
    --bs-link-color-rgb: 11, 107, 222;
    --bs-link-hover-color: #0A1A3F;
    --bs-link-hover-color-rgb: 10, 26, 63;
    --bs-primary-text-emphasis: #0A1A3F;
    --bs-primary-bg-subtle: #e3f0fd;
    --bs-primary-border-subtle: #b6d6fa;
    --bs-focus-ring-color: rgba(11, 107, 222, .25);
}

/* Compact typography: Bootstrap sizes everything in rem, so a 14px root
   shrinks fonts, inputs, buttons, tables and spacing across the whole app. */
html { font-size: 14px; }
html, body { height: 100%; }
body { background: var(--page-bg); font-size: 0.93rem; color: #1a2540;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; }
h1, .h1 { font-size: 1.6rem; } h2, .h2 { font-size: 1.4rem; } h3, .h3 { font-size: 1.22rem; }
h4, .h4 { font-size: 1.1rem; } h5, .h5 { font-size: 1rem; } h6, .h6 { font-size: .93rem; }
.form-control, .form-select, .input-group-text, .btn, .dropdown-menu, .table, .alert, .badge-lg { font-size: .9rem; }
.form-control-sm, .form-select-sm, .btn-sm { font-size: .8rem; }
.small, small { font-size: .82em; }
body.plain { background: #eef2f7; }

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: 230px; flex-shrink: 0; background: linear-gradient(180deg, var(--ady-navy) 0%, var(--ady-navy-2) 100%); color: var(--sidebar-fg);
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 1030;
}
.sidebar .brand {
    display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem; text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,.08); flex-shrink: 0;
}
.sidebar .brand img { width: 30px; height: 30px; object-fit: contain; flex-shrink: 0;
    background: #fff; border-radius: 8px; padding: 3px; }
.sidebar .brand .brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.sidebar .brand .name { color: #fff; font-weight: 800; font-size: .95rem; letter-spacing: .06em; }
.sidebar .brand .name b { color: var(--ady-cyan); font-weight: 800; }
.sidebar .brand .product { font-size: .62rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #8fb3e3; margin-top: 2px; }
.brand-mark {
    width: 36px; height: 36px; border-radius: 9px; background: var(--ady-gradient); display: grid; place-items: center;
    font-weight: 700; font-size: 1.15rem; color: #fff;
}
.nav-scroll { overflow-y: auto; padding: .5rem .55rem 2rem; }
.nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #6fa8e8; padding: .9rem .6rem .3rem; }
.sidebar .nav-link {
    color: var(--sidebar-fg); padding: .38rem .65rem; border-radius: 7px; display: flex; gap: .55rem; align-items: center; font-size: .86rem;
}
.sidebar .nav-link:hover { background: rgba(28,181,240,.12); color: #fff; }
.sidebar .nav-link.active { background: var(--ady-gradient); color: #fff; box-shadow: 0 4px 12px rgba(11,107,222,.35); }
.sidebar .nav-link i { color: #5fb6f5; }
.sidebar .nav-link.active i { color: #fff; }
.sidebar-footer { margin-top: auto; padding: .6rem 1rem; font-size: .7rem; color: #6f86a8; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-footer img { height: 16px; vertical-align: -3px; margin-right: 4px; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 50px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center;
    padding: 0 1.25rem; position: sticky; top: 0; z-index: 1020;
}
.topbar { background: linear-gradient(90deg, #0A1A3F, #0B6BDE 50%, #1CB5F0) top / 100% 3px no-repeat, #fff !important; }
.page-title { font-weight: 700; font-size: 1.05rem; color: var(--ady-navy); }
.content { padding: 1.25rem; }

/* Hamburger toggle */
.nav-toggle { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 0; border-radius: 8px;
    background: transparent; color: var(--ady-navy); font-size: 1.35rem; line-height: 1; flex-shrink: 0; }
.nav-toggle:hover { background: #eef4fc; color: var(--ady-blue); }

/* Desktop: collapsed (icon-only) sidebar */
.sidebar { transition: width .18s ease; }
@media (min-width: 992px) {
    .sb-mini .sidebar { width: 64px; }
    .sb-mini .sidebar .brand { justify-content: center; padding: .85rem 0; }
    .sb-mini .sidebar .brand-text, .sb-mini .sidebar .nav-section, .sb-mini .sidebar-footer { display: none; }
    .sb-mini .sidebar .nav-scroll { padding: .5rem .5rem 2rem; }
    .sb-mini .sidebar .nav-link { font-size: 0; justify-content: center; padding: .5rem 0; margin-bottom: 2px; }
    .sb-mini .sidebar .nav-link i { font-size: 1.05rem; }
}

/* Mobile: slide-in sidebar + backdrop */
.sb-backdrop { display: none; }
@media (max-width: 991.98px) {
    .sidebar { position: fixed; left: -240px; transition: left .2s; }
    .sidebar.open { left: 0; box-shadow: 8px 0 24px rgba(0,0,0,.25); }
    .sb-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(10,26,63,.45); z-index: 1025; }
}

/* ---------- Components ---------- */
.card { border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--border); font-weight: 600; }
.table { margin-bottom: 0; }
.table > thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #f8fafc; white-space: nowrap; }
.table td { vertical-align: middle; }
.table-hover tbody tr { cursor: default; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.toolbar .form-control, .toolbar .form-select { width: auto; }
.stat { padding: 1rem 1.1rem; }
.stat .label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.stat { box-shadow: inset 4px 0 0 #0B6BDE, 0 1px 2px rgba(16,24,40,.04); }
.stat .value { font-size: 1.45rem; font-weight: 700; margin-top: .2rem; color: var(--ady-navy); }
.stat .sub { font-size: .8rem; color: var(--muted); }
.badge { font-weight: 600; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.form-label { font-weight: 500; font-size: .85rem; margin-bottom: .25rem; }
.required::after { content: " *"; color: #d92d20; }

/* Trend bars */
.bars { display: flex; gap: 1rem; align-items: flex-end; height: 180px; padding-top: .5rem; }
.bars .col-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .3rem; height: 100%; justify-content: flex-end; }
.bars .pair { display: flex; gap: 4px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bars .bar { width: 40%; max-width: 26px; border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .bar.s { background: var(--ady-gradient); }
.bars .bar.p { background: var(--ady-navy-2); }
.bars small { color: var(--muted); font-size: .72rem; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; }

/* Document form */
.lines-table input, .lines-table select { min-width: 70px; }
.lines-table .desc { min-width: 220px; }
.lines-table td { padding: .35rem; }
.totals-table td { padding: .3rem .5rem; }
.totals-table .grand td { font-size: 1.1rem; font-weight: 700; border-top: 2px solid var(--ady-navy); color: var(--ady-navy); }

/* Printable document */
.doc-sheet { background: #fff; max-width: 900px; margin: 0 auto; padding: 32px 36px; border: 1px solid var(--border); border-radius: 6px; font-size: .86rem; }
.doc-sheet { border-top: 5px solid var(--ady-blue) !important; }
.doc-sheet h1 { font-size: 1.35rem; letter-spacing: .08em; color: var(--ady-navy); }
.doc-sheet table.items th { background: var(--ady-navy); color: #fff; font-size: .72rem; text-transform: uppercase; }
.doc-sheet table.items td, .doc-sheet table.items th { border: 1px solid #d0d7e2; padding: 5px 6px; }
.doc-sheet .box { border: 1px solid #d0d7e2; padding: 8px 10px; border-radius: 4px; height: 100%; }
.doc-sheet .muted { color: #667085; }
.doc-logo { max-height: 64px; max-width: 200px; }
.watermark { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-25deg); font-size: 6rem; color: rgba(217,45,32,.12); font-weight: 800; pointer-events: none; }

@media print {
    .sidebar, .topbar, .no-print, .alert { display: none !important; }
    body, .content, .main { background: #fff !important; padding: 0 !important; }
    .doc-sheet { border: none; padding: 0; max-width: none; }
    @page { size: A4; margin: 12mm; }
}

/* Login & public pages */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
    background: radial-gradient(circle at 85% 15%, rgba(28,181,240,.45) 0, transparent 40%), linear-gradient(135deg, #0A1A3F 0%, #0D2A63 45%, #0B6BDE 100%); }
.auth-logo { max-width: 230px; width: 100%; }
.powered { font-size: .72rem; color: var(--muted); }
.powered img { height: 14px; vertical-align: -2px; }
.auth-card { width: 100%; max-width: 410px; }

/* ---------- Login (compact split card, centered) ---------- */
.login-center { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: #eef2f7; }
.login-shell {
    width: 100%; max-width: 720px; display: grid; grid-template-columns: 1fr 1fr; background: #fff;
    border-radius: 14px; overflow: hidden; box-shadow: 0 16px 40px rgba(10, 26, 63, .18);
}
.login-brand {
    position: relative; overflow: hidden; color: #dbe7fb; padding: 1.4rem 1.5rem; display: flex; flex-direction: column; min-height: 400px;
    background: radial-gradient(circle at 90% 10%, rgba(28,181,240,.38) 0, transparent 45%),
                radial-gradient(circle at 0% 100%, rgba(11,107,222,.45) 0, transparent 50%),
                linear-gradient(150deg, #0A1A3F 0%, #0D2A63 60%, #0B4FA8 100%);
}
.login-brand::after {
    content: ""; position: absolute; right: -40px; bottom: -30px; width: 200px; height: 200px; opacity: .07;
    background: url("../img/adycore-mark.png") center / contain no-repeat; pointer-events: none;
}
.lb-top, .login-mobile-brand { display: flex; align-items: center; gap: .45rem; }
.lb-top img, .login-mobile-brand img { width: 24px; height: 24px; background: #fff; border-radius: 6px; padding: 2px; }
.lb-name { font-weight: 800; font-size: .85rem; letter-spacing: .07em; color: #fff; }
.lb-name b { color: var(--ady-cyan); font-weight: 800; }
.lb-body { margin: auto 0; position: relative; z-index: 1; }
.lb-chip { display: inline-flex; gap: .3rem; align-items: center; font-size: .62rem; font-weight: 600; color: #bfe6ff;
    background: rgba(28,181,240,.14); border: 1px solid rgba(28,181,240,.35); padding: .15rem .5rem; border-radius: 999px; }
.lb-body h1 { color: #fff; font-size: 1.15rem; font-weight: 700; line-height: 1.3; margin: .6rem 0 .45rem; }
.lb-body p { color: #a9c0e4; font-size: .74rem; margin-bottom: .9rem; }
.lb-features { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.lb-features li { display: flex; align-items: center; gap: .5rem; font-size: .74rem; color: #dbe7fb; }
.lb-features i { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; flex-shrink: 0;
    background: rgba(255,255,255,.08); color: #5fc4f7; font-size: .75rem; }
.lb-foot { font-size: .62rem; color: #7590ba; position: relative; z-index: 1; }

.login-form-side { display: grid; place-items: center; padding: 1.5rem 1.6rem; background: #f7f9fd; }
.login-box { width: 100%; }
.login-mobile-brand { display: none; margin-bottom: 1rem; }
.login-mobile-brand .lb-name { color: var(--ady-navy); }
.login-box h2 { font-size: 1.1rem; font-weight: 700; color: var(--ady-navy); margin-bottom: .15rem; }
.login-sub { color: var(--muted); font-size: .76rem; margin-bottom: 1rem; }
.login-box .form-label { font-size: .76rem; color: #334766; margin-bottom: .2rem; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); color: #8a9bb6; font-size: .8rem; pointer-events: none; }
.input-icon .form-control { padding-left: 1.85rem; height: 32px; font-size: .8rem; background: #fff; border-color: #d6dfec; }
.input-icon .pw-toggle { position: absolute; right: .2rem; top: 50%; transform: translateY(-50%); border: 0; background: none;
    color: #8a9bb6; padding: .1rem .4rem; border-radius: 6px; font-size: .8rem; }
.input-icon .pw-toggle:hover { color: var(--ady-blue); background: #eef4fc; }
.input-icon:has(.pw-toggle) .form-control { padding-right: 2rem; }
.login-box .form-check-label { font-size: .76rem; }
.login-btn { height: 32px; font-weight: 600; font-size: .8rem; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
.login-demo { margin-top: .8rem; font-size: .68rem; color: var(--muted); background: #eef4fc; border: 1px dashed #c4d8f3;
    padding: .4rem .55rem; border-radius: 7px; }
.login-demo code { color: var(--ady-navy-2); font-size: .68rem; }

@media (max-width: 640px) {
    .login-shell { grid-template-columns: 1fr; max-width: 340px; }
    .login-brand { display: none; }
    .login-mobile-brand { display: flex; }
}

/* ---------- Brand-coloured Bootstrap components ---------- */
.btn-primary {
    --bs-btn-bg: #0B6BDE; --bs-btn-border-color: #0B6BDE;
    --bs-btn-hover-bg: #0A1A3F; --bs-btn-hover-border-color: #0A1A3F;
    --bs-btn-active-bg: #0A1A3F; --bs-btn-active-border-color: #0A1A3F;
    --bs-btn-disabled-bg: #0B6BDE; --bs-btn-disabled-border-color: #0B6BDE;
    background-image: var(--ady-gradient); border: none;
}
.btn-primary:hover { background-image: linear-gradient(135deg, #0A1A3F, #0B6BDE); }
.btn-outline-primary {
    --bs-btn-color: #0B6BDE; --bs-btn-border-color: #0B6BDE;
    --bs-btn-hover-bg: #0B6BDE; --bs-btn-hover-border-color: #0B6BDE;
    --bs-btn-active-bg: #0A1A3F; --bs-btn-active-border-color: #0A1A3F;
}
.btn-link { --bs-btn-color: #0B6BDE; --bs-btn-hover-color: #0A1A3F; }
.text-bg-primary { background-color: #0B6BDE !important; }
.text-bg-info { background-color: #1CB5F0 !important; color: #fff !important; }
.text-primary { color: #0B6BDE !important; }
.nav-pills { --bs-nav-pills-link-active-bg: #0B6BDE; --bs-nav-link-color: #0B6BDE; --bs-nav-link-hover-color: #0A1A3F; }
.nav-pills .nav-link.active { background-image: var(--ady-gradient); }
.progress-bar { background-image: var(--ady-gradient); }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: #1E90F5; box-shadow: 0 0 0 .2rem rgba(11,107,222,.18); }
.form-check-input:checked { background-color: #0B6BDE; border-color: #0B6BDE; }
.dropdown-item.active, .dropdown-item:active { background-color: #0B6BDE; }
.card-header { color: var(--ady-navy); }
.table > thead th { background: #eef4fc; color: #3b5584; }
.alert-info { --bs-alert-bg: #e3f0fd; --bs-alert-border-color: #b6d6fa; --bs-alert-color: #0A1A3F; }
a { color: #0B6BDE; }
a:hover { color: #0A1A3F; }
.checkout-card .card-header.bg-dark { background: linear-gradient(135deg, #0A1A3F, #0D2A63) !important; }

/* hide empty validation summary box */
.validation-summary-valid { display: none !important; }

/* ---------- Multi-tenant (ADYCORE platform) ---------- */
.company-chip { align-items: center; gap: .35rem; margin-left: .75rem; padding: .2rem .6rem; border-radius: 999px;
    background: #eef4fc; color: var(--ady-navy-2); font-size: .78rem; font-weight: 600; border: 1px solid #d5e4f7;
    max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.support-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .45rem 1.25rem; font-size: .82rem;
    background: #fff4d6; color: #6b4b00; border-bottom: 1px solid #f1dc9c; }
.support-bar .bi-headset { font-size: 1rem; }
.stat.stat-ok { box-shadow: inset 4px 0 0 #12a150, 0 1px 2px rgba(16,24,40,.04); }
.stat.stat-warn { box-shadow: inset 4px 0 0 #e8a317, 0 1px 2px rgba(16,24,40,.04); }
.stat.stat-bad { box-shadow: inset 4px 0 0 #d92d20, 0 1px 2px rgba(16,24,40,.04); }
body.platform .sidebar { background: linear-gradient(180deg, #081430 0%, #0A1A3F 100%); }
.text-expiring { color: #b45309; font-weight: 600; }
