/* Hifz — Mac layout */
:root {
  /* Rating scale: blue (strong) ↔ red (weak). Always paired with a text label. */
  --r4: #256abf;
  --r3: #86b6ef;
  --r2: #f0a07a;
  --r1: #d03b3b;
  --r-none: #e6e5e0;
  --hm0: #ebeae5;
  --hm1: #b7d3f6;
  --hm2: #6da7ec;
  --hm3: #2a78d6;
  --hm4: #184f95;
  --t-mem: #1f6f5c;
  --t-rev: #6250d6;
  --up: #006300;
  --down: #c23434;
  --sidebar: #efeee9;
}
@media (prefers-color-scheme: dark) {
  :root {
    --r4: #5598e7;
    --r3: #2c5d97;
    --r2: #b8613c;
    --r1: #e66767;
    --r-none: #2c2c2a;
    --hm0: #242423;
    --hm1: #184f95;
    --hm2: #256abf;
    --hm3: #3987e5;
    --hm4: #86b6ef;
    --t-mem: #3fae8f;
    --t-rev: #9085e9;
    --up: #0ca30c;
    --down: #e66767;
    --sidebar: #161615;
  }
}

body { overflow: hidden; }
.app { display: grid; grid-template-columns: 220px 1fr; height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar {
  background: var(--sidebar);
  border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 18px 12px 14px;
  gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font: 600 22px var(--font-ar);
}
.brand-name { font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.brand-sub.ar { text-align: left; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav .ico { width: 16px; text-align: center; opacity: 0.8; }
.nav-badge:not(:empty) {
  margin-inline-start: auto; min-width: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; text-align: center; line-height: 18px;
}
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 6px; }
.last-export { font-size: 12px; color: var(--text-2); }
.keys { font-size: 11px; }

/* ---------- main ---------- */
main { overflow-y: auto; padding: 24px 32px 48px; outline: none; }
main > * { max-width: 1240px; }
h1 { font-size: 26px; margin: 0 0 2px; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0; }
h3 { font-size: 13px; margin: 0; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); }
p { margin: 0 0 8px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.empty { color: var(--muted); padding: 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius); text-align: center; font-size: 13px; }
.empty.big { padding: 32px; margin: 12px 0; }
.empty a { color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.panel > header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.panel > header .muted { font-size: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid2 > .panel, .grid3 > .panel { margin-bottom: 0; }
.grid2, .grid3 { margin-bottom: 16px; }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: var(--shadow); }
.seg.small button { padding: 3px 10px; font-size: 13px; }

/* rating swatches */
.r4 { --rc: var(--r4); } .r3 { --rc: var(--r3); } .r2 { --rc: var(--r2); } .r1 { --rc: var(--r1); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px 1px 7px; border-radius: 20px; background: var(--surface-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill i, .rb i, .chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--rc); flex: none; }
.rate, .rate-filter { display: flex; gap: 4px; flex-wrap: wrap; }
.rb { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; font-size: 13px; border-radius: 20px; }
.rb[aria-pressed="true"] { background: color-mix(in srgb, var(--rc, var(--text-2)) 22%, var(--surface)); border-color: var(--rc, var(--text-2)); font-weight: 600; }

.badge { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 5px; white-space: nowrap; background: var(--surface-2); color: var(--text-2); }
.badge.st-today { background: var(--accent-soft); color: var(--accent); }
.badge.st-missed { color: var(--down); }
.badge.st-done { color: var(--up); }
.type { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; width: 74px; flex: none; }
.type.t-memorize { color: var(--t-mem); }
.type.t-review { color: var(--t-rev); }
.range { font-weight: 600; }
.range-ar { color: var(--text-2); font-size: 15px; }

/* ---------- Day ---------- */
.day-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.day-wd { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.day-date { font-size: 15px; color: var(--text-2); margin-top: 2px; }
.day-rel { font-size: 12px; font-weight: 600; color: var(--accent); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.day-nav { display: flex; gap: 6px; align-items: center; }
.day-nav button[aria-label] { font-size: 18px; line-height: 1; padding: 5px 12px; }

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 20px; }
.ws-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px; background: var(--surface); border-color: var(--border); }
.ws-day.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ws-day.is-today .ws-n { color: var(--accent); }
.ws-wd { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.ws-n { font-size: 17px; font-weight: 600; }
.ws-dots { display: flex; gap: 3px; min-height: 8px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rc, var(--border-strong)); }
.dot.st-today, .dot.st-planned { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.dot.st-missed { background: transparent; box-shadow: inset 0 0 0 1.5px var(--down); }

.day-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.day-col > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.day-col { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.session.st-missed { border-style: dashed; }
.session.st-today { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.sc-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.sc-range { font-size: 16px; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.sc-meta { font-size: 12px; color: var(--muted); margin: 2px 0 10px; }
.sc-note { margin: 10px 0 0; font-size: 13px; color: var(--text-2); white-space: pre-wrap; }
.sc-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
.sc-actions button { font-size: 12px; padding: 3px 8px; color: var(--muted); }

/* ---------- Plan ---------- */
.plan-summary { display: flex; gap: 22px; flex-wrap: wrap; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; font-size: 13px; }
.plan-table { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.pt-row { display: grid; grid-template-columns: 150px 1fr 1fr; border-top: 1px solid var(--border); min-height: 42px; }
.pt-row.week-start { border-top: 2px solid var(--border-strong); }
.pt-head { border-top: 0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); min-height: 0; }
.pt-head > div { padding: 8px 12px; }
.pt-row.is-today { background: var(--accent-soft); }
.pt-row.fri .pt-day b { color: var(--accent); }
.pt-day { border: 0; border-radius: 0; background: transparent; text-align: start; display: flex; flex-direction: column; justify-content: center; padding: 4px 12px; line-height: 1.2; }
.pt-day span { font-size: 12px; color: var(--muted); }
.pt-cell { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; padding: 6px 10px; border-inline-start: 1px solid var(--border); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; font-size: 12.5px; border-radius: 7px; background: var(--surface-2); border: 1px solid transparent; }
.chip.t-memorize { border-inline-start: 3px solid var(--t-mem); }
.chip.t-review { border-inline-start: 3px solid var(--t-rev); }
.chip-n { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; }
.add-chip { padding: 0 8px; font-size: 15px; line-height: 22px; border-style: dashed; color: var(--muted); background: transparent; opacity: 0; }
.pt-row:hover .add-chip, .add-chip:focus-visible, .pt-cell:not(:has(.chip)) .add-chip { opacity: 1; }
.pt-cell:not(:has(.chip)) .add-chip { opacity: 0.35; }
.pt-row:hover .pt-cell .add-chip { opacity: 1; }

/* ---------- dialogs ---------- */
dialog {
  border: 1px solid var(--border); border-radius: 14px; padding: 0;
  background: var(--surface); color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: min(620px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.editor { padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.editor.wide { width: 100%; }
dialog:has(.editor.wide) { width: min(980px, calc(100vw - 32px)); }
.editor h2 { font-size: 18px; }
.editor footer { display: flex; gap: 8px; margin-top: 6px; }
.spacer { flex: 1; }
.field { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: start; }
.field > span:first-child { padding-top: 6px; color: var(--text-2); font-size: 13px; }
.date-wrap { display: flex; align-items: center; gap: 10px; }
.date-wrap .wd { font-weight: 600; }
textarea { resize: vertical; width: 100%; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.danger-fill { background: var(--danger) !important; }

.rp { display: flex; flex-direction: column; gap: 6px; }
.rp-row, .pos { display: flex; align-items: center; gap: 6px; }
.rp-row select, .pos select { flex: 1; min-width: 0; }
.rp-row input, .pos input { width: 70px; }
.lbl { width: 38px; font-size: 12px; color: var(--muted); }
.lbl-sm { font-size: 12px; color: var(--muted); }
.rp-quick { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rp-quick button, .rp-quick select { font-size: 12px; padding: 3px 8px; }
.rp-sum { font-size: 12px; color: var(--text-2); margin-inline-start: 4px; }
.rp-sum.err { color: var(--danger); }

.ap-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; }
.ap-grid > div:first-child { display: flex; flex-direction: column; gap: 12px; }
.ap-grid [data-for] { display: flex; flex-direction: column; gap: 12px; }
.ap-grid [data-for][hidden] { display: none; }
.ap-grid input[type="number"] { width: 70px; }
.wd-boxes { display: flex; gap: 4px; flex-wrap: wrap; }
.wd-box { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 3px 7px; border: 1px solid var(--border-strong); border-radius: 6px; }
.ap-preview { background: var(--surface-2); border-radius: 10px; padding: 12px; max-height: 470px; overflow: auto; }
.ap-preview h3 { margin-bottom: 8px; }
.ap-preview ol { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.ap-preview li { display: grid; grid-template-columns: 96px 1fr 34px; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.ap-preview li .num { text-align: end; }

/* ---------- History ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; position: sticky; top: -24px; z-index: 2; background: var(--bg); padding: 8px 0 12px; }
.filters input[type="search"] { flex: 1 1 340px; padding: 8px 12px; font-size: 14px; }
.filters .rb { font-size: 12px; padding: 3px 9px; }
.hist-layout { display: grid; grid-template-columns: 1fr 170px; gap: 20px; align-items: start; }
.hist-sum { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.month-h { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 18px 0 8px; scroll-margin-top: 70px; }
.hist-day { display: grid; grid-template-columns: 130px 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; overflow: hidden; }
.hist-day.is-today { border-color: var(--accent); }
.hd-date { grid-row: span 50; border: 0; border-inline-end: 1px solid var(--border); border-radius: 0; background: transparent; text-align: start; display: flex; flex-direction: column; justify-content: flex-start; padding: 9px 12px; line-height: 1.3; }
.hd-date span { font-size: 12px; color: var(--text-2); }
.hd-date .muted { color: var(--muted); font-size: 11px; }
.hist-row { grid-column: 2; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 0; background: transparent; text-align: start; padding: 8px 12px; border-bottom: 1px solid var(--border); min-width: 0; }
.hist-row:last-child { border-bottom: 0; }
.hr-range { flex: 0 1 auto; display: flex; gap: 8px; align-items: baseline; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hr-n { width: 34px; text-align: end; font-size: 12px; flex: none; }
.hr-rating { flex: none; }
.hr-note { flex: 1; min-width: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.more { width: 100%; margin-top: 8px; }
.month-index { position: sticky; top: 64px; display: flex; flex-direction: column; gap: 1px; max-height: calc(100vh - 120px); overflow: auto; }
.month-index button { display: flex; justify-content: space-between; border: 0; background: transparent; font-size: 12.5px; padding: 4px 8px; text-align: start; }
.month-index button:hover { background: var(--surface-2); }

/* ---------- Insights ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.kpi-l { font-size: 12px; color: var(--text-2); font-weight: 500; }
.kpi-v { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; margin: 2px 0; }
.kpi-v small { font-size: 13px; font-weight: 600; color: var(--text-2); }
.kpi-s { font-size: 12px; color: var(--muted); }
.up { color: var(--up); font-weight: 600; }
.down { color: var(--down); font-weight: 600; }
.meter { height: 6px; background: var(--surface-2); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 4px; min-width: 2px; }

.legend { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 12px; color: var(--text-2); }
.panel > header .legend { margin-inline-start: auto; }
.legend > span { display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 10px; height: 10px; border-radius: 3px; background: var(--rc); display: inline-block; }
.sw.none { background: var(--r-none); }

.tiles { display: grid; gap: 4px; }
.tiles.surah { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
.tiles.juz { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 6px 7px 9px; border-radius: 7px; text-align: start; background: var(--surface-2); border: 1px solid transparent; overflow: hidden; min-height: 54px; }
.tile.has { background: color-mix(in srgb, var(--rc) 16%, var(--surface)); border-color: color-mix(in srgb, var(--rc) 40%, transparent); }
.tile:hover { border-color: var(--text-2); }
.tile-n { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tile-name { font-size: 11.5px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tile-ar { position: absolute; top: 4px; inset-inline-end: 6px; font-size: 12px; color: var(--text-2); }
.tiles.surah .tile-ar { display: none; }
.tile-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: transparent; }
.tile-bar span { display: block; height: 100%; background: var(--rc, transparent); border-start-end-radius: 2px; border-end-end-radius: 2px; }

.spots { list-style: none; margin: 0; padding: 0; }
.spots li button { width: 100%; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "p r" "p w"; column-gap: 10px; align-items: center; border: 0; background: transparent; text-align: start; padding: 6px 4px; border-radius: 6px; }
.spots li button:hover { background: var(--surface-2); }
.spots .pill { grid-area: p; }
.sp-range { grid-area: r; font-weight: 600; font-size: 13px; }
.sp-range .ar { font-weight: 400; color: var(--text-2); margin-inline-start: 4px; }
.sp-when { grid-area: w; font-size: 11.5px; }
.more-note { font-size: 12px; padding: 4px; }

.heatmap { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; }
.hm-wd { display: grid; grid-template-rows: 14px repeat(7, 13px); row-gap: 3px; font-size: 10px; color: var(--muted); }
.hm-wd span:first-child { grid-row: 2; }
.hm-months { display: grid; grid-template-columns: repeat(26, 13px); column-gap: 3px; height: 14px; font-size: 10px; color: var(--muted); white-space: nowrap; }
.hm-grid { display: grid; grid-template-rows: repeat(7, 13px); grid-auto-flow: column; grid-auto-columns: 13px; gap: 3px; }
.hm-cell { width: 13px; height: 13px; border-radius: 3px; background: var(--hm0); display: inline-block; }
.hm-cell[data-day] { cursor: pointer; }
.hm-cell.l1 { background: var(--hm1); } .hm-cell.l2 { background: var(--hm2); } .hm-cell.l3 { background: var(--hm3); } .hm-cell.l4 { background: var(--hm4); }
.hm-cell.future { background: transparent; }
.legend .hm-cell { width: 11px; height: 11px; }

.dist-row { display: grid; grid-template-columns: 100px 1fr 40px; gap: 10px; align-items: center; margin-bottom: 12px; font-size: 13px; }
.dist-row .num { text-align: end; }
.dist-bar { display: flex; gap: 2px; height: 22px; }
.dist-bar span { background: var(--rc); min-width: 3px; }
.dist-bar span:first-child { border-start-start-radius: 4px; border-end-start-radius: 4px; }
.dist-bar span:last-child { border-start-end-radius: 4px; border-end-end-radius: 4px; }
.dist-bar .none { flex: 1; background: var(--surface-2); border-radius: 4px; }

.wdbars { display: flex; flex-direction: column; gap: 6px; }
.wdbar { display: grid; grid-template-columns: 34px 1fr 30px 70px; gap: 8px; align-items: center; font-size: 12.5px; }
.wd-track { height: 12px; background: var(--surface-2); border-start-end-radius: 4px; border-end-end-radius: 4px; }
.wd-track span { display: block; height: 100%; background: var(--hm3); border-start-end-radius: 4px; border-end-end-radius: 4px; }
.wd-v { text-align: end; }
.wd-r { font-size: 11.5px; }

.mbars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; height: 130px; }
.mbar { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.mbar-col { flex: 1; width: 100%; display: flex; align-items: flex-end; border-bottom: 1px solid var(--border-strong); }
.mbar-col span { display: block; width: 100%; background: var(--hm3); border-radius: 4px 4px 0 0; }
.mbar-l { font-size: 10px; color: var(--muted); }
.mbars-foot { display: flex; justify-content: space-between; font-size: 11px; margin-top: 4px; }

/* ---------- Backup ---------- */
code { font: 12.5px ui-monospace, "SF Mono", Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.file-btn { display: inline-block; cursor: pointer; border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 12px; background: var(--surface); }
.file-btn:hover { background: var(--surface-2); }
.file-btn input { display: none; }
.result { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); font-size: 13px; }
.result.err { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.result ul { margin: 6px 0 0; padding-inline-start: 18px; }
.storage-status { margin-top: 12px; font-size: 12.5px; color: var(--text-2); }
.storage-status.ok { color: var(--up); }
.steps { margin: 0; padding-inline-start: 20px; line-height: 1.8; }

/* ---------- language ---------- */
.lang-switch { align-self: flex-start; }
.lang-switch button { font-size: 12px; }
html[lang="ar"] body { font-family: "SF Arabic", -apple-system, BlinkMacSystemFont, system-ui, "Geeza Pro", sans-serif; font-size: 15px; }
/* Arabic letters must stay joined: no tracking or case transforms. */
html[lang="ar"] * { letter-spacing: 0 !important; text-transform: none !important; }
/* In Arabic the surah name is already the main label, so drop the duplicate. */
html[lang="ar"] .range-ar, html[lang="ar"] .tile-ar, html[lang="ar"] .sp-range .ar { display: none; }
html[lang="ar"] .type { width: 60px; }
html[lang="ar"] .hm-months { font-size: 9px; }
code[dir="ltr"] { unicode-bidi: isolate; }

/* ---------- overlays ---------- */
#tip { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; max-width: 320px; padding: 6px 9px; border-radius: 7px; font-size: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); opacity: 0; transition: 0.2s; z-index: 60; background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-size: 13px; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* narrower windows */
@media (max-width: 1240px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 64px 1fr; }
  .brand > div:last-child, .side-foot, .nav a { font-size: 0; }
  .nav a .ico { font-size: 16px; width: 100%; }
  .nav-badge { display: none; }
  main { padding: 16px; }
  .day-cols, .grid2, .grid3, .ap-grid { grid-template-columns: 1fr; }
  .hist-layout { grid-template-columns: 1fr; }
  .month-index { display: none; }
}
