:root {
    --accent: #2f6fed;
    --accent-contrast: #ffffff;
    --border: #e3e6ea;
    --text: #1f2430;
    --text-muted: #6b7280;
    --bg: #f7f8fa;
    --bg-panel: #ffffff;
    --row-hover: #eef2fb;
    --sidebar-width: 220px;
    --topbar-height: 56px;
    --radius: 6px;

    /* ui_redesign_brief_1.md item 4: one spacing scale, used
       everywhere instead of ad-hoc padding per component. */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;

    /* Every form control and button shares this height so rows of
       mixed inputs/buttons (filter bars, inline forms) line up. */
    --control-height: 36px;
    --font-data: 13px;
    --font-label: 11px;
    --font-header: 16px;

    --badge-amber-bg: #fef3e0; --badge-amber-fg: #92610a;
    --badge-green-bg: #e6f6ec; --badge-green-fg: #1a7a41;
    --badge-red-bg: #fdeaea;  --badge-red-fg: #b3261e;
    --badge-blue-bg: #e8f0fe; --badge-blue-fg: #1a56c4;
    --badge-gray-bg: #eef0f2; --badge-gray-fg: #565f6b;
}

:root[data-theme="dark"] {
    --border: #33383f;
    --text: #e6e8eb;
    --text-muted: #9aa1ab;
    --bg: #16181c;
    --bg-panel: #1e2126;
    --row-hover: #202840;

    --badge-amber-bg: #4a3a14; --badge-amber-fg: #f0c063;
    --badge-green-bg: #17361f; --badge-green-fg: #6fd18c;
    --badge-red-bg: #3d1c1c;  --badge-red-fg: #f0908a;
    --badge-blue-bg: #1b2c4a; --badge-blue-fg: #8fb4f5;
    --badge-gray-bg: #2a2d33; --badge-gray-fg: #b7bcc4;
}

:root[data-theme="dark"] .dropdown-menu-custom {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--accent); }

/* ---------- App shell ---------- */

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

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.sidebar-brand {
    padding: 16px;
    font-weight: 700;
    font-size: 1.05rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-brand-mark {
    width: 28px; height: 28px;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-nav { padding: 8px; flex: 1; }

.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    border: none;
    border-top: 1px solid var(--border);
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
}

.sidebar-collapse-btn:hover { background: var(--bg); }

.sidebar-collapse-btn .icon { width: 18px; text-align: center; flex-shrink: 0; }

/* ---------- Collapsed sidebar (icon-only rail) ---------- */

body.sidebar-collapsed .sidebar { width: 56px; }
body.sidebar-collapsed .sidebar-brand-name,
body.sidebar-collapsed .sidebar-link-label,
body.sidebar-collapsed .sidebar-brand span:not(.sidebar-brand-mark) {
    display: none;
}
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 16px 8px; }
body.sidebar-collapsed .sidebar-link { justify-content: center; padding: 9px; }
body.sidebar-collapsed .sidebar-collapse-btn { justify-content: center; }

.sidebar-section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 12px 12px 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.sidebar-link:hover { background: var(--bg); color: var(--text); text-decoration: none; }

.sidebar-link.active {
    background: var(--accent);
    color: var(--accent-contrast);
    font-weight: 600;
}

.sidebar-link .icon {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.main-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-title {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
}

.topbar-search {
    flex: 1;
    max-width: 420px;
}

.topbar-search input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 10px;
    font-size: 0.85rem;
    background: var(--bg);
}

.topbar-spacer { flex: 1; }

.topbar-icon-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius);
}

.topbar-icon-btn:hover { background: var(--bg); }

.badge-dot {
    position: absolute;
    top: 2px; right: 2px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--badge-red-fg);
}

.avatar-circle {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 700;
}

.dropdown-menu-custom {
    position: absolute;
    right: 0; top: calc(var(--topbar-height) - 4px);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(20, 24, 33, 0.08);
    min-width: 240px;
    display: none;
    z-index: 30;
}

.dropdown-menu-custom.open { display: block; }

.dropdown-menu-custom a, .dropdown-menu-custom button.linklike {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--text);
    text-decoration: none;
    border: none;
    background: none;
}

.dropdown-menu-custom a:hover, .dropdown-menu-custom button.linklike:hover { background: var(--bg); }

.content { padding: var(--space-4) var(--space-4) 40px; }

h3, .h3 { font-size: 1.25rem; }
h5, .h5 { font-size: var(--font-header); }

/* ---------- Stat chips ---------- */
/* ui_redesign_brief_1.md item 1/4: one compact row, not a grid of
   oversized cards — reserve visual weight for the table below. */

.stat-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.stat-chip {
    display: inline-flex;
    align-items: baseline;
    gap: var(--space-1);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-1) var(--space-3);
    line-height: 1.3;
}

