/* Liquid glass: one layer on top of styles.css that gives the whole platform a translucent, light-refracting look.
   Surfaces become frosted glass (blur + saturation + a bright top edge) floating over a soft colour field that follows the brand.
   Everything is driven by the same tokens the app already uses (--surface, --border, --shadow, --radius), so every screen picks it up.
   Safe fallbacks: solid surfaces when the browser has no backdrop blur, or when the person asks for less transparency or more contrast. */

/* ---- tokens: light */
:root {
  --glass-blur: blur(22px) saturate(1.7);
  --glass-strong-bg: rgba(255, 255, 255, .78);
  --surface: rgba(255, 255, 255, .54);
  --surface-2: rgba(255, 255, 255, .36);
  --border: rgba(31, 38, 135, .11);
  --edge: rgba(255, 255, 255, .85);
  --radius: 18px;
  --shadow: 0 10px 34px rgba(31, 38, 135, .10), 0 1px 3px rgba(31, 38, 135, .06), inset 0 1px 0 var(--edge), inset 0 0 0 1px rgba(255, 255, 255, .38);
  --shadow-lg: 0 28px 70px rgba(31, 38, 135, .24), 0 2px 8px rgba(31, 38, 135, .10), inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 0 0 1px rgba(255, 255, 255, .5);
  --field-bg: rgba(255, 255, 255, .55);
  --field-shadow: inset 0 1px 2px rgba(31, 38, 135, .08);
  --bg-field:
    radial-gradient(60vmax 52vmax at 6% -8%, rgba(139, 133, 255, .72), transparent 62%),
    radial-gradient(52vmax 46vmax at 104% 8%, rgba(46, 230, 168, .36), transparent 62%),
    radial-gradient(62vmax 50vmax at 72% 108%, rgba(67, 56, 224, .36), transparent 62%),
    radial-gradient(42vmax 40vmax at -6% 92%, rgba(255, 170, 205, .34), transparent 62%);
}
/* ---- tokens: dark (black and charcoal glass; purple stays a quiet accent) */
:root[data-theme="dark"] {
  --glass-strong-bg: rgba(26, 26, 32, .82);
  --surface: rgba(30, 30, 38, .56);
  --surface-2: rgba(255, 255, 255, .055);
  --border: rgba(255, 255, 255, .105);
  --edge: rgba(255, 255, 255, .17);
  --shadow: 0 10px 34px rgba(0, 0, 0, .45), inset 0 1px 0 var(--edge), inset 0 0 0 1px rgba(255, 255, 255, .04);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 0 0 1px rgba(255, 255, 255, .06);
  --field-bg: rgba(255, 255, 255, .06);
  --field-shadow: inset 0 1px 2px rgba(0, 0, 0, .4);
  --bg-field:
    radial-gradient(55vmax 48vmax at 4% -10%, rgba(139, 133, 255, .27), transparent 62%),
    radial-gradient(48vmax 44vmax at 106% 6%, rgba(46, 230, 168, .075), transparent 62%),
    radial-gradient(60vmax 48vmax at 70% 110%, rgba(67, 56, 224, .22), transparent 62%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glass-strong-bg: rgba(26, 26, 32, .82); --surface: rgba(30, 30, 38, .56); --surface-2: rgba(255, 255, 255, .055); --border: rgba(255, 255, 255, .105); --edge: rgba(255, 255, 255, .17);
    --shadow: 0 10px 34px rgba(0, 0, 0, .45), inset 0 1px 0 var(--edge), inset 0 0 0 1px rgba(255, 255, 255, .04); --shadow-lg: 0 28px 70px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 0 0 1px rgba(255, 255, 255, .06);
    --field-bg: rgba(255, 255, 255, .06); --field-shadow: inset 0 1px 2px rgba(0, 0, 0, .4);
    --bg-field: radial-gradient(55vmax 48vmax at 4% -10%, rgba(139, 133, 255, .27), transparent 62%), radial-gradient(48vmax 44vmax at 106% 6%, rgba(46, 230, 168, .075), transparent 62%), radial-gradient(60vmax 48vmax at 70% 110%, rgba(67, 56, 224, .22), transparent 62%);
  }
}

