/* Tabe3 glass style: same identity, Apple like liquid glass on top of app.css.
   Active only with <html data-style="glass">, works with both light and dark.
   Pieces: low fill + backdrop blur, a rim that fades along the edge (bright corners, clear sides),
   soft inner depth, glow that sinks inward on focus. Chromium also bends what is behind the
   floating layers (SVG lens injected by core.js, enabled by <html data-lens>). */

:root[data-style="glass"] {
  --r: 14px;
  --r-lg: 22px;
  --r-xl: 28px;
  --glass:        rgba(255,255,255,.40);
  --glass-strong: rgba(255,255,255,.42);
  --glass-ctl:    rgba(255,255,255,.38);
  --glass-sel:    rgba(255,255,255,.70);
  --rim: linear-gradient(180deg, rgba(255,255,255,.75), rgba(255,255,255,.30) 35%, rgba(255,255,255,.25) 65%, rgba(255,255,255,.50));
  --rim-tint: linear-gradient(180deg, rgba(255,255,255,.40), rgba(255,255,255,.10) 35%, rgba(255,255,255,.08) 65%, rgba(255,255,255,.20));
  --depth: inset 0 1px 1px rgba(255,255,255,.45);
  --depth-ctl: inset 0 1px 1px rgba(255,255,255,.45);
  --focus: inset 0 0 0 1px rgba(11,122,153,.35);
  --field-focus: rgba(11,122,153,.45);
  --ring-in: inset 0 0 0 1px rgba(255,255,255,.55);
  --blur:     blur(24px) saturate(180%);
  --blur-ctl: blur(12px) saturate(160%);
  --shadow-ctl:   0 2px 8px rgba(16,32,46,.08);
  --shadow-soft:  0 8px 28px rgba(16,32,46,.09);
  --shadow-float: 0 12px 36px rgba(16,32,46,.13);
  --shadow-pop:   0 22px 60px rgba(16,32,46,.20);
  --surface:  rgba(255,255,255,.40);
  --bg:       rgba(255,255,255,.25);
  --sunken:   rgba(16,32,46,.05);
  --line:     rgba(16,32,46,.07);
  --line-2:   rgba(16,32,46,.11);
  --paper-50: rgba(255,255,255,.3);
  --accent-bg: rgba(11,122,153,.13);
  --scrim: rgba(16,32,46,.16);
  --toast-bg: rgba(16,32,46,.55);
  --tint-primary: rgba(11,122,153,.75);
  --page: #e9eef2;
}
:root[data-style="glass"][data-theme="dark"] {
  --glass:        rgba(30,40,52,.38);
  --glass-strong: rgba(26,35,46,.32);
  --glass-ctl:    rgba(255,255,255,.05);
  --glass-sel:    rgba(255,255,255,.11);
  --rim: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.06) 35%, rgba(255,255,255,.05) 65%, rgba(255,255,255,.09));
  --rim-tint: linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,.06) 35%, rgba(255,255,255,.04) 65%, rgba(255,255,255,.12));
  --depth: inset 0 1px 1px rgba(255,255,255,.04);
  --depth-ctl: inset 0 1px 1px rgba(255,255,255,.04);
  --focus: inset 0 0 0 1px rgba(60,175,210,.35);
  --field-focus: rgba(60,175,210,.40);
  --ring-in: inset 0 0 0 1px rgba(255,255,255,.08);
  --shadow-ctl:   0 2px 8px rgba(0,0,0,.22);
  --shadow-soft:  0 8px 28px rgba(0,0,0,.28);
  --shadow-float: 0 12px 36px rgba(0,0,0,.38);
  --shadow-pop:   0 22px 60px rgba(0,0,0,.55);
  --surface:  rgba(255,255,255,.045);
  --bg:       rgba(255,255,255,.035);
  --sunken:   rgba(255,255,255,.06);
  --line:     rgba(255,255,255,.06);
  --line-2:   rgba(255,255,255,.10);
  --paper-50: rgba(255,255,255,.04);
  --accent-bg: rgba(26,141,176,.20);
  --scrim: rgba(0,0,0,.28);
  --toast-bg: rgba(30,40,52,.50);
  --tint-primary: rgba(26,141,176,.62);
  --page: #0b1116;
}

[data-style="glass"] body { background: var(--page); }