.stat-chip-value { font-size: 15px; font-weight: 700; }
.stat-chip-label { font-size: var(--font-label); color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.stat-chip-accent .stat-chip-value { color: var(--accent); }
.stat-chip-green .stat-chip-value { color: var(--badge-green-fg); }
.stat-chip-amber .stat-chip-value { color: var(--badge-amber-fg); }
.stat-chip-red .stat-chip-value { color: var(--badge-red-fg); }

/* ---------- Filter bar ---------- */
/* ui_redesign_brief_1.md item 1: filters collapse into one row, every
   control (dropdowns, the Filter button) sharing --control-height so
   nothing looks mismatched. */

.filter-bar {
    display: flex;
    align-items: end;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-3);
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filter-field label {
    font-size: var(--font-label);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.filter-field select,
.filter-field input {
    min-width: 140px;
}

/* "Export Visible Columns" toolbar control — two labeled date fields
   grouped with their button in one bordered pill (same bordered-group
   treatment as .bulk-bar), so it reads as one cohesive control sitting
   in the icon-btn row instead of two bare, unlabeled date inputs that
   look like broken/placeholder elements next to real buttons. */
.export-visible-columns-form {
    display: flex;
    align-items: end;
    gap: var(--space-2);
    padding: 3px var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-panel);
}
.export-visible-columns-form .filter-field input {
    min-width: 120px;
    height: var(--control-height);
}

/* ---------- List toolbar ---------- */
/* ui_redesign_brief.md correction: replaces the stat-card row that
   used to sit above every list view. Stat/metric cards now live only
   on Dashboard/Analytics. Slim single row: view tabs on the left,
   search + filter/columns icons + primary action on the right —
   everything at --control-height so it reads as one strip, not a
   stack of separate widgets. */

.list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-2);
}

.list-toolbar-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
}

.list-tab {
    display: inline-flex;
    align-items: center;
    height: var(--control-height);
    padding: 0 var(--space-3);
    border-radius: var(--radius);
    font-size: var(--font-data);
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
}

.list-tab:hover { background: var(--bg); color: var(--text); text-decoration: none; }

.list-tab.active {
    background: var(--accent);
    color: var(--accent-contrast);
    font-weight: 600;
}

.list-toolbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.list-search {
    height: var(--control-height);
    font-size: var(--font-data);
    width: 200px;
    max-width: 100%;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: var(--control-height);
    padding: 0 var(--space-2);
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: var(--font-data);
    cursor: pointer;
    line-height: 1;
    text-decoration: none;
}

.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn.active { background: var(--bg); color: var(--text); border-color: var(--accent); }

/* Extra filters (Technology/Visa etc.) collapsed behind the toolbar's
   Filter icon instead of always occupying a row of their own. */
.filter-panel {
    display: none;
    gap: var(--space-2);
    flex-wrap: wrap;
    align-items: end;
    padding: var(--space-2);
    margin-bottom: var(--space-2);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.filter-panel.open { display: flex; }

/* Bulk-action bar (Bulk Approve/Reassign/Assign Selected, etc.) — same
   bordered-panel treatment as .filter-panel above, so a row of controls
   that only appears once you've selected something reads as part of the
   interface instead of floating unstyled below the table. Visibility
   itself stays inline (style="display:none", toggled by
   crmUpdateBulkBar in base.html) rather than a class, so this only
   needs to supply the "flex + border" layout, not the show/hide state.
   flex-wrap is load-bearing: a multi-field bar (select + textarea +
   button) has to drop extra controls to their own line rather than
   squeezing everything onto one, which is what made a button's label
   wrap/overlap illegibly before this existed. */
.bulk-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: var(--space-3);
    padding: var(--space-3);
    margin-top: var(--space-2);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.bulk-bar .btn { white-space: nowrap; }

/* ---------- Data table ---------- */
/* ui_redesign_brief.md correction: Zoho-style dense data grid, not a
   rounded card around a lightly-padded table. Bordered flat grid
   (no radius/shadow on the wrapper — that treatment is reserved for
   single-record .detail-card views), ~32-34px rows, tight cell
   padding, sticky header, frozen first column, zebra striping. Show
   every column the data has and let the wrapper's overflow-x handle
   width instead of curating columns down. */

.data-table-wrap {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    overflow-x: auto;
    /* Bug fix: leaving overflow-y at its default `visible` here doesn't
       actually stay `visible` — per the CSS overflow spec, when one axis
       is `auto`/non-visible and the other is `visible`, the UA is
       required to force the `visible` one to `auto` too. That silently
       made this wrapper (not the page) the sticky positioning container
       for the <thead> below, even though it never grows tall enough to
       need its own vertical scrollbar — so the header's `top` offset was
       being applied against a container that doesn't scroll, painting it
       shifted down over the first data row instead of at the table's
       top edge. Setting overflow-y explicitly (not `visible`) avoids
       relying on that forced-auto behavior. */
    overflow-y: hidden;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-data);
}

