/* ============ Tokens ============ */
:root {
  --bg: #f1f2f6;
  --surface: #ffffff;
  --surface-2: #f5f6fa;
  --text: #0a0b12;
  --muted: #6a6e80;
  --line: rgba(10, 12, 30, .08);
  --accent: #5a48f5;
  --accent-soft: rgba(90, 72, 245, .1);
  --good: #12a568;
  --shadow: 0 1px 2px rgba(10, 12, 30, .04), 0 10px 30px rgba(10, 12, 30, .06);
  --radius: 22px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08080d;
    --surface: #13131b;
    --surface-2: #1b1b25;
    --text: #f4f5fa;
    --muted: #9799ab;
    --line: rgba(255, 255, 255, .07);
    --accent: #8b7dff;
    --accent-soft: rgba(139, 125, 255, .16);
    --good: #2fd38c;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #08080d;
  --surface: #13131b;
  --surface-2: #1b1b25;
  --text: #f4f5fa;
  --muted: #9799ab;
  --line: rgba(255, 255, 255, .07);
  --accent: #8b7dff;
  --accent-soft: rgba(139, 125, 255, .16);
  --good: #2fd38c;
  --shadow: none;
  color-scheme: dark;
}

/* ============ Base ============ */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app {
  max-width: 600px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom));
}

