:root{
  --bg:#0b1020;
  --panel:#111a33;
  --card:#0f1730;
  --text:#eaf0ff;
  --muted:#a9b3d0;
  --line:rgba(255,255,255,.10);
  --accent:#6ea8ff;
  --accent2:#35d1b4;
  --danger:#ff4d6d;
  --shadow: 0 12px 40px rgba(0,0,0,.35);
  --radius: 18px;
  --radius-sm: 12px;
  --gap: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
}
[data-theme="light"]{
  --bg:#f4f6fb;
  --panel:#ffffff;
  --card:#ffffff;
  --text:#0e1220;
  --muted:#5c678a;
  --line:rgba(10,14,32,.10);
  --accent:#2e6bff;
  --accent2:#0aa37f;
  --danger:#d11a3a;
  --shadow: 0 10px 30px rgba(20,30,60,.10);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  background: radial-gradient(1200px 600px at 20% -10%, rgba(110,168,255,.20), transparent 60%),
              radial-gradient(900px 500px at 100% 0%, rgba(53,209,180,.14), transparent 55%),
              var(--bg);
  color:var(--text);
}
a{color:inherit; text-decoration:none}
.container{max-width:1200px; margin:0 auto; padding:24px}
.topbar{
  display:flex; align-items:center; gap:12px; justify-content:space-between;
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0));
  border:1px solid var(--line);
  padding:14px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position:sticky; top:12px; z-index:50;
  backdrop-filter: blur(10px);
}
.brand{display:flex; align-items:center; gap:10px}
.logo{
  width:38px; height:38px; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 12px 30px rgba(110,168,255,.25);
}
.brand h1{font-size:18px; margin:0; letter-spacing:.2px}
.brand .sub{font-size:12px; color:var(--muted)}
.actions{display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:flex-end}
.btn{
  border:1px solid var(--line);
  background: rgba(255,255,255,.06);
  color:var(--text);
  padding:10px 12px;
  border-radius: 14px;
  cursor:pointer;
  display:inline-flex; align-items:center; gap:8px;
  transition: transform .06s ease, background .2s ease, border-color .2s ease;
  user-select:none;
}
.btn:hover{background: rgba(255,255,255,.10)}
.btn:active{transform: scale(.98)}
.btn.primary{background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #061020}
[data-theme="light"] .btn.primary{color:#fff}
.btn.danger{background: rgba(255,77,109,.14); border-color: rgba(255,77,109,.35); color: var(--text)}
.pill{
  padding:6px 10px; border-radius:999px; border:1px solid var(--line);
  background: rgba(255,255,255,.05); color:var(--muted); font-size:12px;
}

.grid{
  margin-top:18px;
  display:grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--gap);
}
@media (max-width: 980px){
  .grid{grid-template-columns: 1fr}
  .container{padding:14px}
  .topbar{top:8px}
}

.panel{
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
[data-theme="light"] .panel{background: rgba(255,255,255,.88)}
.panel h2{margin:0 0 10px 0; font-size:14px; color:var(--muted); font-weight:600}

/* Calendar */
.cal-wrap{overflow:auto; border-radius: var(--radius); border:1px solid var(--line)}
.calendar{
  min-width: 980px;
  display:grid;
  grid-template-columns: 120px repeat(7, 1fr);
  background: rgba(0,0,0,.10);
}
[data-theme="light"] .calendar{background: rgba(10,14,32,.03)}
.cal-head{
  position:sticky; top:0; z-index:5;
  background: rgba(10,14,32,.65);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line);
}
[data-theme="light"] .cal-head{background: rgba(255,255,255,.92)}
.cell{
  border-right:1px solid var(--line);
  border-bottom:1px solid var(--line);
  padding:10px;
  font-size:12px;
  min-height: 42px;
  display:flex; align-items:flex-start; justify-content:flex-start;
  position:relative;
}
.cell.time{color:var(--muted); font-weight:600; background: rgba(255,255,255,.02)}
.cell.day{font-weight:700; font-size:12px}
.cell.slot{cursor:pointer}
.cell.slot:hover{background: rgba(110,168,255,.10)}
.slot .meta{color:var(--muted); font-size:11px}
.tag{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(110,168,255,.35);
  background: rgba(110,168,255,.13);
  margin: 2px 0;
  width: 100%;
  justify-content:space-between;
  box-shadow: 0 8px 18px rgba(110,168,255,.10);
}
.tag .who{font-weight:700}
.tag .what{font-size:11px; color:var(--muted)}
.tag.block{border-color: rgba(255,77,109,.35); background: rgba(255,77,109,.13); box-shadow: 0 8px 18px rgba(255,77,109,.10)}
.tag.me{border-color: rgba(53,209,180,.45); background: rgba(53,209,180,.14)}
.tag .right{display:flex; gap:8px; align-items:center}
.icon{
  width:26px; height:26px; border-radius: 10px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.06);
  display:grid; place-items:center;
  cursor:pointer;
}