/* ── 1. glass bodies: fill + blur + depth, no border ── */
[data-style="glass"] .top::before,
[data-style="glass"] .menu-pop,
[data-style="glass"] .dp-pop,
[data-style="glass"] .modal,
[data-style="glass"] .login-box,
[data-style="glass"] .pdfv-bar,
[data-style="glass"] .list > .li,
[data-style="glass"] .day-group,
[data-style="glass"] .figures > div,
[data-style="glass"] .decide,
[data-style="glass"] .missed,
[data-style="glass"] .slist,
[data-style="glass"] .my-grid,
[data-style="glass"] .risk-avg,
[data-style="glass"] .chat-list,
[data-style="glass"] .thread,
[data-style="glass"] .ann,
[data-style="glass"] .ann-compose,
[data-style="glass"] .sol-card,
[data-style="glass"] .tt {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 0;
  box-shadow: var(--depth), var(--shadow-soft);
}
[data-style="glass"] .top::before,
[data-style="glass"] .login-box { box-shadow: var(--depth), var(--shadow-float); }
[data-style="glass"] .menu-pop,
[data-style="glass"] .dp-pop,
[data-style="glass"] .modal { background: var(--glass-strong); box-shadow: var(--depth), var(--shadow-pop); }

/* ── 2. the rim: a 1px ring painted with a fading gradient, so the edge is one continuous piece ── */
[data-style="glass"] .top::after,
[data-style="glass"] .dp-pop::before,
[data-style="glass"] .login-box::before,
[data-style="glass"] .pdfv-bar::before,
[data-style="glass"] .list > .li::before,
[data-style="glass"] .day-group:not(.wkend)::before,
[data-style="glass"] .figures > div::before,
[data-style="glass"] .decide::before,
[data-style="glass"] .missed::before,
[data-style="glass"] .slist::before,
[data-style="glass"] .my-grid::before,
[data-style="glass"] .risk-avg::before,
[data-style="glass"] .chat-list::before,
[data-style="glass"] .thread::before,
[data-style="glass"] .ann::before,
[data-style="glass"] .ann-compose::before,
[data-style="glass"] .sol-card::before,
[data-style="glass"] .btn:not(.btn-text):not(:disabled)::before,
[data-style="glass"] .dp-btn::before,
[data-style="glass"] .chip::before,
[data-style="glass"] .rowpick::before,
[data-style="glass"] .role-card::before,
[data-style="glass"] .prog::before,
[data-style="glass"] .seg button[aria-checked="true"]::before,
[data-style="glass"] .prog button[aria-checked="true"]::before,
[data-style="glass"] .dp-opt[aria-selected="true"]::before,
[data-style="glass"] .rowopt[aria-checked="true"]::before,
[data-style="glass"] .nav a[aria-current="page"]::before,
[data-style="glass"] .strip > button:not(:disabled)::before,
[data-style="glass"] .cell:not(:disabled):not(.wkend)::before,
[data-style="glass"] .msg.them::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  border-radius: inherit; padding: 1px;
  background: var(--rim);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
/* hosts need a box for the ring */
[data-style="glass"] .list > .li, [data-style="glass"] .day-group, [data-style="glass"] .figures > div,
[data-style="glass"] .decide, [data-style="glass"] .missed, [data-style="glass"] .slist, [data-style="glass"] .my-grid,
[data-style="glass"] .risk-avg, [data-style="glass"] .chat-list, [data-style="glass"] .thread, [data-style="glass"] .ann,
[data-style="glass"] .ann-compose, [data-style="glass"] .sol-card, [data-style="glass"] .modal, [data-style="glass"] .pdfv-bar,
[data-style="glass"] .btn, [data-style="glass"] .dp-btn, [data-style="glass"] .chip, [data-style="glass"] .rowpick,
[data-style="glass"] .role-card, [data-style="glass"] .seg, [data-style="glass"] .prog, [data-style="glass"] .seg button,
[data-style="glass"] .prog button, [data-style="glass"] .dp-opt, [data-style="glass"] .rowopt, [data-style="glass"] .nav a,
[data-style="glass"] .strip > * { position: relative; }
/* tinted pieces get a softer rim */
[data-style="glass"] .btn-primary::before,
[data-style="glass"] .btn-danger-fill::before,
[data-style="glass"] .prog button:last-child[aria-checked="true"]::before,
[data-style="glass"] .cell.sel::before { background: var(--rim-tint); }

/* scroll containers (.seg, menus, modals): a ::before ring would scroll with their content, so the ring is a box shadow */
[data-style="glass"] .menu-pop,
[data-style="glass"] .modal { box-shadow: var(--ring-in), var(--depth), var(--shadow-pop); }