/* ---- the colour field the glass floats over */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--bg-field); pointer-events: none; }

/* ---- structure: the sidebar floats as a glass panel; the glass lives on a pseudo-element so fixed children (the phone menu) are not affected */
.app { grid-template-columns: 236px 1fr; }
.sidebar { position: relative; background: none; border-right: 0; margin: 12px 0 12px 12px; border-radius: 24px; isolation: isolate; box-shadow: var(--shadow); }
.sidebar::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--surface); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
.nav a { border-radius: 14px; transition: background .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease; }
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--accent-weak); box-shadow: inset 0 1px 0 var(--edge), 0 4px 14px rgba(67, 56, 224, .12); }

/* ---- glass containers */
.card, .col, .modal, .toast, .filter-panel, .dropbar, .kpi, .seg, .tabs, .adm-card, .tablewrap, .adm-nav, .popover, .menu { -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
.card, .kpi, .adm-card, .tablewrap { border-color: transparent; border-radius: var(--radius); }
.col { background: var(--surface-2); border-color: var(--border); border-radius: var(--radius); }
.modal { background: var(--glass-strong-bg); border: 1px solid var(--border); border-radius: 26px; -webkit-backdrop-filter: blur(34px) saturate(1.8); backdrop-filter: blur(34px) saturate(1.8); }
.scrim { background: rgba(20, 22, 60, .28); -webkit-backdrop-filter: blur(8px) saturate(1.2); backdrop-filter: blur(8px) saturate(1.2); }
.toast { background: var(--glass-strong-bg); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: 16px; }
.filter-panel, .dropbar { background: var(--glass-strong-bg); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: 18px; }
.deal-card, .task, .file, .view-row { border-radius: 14px; }
.deal-card { background: var(--surface); box-shadow: var(--shadow); }
.deal-card:hover, .task:hover { transform: translateY(-1px); }
.deal-card, .task { transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }

/* ---- controls */
.btn { border-radius: 13px; border: 1px solid var(--border); background: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, .22)); box-shadow: 0 1px 2px rgba(31, 38, 135, .08), inset 0 1px 0 var(--edge); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: transform .15s ease, box-shadow .15s ease, background .15s ease, filter .15s ease; }
.btn:hover { background: linear-gradient(180deg, rgba(255, 255, 255, .72), rgba(255, 255, 255, .34)); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(31, 38, 135, .12), inset 0 1px 0 var(--edge); }
.btn:active { transform: translateY(0); }
.btn.primary { color: var(--accent-ink); border-color: rgba(255, 255, 255, .35); background: linear-gradient(180deg, rgba(255, 255, 255, .30), rgba(255, 255, 255, 0) 62%), var(--accent); box-shadow: 0 8px 20px rgba(67, 56, 224, .30), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn.primary:hover { filter: brightness(1.07); background: linear-gradient(180deg, rgba(255, 255, 255, .36), rgba(255, 255, 255, 0) 62%), var(--accent); }
:root[data-theme="dark"] .btn { background: linear-gradient(180deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .05)); box-shadow: 0 1px 2px rgba(0, 0, 0, .35), inset 0 1px 0 var(--edge); }
:root[data-theme="dark"] .btn:hover { background: linear-gradient(180deg, rgba(255, 255, 255, .19), rgba(255, 255, 255, .08)); box-shadow: 0 8px 18px rgba(0, 0, 0, .4), inset 0 1px 0 var(--edge); }
:root[data-theme="dark"] .btn.primary { background: linear-gradient(180deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 70%), var(--accent); box-shadow: 0 8px 22px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .7); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn { background: linear-gradient(180deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .05)); box-shadow: 0 1px 2px rgba(0, 0, 0, .35), inset 0 1px 0 var(--edge); } :root:not([data-theme="light"]) .btn.primary { background: linear-gradient(180deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 70%), var(--accent); } }
.btn.won, .btn.lost { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4); }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=time], input[type=search], input[type=password], input[type=url], input[type=datetime-local], select, textarea { background: var(--field-bg); border: 1px solid var(--border); border-radius: 13px; box-shadow: var(--field-shadow); transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft), var(--field-shadow); background: var(--glass-strong-bg); }
.badge, .tag, .soc-b, .soc-chip { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }

