/* Alaidroos & Associates — Internal Operations Platform
   Light theme: teal accent (#2ba5a6) + brand blue (#1b5098) on white/grey surfaces.
   Top navbar with dropdowns. To rebrand: change ONLY the :root variables below. */
:root {
    /* Brand — teal accent + blue secondary (from alaidrooscpa.com) */
    --gold:           #2ba5a6;                 /* primary accent (teal) */
    --gold-hover:     #33bcbd;
    --gold-soft:      rgba(43,165,166,.12);
    --gold-line:      rgba(43,165,166,.45);    /* hairlines / accent rules */
    --brand-blue:     #1b5098;                 /* secondary brand blue */

    /* Surfaces — light */
    --bg-page:        #f7f7f7;   /* page body */
    --bg-page-deep:   #eef1f4;   /* hero base / deepest surface */
    --bg-card:        #ffffff;   /* default card / panel */
    --bg-card-2:      #f0f3f6;   /* card header, table header band */
    --bg-raised:      #eef2f6;   /* hovered rows / raised surfaces */
    --bg-header:      #ffffff;   /* page header band (white; accent used for active) */
    --bg-nav:         #ffffff;   /* nav bar band */
    --bg-input:       #ffffff;   /* form inputs */

    /* Text — dark on light */
    --text:           #222222;
    --text-secondary: #444444;
    --text-muted:     #666666;
    --text-on-input:  #222222;

    /* Lines / elevation — light-theme shadows */
    --border:         #e4e4e4;
    --border-strong:  #d0d4da;
    --shadow:         0 1px 3px rgba(0,0,0,.08);
    --shadow-lg:      0 10px 25px rgba(0,0,0,.12);
    --shadow-soft:    0 1px 2px rgba(0,0,0,.06), 0 8px 20px rgba(0,0,0,.06);
    --shadow-hover:   0 4px 10px rgba(0,0,0,.08), 0 16px 34px rgba(0,0,0,.12);

    /* Semantic — status meaning only; teal stays the single brand accent */
    --primary:        var(--gold);
    --info:           var(--brand-blue);       /* brand blue */
    --info-bg:        rgba(27,80,152,.12);
    --info-soft:      #e7eefb;
    --success:        #2fa47f;   /* green — paid / sent */
    --warning:        #d99a2b;   /* amber — attention */
    --danger:         #e5546a;   /* coral — failed / error */

    /* Radius */
    --radius:         8px;
    --radius-lg:      12px;
    --radius-pill:    999px;

    /* Motion */
    --t-fast:         .15s;
    --t-med:          .18s;

    /* Type — Lato body, Source Sans Pro headings (both Google Fonts).
       Update the Google Fonts <link> in base.html to load Lato + Source Sans Pro. */
    --font:           'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-heading:   'Source Sans Pro', var(--font);
    --font-display:   'Source Sans Pro', var(--font);
    --font-mono:      ui-monospace, 'Courier New', monospace;

    --header-h:       64px;
    --nav-h:          48px;
}