table.data-table th {
    text-align: left;
    font-size: var(--font-label);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    padding: 6px var(--space-2);
    white-space: nowrap;
    position: sticky;
    /* Sticky positioning is relative to .data-table-wrap (the nearest
       scrolling ancestor, see the fix note above), not the page — so
       var(--topbar-height) was never the right offset here; it was
       overlapping the wrapper's own top edge (and the first data row
       under it) by that same 56px on every render, not just on scroll. */
    top: 0;
    z-index: 2;
}

table.data-table th a { color: var(--text-muted); text-decoration: none; }
table.data-table th a:hover { color: var(--text); }

table.data-table td {
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: 5px var(--space-2);
    vertical-align: middle;
    height: 32px;
    white-space: nowrap;
}

table.data-table td:last-child { border-right: none; }

table.data-table tbody tr[data-href] { cursor: pointer; }
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr:nth-child(even) td { background: var(--bg); }
table.data-table tbody tr:hover td { background: var(--row-hover); }

/* Freeze the first column during horizontal scroll (Lead # etc.) */
table.data-table .freeze-col {
    position: sticky;
    left: 0;
    background: var(--bg-panel);
    box-shadow: 2px 0 4px rgba(20, 24, 33, 0.06);
}
table.data-table thead .freeze-col { z-index: 3; }
table.data-table tbody tr:nth-child(even) .freeze-col { background: var(--bg); }
table.data-table tbody tr:hover .freeze-col { background: var(--row-hover); }

/* Lower-priority columns, hidden by default behind the "⋯ Columns"
   toggle (see base.html's crmToggleColumns) so the always-visible set
   (Lead #, Candidate, Number, Status, Sales Person, Technology, ...)
   never needs a scroll. */
table.data-table.cols-collapsed .col-secondary { display: none; }

/* Row density toggle — the default grid is already the Zoho-style
   dense layout (~32px rows) from the earlier redesign; this is an
   opt-in looser mode for anyone who wants more breathing room, not a
   third visual language. One class, toggled body-wide, covers every
   .data-table on the page at once — no per-column resize/drag library. */
body.density-comfortable table.data-table th,
body.density-comfortable table.data-table td {
    padding: 10px var(--space-3);
}
body.density-comfortable table.data-table td {
    height: 44px;
}

/* LinkedIn column: a full profile URL as text ate too much grid width
   for the information it conveys — a small brand-colored icon opens
   the same link in a new tab, same information, a fraction of the
   space. */
.linkedin-icon-link {
    display: inline-flex;
    color: #0a66c2;
}
.linkedin-icon-link:hover { color: #004182; }

/* ---------- Detail page: cards, key/value grid, empty states ---------- */

.detail-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
}

.detail-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border);
    font-size: var(--font-label);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-muted);
}

.detail-card-body { padding: var(--space-3); }

/* Small payment-due-dates calendar on the Deal and Payment tab —
   current month only, compact cells, no navigation chrome (that's the
   full Marketing Calendar page's job, this is deliberately "small"). */
.payment-mini-calendar th { font-size: var(--font-label); color: var(--text-muted); font-weight: 600; }
.payment-mini-calendar td { height: 44px; vertical-align: top; padding: 2px 4px; font-size: var(--font-data); }

/* ---------- ui_redesign_brief.md "Interaction Conventions" ---------- */

/* 1. View-mode-by-default, edit-on-click. .edit-field-edit stays out of
   the flow until .editing is toggled on the wrapper, so a detail page
   reads as text by default (no permanently-open input boxes) and
   nothing is editable until the pencil is deliberately clicked. */
.edit-field-edit { display: none; }
.edit-field.editing .edit-field-edit { display: inline-block; margin-top: var(--space-2); }
.edit-field.editing .edit-field-view { display: none; }
.edit-pencil-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    font-size: var(--font-label);
    line-height: 1;
}
.edit-pencil-btn:hover { color: var(--accent); }

/* 3. Row-actions kebab menu — reuses .dropdown-menu-custom's look, but
   positioned via JS (position: fixed, coordinates set on open) instead
   of the topbar's `position: absolute; right: 0`, since a menu
   absolutely-positioned inside .data-table-wrap would get clipped by
   that wrapper's overflow-x/y (needed for sticky columns — see that
   rule's own comment). Fixed positioning escapes the clip entirely. */
.dropdown-menu-custom.row-menu {
    position: fixed;
    top: auto; right: auto; left: auto;
    min-width: 160px;
}
.row-actions-kebab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: none;
    border: none;
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}
.row-actions-kebab:hover { background: var(--bg); color: var(--text); }