/* ── 3. floating bars ── */
/* blur sits on a layer behind the bar: backdrop-filter on .top itself would trap the fixed phone tab bar inside it */
[data-style="glass"] .top { top: 10px; margin: 10px var(--gutter) 0; border-radius: var(--r-lg); background: transparent; box-shadow: none; }
[data-style="glass"] .top::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; }
[data-style="glass"] .top-in { padding: 0 14px; }
[data-style="glass"] main { padding-top: 26px; }
[data-style="glass"] .modal { border-radius: var(--r-xl); }
[data-style="glass"] .login-box { border-radius: var(--r-xl); padding: 34px 30px; }
[data-style="glass"] .modal-bg { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
[data-style="glass"] .toast {
  background: var(--toast-bg); border-radius: var(--r-pill); padding: 12px 22px;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--depth), var(--shadow-float);
}
[data-style="glass"] .toast.err { background: rgba(200,54,75,.65); }

/* ── 4. controls: small glass pieces ── */
[data-style="glass"] .btn,
[data-style="glass"] .dp-btn,
[data-style="glass"] .chip,
[data-style="glass"] .rowpick,
[data-style="glass"] .role-card,
[data-style="glass"] .seg,
[data-style="glass"] .prog {
  background: var(--glass-ctl);
  -webkit-backdrop-filter: var(--blur-ctl); backdrop-filter: var(--blur-ctl);
  border-color: transparent;
  box-shadow: var(--depth-ctl), var(--shadow-ctl);
}
/* typing fields stay calm: flat fill, one quiet border, no rim or light band */
[data-style="glass"] .input,
[data-style="glass"] .composer textarea {
  border: 1px solid var(--line-2);
  background: var(--glass-ctl);
  -webkit-backdrop-filter: var(--blur-ctl); backdrop-filter: var(--blur-ctl);
  box-shadow: none;
}
/* focus: the border takes the brand color, nothing glows */
[data-style="glass"] .input:focus,
[data-style="glass"] .composer textarea:focus { border-color: var(--field-focus); box-shadow: none; background: var(--glass-ctl); }
[data-style="glass"] .dp-btn[aria-expanded="true"] { border-color: transparent; box-shadow: var(--depth-ctl), var(--focus), var(--shadow-ctl); }
[data-style="glass"] .btn { transition: background var(--t), transform var(--t); }
[data-style="glass"] .btn:hover:not(:disabled),
[data-style="glass"] .dp-btn:hover,
[data-style="glass"] .chip:hover { background: var(--glass-strong); border-color: transparent; }
[data-style="glass"] .btn:active:not(:disabled) { transform: scale(.97); }
[data-style="glass"] .btn-primary,
[data-style="glass"] .btn-primary:hover:not(:disabled) { background: var(--tint-primary); color: #fff; }
[data-style="glass"] .btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
[data-style="glass"] .btn-danger-fill,
[data-style="glass"] .btn-danger-fill:hover:not(:disabled) { background: rgba(200,54,75,.68); }
[data-style="glass"] .btn-text { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; border-color: transparent; }
[data-style="glass"] .btn-text:hover:not(:disabled) { background: var(--accent-bg); }
[data-style="glass"] .btn:disabled { background: var(--sunken); box-shadow: none; }
[data-style="glass"] .icon-btn { border-radius: 50%; }
[data-style="glass"] .role-card { border-radius: var(--r-lg); }

/* chosen pieces: a lighter glass lens with its own rim, no flat colored box */
[data-style="glass"] .seg, [data-style="glass"] .prog { border-radius: var(--r-pill); padding: 3px; }
[data-style="glass"] .seg button, [data-style="glass"] .prog button { border-radius: var(--r-pill); }
[data-style="glass"] .seg button[aria-checked="true"],
[data-style="glass"] .prog button[aria-checked="true"],
[data-style="glass"] .nav a[aria-current="page"] { background: var(--glass-sel); box-shadow: var(--depth-ctl), var(--shadow-ctl); }
[data-style="glass"] .prog button:last-child[aria-checked="true"] { background: var(--tint-primary); }
[data-style="glass"] .dp-opt, [data-style="glass"] .rowopt { border-radius: 12px; }
[data-style="glass"] .dp-opt[aria-selected="true"],
[data-style="glass"] .rowopt[aria-checked="true"],
[data-style="glass"] .conv[aria-current="true"] { background: var(--glass-sel); box-shadow: var(--depth-ctl); }
[data-style="glass"] .chip[aria-checked="true"] { background: var(--accent-bg); box-shadow: var(--depth-ctl), var(--focus); border-color: transparent; }
[data-style="glass"] .dp-head { background: var(--bg); border-radius: 12px; }
[data-style="glass"] .cards > .li, [data-style="glass"] .msgs { background: var(--bg); }

/* calendar and strips */
[data-style="glass"] .strip > *,
[data-style="glass"] .cell { background: var(--glass-ctl); border-color: transparent; box-shadow: var(--depth-ctl); }
[data-style="glass"] .cell:disabled, [data-style="glass"] .cell.wkend, [data-style="glass"] .strip .wkend { background: transparent; box-shadow: none; }
[data-style="glass"] .cell.wkend { border-color: var(--line-2); }
[data-style="glass"] .cell.av-ok, [data-style="glass"] .strip button[aria-pressed="true"] { background: var(--accent-bg); box-shadow: var(--depth-ctl), var(--focus); }
[data-style="glass"] .cell.sel, [data-style="glass"] .cell.sel:hover { background: var(--tint-primary); border-color: transparent; }

/* cards */
[data-style="glass"] .sol-card { border-inline-start-width: 0; }
[data-style="glass"] .sol-card.new { box-shadow: var(--depth), var(--shadow-soft), inset -3px 0 0 var(--accent); }
[data-style="glass"] .sol-card:hover { transform: translateY(-1px); }
[data-style="glass"] .day-group.wkend { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; border: 1px dashed var(--line-2); }

/* chat */
[data-style="glass"] .msg { border-radius: 20px; }
[data-style="glass"] .msg.them { background: var(--glass-sel); box-shadow: var(--depth-ctl); }
[data-style="glass"] .msg.me { background: var(--tint-primary); box-shadow: none; }

/* no sharp corners left */
[data-style="glass"] .meter i { border-radius: 99px; }
[data-style="glass"] .cell .ex, [data-style="glass"] .legend i.ex { border-radius: 2px; }
[data-style="glass"] .pdfv-page { border-radius: 10px; overflow: hidden; }
[data-style="glass"] .pdfv-bar { margin: 8px; border-radius: var(--r-lg); }
[data-style="glass"] .ann-imgs img, [data-style="glass"] .msg-img { border-radius: var(--r-lg); }
[data-style="glass"] .badge, [data-style="glass"] .badge-n { border-radius: var(--r-pill); }

/* .seg scrolls sideways: its ring is a box shadow (kept after the control rules so it wins) */
[data-style="glass"] .seg { box-shadow: var(--ring-in), var(--depth-ctl), var(--shadow-ctl); }

/* ── 5. lens (Chromium only): what passes behind the floating layers bends at their edges ── */
[data-style="glass"][data-lens] .top::before,
[data-style="glass"][data-lens] .menu-pop,
[data-style="glass"][data-lens] .dp-pop,
[data-style="glass"][data-lens] .modal { backdrop-filter: url(#tabe3-lens) blur(3px) saturate(180%); }

@media (max-width: 760px) {
  /* bottom tab bar floats as one glass pill */
  [data-style="glass"] .top { top: 8px; margin: 8px 10px 0; border-radius: 20px; }
  [data-style="glass"] .nav {
    inset-inline: 10px; bottom: calc(8px + env(safe-area-inset-bottom));
    padding: 6px 12px; border-radius: 26px; scroll-padding-inline: 12px;
    background: var(--glass);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    box-shadow: var(--ring-in), var(--depth), var(--shadow-float);
  }
  [data-style="glass"][data-lens] .nav { backdrop-filter: url(#tabe3-lens) blur(3px) saturate(180%); }
  [data-style="glass"] .nav a { border-radius: 20px; }
  [data-style="glass"] main { padding-bottom: calc(108px + env(safe-area-inset-bottom)); }
  [data-style="glass"] main:has(.chat) { padding-bottom: calc(108px + env(safe-area-inset-bottom)); }
  [data-style="glass"] .chat { height: calc(100dvh - var(--top-h) - 140px - env(safe-area-inset-bottom)); }
  [data-style="glass"] .login-box { padding: 26px 18px; }
}

/* browsers without backdrop blur: make the glass nearly solid so text stays readable */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  [data-style="glass"] { --glass: rgba(255,255,255,.92); --glass-strong: rgba(255,255,255,.96); --surface: rgba(255,255,255,.9); }
  [data-style="glass"][data-theme="dark"] { --glass: rgba(26,36,47,.94); --glass-strong: rgba(26,36,47,.97); --surface: rgba(26,36,47,.9); }
}
