/* ─────────────────────────────────────────────────────────────────────────────
   GLASS
   The liquid-glass material, dashboard chips, utilities and shared components.

   Part 5 of 11, cut from the 5,142-line app.css. THE ORDER OF THESE
   FILES IS LOAD-BEARING — they are one cascade, split for navigation only, and
   index.php links them in this sequence. Moving one changes which rule wins.
   ───────────────────────────────────────────────────────────────────────────── */
/* =========================================================
   LIQUID GLASS — ONE unified material for every surface
   (after iyinchao/liquid-glass-studio). Header pills, mobile
   drawer, content panels, modal, tooltip, dropdown, date
   filter and the sidebar toggle now share ONE recipe so the
   header reads as the same glass as everything else:
     • refractive backdrop  → var(--glass-blur)
       = blur + saturate + brightness + url(#liquid-glass)
       (the SVG turbulence→displacement→RGB-split→screen
        chain that gives chromatic dispersion at the edges)
     • Fresnel top sheen     → 155° light-entry gradient
     • specular streak       → ::before
     • iridescent edge rim   → ::after  (1px conic, masked)
     • layered bevel + drop shadow
   Only the fill DENSITY differs — thin chrome (--bg-glass)
   vs thick panel (--bg-glass-panel) via --surface-fill,
   like thin vs thick glass. Every host keeps its own
   position/layout; this block only paints the material.
   NOTE: js/glass-tuner.js (?tune=1) still drives --glass-blur,
   --bg-glass / --bg-glass-panel and the #liquid-glass filter,
   so all of these stay live-tunable in one shot.
   ========================================================= */
.nav-group,
.action-group,
.glass-panel.nav-group,
.glass-panel.action-group,
.nav-drawer,
.glass-panel.nav-drawer,
.glass-panel,
.modal-card,
.dropdown-content,
.date-filter-container,
.sidebar-toggle-btn {
    /* FLAT — opaque surface, no glass material. The frame is a HAIRLINE plus a
       whisper of shadow, which is the reference system's card exactly: the 1px
       edge draws the boundary and --shadow-2 only implies where the light is.
       The two are a pair — this border went away once while the shadows were
       still heavy enough to carry the edge on their own; they no longer are.
       Revert by setting --hairline: transparent in base.css, not by editing here.
       (Internal document rules + control affordance borders are unaffected.) */
    background: var(--bg-card);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: var(--card-border);
    box-shadow: var(--shadow-2);
}

/* floating chrome + overlays sit higher off the page → stronger shadow
   (.glass-tooltip excluded — it now carries its own trend-style border + shadow) */
.nav-group,
.action-group,
.nav-drawer,
.modal-card,
.dropdown-content {
    box-shadow: var(--shadow-3);
}

/* (Outer frame borders are back as a HAIRLINE, not the old heavy frame — see
   --card-border above. Internal ledger rules (.cdoc-rule / .cdoc-foot / table
   headers) and control borders (buttons, inputs, toggles) keep their own.) */

/* flat: no glass specular streak */
.nav-group::before,
.action-group::before,
.nav-drawer::before,
.glass-panel::before,
.modal-card::before,
.glass-tooltip::before,
.dropdown-content::before,
.date-filter-container::before,
.sidebar-toggle-btn::before { content: none; }

/* flat: no glass iridescent rim (the holographic rim on .client-doc is separate
   and keeps its own ::after) */
.nav-group::after,
.action-group::after,
.nav-drawer::after,
.glass-panel:not(.client-doc)::after,
.modal-card::after,
.glass-tooltip::after,
.dropdown-content::after,
.date-filter-container::after,
.sidebar-toggle-btn::after { content: none; }

/* (light-theme glass shadow + rim overrides removed — flat uses the per-theme
   --shadow-2 / --shadow-3 tokens, which already adapt.) */

/* =========================================
   DASHBOARD — Income vs Expense trend chips & tooltip
   (relocated from the inline <style> in views/overview.php)
   ========================================= */
#chart-overall .donut-svg { width: 100%; max-width: 280px; height: auto; margin: 0 auto; }