/* Forms */
label{display:block; font-size:12px; color:var(--muted); margin:10px 0 6px}
input, select, textarea{
  width:100%;
  background: rgba(255,255,255,.06);
  border:1px solid var(--line);
  color:var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  outline:none;
}
[data-theme="light"] input,[data-theme="light"] select,[data-theme="light"] textarea{
  background: rgba(10,14,32,.04);
}
textarea{min-height: 90px; resize: vertical}
.row{display:grid; grid-template-columns: 1fr 1fr; gap:10px}
@media (max-width: 520px){ .row{grid-template-columns: 1fr} }

.hint{font-size:12px; color:var(--muted); margin-top:8px}
.error{background: rgba(255,77,109,.14); border:1px solid rgba(255,77,109,.35); padding:10px 12px; border-radius: 14px; margin: 10px 0}
.ok{background: rgba(53,209,180,.14); border:1px solid rgba(53,209,180,.35); padding:10px 12px; border-radius: 14px; margin: 10px 0}

/* Modal */
.modal-backdrop{
  position:fixed; inset:0; background: rgba(0,0,0,.55);
  display:none; align-items:center; justify-content:center;
  padding:16px; z-index:100;
}
.modal{
  width: min(520px, 100%);
  border:1px solid var(--line);
  background: rgba(10,14,32,.82);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
[data-theme="light"] .modal{background: rgba(255,255,255,.96)}
.modal h3{margin:0 0 10px 0}
.modal .foot{display:flex; justify-content:flex-end; gap:10px; margin-top:12px; flex-wrap:wrap}

/* Lists */
.list{display:flex; flex-direction:column; gap:10px}
.item{
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  border-radius: var(--radius-sm);
  padding: 12px;
  display:flex; justify-content:space-between; gap:12px; align-items:flex-start;
}
.item .t{font-weight:800}
.item .s{color:var(--muted); font-size:12px; margin-top:4px}

/* === BURGER_MENU_V1 === */
.burger{
  display:none;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
  border-radius:14px;
  padding:12px 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.burger span{
  display:block;
  width:22px;
  height:2px;
  background:rgba(255,255,255,.85);
  margin:5px 0;
  border-radius:2px;
}
.menu-backdrop{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.45);
  z-index:60;
}

@media (max-width: 900px){
  .burger{ display:block; }
  .top-actions{
    position: fixed;
    top: 74px;
    left: 12px;
    right: 12px;
    z-index: 70;
    display:flex;
    flex-direction: column;
    gap:10px;
    padding: 12px;
    border-radius: 18px;
    background: rgba(14,18,30,.82);
    border: 1px solid rgba(255,255,255,.10);
    backdrop-filter: blur(12px);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
  }
  body.menu-open .top-actions{
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  /* keep topbar compact */
  .topbar{
    display:flex;
    align-items:center;
    justify-content: space-between;
    gap: 10px;
  }
  .brand{ max-width: 72%; }
  .pill{ align-self: flex-start; }
}

/* === MODAL_MOBILE_V1 === */
.modal-backdrop{
  align-items: flex-start;
  justify-content: center;
  padding-top: 16px;
}
.modal{
  width: min(720px, calc(100vw - 24px));
  margin: 0 auto;
}
@media (max-width: 600px){
  .modal-backdrop{ padding-top: 10px; }
  .modal{ border-radius: 18px; }
}