/* Reset ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg-page); }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-page);
    line-height: 1.55;
    min-height: 100vh;
}
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hover); text-decoration: underline; }

/* Header (top bar) -------------------------------------------------- */
header {
    background: var(--bg-header);
    color: #fff;
    padding: .75rem 1.5rem;
    border-bottom: 2px solid var(--gold);
    position: relative;
    z-index: 50;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.brand {
    color: #fff;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.brand:hover { text-decoration: none; }
.brand h1 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    margin: 0;
}
.brand small {
    font-size: .7rem;
    letter-spacing: .12em;
    color: var(--gold);
    text-transform: uppercase;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: .85rem;
    color: var(--text-secondary);
}
.user-link {
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .9rem;
    text-decoration: none;
    padding: .3rem .7rem;
    border-radius: var(--radius);
    /* persistent button look so the profile is discoverable at rest, not only on hover;
       a subtle DARK fill (not a white overlay) so it reads as a recessed button on the
       navy header rather than a washed-out gray box */
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(0,0,0,.2);
    transition: background .15s, border-color .15s;
}
.user-link:hover { background: rgba(0,0,0,.32); border-color: rgba(255,255,255,.38); }
.user-link .fa-circle-user { color: var(--gold); }
.user-caret { font-size: .7rem; opacity: .75; }
.env-badge {
    background: var(--gold);
    color: #1a1a2e;
    font-weight: 700;
    font-size: .7rem;
    letter-spacing: .05em;
    padding: .2rem .5rem;
    border-radius: var(--radius);
}

/* Top nav bar with dropdowns --------------------------------------- */
.topnav {
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    position: relative;
    z-index: 40;
}
.topnav-inner {
    display: flex;
    gap: .25rem;
    align-items: stretch;
    min-height: var(--nav-h);
}
.topnav-item, .topnav-toggle {
    color: var(--text);
    text-decoration: none;
    padding: 0 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .9rem;
    font-weight: 500;
    line-height: 1;
    height: var(--nav-h);
    box-sizing: border-box;
    background: none;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    border-bottom: 2px solid transparent;
    transition: color .15s, background .15s, border-color .15s;
}
.topnav-item:hover, .topnav-toggle:hover {
    color: var(--gold);
    background: rgba(255,255,255,.03);
    text-decoration: none;
}
.topnav-item.active, .topnav-toggle.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}
.topnav-toggle .caret { font-size: .65em; opacity: .8; }

.topnav-group { position: relative; }
.topnav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--bg-card-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: .4rem 0;
    z-index: 100;
    display: none;
}
.topnav-group.open .topnav-menu { display: block; }
.topnav-menu a {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem 1rem;
    color: var(--text);
    font-size: .88rem;
    text-decoration: none;
}
.topnav-menu a:hover { background: rgba(201,162,39,.12); color: var(--gold); }

/* Page heading row (gold icon + title) ------------------------------ */
.page-head {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1rem 0 .75rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.25rem;
}
.page-head h2 {
    color: var(--gold);
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: .55rem;
}
.page-head .icon, .page-head h2 i {
    color: var(--gold);
    font-size: 1.15rem;
}
.page-head .head-right { margin-left: auto; display: flex; gap: .5rem; align-items: center; }

/* Main + container -------------------------------------------------- */
main {
    padding: 1.5rem 1.5rem 2.5rem;
    background: var(--bg-page);
    min-height: calc(100vh - var(--header-h) - var(--nav-h));
}
.container, .container-narrow {
    margin: 0 auto;
}

