:root{
  --bg1:#fff6f0;
  --bg2:#f2f7ff;
  --ink:#1f2a37;
  --muted:#556070;
  --card:#ffffffcc;
  --stroke:#e7e2f2;
  --primary:#ff6b8a;
  --primary2:#6b7cff;
  --ok:#2b8a3e;
  --warn:#cc5f00;
  --shadow: 0 18px 60px rgba(27, 39, 51, .10);
  --shadow2: 0 10px 25px rgba(27, 39, 51, .08);
  --r:18px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--ink);
  font-family:"Baloo 2","Nunito",system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:
    radial-gradient(1200px 800px at 15% 0%, #ffe6ef 0%, transparent 55%),
    radial-gradient(900px 650px at 90% 10%, #dff0ff 0%, transparent 55%),
    radial-gradient(900px 700px at 40% 95%, #e6fff6 0%, transparent 55%),
    linear-gradient(180deg,var(--bg1),var(--bg2));
}

@media print{
  .topbar,.toolbar,.week-actions,.toast,.modal{display:none !important}
  body{background:white}
  .container{max-width:none; padding:0}
  .card{box-shadow:none}
}

a{color:inherit}
code{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 18px;
  position:sticky;
  top:0;
  backdrop-filter: blur(14px);
  background: rgba(255,255,255,.55);
  border-bottom:1px solid rgba(231,226,242,.8);
  z-index: 50;
}

.brand{display:flex; gap:12px; align-items:center}
.logo{
  width:42px;height:42px;border-radius:14px;
  display:grid;place-items:center;
  background: linear-gradient(135deg, var(--primary), #ffbf69);
  color:white; font-weight:800;
  box-shadow: var(--shadow2);
}
.brand-title{font-weight:800; letter-spacing:.2px}
.brand-sub{font-size:13px; color:var(--muted); margin-top:-4px}

.nav{display:flex; gap:10px; align-items:center}
.nav-link{
  text-decoration:none;
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid transparent;
  color:var(--ink);
}
.nav-link:hover{background:rgba(255,255,255,.65); border-color:rgba(231,226,242,.9)}

.container{max-width:1200px; margin:0 auto; padding:18px}

.card{
  background: var(--card);
  border:1px solid rgba(231,226,242,.9);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

.auth{max-width:520px; margin:48px auto; padding:22px 22px 18px}

h1{margin:0 0 12px; font-size:28px}

.form{display:flex; flex-direction:column; gap:12px}
.field{display:flex; flex-direction:column; gap:6px}
.label{color:var(--muted); font-size:14px}
input,select,textarea{
  padding:12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(231,226,242,.9);
  background: rgba(255,255,255,.75);
  font: inherit;
  outline: none;
}
textarea{min-height:90px; resize:vertical}
input:focus,select:focus,textarea:focus{border-color: rgba(107,124,255,.55); box-shadow: 0 0 0 4px rgba(107,124,255,.12)}

.btn{
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid rgba(231,226,242,.9);
  background: rgba(255,255,255,.8);
  cursor:pointer;
  font: inherit;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}
.btn:hover{transform: translateY(-1px); box-shadow: var(--shadow2)}
.btn:disabled{opacity:.55; cursor:not-allowed; transform:none; box-shadow:none}
.btn.primary{
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color:white;
  border-color: transparent;
}

.row{display:flex; gap:10px; align-items:center; flex-wrap:wrap}
.grid2{display:grid; grid-template-columns: 1fr 1fr; gap:12px}
@media (max-width:760px){.grid2{grid-template-columns:1fr}}

.alert{padding:10px 12px; border-radius:14px; border:1px solid rgba(231,226,242,.9)}
.alert-ok{background: rgba(230,255,246,.8); color: #0b5b2a}
.alert-bad{background: rgba(255,230,238,.85); color: #7a0b2e}

.hint{color:var(--muted); font-size:13px; margin:8px 0 0}

.week-head{display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin: 8px 0 12px}
.week-title h1{margin:0}
.week-meta{color:var(--muted); font-size:14px; margin-top:-2px}
.week-actions{display:flex; gap:8px; flex-wrap:wrap}

.toolbar{padding:12px 12px; display:flex; align-items:center; justify-content:space-between; gap:12px; margin: 0 0 14px}
.toolbar-left{display:flex; gap:8px; flex-wrap:wrap}

.week{display:grid; grid-template-columns: repeat(5, 1fr); gap:12px}
@media (max-width:980px){.week{grid-template-columns:1fr;}}

.timetable{margin-top:12px}
.tt-grid{
  display:grid;
  grid-template-columns: 76px repeat(5, 1fr);
  gap:10px;
  align-items:stretch;
}
@media (max-width:980px){
  .tt-grid{grid-template-columns: 66px repeat(5, minmax(150px,1fr)); overflow:auto}
}
.tt-head{
  padding:10px 10px;
  font-weight:900;
  color: rgba(31,42,55,.85);
}
.tt-time{
  padding:10px 8px;
  font-weight:800;
  color: rgba(31,42,55,.75);
  font-size:13px;
}
.tt-cell{
  border:1px dashed rgba(231,226,242,.95);
  border-radius: 16px;
  min-height: 58px;
  background: rgba(255,255,255,.55);
  display:grid;
  place-items:stretch;
  position:relative;
}
.tt-cell.filled{border-style:solid; background: rgba(255,255,255,.82); box-shadow: var(--shadow2)}
.tt-cell::before{
  content:"";
  position:absolute;
  left:8px;
  top:8px;
  bottom:8px;
  width:6px;
  border-radius:999px;
  background: var(--seg, rgba(107,124,255,.25));
}
.tt-empty{
  display:grid;
  place-items:center;
  color: rgba(85,96,112,.65);
  font-weight:900;
  font-size:18px;
}
.tt-card{
  padding:10px 10px 10px 18px;
  border-radius: 16px;
  cursor:grab;
  user-select:none;
}
.tt-card:active{cursor:grabbing}
.tt-title{font-weight:900; line-height:1.05}
.tt-sub{font-size:13px; color: rgba(85,96,112,.85); margin-top:3px}
.tt-card.dragging{opacity:.55}

.day{
  border-radius: var(--r);
  border: 1px solid rgba(231,226,242,.9);
  background: rgba(255,255,255,.60);
  box-shadow: var(--shadow2);
  overflow:hidden;
}
.day.today{outline: 3px solid rgba(255,107,138,.25)}
.day-head{padding:12px 12px; border-bottom:1px solid rgba(231,226,242,.9); background: rgba(255,255,255,.55)}
.day-title{font-weight:800}
.day-sub{font-size:13px; color:var(--muted); margin-top:-2px}

.segments{list-style:none; margin:0; padding:10px; display:flex; flex-direction:column; gap:10px; min-height: 120px}

.seg{
  display:grid;
  grid-template-columns: 54px 1fr auto;
  gap:10px;
  align-items:center;
  padding:10px 10px;
  border-radius:16px;
  border:1px solid rgba(231,226,242,.9);
  background: rgba(255,255,255,.85);
  cursor:grab;
  user-select:none;
  position:relative;
}
.seg::before{
  content:"";
  position:absolute;
  left:8px;
  top:8px;
  bottom:8px;
  width:6px;
  border-radius:999px;
  background: var(--seg, rgba(107,124,255,.25));
}
.seg.k-ritual::before{background: var(--seg, rgba(255,191,105,.65));}
.seg.k-break::before{background: var(--seg, rgba(160,174,192,.55));}
.seg.k-workshop::before{background: var(--seg, rgba(43,138,62,.45));}
.seg:active{cursor:grabbing}
.seg.dragging{opacity:.45}
.seg.selected{border-color: rgba(107,124,255,.7); box-shadow: 0 0 0 4px rgba(107,124,255,.14)}
.seg.done .seg-title{text-decoration: line-through; color: rgba(31,42,55,.55)}
.seg.late{border-color: rgba(255,107,138,.55)}

.seg-time{font-weight:800; color: rgba(31,42,55,.8); font-size:14px}
.seg-title{font-weight:700; line-height:1.05}
.seg-meta{display:flex; gap:8px; flex-wrap:wrap; margin-top:4px}

.pill{
  display:inline-flex;
  padding:5px 8px;
  border-radius:999px;
  font-size:12px;
  background: rgba(230,236,255,.9);
  border:1px solid rgba(231,226,242,.9);
  color: rgba(31,42,55,.85);
}
.pill-warn{background: rgba(255,240,221,.95); color: #7c2e00}

.seg-edit{
  padding:8px 10px;
  border-radius: 12px;
  border:1px solid rgba(231,226,242,.9);
  background: rgba(255,255,255,.8);
  cursor:pointer;
  font: inherit;
}
.seg-edit:hover{box-shadow: var(--shadow2)}

.toast{
  position:fixed;
  bottom:16px; left:50%; transform: translateX(-50%);
  min-width: 240px;
  max-width: 420px;
  padding:10px 12px;
  border-radius: 16px;
  border:1px solid rgba(231,226,242,.9);
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow);
  opacity:0;
  pointer-events:none;
  transition: opacity .22s ease, transform .22s ease;
}
.toast.show{opacity:1; transform: translateX(-50%) translateY(-6px)}

.modal[hidden]{display:none}
.modal{position:fixed; inset:0; z-index: 100;}
.modal-backdrop{position:absolute; inset:0; background: rgba(31,42,55,.35); backdrop-filter: blur(6px)}
.modal-card{
  position:relative;
  max-width: 720px;
  margin: 70px auto;
  border-radius: 22px;
  background: rgba(255,255,255,.96);
  border:1px solid rgba(231,226,242,.95);
  box-shadow: var(--shadow);
  overflow:hidden;
}
@media (max-width:760px){.modal-card{margin: 18px;}}
.modal-head{display:flex; align-items:center; justify-content:space-between; padding:12px 14px; border-bottom:1px solid rgba(231,226,242,.9)}
.modal-title{font-weight:900}
.icon-btn{border:none; background:transparent; font-size:26px; cursor:pointer; line-height:1}
.modal-body{padding:14px}