.trend-legend { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.trend-legend-item {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 12px; border-radius: var(--radius-pill);
    border: 1px solid var(--divider);
    background: var(--bg-card);
    color: var(--text-main); font: inherit; line-height: 1; cursor: pointer;
    transition: transform .15s ease, opacity .15s ease, border-color .15s ease;
}
.trend-legend-item:hover { transform: translateY(-1px); border-color: var(--divider-strong); }
.trend-legend-item--off { opacity: .42; }
.trend-legend-item--off .trend-dot { background: var(--text-muted) !important; }
.trend-legend-item--off .trend-legend-val { text-decoration: line-through; }
.trend-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.trend-legend-label { font-size: 12px; font-weight: 600; }
.trend-legend-val { font-size: 12px; color: var(--text-muted); }

.trend-tooltip {
    position: absolute; z-index: 9999; pointer-events: none;
    transform: translate(-50%, calc(-100% - 14px));
    min-width: 172px; padding: 12px 14px;
    border-radius: var(--radius-md); border: 1px solid var(--divider);
    background: var(--bg-card); box-shadow: var(--shadow-3);
    box-shadow: 0 12px 32px -8px rgba(0, 0, 0, .55);
    color: var(--text-main); opacity: 0; transition: opacity .12s ease;
}
.trend-tooltip .tt-cap { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.trend-tooltip .tt-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.trend-tooltip .tt-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.trend-tooltip .tt-lbl { font-size: 12px; color: var(--text-muted); }
.trend-tooltip .tt-val { font-size: 13px; font-weight: 600; margin-left: auto; }

/* =========================================
   UTILITIES — small grouped helpers (spacing on the --space scale, layout)
   so the same declaration isn't repeated inline across views
   ========================================= */
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mt-4 { margin-top: 16px; }
.w-full { width: 100%; }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.flex-center-x { display: flex; justify-content: center; }
.arrow-btn .material-icons { font-size: 16px; }
.fill-center { flex: 1; display: flex; align-items: center; width: 100%; }

/* Classes that were used in markup but only ever styled inline — now real rules */
.chart-title { width: 100%; border: none; margin-bottom: 32px; font-size: 14px; font-weight: var(--fw-medium); letter-spacing: var(--tracking-wide); }
.sync-metric-wrap { display: flex; flex-direction: row; align-items: baseline; gap: 8px; }

/* =========================================
   REUSABLE COMPONENTS — extracted from repeated inline styles so
   layout lives in CSS, not the markup (central control, less duplication)
   ========================================= */
/* View header: title (inherits size from .text-title) + the title group wrapper */
.view-title { margin: 0; }
/* back button INLINE with the title on one row; centred against the first line so a long
   title that wraps keeps the icon top-aligned (not floating in the middle). */
/* DEFAULT header: title (or seg-tabs) stacked OVER the location/time clock — two rows,
   with a generous gap. A plain title gets a little bottom space so it sits as far above
   the clock as the underlined seg-tabs do (so the "bigger" spacing is consistent). */
.header-title-group { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 10px; min-width: 0; }
.header-title-group .view-title { min-width: 0; padding-bottom: 6px; }
/* PROJECT-DETAILS: the back button is INLINE with the title on ONE row (no clock there). */
#view-project-details .header-title-group { flex-direction: row; align-items: center; gap: 14px; }
#view-project-details .header-title-group .view-title { padding-bottom: 0; }

/* Section title + header row (Settings sections, etc.) */
.section-title { margin: 0; font-size: 12.5px; font-weight: var(--fw-semibold); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-main); }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

/* A table wrapper that sits flush inside a board (drops its own border/radius/margin) */
.ledger-table-wrapper.flush { margin-bottom: 0; border: none; border-radius: 0; }
/* Round icon-only button (e.g. the project-details back arrow) */
.btn-icon-round { width: auto; padding: 6px; border-radius: 50%; }

/* Project details — billing-progress widget (single component, styled centrally) */
.billing-progress { margin: 24px; padding: 32px; box-shadow: none; background: var(--active-theme-bg); }
.billing-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 16px; }
.billing-stat { display: flex; flex-direction: column; gap: 4px; }
.billing-stat--right { text-align: right; }
.billing-label { font-size: 13px; color: var(--text-muted); font-weight: var(--fw-medium); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.billing-value { font-size: 32px; font-weight: var(--fw-bold); letter-spacing: 0; line-height: 1; font-variant-numeric: tabular-nums; }
.billing-bar { width: 100%; height: 12px; margin-bottom: 16px; display: flex; overflow: hidden; border-radius: var(--radius-sm); background: var(--bg-card); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15); }
.billing-foot { display: flex; justify-content: space-between; align-items: center; }
.billing-legend { display: flex; align-items: center; gap: 8px; }
.billing-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.billing-legend-text { font-size: 14px; color: var(--text-muted); font-weight: 500; }

/* Settings page: outer stack, preferences panel, and the Financial-Reports tool cards
   (7 near-identical cards — layout in CSS, only each card's accent colour stays inline). */
.settings-stack { display: flex; flex-direction: column; gap: var(--space-8); margin: 0 auto; padding-bottom: 64px; }
.settings-pref-panel { padding: 24px; display: flex; flex-direction: column; gap: 24px; }
.settings-pref-row { display: flex; justify-content: space-between; align-items: center; }
.settings-pref-row h4 { margin: 0; font-size: 14px; color: var(--text-muted); font-weight: 500; }
.settings-pref-row .toggle-group { display: inline-flex; align-items: center; padding: 2px; }
.settings-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-6); align-items: stretch; }
.settings-card { padding: 24px; display: flex; flex-direction: column; height: 100%; }
.settings-card-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.settings-card-icon { width: 48px; height: 48px; border-radius: var(--radius-sm); flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.settings-card-icon .material-icons { font-size: 24px; }
.settings-card-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--text-main); }
.settings-card-desc { font-size: 12px; color: var(--text-muted); }
.settings-card-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.settings-card-foot .btn { width: 100%; justify-content: center; padding: 12px; }
.settings-card-foot .btn .material-icons { font-size: 18px; }
.settings-card-foot .modal-input { width: 100%; padding: 12px 16px; }