/* ---- tabs and segmented controls become glass pills */
.tabs { display: inline-flex; flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; border-bottom: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; padding: 4px; gap: 2px; box-shadow: inset 0 1px 2px rgba(31, 38, 135, .05); }
.tab { border-bottom: 0; border-radius: 12px; padding: 8px 14px; white-space: nowrap; transition: background .18s ease, color .18s ease, box-shadow .18s ease; }
.tab.active { background: var(--glass-strong-bg); box-shadow: var(--shadow); border-bottom: 0; }
.seg { background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; }
.seg-btn { border-radius: 12px; }
.seg-btn.on, .seg-btn[aria-pressed="true"] { background: var(--glass-strong-bg); box-shadow: var(--shadow); }
.page-head h1 { letter-spacing: -.02em; }

/* ---- the phone menu floats as a glass pill */
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { margin: 0; border-radius: 0; box-shadow: none; }
  .sidebar::before { border-bottom: 1px solid var(--border); }
  .nav { left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); border-radius: 26px; border: 1px solid var(--border); background: var(--glass-strong-bg); box-shadow: var(--shadow-lg); -webkit-backdrop-filter: blur(28px) saturate(1.8); backdrop-filter: blur(28px) saturate(1.8); padding: 0 6px; }
  .nav a.active { border-radius: 18px; }
  .view { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
  .soc-bar { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .modal { border-radius: 24px; }
}

/* ---- platform admin console and public pages use the same glass */
.adm-nav { background: var(--surface); border-right: 0; margin: 12px 0 12px 12px; height: calc(100vh - 24px); border-radius: 24px; box-shadow: var(--shadow); }
.adm-nav button.on { box-shadow: inset 0 1px 0 var(--edge); }
.kpi, .adm-card, .tablewrap { background: var(--surface); box-shadow: var(--shadow); }
.adm-main th { background: var(--surface-2); }
@media (max-width: 760px) { .adm-nav { margin: 0; height: auto; border-radius: 0; } }

/* ---- respect the person's settings and the browser's abilities */
@media (prefers-reduced-motion: reduce) { .btn, .nav a, .tab, .deal-card, .task { transition: none; } .btn:hover, .deal-card:hover, .task:hover { transform: none; } }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --surface: rgba(255, 255, 255, .94); --surface-2: rgba(244, 243, 255, .9); --glass-strong-bg: #fff; }
  :root[data-theme="dark"] { --surface: #151518; --surface-2: #1c1c20; --glass-strong-bg: #18181c; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  :root { --surface: #fff; --surface-2: #f1f0fb; --glass-strong-bg: #fff; --border: rgba(15, 18, 64, .28); --field-bg: #fff; --bg-field: none; --glass-blur: none; }
  :root[data-theme="dark"] { --surface: #151518; --surface-2: #1d1d22; --glass-strong-bg: #1a1a1f; --border: rgba(255, 255, 255, .32); --field-bg: #101013; }
  .card, .col, .modal, .toast, .filter-panel, .dropbar, .kpi, .seg, .tabs, .adm-card, .tablewrap, .adm-nav, .btn, .nav, .scrim, .sidebar::before { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}
@media print { body::before { display: none; } .card, .modal { box-shadow: none; background: #fff; } }