/* Typography -------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: #fff;
    margin-bottom: .75rem;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; color: var(--gold); }
h3 { font-size: 1.15rem; color: var(--gold); }
h4 { font-size: 1rem; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--info); }
.text-info { color: var(--info); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-dark { color: var(--text); }
.muted { color: var(--text-muted); }
.bg-light {
    background: rgba(255,255,255,.04);
    color: var(--text);
    border: 1px solid var(--border);
    padding: .5rem .75rem;
    border-radius: var(--radius);
}
pre.bg-light { font-family: var(--font-mono); font-size: .82rem; }
.list-unstyled { list-style: none; padding-left: 0; }
.rounded { border-radius: var(--radius); }
.p-2 { padding: .5rem; }
.w-100 { width: 100%; }
.d-grid { display: grid; }
.col-lg-4 { flex: 1 1 calc(33.33% - .833rem); min-width: 280px; }
.col-lg-8 { flex: 1 1 calc(66.66% - .417rem); min-width: 320px; }
.col-md-2 { flex: 1 1 calc(16.66% - 1.04rem); min-width: 130px; }
.col-md-4 { flex: 1 1 calc(33.33% - .833rem); min-width: 200px; }
.text-center { text-align: center; }

/* Alerts (info / success / danger / warning) ------------------------ */
.alert {
    padding: .85rem 1.1rem;
    margin-bottom: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: .65rem;
    font-size: .9rem;
}
.alert-info {
    background: var(--info-soft);
    border-color: #1e3a72;
    color: #cfe3ff;
}
.alert-info::before { content: "ⓘ"; font-size: 1rem; color: #9ecbff; }
.alert-success { background: rgba(25,135,84,.18); border-color: #1f6f4a; color: #c1e7d2; }
.alert-warning { background: rgba(214,158,46,.18); border-color: #7a5a18; color: #f4d9a3; }
.alert-danger  { background: rgba(220,53,69,.18); border-color: #7d2530; color: #f6c1c8; }
.alert .alert-close {
    margin-left: auto;
    background: none; border: 0;
    color: inherit;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: .7;
}
.alert .alert-close:hover { opacity: 1; }

/* Buttons ----------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    font-family: var(--font);
    white-space: nowrap;
    transition: background-color .22s ease, color .22s ease, border-color .22s ease, box-shadow .22s ease, opacity .22s ease;
}
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: .35rem .7rem; font-size: .78rem; }

/* Button-like anchors never underline on hover (only inline text links do) */
.btn:hover, .btn:focus,
.user-link:hover,
.stat-card:hover, .instrument:hover,
.topnav-item:hover, .topnav-toggle:hover, .topnav-menu a:hover { text-decoration: none; }

/* Smooth, DTR-style hover/focus feedback across ALL interactive surfaces */
a,
.topnav-item, .topnav-toggle, .topnav-menu a,
.count-badge, .rp-role, .rp-cap,
.data-table tbody tr, table tbody tr,
input, select, textarea, .form-control, .form-select,
.alert-close, .mc-modal-x, .pill {
    transition: background-color .22s ease, color .22s ease,
                border-color .22s ease, box-shadow .22s ease;
}

.btn-primary,
.btn-warning {
    background: var(--gold);
    color: #1a1a2e;
    border-color: var(--gold);
}
.btn-primary:hover, .btn-warning:hover { background: var(--gold-hover); color: #1a1a2e; }

.btn-info {
    background: var(--info);
    color: #fff;
    border-color: var(--info);
}
.btn-info:hover { background: #3f86bd; color: #fff; }

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover { background: #bb2d3b; color: #fff; }

.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}
.btn-success:hover { background: #146c43; color: #fff; }

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-strong);
}
.btn-secondary:hover { background: rgba(255,255,255,.04); color: var(--text); }

.btn-outline-primary {
    background: transparent;
    color: var(--gold);
    border-color: var(--gold);
}
.btn-outline-primary:hover { background: var(--gold); color: #1a1a2e; }

.btn-outline-secondary {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-strong);
}
.btn-outline-secondary:hover { background: rgba(255,255,255,.04); color: var(--text); }

.btn-logout {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-strong);
}
.btn-logout:hover { background: rgba(255,255,255,.05); }

/* Cards ------------------------------------------------------------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}
.card-header {
    background: var(--bg-card-2);
    margin: -1.1rem -1.25rem 1rem;
    padding: .75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}
.card-header h6, .card-header h5, .card-header h4, .card-header h3 { margin: 0; }
.card-body { padding: 0; }

/* Dashboard cards --------------------------------------------------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}
.card-grid .card { display: flex; flex-direction: column; gap: .75rem; }
.card-grid .card h3 {
    color: var(--gold);
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    margin: 0;
}
.card-grid .card p {
    color: var(--text-secondary);
    font-size: .88rem;
    margin: 0;
    flex-grow: 1;
}
.card-grid .card .btn { align-self: flex-start; }

/* Tables ------------------------------------------------------------ */
.table-wrap, .table-responsive {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text);
    background: var(--bg-card);
}
table thead tr { background: var(--bg-card-2); }
table th {
    color: var(--gold);
    text-align: left;
    font-weight: 600;
    font-size: .78rem;
    letter-spacing: .03em;
    padding: .65rem .85rem;
    border-bottom: 1px solid var(--border-strong);
    white-space: nowrap;
}
table td {
    padding: .65rem .85rem;
    border-bottom: 1px solid var(--border);
    font-size: .85rem;
    vertical-align: middle;
}
table tbody tr:hover { background: rgba(201,162,39,.05); }
table tbody tr:last-child td { border-bottom: 0; }
table .actions { display: flex; gap: .35rem; align-items: center; }

/* Status pills / type badges --------------------------------------- */
.badge {
    display: inline-block;
    padding: .25em .6em;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1;
    border-radius: var(--radius);
    color: #fff;
    vertical-align: middle;
}
.badge-customer, .bg-primary { background: var(--info); }
.badge-broker,   .bg-success { background: var(--success); }
.badge-trader,   .bg-warning { background: var(--warning); color: #1a1a2e; }
.bg-secondary { background: #495057; }
.bg-info      { background: #0dcaf0; color: #1a1a2e; }
.bg-danger    { background: var(--danger); }
.bg-dark      { background: #212529; }

/* Forms ------------------------------------------------------------- */
.form-label {
    display: block;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: .85rem;
    margin-bottom: .35rem;
}
.form-text {
    display: block;
    color: var(--text-muted);
    font-size: .78rem;
    margin-top: .25rem;
}
.form-control, .form-select, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="search"], textarea, select {
    width: 100%;
    padding: .5rem .7rem;
    background: var(--bg-input);
    color: var(--text-on-input);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: .9rem;
}
.form-control:focus, .form-select:focus, input:focus, textarea:focus, select:focus {
    outline: 0;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,162,39,.2);
}
textarea { font-family: var(--font-mono); }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: 1rem; }
.ms-2 { margin-left: .5rem; }
.me-2 { margin-right: .5rem; }
.d-inline { display: inline; }
.d-inline-flex { display: inline-flex; }
.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.row { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.col-md-6 { flex: 1 1 calc(50% - .625rem); min-width: 320px; }
.col-6 { flex: 0 0 50%; }
.btn-group { display: inline-flex; gap: 0; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-top-left-radius: var(--radius); border-bottom-left-radius: var(--radius); }
.btn-group .btn:last-child  { border-top-right-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.btn-group .btn + .btn { margin-left: -1px; }

/* Form check (custom checkbox) ------------------------------------- */
.form-check {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.form-check-input {
    width: auto;
    margin: 0;
    width: 16px; height: 16px;
}
.form-check-label { color: var(--text); }

/* Misc utilities --------------------------------------------------- */
.small { font-size: .8rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: 1rem; }

/* Login -------------------------------------------------------------- */
.login-container {
    min-height: calc(100vh - var(--header-h) - 4rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 2.25rem;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.login-card .login-logo {
    width: 90px;
    background: #fff;
    padding: 6px 10px;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.login-card h2 { color: var(--gold); margin-bottom: .25rem; }
.login-card .muted { color: var(--text-muted); font-size: .85rem; margin-bottom: 1.25rem; }
.login-card label {
    display: block;
    text-align: left;
    color: var(--text-secondary);
    font-size: .8rem;
    margin: .75rem 0 .25rem;
}
.login-card .btn { width: 100%; justify-content: center; margin-top: 1rem; }

/* Footer ----------------------------------------------------------- */
footer {
    padding: 1.25rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    font-size: .8rem;
}

/* Flash message slide-in ------------------------------------------- */
@keyframes slideIn { from { transform: translateY(-6px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.alert { animation: slideIn .25s ease; }

/* Responsive small fix -------------------------------------------- */
@media (max-width: 720px) {
    .topnav-inner { flex-wrap: wrap; }
    .header-inner { flex-wrap: wrap; gap: .5rem; }
}

/* ===== Role admin components (MCA-30) ============================== */

/* count pill used on the roles list + matrix role list */
.count-badge {
    display: inline-block; min-width: 1.7rem; padding: .12rem .5rem;
    border-radius: 999px; background: var(--bg-card-2); border: 1px solid var(--border);
    color: var(--text-secondary); font-size: .78rem; font-weight: 700; text-align: center;
}
a.count-badge { text-decoration: none; }
a.count-badge:hover { border-color: var(--gold); color: var(--gold); }
.row-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: nowrap; }
.btn-icon { padding: .4rem .55rem; line-height: 1; }
.btn-icon i { font-size: .85rem; }

/* lightweight modal (roles + capabilities add/edit) */
.mc-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.62);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 7vh 1rem 1rem; z-index: 1000;
}
.mc-modal-overlay[hidden] { display: none; }
.mc-modal {
    background: var(--bg-card); border: 1px solid var(--border-strong);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    width: 100%; max-width: 500px; animation: slideIn .18s ease;
}
.mc-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: .9rem 1.2rem; border-bottom: 1px solid var(--border);
}
.mc-modal-head h3 { margin: 0; font-size: 1.05rem; }
.mc-modal-x {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.mc-modal-x:hover { color: var(--text); }
.mc-modal form { padding: 1.2rem; }
.mc-field { margin-bottom: 1rem; }
.mc-field:last-of-type { margin-bottom: 0; }
.mc-field label { display: block; margin-bottom: .35rem; font-size: .82rem; color: var(--text-secondary); }
.mc-field input, .mc-field textarea, .mc-field select { width: 100%; }
/* modal textareas default to the mono font globally (line ~503); use the app
   font so the description reads the same as the role-name input, not pixelated */
.mc-field textarea { font-family: var(--font); }
.mc-modal-foot { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.3rem; }

/* two-panel role -> capability matrix */
.rp-grid { display: grid; grid-template-columns: 260px 1fr; gap: 1rem; align-items: start; }
.rp-h { margin: 0 0 .75rem; font-size: 1rem; }
.rp-role-list { list-style: none; margin: 0; padding: 0; }
.rp-role-list li { margin-bottom: .3rem; }
.rp-role {
    display: flex; align-items: center; justify-content: space-between;
    padding: .5rem .7rem; border-radius: var(--radius); text-decoration: none;
    color: var(--text); border: 1px solid var(--border); background: var(--bg-card-2);
}
.rp-role:hover { border-color: var(--gold); }
.rp-role.active { background: var(--gold); color: #1a1a2e; border-color: var(--gold); }
.rp-role.active .count-badge { background: rgba(0,0,0,.15); color: #1a1a2e; border-color: rgba(0,0,0,.2); }
.rp-caps-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.rp-tools { display: flex; align-items: center; justify-content: space-between; padding: .5rem 0 .75rem; border-bottom: 1px solid var(--border); margin-bottom: .5rem; }
.rp-selectall { font-size: .85rem; color: var(--text-secondary); cursor: pointer; user-select: none; }
.rp-cat {
    text-transform: uppercase; letter-spacing: .04em; font-size: .72rem; font-weight: 700;
    color: var(--gold); margin: .9rem 0 .35rem; padding-bottom: .2rem; border-bottom: 1px solid var(--border);
}
.rp-cap { display: flex; align-items: flex-start; gap: .6rem; padding: .4rem .3rem; border-radius: var(--radius); cursor: pointer; }
.rp-cap:hover { background: var(--bg-card-2); }
.rp-cap input { margin-top: .2rem; }
.rp-cap-body { display: flex; flex-direction: column; }
.rp-cap-name { font-weight: 600; font-size: .9rem; }
.rp-cap-desc { font-size: .78rem; color: var(--text-muted); }
.rp-foot { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.rp-empty { text-align: center; color: var(--text-muted); padding: 3rem 1rem; }
.rp-empty i { font-size: 2rem; display: block; margin-bottom: .75rem; opacity: .6; }
@media (max-width: 768px) { .rp-grid { grid-template-columns: 1fr; } }

/* ==================================================================
   THE BRIDGE — Marina design system (Instrument type · Restrained motion)
   Maritime instrument panel: brass gold on deep-water navy, tabular-mono
   data, a single luminous "tideline" horizon as the signature.
   ================================================================== */

/* Base type treatment ---------------------------------------------- */
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.01em; }
/* Money & data always read as a ledger/telegraph readout */
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.eyebrow {
    display: block; font-size: .68rem; font-weight: 700; letter-spacing: .1em;
    text-transform: uppercase; color: var(--gold);
}

/* Motion + accessibility floor ------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rise { opacity: 0; animation: rise .5s cubic-bezier(.22,.61,.36,1) forwards; }
.d1 { animation-delay: .04s; } .d2 { animation-delay: .10s; }
.d3 { animation-delay: .16s; } .d4 { animation-delay: .22s; } .d5 { animation-delay: .28s; }
@keyframes tidePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(229,84,106,0); }
    50%      { box-shadow: 0 0 0 6px rgba(229,84,106,.16); }
}
:where(a, button, input, select, textarea, .btn):focus-visible {
    outline: 2px solid var(--gold); outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    /* Disable keyframe ANIMATIONS and translate "lifts" (the vestibular motion),
       but KEEP gentle color/background/opacity fades so hover feedback still
       reads smoothly. */
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
    .rise { opacity: 1 !important; transform: none !important; }
    .stat-card:hover, .instrument:hover, .btn:hover { transform: none !important; }
}

/* Modest global elevation refresh (rounder cards, softer shadow) ---- */
.card { border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); }

/* Header profile pill (refined) ------------------------------------ */
.user-link {
    gap: .5rem; padding: .32rem .8rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(0,0,0,.18);
    transition: background-color .22s ease, border-color .22s ease, color .22s ease;
}
.user-link:hover { background: rgba(0,0,0,.34); border-color: var(--gold-line); }
.user-link .fa-circle-user { color: var(--gold); font-size: 1.05rem; }
.user-caret { font-size: .7rem; opacity: .6; }

/* Consistent page header (eyebrow + title + action) ---------------- */
.page-header {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
    padding: .25rem 0 1rem; margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}
.page-header h1 { font-size: 1.55rem; font-weight: 700; margin: .2rem 0 0; color: #fff; }
.page-header-actions { display: flex; gap: .5rem; align-items: center; }

/* ---- Dashboard: the Bridge instrument band ----------------------- */
.bridge {
    position: relative; overflow: hidden; text-align: center;
    padding: 1.6rem 1.75rem 1.4rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(120% 150% at 94% -20%, rgba(201,162,39,.07), transparent 58%),
        linear-gradient(180deg, var(--bg-card-2), var(--bg-card));
    box-shadow: var(--shadow-soft);
}
.bridge-head { margin-bottom: 1.35rem; }
.bridge-eyebrow { color: var(--gold); }
.bridge-greeting { display: block; margin-top: .15rem; font-size: .85rem; color: var(--text-secondary); }
.bridge-greeting strong { color: var(--text); font-weight: 600; }
.bridge-clock {
    position: absolute; top: 1.15rem; right: 1.4rem;
    font-family: var(--font-mono); font-size: .76rem; color: var(--text-muted);
    font-variant-numeric: tabular-nums; white-space: nowrap;
}
@media (max-width: 640px) { .bridge-clock { display: none; } }
.bridge-instruments {
    display: flex; flex-wrap: wrap; gap: 1.4rem 3.25rem;
}
.instrument {
    position: relative; display: flex; flex-direction: column; gap: .18rem;
    min-width: 150px; flex: 0 1 auto;
    padding: .15rem .3rem .15rem 1rem;
    border-left: 2px solid var(--border-strong);
    text-decoration: none; color: var(--text);
    transition: border-color var(--t-fast), transform var(--t-fast);
}
.instrument:hover { border-left-color: var(--gold); transform: translateX(1px); }
.instrument-label {
    font-size: .66rem; font-weight: 700; letter-spacing: .09em;
    text-transform: uppercase; color: var(--text-muted);
}
.instrument-value {
    font-family: var(--font-mono); font-weight: 600;
    font-size: 1.9rem; line-height: 1.12; color: #fff;
    font-variant-numeric: tabular-nums;
}
.instrument-note { font-size: .73rem; color: var(--text-secondary); }
.instrument.is-primary { border-left-color: var(--gold); }
.instrument.is-primary .instrument-value { color: var(--gold); }
.instrument.is-danger { border-left-color: var(--danger); border-radius: 2px; animation: tidePulse 2.6s ease-in-out infinite; }
.instrument.is-danger .instrument-value { color: #f2919b; }

/* The signature: a luminous gold horizon (tideline) ---------------- */
.tideline {
    position: relative; height: 2px; margin-top: 1.35rem;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--gold-line) 16%, var(--gold) 50%, var(--gold-line) 84%, transparent);
    box-shadow: 0 0 18px 1px rgba(201,162,39,.26);
}
.tideline::after {
    content: ""; position: absolute; left: 10%; right: 10%; top: 5px; height: 22px;
    background: radial-gradient(60% 100% at 50% 0, rgba(201,162,39,.12), transparent 72%);
    pointer-events: none;
}
.bridge-title {
    font-family: var(--font-display); font-size: 1.9rem; font-weight: 700;
    letter-spacing: -.01em; line-height: 1.1; margin: 0 0 .2rem; color: #fff;
}

/* ---- Metric cards: the 6-up overview grid ------------------------- */
.stat-cards {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
    position: relative; display: flex; flex-direction: column; gap: .18rem;
    padding: 1.15rem 1.3rem;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-soft);
    text-decoration: none; overflow: hidden;
    transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.stat-card::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--gold); opacity: .8;
}
.stat-card:hover {
    transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-hover);
}
.stat-card-icon {
    position: absolute; top: 1rem; right: 1.1rem;
    font-size: 1.3rem; color: var(--gold); opacity: .28;
}
.stat-card-value {
    font-family: var(--font-mono); font-variant-numeric: tabular-nums;
    font-size: 1.85rem; font-weight: 600; line-height: 1.1; color: #fff;
}
.stat-card-label { font-size: .8rem; font-weight: 600; color: var(--text); margin-top: .1rem; }
.stat-card-sub { font-size: .73rem; color: var(--text-muted); }
.stat-card.is-danger::before { background: var(--danger); opacity: 1; }
.stat-card.is-danger .stat-card-value { color: #f2919b; }
.stat-card.is-danger .stat-card-icon { color: var(--danger); opacity: .5; }
/* Destination label — names the page each card links to */
.stat-card-link {
    margin-top: .6rem; padding-top: .55rem;
    border-top: 1px solid var(--border);
    font-size: .72rem; font-weight: 600; color: var(--text-muted);
    display: inline-flex; align-items: center; gap: .35rem;
    transition: color .22s ease;
}
.stat-card-link i { font-size: .62rem; transition: transform .22s ease; }
.stat-card:hover .stat-card-link { color: var(--gold); }
.stat-card:hover .stat-card-link i { transform: translateX(2px); }

/* ---- Quick actions bar ------------------------------------------- */
.quick-actions {
    display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
    padding: .8rem 1.1rem; margin-bottom: 1.5rem;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.quick-actions-label {
    font-size: .68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; color: var(--text-muted); margin-right: .2rem;
}
.quick-actions-label i { color: var(--gold); margin-right: .3rem; }
.quick-actions-roster {
    margin-left: auto; font-family: var(--font-mono); font-size: .76rem;
    color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.quick-actions-roster strong { color: var(--text-secondary); font-weight: 600; }

/* ---- Two-column body: activity + manage -------------------------- */
.dash-cols {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 1.5rem; align-items: start;
}
.dash-panel { min-width: 0; }
.dash-panel-title {
    font-family: var(--font-display); font-size: 1rem; color: var(--text);
    display: inline-flex; align-items: center; gap: .5rem; margin: 0 0 .9rem;
}
.dash-panel-title i { color: var(--gold); }
.dash-panel .card-grid { margin-top: 0; grid-template-columns: 1fr; }
.dash-panel-empty {
    color: var(--text-muted); font-size: .88rem; padding: 1.5rem; text-align: center;
    background: var(--bg-card); border: 1px dashed var(--border); border-radius: var(--radius-lg);
}
.dash-panel-empty i { margin-right: .4rem; opacity: .7; }

/* Recent activity list */
.activity-list {
    list-style: none; margin: 0; padding: 0;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
}
.activity-item {
    display: flex; align-items: flex-start; gap: .75rem;
    padding: .7rem .95rem; border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-level {
    flex: none; font-size: .6rem; font-weight: 700; letter-spacing: .05em;
    text-transform: uppercase; padding: .2rem .45rem; border-radius: var(--radius-pill);
    margin-top: .05rem; background: var(--info-bg); color: #8fc4ea;
    border: 1px solid rgba(79,157,212,.3);
}
.activity-warning, .activity-warn { background: rgba(217,154,43,.16); color: #e7b85c; border-color: rgba(217,154,43,.3); }
.activity-error, .activity-critical { background: rgba(229,84,106,.16); color: #f2919b; border-color: rgba(229,84,106,.3); }
.activity-info { background: var(--info-bg); color: #8fc4ea; border-color: rgba(79,157,212,.3); }
.activity-body { display: flex; flex-direction: column; min-width: 0; }
.activity-msg {
    font-size: .85rem; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.activity-meta { font-size: .72rem; color: var(--text-muted); margin-top: .1rem; }
.activity-meta .src { font-family: var(--font-mono); }
.dash-panel-more {
    display: inline-block; margin-top: .7rem; font-size: .8rem;
    color: var(--gold); text-decoration: none;
}
.dash-panel-more:hover { text-decoration: underline; }
.dash-panel-more i { font-size: .7rem; margin-left: .2rem; }

/* ==================================================================
   Reusable status pills (tables, lists, detail views)
   ================================================================== */
.pill {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .2rem .55rem; border-radius: var(--radius-pill);
    font-size: .72rem; font-weight: 600; line-height: 1.4;
    border: 1px solid transparent; white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-success { background: rgba(47,164,127,.14);  color: #5fd3ab; border-color: rgba(47,164,127,.32); }
.pill-warning { background: rgba(217,154,43,.14);  color: #e7b85c; border-color: rgba(217,154,43,.32); }
.pill-danger  { background: rgba(229,84,106,.14);  color: #f2919b; border-color: rgba(229,84,106,.32); }
.pill-info    { background: rgba(79,157,212,.14);  color: #8fc4ea; border-color: rgba(79,157,212,.32); }
.pill-muted   { background: rgba(124,129,148,.14); color: #aab0c0; border-color: rgba(124,129,148,.32); }

/* ==================================================================
   Table system — the surface AR staff live in
   ================================================================== */
.table-toolbar {
    display: flex; flex-wrap: wrap; gap: .75rem; align-items: center;
    justify-content: space-between; margin-bottom: 1rem;
}
.toolbar-group { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.data-table-wrap {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
}
.data-table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
    position: sticky; top: 0; z-index: 2; background: var(--bg-card-2);
    color: var(--text-secondary); font-size: .7rem; font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase; text-align: left;
    padding: .7rem .9rem; border-bottom: 1px solid var(--border-strong);
    white-space: nowrap;
}
.data-table tbody td {
    padding: .7rem .9rem; border-bottom: 1px solid var(--border);
    font-size: .86rem; vertical-align: middle; color: var(--text);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--t-fast); }
.data-table tbody tr:hover { background: var(--bg-raised); }
.data-table .num-cell, .data-table th.num-cell {
    font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap;
}
.data-table td.num-cell { font-family: var(--font-mono); }
.data-table .col-actions, .data-table th.col-actions { text-align: right; white-space: nowrap; }
.row-actions { display: inline-flex; gap: .3rem; justify-content: flex-end; align-items: center; }
.table-empty { padding: 3rem 1rem; text-align: center; color: var(--text-muted); }
.table-empty i { font-size: 2rem; display: block; margin-bottom: .75rem; opacity: .6; }
.cell-strong { font-weight: 600; color: #fff; }
.cell-sub { font-size: .76rem; color: var(--text-muted); }

@media (max-width: 860px) {
    .dash-cols { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .bridge-instruments { gap: 1.2rem 2rem; }
}

/* ==================================================================
   Site-wide form + detail utilities (design-system rollout)
   ================================================================== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.15rem 1.25rem; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.15rem 1.25rem; }
.form-actions {
    display: flex; flex-wrap: wrap; gap: .75rem;
    margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--border);
}
@media (max-width: 640px) { .form-grid, .form-grid-3 { grid-template-columns: 1fr; } }

/* Profile / detail list */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.profile-dl { display: grid; grid-template-columns: max-content 1fr; gap: .55rem 1.4rem; margin: 0; }
.profile-dl dt { color: var(--text-secondary); font-size: .85rem; }
.profile-dl dd { margin: 0; word-break: break-word; }
.profile-subh {
    margin: 1.4rem 0 .55rem; font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; color: var(--gold);
}
.profile-caps { display: flex; flex-wrap: wrap; gap: .35rem; }
.status-on { color: var(--success); font-weight: 600; }
.req { color: var(--danger); }
@media (max-width: 768px) { .profile-grid { grid-template-columns: 1fr; } }
