/* ═══════════════════════════════════════════════════════════════════════
   base.css — Lumus Back Office design system
   ─────────────────────────────────────────────────────────────────────
   Drop-in override of Bootstrap 4 defaults so every page extending
   base.html picks up the corporate look without per-template edits.

   Palette aligned with backend/reports/daily_report.py:
     --green-dark : #23322d    primary, headings, navbar
     --green-mid  : #73cd82    accent (dropdowns, hover bars)
     --paper      : #fbfaf6    institutional off-white background
     --rule       : #e5e2db    subtle borders
     --ink        : #1c1c1c    body text
     --ink-mute   : #6b6b66    secondary text
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --green-dark:   #23322d;
    --green-mid:    #73cd82;
    --green-darker: #1a2521;
    --paper:        #fbfaf6;
    --rule:         #e5e2db;
    --ink:          #1c1c1c;
    --ink-mute:     #6b6b66;
    --ok:           #1f7a38;
    --bad:          #b23a2e;
}

/* ── Base typography ─────────────────────────────────────────────── */
html, body {
    font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
    font-weight: 400;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, .h1, .h2, .h3, .h4, .h5 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 500;
    color: var(--green-dark);
    letter-spacing: -0.005em;
}
h1, .h1 { font-size: 2rem;    line-height: 1.15; }
h2, .h2 { font-size: 1.5rem;  line-height: 1.2;  }
h3, .h3 { font-size: 1.2rem;  line-height: 1.25; }
h4, .h4 { font-size: 1rem;    line-height: 1.3;  }

a       { color: var(--green-dark); }
a:hover { color: var(--green-darker); text-decoration: underline; }

/* ── Navbar ──────────────────────────────────────────────────────── */
.navbar {
    background-color: var(--green-dark);
    padding: .55rem 1.5rem;
    border-bottom: 0;
}
.navbar .navbar-brand img {
    /* Slim the placeholder Tilda logo from its 60x60 default. */
    height: 36px; width: auto;
}
.navbar-dark .navbar-nav .nav-link {
    color: rgba(255,255,255,.78);
    font-size: .88rem;
    font-weight: 400;
    letter-spacing: .01em;
    padding: .5rem .85rem;
    transition: color .15s ease;
}
.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:focus,
.navbar-dark .navbar-nav .nav-item.active > .nav-link {
    color: #ffffff;
}

/* Dropdowns: keep the mid-green background the existing inline styles
   set, but tighten typography and hover state. */
.navbar .dropdown-menu {
    background-color: var(--green-mid) !important;
    border: 0;
    border-radius: 2px;
    margin-top: 2px;
    padding: .35rem 0;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.navbar .dropdown-menu .dropdown-item,
.navbar .dropdown-menu .nav-link {
    color: #ffffff;
    font-size: .85rem;
    padding: .4rem 1rem;
}
.navbar .dropdown-menu .dropdown-item:hover,
.navbar .dropdown-menu .dropdown-item:focus {
    background-color: rgba(255,255,255,.16);
    color: #ffffff;
}

/* Brand strip below the navbar — appears on every page automatically. */
.brand-strip {
    height: 3px;
    background: linear-gradient(90deg,
        var(--green-mid) 0%, var(--green-mid) 18%,
        var(--green-dark) 18%, var(--green-dark) 100%);
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
    border-radius: 2px;
    font-size: .88rem;
    font-weight: 500;
    letter-spacing: .02em;
    padding: .42rem 1.1rem;
    box-shadow: none !important;
    transition: background-color .15s ease, border-color .15s ease;
}
.btn-primary, .btn-success {
    background-color: var(--green-dark);
    border-color: var(--green-dark);
    color: #ffffff;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active,
.btn-success:hover, .btn-success:focus, .btn-success:active {
    background-color: var(--green-darker) !important;
    border-color: var(--green-darker) !important;
    color: #ffffff !important;
}
.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--green-dark);
    color: var(--green-dark);
}
.btn-secondary:hover, .btn-secondary:focus {
    background-color: var(--green-dark);
    color: #ffffff;
}
.btn-danger {
    background-color: var(--bad);
    border-color: var(--bad);
}