/* 4. Inline reassign confirmation — replaces a persistent "Reassign"
   button. Hidden until the dropdown's value actually changes (see
   crmShowReassignConfirm in base.html), so reassigning a lead is still
   one deliberate confirm step, just not a button sitting there doing
   nothing until then. */
.reassign-confirm {
    display: none;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    padding: var(--space-2);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: var(--font-data);
}
.payment-mini-calendar-today { background: var(--bg); font-weight: 700; }

.detail-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-3);
}

.detail-header-bar h3 { margin: 0; font-size: var(--font-header); }
.detail-header-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

/* ---------- Detail page tabs ---------- */
/* ui_redesign_brief.md: tabbed detail pages (Sales lead/deal detail
   first) so a long stacked-card page doesn't scroll forever and
   low-frequency sections (Deal & Payment) don't dominate every record's
   page by default. Plain CSS/JS, no framework — server-renders the
   default tab's panel as .active so there's no flash of the wrong
   panel before JS runs. */
.detail-tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
}
.detail-tab {
    padding: var(--space-2) var(--space-3);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: var(--font-data);
    cursor: pointer;
}
.detail-tab:hover { color: var(--text); }
.detail-tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.kv-grid {
    display: grid;
    grid-template-columns: max-content 1fr max-content 1fr;
    gap: var(--space-2) var(--space-3);
    font-size: var(--font-data);
    align-items: baseline;
}
.kv-grid dt { color: var(--text-muted); white-space: nowrap; grid-column: auto; }
.kv-grid dd { margin: 0; }

@media (max-width: 700px) {
    .kv-grid { grid-template-columns: max-content 1fr; }
}

.empty-state {
    color: var(--text-muted);
    font-size: var(--font-data);
    padding: var(--space-2) 0;
}

/* ---------- Badge pills ---------- */

.badge-pill {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.5;
}

.badge-amber { background: var(--badge-amber-bg); color: var(--badge-amber-fg); }
.badge-green { background: var(--badge-green-bg); color: var(--badge-green-fg); }
.badge-red   { background: var(--badge-red-bg);   color: var(--badge-red-fg); }
.badge-blue  { background: var(--badge-blue-bg);  color: var(--badge-blue-fg); }
.badge-gray  { background: var(--badge-gray-bg);  color: var(--badge-gray-fg); }

/* schema_1.sql "COLOR CODING": replaces tags as the categorize-at-a-
   glance mechanism for stage/remark/call-outcome text specifically —
   colored text only, no pill background, restrained by design (this is
   deliberately NOT .badge-pill). Same tone tokens as the badges above
   so "green always means the same thing" holds across both styles. */
.status-text { font-weight: 600; }
.status-text-amber { color: var(--badge-amber-fg); }
.status-text-green { color: var(--badge-green-fg); }
.status-text-red   { color: var(--badge-red-fg); }
.status-text-blue  { color: var(--badge-blue-fg); }
.status-text-gray  { color: var(--text-muted); }

/* ---------- Focus states ---------- */

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, .sidebar-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- Forms / buttons kept close to Bootstrap but flatter ---------- */
/* ui_redesign_brief_1.md item 4: consistent ~36px control height so
   filter bars, inline rows (leave request form) and table rows line
   up. Overrides Bootstrap's own .form-control/.form-select/.btn sizing
   — relies on app.css loading after the Bootstrap CDN link in
   base.html for cascade priority. Left untouched: .btn-lg/.btn-sm,
   textarea (needs its own height), and select[multiple] (fixed height
   would clip the option list). */

.form-control, .form-select, .btn,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="search"] {
    min-height: var(--control-height);
    font-size: var(--font-data);
}

.form-control:not(textarea), .form-select {
    height: var(--control-height);
    padding-top: 0;
    padding-bottom: 0;
    line-height: var(--control-height);
}

.btn {
    height: var(--control-height);
    padding-top: 0;
    padding-bottom: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

select[multiple].form-select { height: auto; line-height: normal; }
.btn-lg, .btn-sm { height: auto; display: inline-block; }

.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-accent:hover { filter: brightness(0.88); color: #fff; }

.sidebar-brand-logo {
    max-height: 28px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.login-brand-logo {
    max-width: 280px;
    height: auto;
}

/* ---------- Responsive sidebar ---------- */

.sidebar-toggle-btn { display: none; }

@media (max-width: 900px) {
    .sidebar-toggle-btn { display: inline-flex; }

    .sidebar {
        position: fixed;
        left: 0; top: 0;
        transform: translateX(-100%);
        transition: transform 0.15s ease;
        box-shadow: 0 0 0 9999px rgba(0,0,0,0);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: 0 0 0 9999px rgba(20,24,33,0.35);
    }

    .topbar-search { display: none; }
}
