:root{
  --bg:#0b0f17;
  --panel:#111827;
  --panel2:#0f172a;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --accent:#22c55e;
  --accent2:#60a5fa;
  --danger:#ef4444;
  --warn:#f59e0b;
  --line:rgba(255,255,255,.08);
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --r:16px;
  --tap:48px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Apple Color Emoji","Segoe UI Emoji";
}

*{box-sizing:border-box}
html,body{height:100%; min-height:100vh}
body{
  margin:0;
  font-family:var(--font);
  background: var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

button, input, select, textarea{font:inherit}
.app{min-height:100%; display:flex; align-items:stretch}
.container{
  width:min(1100px, 100%);
  margin:0 auto;
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:16px;
}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border:1px solid var(--line);
  border-radius:var(--r);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card-header{
  padding:14px 14px 10px;
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.card-title{display:flex; flex-direction:column; gap:2px;}
.card-title h1, .card-title h2{margin:0;font-size:16px;font-weight:700;letter-spacing:.2px;}
.card-title p{margin:0;font-size:12px;color:var(--muted);}
.card-body{padding:14px}
.muted{color:var(--muted)}
.row{display:flex; gap:10px; align-items:center; flex-wrap:wrap}

.field{display:flex; flex-direction:column; gap:6px; width:100%}
.label{font-size:12px; color:var(--muted)}
.input, .select, .textarea{
  width:100%;
  min-height: var(--tap);
  padding:12px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(15, 23, 42, .55);
  color:var(--text);
  outline:none;
}
.textarea{min-height:96px; resize:vertical}
.input:focus, .select:focus, .textarea:focus{
  border-color: rgba(96,165,250,.7);
  box-shadow:0 0 0 4px rgba(96,165,250,.12);
}

.btn{
  min-height: var(--tap);
  padding: 12px 14px;
  border-radius: 14px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.06);
  color:var(--text);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  cursor:pointer;
  user-select:none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .06s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
}
.btn i{font-size:0.9em}
.btn:active{transform: translateY(1px)}
.btn.primary{
  background: linear-gradient(180deg, rgba(34,197,94,.95), rgba(34,197,94,.75));
  border-color: rgba(34,197,94,.5);
  color:#07110b;
  font-weight:700;
}
.btn.blue{
  background: linear-gradient(180deg, rgba(96,165,250,.95), rgba(96,165,250,.75));
  border-color: rgba(96,165,250,.55);
  color:#07111a;
  font-weight:700;
}
.btn.danger{
  background: linear-gradient(180deg, rgba(239,68,68,.95), rgba(239,68,68,.75));
  border-color: rgba(239,68,68,.55);
  color:#190707;
  font-weight:700;
}
.btn.success{
  background: linear-gradient(180deg, rgba(34,197,94,.95), rgba(34,197,94,.75));
  border-color: rgba(34,197,94,.55);
  color:#07110b;
  font-weight:800;
}
.btn.ghost{background: transparent;}
.btn.small{min-height:38px; padding:8px 10px; border-radius:12px; font-size:13px}

.topbar{
  z-index:30;
  background: rgba(11,15,23,.95);
  backdrop-filter: blur(10px);
  border:1px solid var(--line);
  border-radius: var(--r);
  padding:10px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.brand{display:flex; flex-direction:column; gap:2px; min-width:0;}
.brand strong{font-size:14px}
.brand span{font-size:12px; color:var(--muted)}
.chip{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.05);
  color:var(--muted);
  white-space:nowrap;
}

.grid{display:grid; grid-template-columns: 1fr; gap:16px;}
@media (min-width: 920px){
  .grid{grid-template-columns: 1.35fr .95fr; align-items:start;}
  .calendar-card{position:sticky; top:84px}
}

.auth-wrap{
  position:fixed;
  top:0;
  left:0;
  right:0;
  bottom:0;
  width:100%;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
  overflow:auto;
}
.auth{width:min(520px, 100%); margin:0 auto;}
.auth .logo{display:flex; align-items:center; gap:10px; padding:16px 16px 0;}
.dot{width:14px; height:14px; border-radius:50%; background: var(--accent2); box-shadow:0 0 0 6px rgba(96,165,250,.12);}

.calendar-controls{display:flex; gap:10px; flex-wrap:wrap; align-items:center;}
.calendar-controls .select{min-height:42px; padding:10px 10px}
.cal{padding:12px 12px 14px;}
.dow{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  gap:8px;
  padding:0 2px 10px;
  font-size:12px;
  color:var(--muted);
  text-align:center;
}
.grid-days{display:grid; grid-template-columns: repeat(7, 1fr); gap:8px;}
.day{
  border:1px solid var(--line);
  background: rgba(15,23,42,.45);
  border-radius:14px;
  min-height: 46px;
  padding:8px 8px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  cursor:pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s ease, transform .06s ease, background .15s ease;
  position:relative;
  overflow:hidden;
}
.day:hover{border-color: rgba(96,165,250,.5)}
.day:active{transform: translateY(1px)}
.day .n{font-weight:700;font-size:13px;line-height:1;color:var(--text);opacity:.95;}
.day .dots{display:flex; gap:4px; justify-content:flex-end; padding-top:6px;}
.day .dots i{width:6px; height:6px; border-radius:50%; display:block; background: rgba(255,255,255,.22);}
.day.muted{opacity:.45; background: rgba(15,23,42,.25);}
.day.selected{
  outline: 3px solid rgba(34,197,94,.35);
  border-color: rgba(34,197,94,.55);
  background: rgba(34,197,94,.08);
}
.day.today{
  border-color: rgba(96,165,250,.65);
  background: rgba(96,165,250,.08);
}

.day-head{display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap;}
.date-big{display:flex; flex-direction:column; gap:2px;}
.date-big strong{font-size:15px}
.date-big span{font-size:12px; color:var(--muted)}
.list{display:flex; flex-direction:column; gap:10px; margin-top:12px;}
.item{
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  border-radius:16px;
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:8px;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.item.done{
  border-color: rgba(34,197,94,.55);
  background: rgba(34,197,94,.10);
  box-shadow: 0 0 0 4px rgba(34,197,94,.08);
}
.item-top{display:flex; align-items:flex-start; justify-content:space-between; gap:10px;}
.item-top .meta{display:flex; flex-direction:column; gap:2px; min-width:0;}
.time{font-weight:800; letter-spacing:.2px;}
.title{
  font-size:13px;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 100%;
}
.note{font-size:13px; color:var(--text); opacity:.95; white-space:pre-wrap;}
.item-actions{display:flex; gap:8px; flex-wrap:wrap;}

.price-line{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  font-size:12px;
  color:var(--muted);
  border-top: 1px solid rgba(255,255,255,.06);
  padding-top:10px;
  margin-top:2px;
}
.price-line strong{color: var(--text);}

.empty{
  padding:14px;
  border:1px dashed rgba(255,255,255,.18);
  border-radius:16px;
  color:var(--muted);
  background: rgba(255,255,255,.02);
  font-size:13px;
}

.banner{
  border:1px solid var(--line);
  background: rgba(245,158,11,.12);
  color: #fde68a;
  padding:10px 12px;
  border-radius:14px;
  display:none;
  gap:10px;
  align-items:flex-start;
}
.banner.show{display:flex}
.banner strong{color:#fff}
.pill{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.05);
  color:var(--text);
  white-space:nowrap;
}

/* MODALS (CENTERED ALWAYS) */
.overlay{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.6);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:50;
  padding:16px;
}
.overlay.show{display:flex}
.modal{
  width:min(720px, 100%);
  border-radius: 22px;
  overflow:hidden;
  border:1px solid var(--line);
  background: linear-gradient(180deg, rgba(17,24,39,.96), rgba(15,23,42,.96));
  box-shadow: var(--shadow);
  max-height: 86vh;
  display:flex;
  flex-direction:column;
}
.modal.small{width:min(520px, 100%);}
.modal-head{
  padding:12px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  border-bottom:1px solid var(--line);
}
.modal-head strong{font-size:14px}
.modal-body{
  padding:14px;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.modal-foot{
  padding:12px 14px;
  border-top:1px solid var(--line);
  display:flex;
  gap:10px;
  justify-content:flex-end;
  flex-wrap:wrap;
}
.grid2{display:grid; grid-template-columns: 1fr; gap:10px;}
@media (min-width: 560px){ .grid2{grid-template-columns: 1fr 1fr} }

.hint{font-size:12px; color:var(--muted); margin-top:-6px}
.sep{height:1px; background:var(--line); margin:4px 0}

[data-screen]{display:none}
[data-screen].active{display:block}