/* Plain HTML <input type="submit"> tags used in many templates. */
input[type="submit"], input[type="button"] {
    background-color: var(--green-dark);
    border: 1px solid var(--green-dark);
    color: #ffffff;
    border-radius: 2px;
    font-size: .88rem;
    font-weight: 500;
    padding: .42rem 1.1rem;
    cursor: pointer;
    transition: background-color .15s ease;
}
input[type="submit"]:hover, input[type="button"]:hover {
    background-color: var(--green-darker);
}

/* ── Forms ───────────────────────────────────────────────────────── */
.form-control, .form-select, select, textarea, input[type="text"],
input[type="email"], input[type="password"], input[type="number"],
input[type="date"] {
    border: 1px solid var(--rule);
    border-radius: 2px;
    color: var(--ink);
    background-color: #ffffff;
    font-size: .9rem;
    padding: .4rem .7rem;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.form-control:focus, select:focus, textarea:focus,
input[type="text"]:focus, input[type="email"]:focus,
input[type="password"]:focus, input[type="number"]:focus,
input[type="date"]:focus {
    border-color: var(--green-dark);
    box-shadow: 0 0 0 .15rem rgba(35,50,45,.10);
    outline: 0;
}
label, .form-group label, .control-label {
    color: var(--ink);
    font-size: .82rem;
    font-weight: 500;
    margin-bottom: .25rem;
    letter-spacing: .01em;
}

/* ── Tables ──────────────────────────────────────────────────────── */
.table {
    color: var(--ink);
    font-size: .88rem;
}
.table thead th, .table th {
    color: var(--green-dark);
    font-weight: 600;
    border-top: 0;
    border-bottom: 1px solid var(--green-dark);
    background-color: transparent;
    padding: .55rem .6rem;
    text-transform: none;
}
.table tbody td, .table td {
    border-top: 0;
    border-bottom: 1px solid var(--rule);
    padding: .5rem .6rem;
    vertical-align: middle;
}
.table tbody tr:last-child td {
    border-bottom: 1px solid var(--green-dark);
}
/* Numbers tab-aligned in financial columns. */
.table td.num, .table th.num,
.table td.numeric, .table th.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum';
}
/* Disable Bootstrap zebra-striping — not corporate. */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: transparent;
}
.table-hover tbody tr:hover {
    background-color: rgba(35,50,45,.03);
}

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
    background-color: #ffffff;
    border: 1px solid var(--rule);
    border-radius: 2px;
    box-shadow: none;
}
.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--green-dark);
    padding: .75rem 1rem;
}
.card-header h1, .card-header h2, .card-header h3 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.3;
}
.card-header.bg-success {
    /* Several legacy templates use bg-success for card headers — keep
       them readable but switch from Bootstrap's green to our palette. */
    background-color: var(--green-dark) !important;
    color: #ffffff !important;
}
.card-header.bg-success h3 { color: #ffffff !important; }
.card-body { padding: 1rem; }
/* Old Bootstrap `card shadow-sm` pattern — flatten the shadow. */
.card.shadow-sm { box-shadow: none !important; }

/* ── Cover-container form-page pattern ───────────────────────────── */
/* Used by risk_report.html, administrator_pricing.html, and similar.
   Was originally a Bootstrap "cover" example — restyle in place. */
.cover-container {
    background: #ffffff !important;
    border: 1px solid var(--rule);
    border-radius: 2px;
    max-width: 560px !important;
    width: 100% !important;
    margin: 2.5rem auto !important;
    padding: 2.5rem 2rem !important;
    text-align: left !important;
    text-shadow: none !important;
    box-shadow: none !important;
}
/* Bootstrap's cover example body styling — kill it. */
body.text-white { color: var(--ink) !important; }
body.bg-dark { background: var(--paper) !important; }

.cover-container .masthead {
    border-bottom: 1px solid var(--rule);
    padding-bottom: 1rem;
    margin-bottom: 1.25rem !important;
}
.cover-container .masthead h3,
.cover-container .masthead h3.float-md-start {
    font-family: 'Fraunces', Georgia, serif;
    color: var(--green-dark);
    margin: 0;
    font-size: 1.4rem;
    font-weight: 500;
    text-align: left;
    float: none !important;
}
.cover-container .cover-heading {
    font-family: 'Fraunces', Georgia, serif;
    font-size: .82rem;
    font-weight: 500;
    color: var(--ink-mute);
    text-transform: uppercase;
    letter-spacing: .14em;
    margin-bottom: 1rem;
}
.cover-container .mastfoot {
    border-top: 1px solid var(--rule);
    padding-top: .75rem;
    margin-top: 1.5rem;
    font-size: .75rem;
    color: var(--ink-mute);
    text-transform: uppercase;
    letter-spacing: .12em;
}
.cover-container .mastfoot p { margin: 0; }
.cover-container form { margin-top: .5rem; }
.cover-container .inner { width: 100%; }

/* ── django-tables2 default styling ──────────────────────────────── */
.table-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

/* ── Status icons (used across multiple templates) ───────────────── */
.status-ok   { color: var(--ok);  font-weight: 700; }
.status-bad  { color: var(--bad); font-weight: 700; }

/* ── Sign-tinted numbers (delta NAV, P&L cells) ──────────────────── */
.num-pos  { color: var(--ok);  font-variant-numeric: tabular-nums; }
.num-neg  { color: var(--bad); font-variant-numeric: tabular-nums; }
.num-zero { color: var(--ink-mute); font-variant-numeric: tabular-nums; }

/* ── Misc helpers used in the codebase ───────────────────────────── */
/* Bootstrap's `text-muted` washes out too much against cream paper. */
.text-muted { color: var(--ink-mute) !important; }
/* Some templates apply `text-secondary` to lighten H1 — restore weight. */
.text-secondary { color: var(--ink) !important; }
hr { border-top: 1px solid var(--rule); }

/* ── Page-content wrapper (extends below navbar) ─────────────────── */
main, .main-content {
    min-height: calc(100vh - 76px);
    padding-bottom: 3rem;
}

/* ═══════════════════════════════════════════════════════════════════════
   Existing status indicator (#nav-status-link) — refine the label
   typography to match the rest of the corporate navbar. The dot itself
   is inline-styled by the JS in base.html, so we don't touch its
   background (it must stay overridable from script).
   ═══════════════════════════════════════════════════════════════════════ */

#nav-status-link {
    display: inline-flex;
    align-items: center;
    padding: .5rem .85rem;
}
#nav-status-link:hover,
#nav-status-link:focus {
    text-decoration: none;
}
#nav-status-label {
    font-size: .68rem;
    font-weight: 500;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(255,255,255,.82);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
/* Tiny outer pulse on the dot when the JS has marked the system healthy
   (green). Hooked off the dot's background colour — when JS sets the
   green '#28a745' inline, this matching attribute-selector lights up.
   Falls back gracefully: if the dot is any other colour, no animation. */
@keyframes nav-status-pulse {
    0%, 100% { box-shadow: 0 0 0 1px rgba(255,255,255,.3),
                           0 0 0 0   rgba(40,167,69,.55); }
    50%      { box-shadow: 0 0 0 1px rgba(255,255,255,.3),
                           0 0 0 5px rgba(40,167,69,0); }
}
#nav-status-dot[style*="rgb(40, 167, 69)"],
#nav-status-dot[style*="#28a745"] {
    animation: nav-status-pulse 2.4s ease-in-out infinite;
}