/* ============================================================
   PakInvoice - Techno Financials theme
   Dark teal sidebar, gradient KPI cards, clean white content
   ============================================================ */

:root {
    --sidebar-bg: #0d3848;
    --sidebar-bg-darker: #0a2c39;
    --sidebar-text: #e6f1f5;
    --sidebar-hover: #134a5e;
    --sidebar-active: #1565a0;
    --topbar-bg: #0d3848;
    --topbar-text: #ffffff;
    --page-bg: #f5f7fa;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
    --primary: #1565a0;
    --danger: #e74c3c;
    --success: #16a085;

    /* KPI gradients */
    --kpi-orange-from: #ff8a65;
    --kpi-orange-to:   #ff5722;
    --kpi-teal-from:   #4dd0e1;
    --kpi-teal-to:     #00acc1;
    --kpi-green-from:  #66bb6a;
    --kpi-green-to:    #2e7d32;
    --kpi-purple-from: #ba68c8;
    --kpi-purple-to:   #7b1fa2;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--page-bg);
    margin: 0;
    padding: 0;
    color: #2d3436;
    /* 13px is the sweet spot for the density of information we show. 14px+
       forced users to zoom to 90% to see the invoice-items table without
       horizontal scroll on 1366×768 laptops. */
    font-size: 13px;
    line-height: 1.45;
}

/* ====================== LAYOUT ====================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ====================== SIDEBAR ====================== */
.sidebar {
    width: 220px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    min-height: 100vh;
    flex-shrink: 0;
}

