/* Motywy kolorystyczne (wybór każdego użytkownika: menu „⋯” przy nazwisku → Motyw kolorystyczny)
 *  brak atrybutu data-theme = „Klasyczny” (szkło, romby RTM, jasny/ciemny wg systemu)
 *  biz     – Biznesowy jasny: biel + zieleń RTM
 *  night   – Nocny: grafit + granat, do pracy wieczorem
 *  rose    – Pudrowy róż: biel + malinowy
 *  purple  – Purpura: ciemnofioletowe menu + róż
 *  burgund – Burgund: bordowe menu + złoto
 * Wspólne dla nowych motywów: dużo bieli, bez ptaków i rozmyć, kanciaste kafelki (4 px), ikony konturowe w menu. */
html[data-theme] {
  --r: 4px; --shadow: none;
  --side-bg: var(--surface); --side-text: var(--text); --side-muted: var(--muted); --side-line: var(--line); --side-act-bg: var(--soft2); --side-act: var(--navy); --side-bar: var(--navy); --side-hover: var(--soft2);
  --pri: var(--navy); --pri-hover: var(--blue2); --pri-text: #fff; --ring: rgba(0,152,95,.18);
  color-scheme: light;
}
html[data-theme=biz] {
  --navy: #004438; --blue: #007A4C; --blue2: #007A4C; --soft: #E1F0E7; --soft2: #EEF6F1;
  --bg: #F4F6F2; --surface: #FFFFFF; --surface-2: #F7F8FA; --line: #E3E7EE; --line2: #D5DBE4; --text: #141B2D; --muted: #6B7488;
  --glass: #FFFFFF; --glass-strong: #FFFFFF; --glass-line: #E3E7EE;
}
html[data-theme=night] {
  --navy: #6FCF9F; --blue: #3DB57F; --blue2: #6FCF9F; --soft: #1A3029; --soft2: #1C2D27;
  --bg: #0D1412; --surface: #151E1B; --surface-2: #19231F; --line: #24332E; --line2: #2F423B; --text: #E6EAF1; --muted: #8B96A9;
  --glass: #151E1B; --glass-strong: #151E1B; --glass-line: #24332E;
  --side-bg: #111A17; --pri: #3DB57F; --pri-hover: #6FCF9F; --pri-text: #0D1412; --ring: rgba(61,181,127,.25);
  color-scheme: dark;
}
html[data-theme=rose] {
  --navy: #A63D66; --blue: #C9658B; --blue2: #A63D66; --soft: #F8DDE7; --soft2: #FBEAF0;
  --bg: #FBF6F7; --surface: #FFFFFF; --surface-2: #FCF7F8; --line: #EEDFE4; --line2: #E3CDD5; --text: #2B1F27; --muted: #8A7681;
  --glass: #FFFFFF; --glass-strong: #FFFFFF; --glass-line: #EEDFE4; --pri-hover: #8E3157; --ring: rgba(201,101,139,.2);
}
html[data-theme=purple] {
  --navy: #6E3AA6; --blue: #8A4FC8; --blue2: #7B3FB8; --soft: #EBDDF7; --soft2: #F1E9FA;
  --bg: #F8F5FB; --surface: #FFFFFF; --surface-2: #FAF7FC; --line: #E7DFF0; --line2: #D9CCE6; --text: #24182F; --muted: #857595;
  --glass: #FFFFFF; --glass-strong: #FFFFFF; --glass-line: #E7DFF0; --ring: rgba(138,79,200,.2);
  --side-bg: #2E1A47; --side-text: #E4D9F0; --side-muted: #A08BBE; --side-line: rgba(255,255,255,.1); --side-act-bg: rgba(255,255,255,.10); --side-act: #FFFFFF; --side-bar: #D0628E; --side-hover: rgba(255,255,255,.06);
  --pri: linear-gradient(135deg, #7B3FB8, #B04E8C); --pri-hover: linear-gradient(135deg, #6A33A3, #9C4079);
}
html[data-theme=burgund] {
  --navy: #7A1F35; --blue: #A8364F; --blue2: #8C2740; --soft: #F3E1E5; --soft2: #F8EDEF;
  --bg: #F8F5F4; --surface: #FFFFFF; --surface-2: #FAF7F6; --line: #EADFDD; --line2: #DCCDCA; --text: #2A1A1D; --muted: #85747A;
  --glass: #FFFFFF; --glass-strong: #FFFFFF; --glass-line: #EADFDD; --ring: rgba(140,39,64,.18);
  --side-bg: #3E101C; --side-text: #EFDDE1; --side-muted: #B98F99; --side-line: rgba(255,255,255,.1); --side-act-bg: rgba(255,255,255,.09); --side-act: #FFFFFF; --side-bar: #C9A15A; --side-hover: rgba(255,255,255,.06);
  --pri: #7A1F35; --pri-hover: #5E1628;
}

/* --- tło: bez rombów i gradientów --- */
html[data-theme] body { background: var(--bg); font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
html[data-theme] body::before { background: var(--bg); }
html[data-theme] body::after { display: none; }
html[data-theme] #intro.play { background: var(--bg); }
html[data-theme=night] .i-logo img { filter: brightness(0) invert(1); }

/* --- bez szkła: pełne, białe powierzchnie --- */
html[data-theme] .glass, html[data-theme] .glass-strong { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; border-color: var(--line); }
html[data-theme] .menu { background: var(--surface); backdrop-filter: none; box-shadow: 0 8px 24px rgba(0,0,0,.12); }

/* --- kanciaste kafelki: zaokrąglenia maks. 4 px (okrągłe zostają tylko awatary, kropki, znaczniki na mapie) --- */
html[data-theme] :is(div, button, input, select, textarea, label, form, section, aside, header, main, nav, a, span, img, video, canvas, iframe, ul, li, details, summary):not(:is(.av, .av *, .dot, .badge, .live-dot, .mpin, .pin-num, .pin-start, .rt-n, .lg-i, .lg-dot, .rec-dot, .dot-on, .sw, .num, .cat-pill, .att-chip, .mp-chip, .st-card, .leaflet-container *, .bd, .tswatch i, .leaflet-container)) { border-radius: 4px; }
html[data-theme] .ibtn .bd, html[data-theme] .nav a .cnt { border-radius: 3px; }

/* --- menu boczne --- */
html[data-theme] .side { background: var(--side-bg); border-right: 1px solid var(--side-line) !important; color: var(--side-text); }
html[data-theme] .brand { border-bottom-color: var(--side-line); padding: 14px 18px; min-height: 56px; }
html[data-theme] .brand .tag { color: var(--side-muted); border-left-color: var(--side-line); font-weight: 600; }
html[data-theme=night] .brand img, html[data-theme=purple] .brand img, html[data-theme=burgund] .brand img, html[data-theme=night] .auth-logo { filter: brightness(0) invert(1); }
html[data-theme] .navg { color: var(--side-muted); font-weight: 600; letter-spacing: .12em; padding-top: 16px; }
html[data-theme] .nav a { color: var(--side-text); opacity: 1; padding: 8px 10px; }
html[data-theme] .nav a:hover { background: var(--side-hover); }
html[data-theme] .nav a.act { background: var(--side-act-bg); color: var(--side-act); }
html[data-theme] .nav a.act::before { background: var(--side-bar); border-radius: 0; }
html[data-theme] .nav a .cnt { background: color-mix(in srgb, var(--side-muted) 18%, transparent); color: var(--side-text); font-weight: 600; }
html[data-theme] .nav a .cnt.red { background: #FBEAE8; color: #C0392B; }
html[data-theme] .nav-add { color: var(--side-muted); }
html[data-theme] .side-bottom { border-top-color: var(--side-line); }
html[data-theme] .me b { color: var(--side-text); } html[data-theme] .me small, html[data-theme] .me .dots { color: var(--side-muted); }
html[data-theme] .me:hover { background: var(--side-hover); }
html[data-theme] .menu, html[data-theme] .menu button { color: var(--text); }
/* ikony: konturowe SVG zamiast emoji */
.nav a .ics, .ibtn .ics { display: none; }
html[data-theme] .nav a .ic { display: none; }
html[data-theme] .nav a .ics { display: block; width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
html[data-theme] .ibtn .ic-emo { display: none; }
html[data-theme] .ibtn .ics { display: block; width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* --- górny pasek --- */
html[data-theme] .top { background: var(--surface); border-bottom: 1px solid var(--line) !important; }
html[data-theme] .top h1 { color: var(--text); font-weight: 700; }
html[data-theme] .search { background: var(--bg); border-color: var(--line); }
html[data-theme] .ibtn { background: var(--surface); border-color: var(--line); color: var(--muted); }
html[data-theme] .ibtn.chatbtn { color: var(--navy); }
html[data-theme] .ibtn .bd { background: #C0392B; border-color: var(--surface); }

/* --- przyciski, pola --- */
/* :where – niska waga, żeby kolorowe przyciski (Usuń, OK, Start…) zachowały swój kolor */
html[data-theme] :where(.btn) { background: var(--surface); border-color: var(--line2); }
html[data-theme] :where(.btn):hover { border-color: var(--blue); }
html[data-theme] .btn.pri { background: var(--pri); border-color: transparent; color: var(--pri-text); }
html[data-theme] .btn.pri:hover { background: var(--pri-hover); }
html[data-theme] .btn.ghost { background: transparent; border-color: transparent; }
html[data-theme] input:focus, html[data-theme] textarea:focus, html[data-theme] select:focus { box-shadow: 0 0 0 3px var(--ring); }
html[data-theme] input[type=text], html[data-theme] input:not([type]), html[data-theme] input[type=email], html[data-theme] input[type=tel], html[data-theme] input[type=password], html[data-theme] input[type=search], html[data-theme] input[type=number], html[data-theme] input[type=date], html[data-theme] input[type=time], html[data-theme] input[type=datetime-local], html[data-theme] input[type=month], html[data-theme] select, html[data-theme] textarea { background: var(--surface); }

/* --- tabele i kafelki --- */
html[data-theme] .t th { background: var(--surface-2); }
html[data-theme] .t tr.r:hover td { background: var(--soft2); }
html[data-theme] .t tr.r.open td { background: var(--soft); }
html[data-theme] .t tr.exp > td { background: var(--surface-2); }
html[data-theme] .tbl-topscroll { background: var(--surface); backdrop-filter: none; }
html[data-theme] .tkpis .kpi, html[data-theme] .kpi { border-top: 3px solid var(--navy); }
html[data-theme] .chip-sel.on { background: var(--soft2); border-color: var(--blue); color: var(--navy); }
html[data-theme] .cat-t { background: var(--surface); }
html[data-theme] .cat-t.on { background: var(--pri); border-color: transparent; color: var(--pri-text); }
html[data-theme] .cat-t.on small { color: inherit; opacity: .75; }
html[data-theme] .fchip.on, html[data-theme] .pill.on { background: var(--pri); border-color: transparent; color: var(--pri-text); }
html[data-theme] .modal { background: var(--surface); box-shadow: 0 20px 50px rgba(0,0,0,.22); }
html[data-theme] .auth-card { border-top-color: var(--navy) !important; }
html[data-theme] a { color: var(--blue2); }

/* --- okno wyboru motywu --- */
.tpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tpick label { display: flex; flex-direction: column; gap: 6px; cursor: pointer; padding: 8px; border: 2px solid var(--line); border-radius: 8px; background: var(--surface); }
.tpick label:has(input:checked) { border-color: var(--navy); box-shadow: 0 0 0 3px var(--ring, rgba(0,152,95,.2)); }
.tpick input { position: absolute; opacity: 0; pointer-events: none; }
.tpick b { font-size: 12.5px; } .tpick small { color: var(--muted); font-size: 11px; line-height: 1.3; }
.tswatch { display: grid; grid-template-columns: 26% 1fr; height: 64px; border: 1px solid rgba(0,0,0,.08); overflow: hidden; border-radius: 4px; }
.tswatch .s { display: flex; flex-direction: column; gap: 4px; padding: 6px 5px; }
.tswatch .s i { display: block; height: 4px; border-radius: 2px; opacity: .55; background: currentColor; }
.tswatch .s i:first-child { opacity: 1; }
.tswatch .b { padding: 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; align-content: start; }
.tswatch .b i { height: 18px; border-radius: 2px; border-top: 3px solid; }
.tswatch .b em { grid-column: 1 / -1; height: 9px; border-radius: 2px; width: 50%; }

/* elementy wypełnione kolorem akcentu – czytelny tekst w każdym motywie (w nocnym akcent jest jasny) */
html[data-theme] :is(.pill.navy, .seg .on, .seg label:has(input:checked), .cal-day.today .num, .chip.meet, .msg.me .bub, .useg button.on, .cal-wk.now) { background: var(--pri); color: var(--pri-text); }
html[data-theme=purple] .msg.me .bub, html[data-theme=purple] .cal-day.today .num { background: #7B3FB8; }
html[data-theme] .seg .on { background: var(--pri); color: var(--pri-text); }
html[data-theme=night] .cal-who.other { background: #2D2413; border-color: #6B5320; color: #F0D9A0; }

/* --- przezroczyste okna (~18%): kafelki i panele przepuszczają delikatne tło motywu; menu boczne i górny pasek pełne --- */
html[data-theme] body::before { background:
  radial-gradient(900px 560px at 88% 6%, color-mix(in srgb, var(--blue) 30%, transparent), transparent 62%),
  radial-gradient(760px 520px at 22% 104%, color-mix(in srgb, var(--navy) 24%, transparent), transparent 66%),
  radial-gradient(560px 420px at 60% 50%, color-mix(in srgb, var(--blue) 14%, transparent), transparent 70%),
  var(--bg); }
html[data-theme] body::after { display: block; opacity: .16; background: url(/brand/romby-2.svg) right -120px top 110px / 640px auto no-repeat, url(/brand/romby-1.svg) left 300px bottom 0 / 900px auto no-repeat; }
html[data-theme=night] body::after { opacity: .10; }
html[data-theme] .glass, html[data-theme] .glass-strong { background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); border-color: color-mix(in srgb, var(--line) 80%, transparent); }
html[data-theme] .t th { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
html[data-theme] .side.glass { background: var(--side-bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
html[data-theme] .top.glass { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
html[data-theme] .menu, html[data-theme] .modal, html[data-theme] .dd { background: var(--surface) !important; backdrop-filter: none; }

/* ikony konturowe zamiast emoji (wstawiane przez iconize() w base.js tylko w nowych motywach) */
.ei-x { display: none; }
html[data-theme] svg.ei { display: inline-block; width: 15px; height: 15px; flex: none; vertical-align: -2px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--blue2); }
html[data-theme] :is(h2, h3, h4, .sec-h) > svg.ei { width: 17px; height: 17px; vertical-align: -3px; color: var(--navy); }
html[data-theme] :is(.btn.pri, .btn.danger-solid, .btn.ok, .btn.go, .btn.orange, .seg .on, .cat-t.on, .fchip.on, .pill, .btn.danger) svg.ei { color: inherit; }
html[data-theme] .btn.danger svg.ei { color: var(--red); }