/* ============ Top bar ============ */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 6px 2px 16px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 14px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #7b61ff, #2f80ff);
  box-shadow: 0 6px 18px rgba(91, 75, 255, .35);
}
.brand-logo svg { fill: #fff; stroke: none; width: 22px; height: 22px; }
.brand > div:last-child { min-width: 0; }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.view-btn {
  height: 42px; padding: 0 14px 0 12px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  font-size: 13.5px; font-weight: 800; white-space: nowrap;
  transition: transform .15s ease, background .2s, color .2s;
}
.view-btn svg { width: 18px; height: 18px; color: var(--accent); }
.view-btn:active { transform: scale(.95); }
.view-btn[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: transparent; }
.view-btn[aria-pressed="true"] svg { color: #fff; }
@media (max-width: 360px) { .brand-sub { display: none; } }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line);
  transition: transform .15s ease;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 20px; height: 20px; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* ============ Hero ============ */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: 28px; color: #fff;
  background: #1a1240;
  min-height: 0;
  box-shadow: 0 18px 40px -18px rgba(60, 40, 200, .55);
}
.hero-bg { position: absolute; inset: 0; z-index: -1; background: linear-gradient(140deg, #3b1fd6 0%, #6a3cff 45%, #2a7bff 100%); }
.hero-bg i { position: absolute; border-radius: 50%; filter: blur(42px); opacity: .75; animation: float 14s ease-in-out infinite alternate; }
.hero-bg i:nth-child(1) { width: 240px; height: 240px; background: #ff5fa2; top: -90px; right: -60px; }
.hero-bg i:nth-child(2) { width: 220px; height: 220px; background: #00d4ff; bottom: -110px; left: -50px; animation-delay: -5s; }
.hero-bg i:nth-child(3) { width: 160px; height: 160px; background: #8f5bff; top: 40%; left: 45%; animation-delay: -9s; opacity: .55; }
.hero.is-past .hero-bg { filter: saturate(.25) brightness(.8); }
.hero.is-live .hero-bg { background: linear-gradient(140deg, #087a52 0%, #11b375 50%, #1aa0c8 100%); }
@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-30px, 24px) scale(1.15); }
}
.hero-inner { position: relative; padding: 20px 20px 24px; }
.hero-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .16); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 12.5px; font-weight: 700; letter-spacing: .01em;
}
.pill-btn { color: #fff; transition: background .2s; }
.pill-btn:hover { background: rgba(255, 255, 255, .26); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; }
.hero.is-live .dot { background: #b5ffd9; box-shadow: 0 0 0 0 rgba(181, 255, 217, .8); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(181, 255, 217, 0); } 100% { box-shadow: 0 0 0 0 rgba(181, 255, 217, 0); } }
.hero-date { font-size: clamp(34px, 10vw, 46px); font-weight: 800; letter-spacing: -.035em; line-height: 1.05; margin-top: 18px; }
.hero-sub { opacity: .85; font-weight: 600; margin-top: 6px; font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tags:empty { display: none; }
/* ============ Casete departamente (sus și în fiecare duminică) ============ */
.boxes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 480px) { .boxes { grid-template-columns: repeat(3, 1fr); } }
.hero .boxes { margin-top: 18px; }
.rb {
  border-radius: 16px; padding: 12px; background: var(--surface-2);
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
  transition: background .2s, box-shadow .2s;
}
.rb-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rb-ic { width: 30px; height: 30px; border-radius: 10px; flex: none; display: grid; place-items: center; }
.rb-ic svg { width: 17px; height: 17px; }
.rb-label { font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-name { display: block; font-size: 16px; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; word-break: break-word; }
.rb.empty .rb-name { color: var(--muted); font-weight: 600; }
.rb.me { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.c1 { background: rgba(123, 97, 255, .15); color: #6b4dff; }
.c2 { background: rgba(255, 95, 162, .15); color: #e3407f; }
.c3 { background: rgba(47, 128, 255, .15); color: #2f72ee; }
.c4 { background: rgba(255, 159, 28, .17); color: #d9780a; }
.c5 { background: rgba(18, 165, 104, .15); color: #0f9a60; }
.c6 { background: rgba(0, 190, 220, .16); color: #0099b5; }
/* varianta „de sticlă” din cardul colorat */
:is(.hero, .day) .rb { background: rgba(255, 255, 255, .13); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
:is(.hero, .day) .rb-ic { background: rgba(255, 255, 255, .2); color: #fff; }
:is(.hero, .day) .rb-label { color: rgba(255, 255, 255, .82); }
:is(.hero, .day) .rb.empty .rb-name { color: rgba(255, 255, 255, .5); }
:is(.hero, .day) .rb.me { background: rgba(255, 255, 255, .96); color: #2c1a9e; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
:is(.hero, .day) .rb.me .rb-ic { background: rgba(90, 72, 245, .14); color: #5a48f5; }
:is(.hero, .day) .rb.me .rb-label { color: #5d6080; }
.tag { padding: 5px 11px; border-radius: 999px; background: rgba(255, 255, 255, .95); color: #2c1a9e; font-size: 12.5px; font-weight: 800; }

/* ============ Actions ============ */
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; margin: 18px 0 6px; }
.action { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--text); }
.action[hidden] { display: none; }
.action-ic {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  color: var(--accent); transition: transform .15s ease, background .2s;
}
.action:hover .action-ic { background: var(--accent-soft); }
.action:active .action-ic { transform: scale(.9); }
.action.on .action-ic { background: var(--accent); color: #fff; border-color: transparent; }

/* ============ Blocks ============ */
.block { margin-top: 22px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px 10px; }
.block-head h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.link-btn { color: var(--accent); font-weight: 700; font-size: 14px; }

/* ============ Search ============ */
.search {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 0 14px; height: 52px; box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search svg { color: var(--muted); flex: none; width: 20px; height: 20px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 16px; font-weight: 600; }
.search input::placeholder { color: var(--muted); font-weight: 500; }
.search input::-webkit-search-cancel-button { display: none; }
.clear { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 18px; line-height: 1; }
.me-summary {
  margin-top: 10px; padding: 14px 16px; border-radius: 18px;
  background: var(--accent-soft); color: var(--text); font-weight: 600; font-size: 14px;
}
.me-summary b { color: var(--accent); }

/* ============ List ============ */
.list { display: flex; flex-direction: column; gap: 12px; }
.month { padding: 8px 4px 0; font-size: 12.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.day {
  position: relative; overflow: hidden; cursor: pointer;
  border-radius: 28px; color: #fff; padding: 20px 20px 24px;
  /* același look ca cardul de sus, dar static (mai ușor pentru telefon) */
  background:
    radial-gradient(circle at 92% -5%, rgba(255, 95, 162, .85), transparent 42%),
    radial-gradient(circle at -5% 105%, rgba(0, 212, 255, .75), transparent 45%),
    radial-gradient(circle at 55% 55%, rgba(143, 91, 255, .45), transparent 40%),
    linear-gradient(140deg, #3b1fd6 0%, #6a3cff 45%, #2a7bff 100%);
  box-shadow: 0 18px 40px -22px rgba(60, 40, 200, .55);
  transition: transform .15s ease, box-shadow .2s;
  animation: rise .4s ease both;
}
.day:hover { box-shadow: 0 22px 44px -18px rgba(60, 40, 200, .7); }
.day:active { transform: scale(.99); }
.day:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.day.past { filter: saturate(.25) brightness(.85); }
.day .rb { backdrop-filter: none; -webkit-backdrop-filter: none; }
.day-date { font-size: clamp(28px, 8vw, 36px); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; margin-top: 14px; }
.day-empty { margin-top: 16px; padding: 14px; border-radius: 16px; background: rgba(255, 255, 255, .13); font-weight: 700; opacity: .9; }
.day .boxes { margin-top: 16px; }
.empty-note { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 28px 16px; text-align: center; color: var(--muted); font-weight: 600; }
.err { padding: 18px; color: #d33; font-weight: 600; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fade-in { animation: rise .4s ease both; }

/* ============ Misc ============ */
.sk { display: inline-block; height: .9em; border-radius: 8px; background: currentColor; opacity: .14; animation: sk 1.2s ease-in-out infinite alternate; }
@keyframes sk { to { opacity: .28; } }
.foot { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 26px; font-weight: 500; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px;
  font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ============ Stil tabel ============ */
:root[data-view="table"] .hero,
:root[data-view="table"] .actions { display: none; }
:root[data-view="table"] .app { max-width: 1120px; }
:root[data-view="table"] .block:first-of-type { margin-top: 4px; }
.table-wrap {
  overflow: auto; max-height: 78vh;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}
.table-wrap table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 820px; font-size: 14px; }
.table-wrap th, .table-wrap td { padding: 11px 14px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table-wrap th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2);
  font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
}
.table-wrap td { font-weight: 600; background: var(--surface); }
.table-wrap .c-date { position: sticky; left: 0; z-index: 1; font-weight: 800; font-variant-numeric: tabular-nums; box-shadow: 1px 0 0 var(--line); }
.table-wrap th.c-date { z-index: 3; }
.table-wrap tr.t-month td { background: var(--bg); color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding-top: 14px; }
.table-wrap tr.has-obs td { background: linear-gradient(rgba(255, 159, 28, .1), rgba(255, 159, 28, .1)), var(--surface); }
.table-wrap tr.next td { background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--surface); }
.table-wrap tr.next .c-date { box-shadow: inset 4px 0 0 var(--accent), 1px 0 0 var(--line); }
.table-wrap tr.past td { color: var(--muted); }
.table-wrap tbody tr:not(.t-month):hover td { background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--surface-2); }
.table-wrap mark { background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 8px; }
.t-tag { display: inline-block; padding: 3px 9px; border-radius: 999px; background: rgba(255, 159, 28, .18); color: #c46a00; font-size: 12px; font-weight: 800; }
.t-next { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; vertical-align: 1px; }