.sidebar-brand {
    padding: 18px 20px;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-brand .brand-icon {
    width: 24px;
    height: 24px;
    background: #00acc1;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 12px 0 0 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}

.sidebar-menu li a:hover {
    background: var(--sidebar-hover);
}

.sidebar-menu li.active a {
    background: var(--sidebar-active);
    border-left: 3px solid #fff;
    padding-left: 17px;
}

.sidebar-menu li a i,
.sidebar-menu li a svg {
    width: 18px;
    text-align: center;
}

/* ====================== TOP BAR ====================== */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: var(--topbar-bg);
    color: var(--topbar-text);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar .company-logo {
    font-size: 16px;
    font-weight: 500;
}

.topbar .company-name {
    margin-left: auto;
    margin-right: 16px;
    font-size: 15px;
    letter-spacing: 0.3px;
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.5);
    color: #fff;
    padding: 6px 14px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s;
}

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

/* ====================== CONTENT ====================== */
.content {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
}

/* ====================== DASHBOARD HEADER ====================== */
.insights-header {
    background: linear-gradient(135deg, #6e51a8 0%, #5b3f96 100%);
    color: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.insights-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.insights-header h2 span {
    color: #ffeb3b;
}

.insights-header .subtitle {
    font-size: 12px;
    opacity: 0.85;
    margin-top: 2px;
}

.insights-header .date-filters {
    display: flex;
    align-items: center;
    gap: 12px;
}

.insights-header .date-filters label {
    font-size: 12px;
    display: block;
    margin-bottom: 2px;
}

.insights-header .date-filters input {
    padding: 6px 10px;
    border-radius: 4px;
    border: none;
}

.btn-insights-apply {
    background: #2196f3;
    color: #fff;
    border: none;
    padding: 7px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.btn-insights-reset {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.5);
    padding: 7px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

/* ====================== KPI CARDS ====================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.kpi-card {
    border-radius: 12px;
    padding: 22px 24px;
    color: #fff;
    box-shadow: var(--card-shadow);
}

.kpi-card .label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.95;
    margin-bottom: 8px;
}

.kpi-card .value {
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
}

.kpi-orange { background: linear-gradient(135deg, var(--kpi-orange-from), var(--kpi-orange-to)); }
.kpi-teal   { background: linear-gradient(135deg, var(--kpi-teal-from),   var(--kpi-teal-to));   }
.kpi-green  { background: linear-gradient(135deg, var(--kpi-green-from),  var(--kpi-green-to));  }
.kpi-purple { background: linear-gradient(135deg, var(--kpi-purple-from), var(--kpi-purple-to)); }

/* ====================== DASHBOARD GRID ====================== */
.dash-grid {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr;
    gap: 16px;
}

.chart-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--card-shadow);
}

.chart-card h3 {
    margin: 0 0 16px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #5a6c7d;
}

.fbr-status-stack { display: flex; flex-direction: column; gap: 12px; }

.fbr-stat {
    background: #fff;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: var(--card-shadow);
    border-left: 4px solid;
}

.fbr-stat .label {
    font-size: 11px;
    text-transform: uppercase;
    color: #7f8c8d;
    margin-bottom: 4px;
}

.fbr-stat .value {
    font-size: 26px;
    font-weight: 700;
    color: #2c3e50;
}

.fbr-stat .progress-mini {
    margin-top: 8px;
    height: 4px;
    background: #ecf0f1;
    border-radius: 2px;
    overflow: hidden;
}

.fbr-stat .progress-mini > div { height: 100%; }

.fbr-posted   { border-left-color: #f39c12; }
.fbr-posted   .progress-mini > div { background: #f39c12; }
.fbr-pending  { border-left-color: #8e44ad; }
.fbr-pending  .progress-mini > div { background: #8e44ad; }
.fbr-rejected { border-left-color: #e74c3c; }
.fbr-rejected .progress-mini > div { background: #e74c3c; }

/* ====================== PAGE CARD (lists, forms) ====================== */
.page-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.page-card-header {
    padding: 14px 20px;
    border-bottom: 1px solid #ecf0f1;
    background: #fafbfc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.page-card-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #2d3436;
}

.page-card-header h2 i { color: var(--primary); }

.page-card-body { padding: 20px; }

/* ====================== BUTTONS ====================== */
.btn-dark {
    background: var(--sidebar-bg);
    color: #fff;
    border: none;
    padding: 7px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-dark:hover { background: var(--sidebar-bg-darker); color: #fff; }

.btn-primary-pi {
    background: var(--primary); color: #fff; border: none;
    padding: 7px 14px; border-radius: 4px; cursor: pointer; font-size: 13px;
}

.btn-danger-pi { background: var(--danger); color: #fff; border: none;
    padding: 7px 14px; border-radius: 4px; cursor: pointer; font-size: 13px; }

.btn-success-pi { background: var(--success); color: #fff; border: none;
    padding: 7px 14px; border-radius: 4px; cursor: pointer; font-size: 13px; }

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    color: #5a6c7d;
}

.btn-icon:hover { color: var(--primary); }
.btn-icon.edit:hover { color: var(--primary); }
.btn-icon.delete:hover { color: var(--danger); }
.btn-icon.view:hover { color: #16a085; }
.btn-icon.post:hover { color: #e74c3c; }

/* ====================== TABLE ====================== */
.dt-table {
    width: 100%;
    border-collapse: collapse;
}

.dt-table thead {
    background: #fafbfc;
}

.dt-table th {
    padding: 9px 10px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #34495e;
    border-bottom: 2px solid #ecf0f1;
    white-space: nowrap;
}

.dt-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #ecf0f1;
    font-size: 12px;
    color: #34495e;
}

.dt-table tbody tr:hover { background: #fafbfc; }

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending  { background: #fff3cd; color: #856404; }
.status-approved { background: #d1ecf1; color: #0c5460; }
.status-posted   { background: #d4edda; color: #155724; }
.status-rejected { background: #f8d7da; color: #721c24; }
.status-paid     { background: #cce5ff; color: #004085; }

/* ====================== FORMS ====================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px 16px;
}

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

/* 5-column grid used by the Customer modal (matches Techno Financials reference).
   Wider fields like BusinessName / AddressLine1 use grid-column: span N to take
   multiple cells. Falls back to 2 columns on narrow screens. */
.form-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #5a6c7d;
    margin-bottom: 4px;
}

.form-control {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #d6dde3;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    color: #2d3436;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(21,101,160,0.15);
}

textarea.form-control { min-height: 70px; resize: vertical; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 14px;
    margin-top: 14px;
    border-top: 1px solid #ecf0f1;
}

/* ====================== INVOICE LINE ITEMS ====================== */
.invoice-items-wrap {
    margin-top: 20px;
    border-top: 1px solid #ecf0f1;
    padding-top: 16px;
}

.invoice-items {
    width: 100%;
    border-collapse: collapse;
}

.invoice-items th {
    background: #fafbfc;
    padding: 8px 6px;
    font-size: 11px;
    font-weight: 600;
    color: #5a6c7d;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.invoice-items td {
    padding: 6px 4px;
    border-bottom: 1px solid #f1f3f5;
}

.invoice-items input,
.invoice-items select {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #d6dde3;
    border-radius: 3px;
    font-size: 11px;
}

.invoice-items .row-num { text-align: center; padding-top: 12px; }

.invoice-total-row td {
    background: #fafbfc;
    font-weight: 600;
    padding: 12px 6px;
    color: #2c3e50;
}

.btn-add-row {
    background: var(--success); color: #fff; border: none;
    width: 28px; height: 28px; border-radius: 4px; cursor: pointer;
    font-size: 16px; font-weight: 700; line-height: 1;
}
.btn-remove-row {
    background: var(--danger); color: #fff; border: none;
    width: 28px; height: 28px; border-radius: 4px; cursor: pointer;
    font-size: 14px; font-weight: 700; line-height: 1;
}

/* ====================== MODAL ====================== */
/* Class prefix is `pi-modal-*` to avoid colliding with Bootstrap's `.modal-*`
   (Bootstrap fades its backdrop to opacity:0.5, which was making our content
   look translucent when the class names collided). */
.pi-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;          /* above Bootstrap's modal layer (1050) */
    opacity: 1 !important;  /* defensive - never inherit a fade */
}

.pi-modal-backdrop.show { display: flex; }

.pi-modal-card {
    background: #ffffff;    /* solid white, never translucent */
    color: #2d3436;
    border-radius: 8px;
    width: 95%;
    max-width: 1180px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    opacity: 1;
}

.pi-modal-header {
    background: var(--sidebar-bg);
    color: #fff;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 8px 8px 0 0;
}

.pi-modal-header h3 {
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pi-modal-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}

.pi-modal-body { padding: 20px; background: #ffffff; }

.pi-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #ecf0f1;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: #fafbfc;
    border-radius: 0 0 8px 8px;
}

/* ====================== LOGIN PAGE ====================== */
.login-layout {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    min-height: 100vh;
}

.login-hero {
    background: url('/images/hero-mountain.jpg') center/cover no-repeat;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(0,0,0,0.5);
    font-size: 32px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(255,255,255,0.4);
}

.login-form {
    padding: 60px 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-form .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 24px;
}

.login-form .brand .brand-icon {
    width: 28px; height: 28px;
    background: #00acc1;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.login-form label { font-size: 13px; font-weight: 500; margin-bottom: 4px; display: block; }

.login-form input[type="email"],
.login-form input[type="password"],
.login-form input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    background: #f0f4f7;
    border: 1px solid #e0e6eb;
    border-radius: 4px;
    margin-bottom: 14px;
    font-size: 14px;
}

.login-form .btn-login {
    width: 100%;
    background: #2196f3;
    color: #fff;
    padding: 10px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 8px;
}

.login-form .register-link { font-size: 13px; margin-top: 12px; }
.login-form .register-link a { color: var(--primary); text-decoration: none; }

.password-rules { font-size: 12px; margin-top: 4px; }
.password-rules li { margin: 2px 0; color: #e74c3c; }
.password-rules li.met { color: var(--success); }

/* ====================== REGISTER PAGE ====================== */
.register-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    min-height: 100vh;
    gap: 0;
}

.register-form { padding: 50px 60px; }
.register-form h1 { font-size: 26px; margin: 0 0 24px 0; }

.register-summary {
    border-left: 1px solid #ecf0f1;
    padding: 50px 40px;
    background: #fafbfc;
}

.register-summary h4 { margin: 0 0 6px 0; color: #5a6c7d; font-weight: 500; font-size: 14px; }
.register-summary h2 { margin: 0 0 8px 0; font-size: 22px; }
.register-summary .price-old { color: #95a5a6; }
.register-summary .price-new { color: var(--success); font-size: 22px; font-weight: 700; }
.register-summary .offer { font-size: 12px; color: #7f8c8d; margin: 8px 0 24px 0; }
.register-summary ul { font-size: 13px; padding-left: 20px; color: #5a6c7d; }

.btn-step {
    background: var(--success); color: #fff; border: none;
    padding: 10px 22px; border-radius: 4px; cursor: pointer; font-size: 14px;
}

/* ====================== UTILITY ====================== */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.flex-1 { flex: 1; }
.justify-end { justify-content: flex-end; }

/* DataTables overrides */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    padding: 5px 8px;
    border: 1px solid #d6dde3;
    border-radius: 4px;
}

@media (max-width: 992px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid-5 { grid-template-columns: repeat(2, 1fr); }
    .sidebar { width: 60px; }
    .sidebar-brand span,
    .sidebar-menu li a span { display: none; }
}

/* ====================== INVOICE FORM - COMPACT DENSITY ======================
   Scoped to body.invoice-form so it doesn't affect customers/products modals
   which look right at current density. Adds tighter padding, smaller font,
   bolder labels, taller items table - matching the user's reference screenshot.

   LAYOUT: The HEADER FORM GRID is constrained to ~870px max-width on the LEFT
   so the right side of the page (next to the form) is intentionally empty -
   reserved for a future totals/summary panel (Subtotal, Tax, Grand Total widget).
   The ITEMS TABLE below uses the full width of the card so all 13 columns
   (S#, Product, SROitem, Sale Type, Quantity, Price, Disc%, Tax%, SRO Sch.No,
   Further Tax, Extra Tax, SalesTax Withheld, Amount Incl Tax, Action) fit.
   ============================================================================ */
body.invoice-form .form-grid {
    grid-template-columns: repeat(3, 1fr);   /* 3 cols matches reference */
    gap: 10px 14px;
    max-width: 870px;                        /* HEADER ONLY - not the items table */
}

body.invoice-form .form-group {
    margin-bottom: 0;
}

body.invoice-form .form-group label {
    font-size: 11.5px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 3px;
    text-transform: none;
    letter-spacing: 0;
}

body.invoice-form .form-control {
    padding: 5px 8px;
    font-size: 12.5px;
    height: 30px;
    line-height: 1.3;
    border-color: #cbd2d8;
}

body.invoice-form .form-control[readonly] {
    background-color: #fafbfc;
    color: #5a6c7d;
}

/* Items table - uses FULL width of the card (NOT constrained like form-grid) */
body.invoice-form .invoice-items-wrap {
    max-width: 100%;
    overflow-x: auto;
}

body.invoice-form .invoice-items {
    width: 100%;
    min-width: 950px;   /* prevent column scrunch on narrow viewports - scroll instead */
}

/* Give the invoice-form card the full content width. The default form-grid
   caps at 1180px, which forced horizontal scroll on 1366px laptops once
   sidebar + padding was accounted for. Invoice screens need every pixel. */
body.invoice-form .form-grid,
body.invoice-form .card {
    max-width: 100%;
}

body.invoice-form .invoice-items th {
    padding: 7px 5px;
    font-size: 11px;
    color: #2c3e50;
    font-weight: 600;
    background: #fff;
    border-bottom: 1px solid #d6dde3;
    white-space: nowrap;
}

body.invoice-form .invoice-items td {
    padding: 5px 4px;
    border-bottom: 1px solid #f1f3f5;
    vertical-align: middle;
}

body.invoice-form .invoice-items input,
body.invoice-form .invoice-items select {
    padding: 5px 6px;
    font-size: 12px;
    height: 30px;
    border-color: #cbd2d8;
    min-width: 50px;
}

body.invoice-form .invoice-items .row-num {
    text-align: center;
    padding-top: 10px;
    font-weight: 600;
    color: #2c3e50;
}

/* Inline action buttons in items table */
body.invoice-form .btn-add-row,
body.invoice-form .btn-remove-row {
    width: 30px;
    height: 30px;
    border-radius: 4px;
}

/* Total row visually distinct but subtle */
body.invoice-form .invoice-total-row td {
    background: transparent;
    border-top: 1px solid #d6dde3;
    border-bottom: 1px solid #d6dde3;
    font-weight: 600;
    padding: 10px 6px;
    color: #2c3e50;
    font-size: 12.5px;
}

/* Footer action buttons - Update + Reset right-aligned within the FULL card width
   (not constrained to 870px - so they sit at the right edge of the page) */
body.invoice-form .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 0 6px;
    border-top: 1px solid #ecf0f1;
    margin-top: 16px;
}

body.invoice-form .btn-reset {
    background: #95a5a6;
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
body.invoice-form .btn-reset:hover { background: #7f8c8d; }

/* Header toolbar buttons (Template1, PDF Template 1, etc) - icon + label compact */
body.invoice-form .page-card-header .btn-dark {
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 500;
}
body.invoice-form .page-card-header .btn-dark i {
    margin-right: 4px;
    font-size: 11px;
}

/* ====================== SIDEBAR SUBMENU ======================
   Expandable submenus under Setup, Report, etc. Initially collapsed,
   click parent to toggle. Auto-open when a child is the active route. */
.sidebar-menu li.has-submenu > a .submenu-chevron {
    transition: transform .2s;
}
.sidebar-menu li.has-submenu.open > a .submenu-chevron {
    transform: rotate(180deg);
}
.sidebar-menu .submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    background: rgba(0,0,0,0.18);   /* slightly darker than sidebar */
    transition: max-height .25s;
}
.sidebar-menu li.has-submenu.open > .submenu {
    max-height: 300px;              /* enough for several children */
}
.sidebar-menu .submenu li a {
    padding-left: 38px;             /* indent past the parent's icon */
    font-size: 13px;
    color: rgba(255,255,255,0.78);
}
.sidebar-menu .submenu li a i {
    font-size: 12px;
    width: 18px;
}
.sidebar-menu .submenu li.active a {
    color: #fff;
    background: rgba(255,255,255,0.08);
}
.sidebar-menu .submenu li:hover a {
    color: #fff;
}

/* ============================================================
   COMPACT MODE — for Reports + Setup pages
   Applied via inline <script>document.body.classList.add('compact');</script>
   in the view. Roughly equivalent to 75% browser zoom but only for the
   affected page: fonts, paddings, table cells, form controls all shrink
   in proportion. Sidebar + topbar are unaffected because they're global.
   ============================================================ */
body.compact {
    font-size: 11px;
    line-height: 1.4;
}

body.compact .content {
    padding: 12px 16px;
}

body.compact h1, body.compact .page-title {
    font-size: 18px;
    margin-bottom: 12px;
}

body.compact h2 { font-size: 15px; }
body.compact h3 { font-size: 13px; }
body.compact h4 { font-size: 12px; }

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

/* Form controls */
body.compact .form-control,
body.compact input,
body.compact select,
body.compact textarea {
    font-size: 11px;
    padding: 5px 8px;
}

body.compact .btn,
body.compact button {
    font-size: 11px;
    padding: 5px 12px;
}

body.compact label {
    font-size: 11px;
    margin-bottom: 3px;
}

/* Tables (report tables, tenant list, schedular list) */
body.compact .dt-table th {
    padding: 7px 8px;
    font-size: 11px;
}

body.compact .dt-table td {
    padding: 6px 8px;
    font-size: 11px;
}

body.compact table,
body.compact table th,
body.compact table td {
    font-size: 11px;
}

body.compact table th { padding: 7px 8px; }
body.compact table td { padding: 6px 8px; }

/* KPI / summary cards on report index */
body.compact .kpi-card {
    padding: 12px 14px;
}

body.compact .kpi-card .value {
    font-size: 20px;
}

body.compact .kpi-card .label {
    font-size: 11px;
}

/* Allow the compact card/form-grid to fill the full width so we don't
   waste horizontal space at this density */
body.compact .form-grid,
body.compact .card {
    max-width: 100%;
}
