*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  min-height: 100%;
  touch-action: manipulation;
}
body {
  margin: 0;
  color: #f3faf7;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(120% 48% at 50% -10%, rgba(32, 120, 90, .38), transparent 52%),
    #07120f;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(255,255,255,.75) 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 72%, rgba(255,255,255,.5) 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 70% 22%, rgba(255,255,255,.7) 50%, transparent 51%),
    radial-gradient(1px 1px at 84% 64%, rgba(255,255,255,.4) 50%, transparent 51%),
    radial-gradient(1px 1px at 46% 40%, rgba(255,255,255,.45) 50%, transparent 51%),
    radial-gradient(1px 1px at 60% 86%, rgba(255,255,255,.35) 50%, transparent 51%),
    radial-gradient(1px 1px at 18% 48%, rgba(255,255,255,.32) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 90% 12%, rgba(255,255,255,.6) 50%, transparent 51%);
  background-size: 280px 360px;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
::selection { background: rgba(42, 212, 168, .35); }
body.sheet-open { overflow: hidden; }

.phone {
  width: min(440px, 100%);
  margin: 0 auto;
  padding: calc(max(var(--app-top, 0px), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px))) + 14px) 16px 0;
  position: relative;
  z-index: 1;
}
.views { padding-bottom: calc(108px + max(var(--app-bottom, 0px), env(safe-area-inset-bottom, 0px))); }
.top { display: flex; align-items: center; justify-content: space-between; padding-top: 4px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.logo { width: 36px; height: 36px; display: block; }
.icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(120, 220, 180, .18);
  background: #0e221c;
  color: #d9fff2;
  display: grid;
  place-items: center;
}
.theme-wrap { position: relative; }
.theme-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 168px;
  padding: 6px;
  border-radius: 16px;
  background: #10241d;
  border: 1px solid rgba(120, 220, 180, .2);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
}
.theme-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #f3faf7;
  font-weight: 700;
  padding: 10px 12px;
}
.theme-menu svg { flex: 0 0 auto; }
.theme-menu button.active { background: #2ad4a8; color: #04241c; }
html[data-theme="light"] .theme-menu { background: #fff; border-color: rgba(16, 36, 28, .08); }
html[data-theme="light"] .theme-menu button { color: #10241c; }
.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #2ad4a8;
  color: #04241c;
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.hello {
  margin: 18px 0 8px;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: -.03em;
  font-weight: 800;
}
.sub { margin: 0; color: #8ea89c; font-size: 15px; }
.remind {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 12px 12px 14px;
  border-radius: 18px;
  background: #10241d;
  border: 1px solid rgba(120, 220, 180, .16);
  color: #d7ebe3;
  font-size: 14px;
}
.remind-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.remind-save {
  border: 0;
  border-radius: 999px;
  background: #2ad4a8;
  color: #04241c;
  font-weight: 800;
  padding: 10px 14px;
}
.remind-save:disabled { opacity: .4; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper b { min-width: 22px; text-align: center; font-size: 16px; }
.stepper button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: #1a3a30;
  color: #d9fff2;
  font-size: 20px;
  line-height: 1;
}
.stepper button:disabled { opacity: .35; }
.pill {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  background: rgba(42, 212, 168, .12);
  color: #8dffe4;
  border: 1px solid rgba(42, 212, 168, .4);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 800;
}
.demo { color: #9fb2aa; font-size: 13px; line-height: 1.4; margin: 10px 0 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 20px 0 10px;
}
.section-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.text-link { background: none; border: 0; color: #2ad4a8; font-weight: 700; padding: 0; }

.card, .hint, .event-card {
  background: #10241d;
  border: 1px solid rgba(120, 220, 180, .16);
  border-radius: 22px;
}
.card { padding: 14px 12px 10px; }
.month-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; padding: 0 4px; }
.month-bar h3 { margin: 0; font-size: 18px; font-weight: 700; }
.nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(120, 220, 180, .18);
  background: #0c1c17;
  color: #e7fff6;
  display: grid;
  place-items: center;
  transition: background .25s ease, transform .25s ease;
}
.nav-btn:active { transform: scale(.94); }
.weekdays, .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.weekdays { margin-bottom: 4px; }
.weekdays span { text-align: center; color: #7f998e; font-size: 12px; font-weight: 700; padding: 6px 0; }
.weekdays .we { color: #5f8f7c; }
.day {
  position: relative;
  height: 50px;
  padding: 0 0 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #f4fbf8;
  font-weight: 700;
  font-size: 15px;
  transition: background .28s ease, color .28s ease, opacity .28s ease, transform .28s ease;
}
.day.past {
  color: #66716d;
  opacity: .42;
}
.day.past.picked {
  background: transparent;
  color: #8b9692;
  box-shadow: inset 0 0 0 1.5px #66716d;
  opacity: .7;
}
.day.out { color: #5c6f67; }
.day.we:not(.selected) { color: #b7e6d4; }
.day.past.we { color: #66716d; }
.day.out.we { color: #4e655c; }
.day.today:not(.selected) { box-shadow: inset 0 0 0 1.5px #2ad4a8; }
.day.selected { background: #2ad4a8; color: #04241c; }
.grid.is-focus .day.dim {
  color: #5c6b66;
  opacity: .38;
}
.grid.is-focus .day.dim .dot { background: #5c6b66; }
.day .dots {
  position: absolute;
  left: 50%;
  bottom: 4px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 2px;
  width: 13px;
  transform: translateX(-50%);
  pointer-events: none;
}
.day .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #2ad4a8;
}
.day.selected .dot { background: #04241c; }
@media (hover: hover) {
  .day:not(.selected):hover { background: rgba(42, 212, 168, .12); }
}

.cta {
  width: 100%;
  margin-top: 14px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #3eefc0 0%, #1ec99a 100%);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  padding: 16px 18px;
  box-shadow: 0 10px 28px rgba(30, 201, 154, .22);
}
.cta { transition: transform .25s ease, opacity .25s ease, box-shadow .25s ease; }
.cta:disabled { opacity: .6; }
.cta:active { transform: scale(.985); }

.hint {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 16px;
}
.hint-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #2ad4a8;
  display: grid;
  place-items: center;
}
.hint h2 { margin: 0 0 4px; font-size: 16px; }
.hint p { margin: 0; color: #8ea89c; font-size: 14px; line-height: 1.35; }

.event-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  margin-bottom: 10px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: transform .28s ease, border-color .28s ease, opacity .28s ease;
}
.event-card:active { transform: scale(.985); }
.focus-card {
  margin-top: 14px;
  padding: 16px;
  background: #10241d;
  border: 1px solid rgba(42, 212, 168, .45);
  border-radius: 22px;
}
.focus-card .when { margin: 0; color: #8ea89c; font-size: 13px; }
.focus-card .what { margin: 6px 0 0; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.event-card .when { color: #8ea89c; font-size: 13px; }
.event-card .what { font-weight: 700; margin-top: 4px; overflow-wrap: anywhere; }
.event-card.past, .event-card.muted { opacity: .5; }
.event-card.muted .what, .event-card.muted .when { color: #8a9691; }
.copy-code { flex: 1; min-width: 0; background: none; border: 0; color: inherit; text-align: left; padding: 0; }
.event-card.day-block { display: block; cursor: pointer; padding: 18px 18px 10px; }
.event-card.day-block .mini-row { padding: 16px 2px; }
.event-card.day-block:not([data-day]) { cursor: default; }
.del, .mini-row button {
  margin-left: auto;
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  color: #ffb4b4;
  font-weight: 700;
  font-size: 13px;
}
.group-title { color: #8ea89c; font-size: 13px; font-weight: 700; margin: 6px 0 8px; }
.admin-title { margin: 14px 0 0; font-size: 22px; }
.mode { display: flex; gap: 8px; margin: 8px 0 14px; }
.mode-btn {
  flex: 1;
  border: 1px solid rgba(120, 220, 180, .2);
  background: #10241d;
  color: #8ea89c;
  border-radius: 999px;
  padding: 10px 12px;
  font-weight: 700;
}
.mode-btn.active { background: #2ad4a8; color: #04241c; border-color: transparent; }
#admin-day { margin-top: 12px; }
#admin-delete { margin: 8px 0 14px; background: #3a1616; color: #ffb4b4; box-shadow: none; }
.gate { padding: 28px 4px 40px; }
.gate h2 { margin: 0 0 8px; }
.gate .cta { margin-top: 12px; }
body.locked .tabbar, body.locked #theme { visibility: hidden; }
.empty {
  color: #8ea89c;
  background: #10241d;
  border: 1px solid rgba(120, 220, 180, .16);
  border-radius: 22px;
  padding: 18px;
  line-height: 1.4;
}

.tabbar {
  position: fixed;
  z-index: 5;
  display: flex;
  width: min(408px, calc(100% - 24px));
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(12px + max(var(--app-bottom, 0px), env(safe-area-inset-bottom, 0px)));
  background: rgba(10, 28, 23, .94);
  border: 1px solid rgba(42, 212, 168, .24);
  border-radius: 22px;
  padding: 8px 6px 6px;
  backdrop-filter: blur(12px);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: 0;
  color: #6f8f82;
  font-size: 11px;
  font-weight: 700;
  transition: color .28s ease, transform .28s ease;
}
.tab svg { width: 22px; height: 22px; display: block; }
.tab.active { color: #2ad4a8; }

.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  animation: fade .35s ease;
}
.sheet {
  position: relative;
  width: min(440px, 100%);
  max-height: min(82dvh, 680px);
  overflow: auto;
  background: #0d211b;
  border-radius: 22px 22px 0 0;
  border: 1px solid rgba(42, 212, 168, .22);
  padding: 4px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -16px 40px rgba(0, 0, 0, .4);
  animation: rise .46s cubic-bezier(.22, 1, .32, 1);
  transition: transform .36s cubic-bezier(.22, 1, .32, 1);
  will-change: transform;
}
.sheet-half {
  height: 75dvh;
  max-height: 75dvh;
}
@media (min-width: 800px) {
  .sheet-half {
    height: auto;
    max-height: min(640px, 70vh);
    margin-bottom: 24px;
    border-radius: 22px;
  }
}
.sheet-half .day { height: 36px; font-size: 14px; }
.sheet-half .focus-card { margin-top: 12px; }
.handle {
  width: 64px;
  height: 22px;
  margin: 0 auto 4px;
  touch-action: none;
  cursor: grab;
  position: relative;
}
.handle::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 9px;
  height: 4px;
  border-radius: 4px;
  background: #3d524a;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.sheet-head h3 { margin: 0; font-size: 18px; }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; margin-bottom: 6px; font-size: 13px; color: #b7cfc4; }
#time {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  appearance: none;
  -webkit-appearance: none;
}
.no-time {
  width: 100%;
  margin: 0 0 12px;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  background: #2ad4a8;
  color: #04241c;
  font-weight: 800;
  font-size: 15px;
}
.no-time.active { background: #16382e; color: #2ad4a8; box-shadow: inset 0 0 0 1.5px #2ad4a8; }
.day-line {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.slot, .day-line { align-items: center; }
.slot { display: flex; gap: 10px; min-width: 0; flex: 1; }
.slot-time, .day-line b {
  flex: 0 0 auto;
  white-space: nowrap;
  color: #2ad4a8;
}
.slot-bar {
  width: 1px;
  align-self: stretch;
  margin: 4px 0;
  background: rgba(255, 255, 255, .14);
}
.slot-text, .day-line span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mini-row.due .slot-time,
.mini-row.due .slot-text,
.day-line.due .slot-time,
.day-line.due span {
  color: #8a9691;
  text-decoration: line-through;
}
.mini-row.due .slot-bar,
.day-line.due .slot-bar { opacity: .45; }
input, textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: #0b1c17;
  border: 1px solid rgba(46, 230, 176, .22);
  color: #f3faf7;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 16px;
  color-scheme: dark;
}
textarea { min-height: 88px; resize: vertical; }
.fine { color: #8ea89c; font-size: 13px; line-height: 1.4; margin: 8px 0; }
.mini-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, .06);
  overflow-wrap: anywhere;
}
.sheet .cta { margin-top: 4px; }

.toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(360px, calc(100% - 32px));
  background: #12352b;
  color: #fff;
  border: 1px solid rgba(42, 212, 168, .35);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 14px;
  text-align: center;
  animation: rise .36s cubic-bezier(.22, 1, .32, 1);
}
#views > section { animation: fade .4s ease; }
.error { color: #ffd0d0; padding: 12px 0; }
.stack { margin-top: 22px; }
.sk {
  border-radius: 16px;
  background: linear-gradient(90deg, #3a3a3a 25%, #555 37%, #3a3a3a 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}
.sk-line { height: 22px; margin-bottom: 10px; }
.sk-line.lg { width: 78%; height: 34px; border-radius: 12px; }
.sk-line.md { width: 42%; height: 16px; }
.sk-card { height: 330px; margin: 18px 0; border-radius: 22px; }
.sk-btn { height: 52px; border-radius: 999px; }
.sk-hint { height: 92px; margin-top: 14px; border-radius: 22px; }

@keyframes rise { from { transform: translateY(28px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
html[data-theme="light"] body {
  color: #10241c;
  background: radial-gradient(120% 48% at 50% -10%, rgba(42, 212, 168, .28), transparent 52%), #f4fbf8;
}
html[data-theme="light"] body::before { opacity: .25; }
html[data-theme="light"] .icon-btn,
html[data-theme="light"] .nav-btn {
  background: #fff;
  color: #10241c;
  border-color: rgba(16, 36, 28, .1);
}
html[data-theme="light"] .sub,
html[data-theme="light"] .hint p,
html[data-theme="light"] .fine,
html[data-theme="light"] .group-title,
html[data-theme="light"] .event-card .when,
html[data-theme="light"] .weekdays span,
html[data-theme="light"] .demo,
html[data-theme="light"] .field span { color: #5d756c; }
html[data-theme="light"] .card,
html[data-theme="light"] .hint,
html[data-theme="light"] .event-card,
html[data-theme="light"] .remind,
html[data-theme="light"] .empty,
html[data-theme="light"] .focus-card,
html[data-theme="light"] .mode-btn,
html[data-theme="light"] .sheet {
  background: #fff;
  color: #10241c;
  border-color: rgba(16, 36, 28, .08);
}
html[data-theme="light"] .day { color: #10241c; }
html[data-theme="light"] .day.we:not(.selected) { color: #0e7a5c; }
html[data-theme="light"] .day.out,
html[data-theme="light"] .day.past { color: #93a49d; }
html[data-theme="light"] .tabbar { background: rgba(255, 255, 255, .94); border-color: rgba(16, 36, 28, .08); }
html[data-theme="light"] .tab { color: #6d847b; }
html[data-theme="light"] input,
html[data-theme="light"] textarea {
  background: #f7fbf9;
  color: #10241c;
  color-scheme: light;
  border-color: rgba(16, 36, 28, .12);
}
html[data-theme="light"] .stepper button { background: #e7f6f1; color: #10241c; }
html[data-theme="light"] .pill { background: rgba(14, 122, 92, .1); color: #0e7a5c; }
html[data-theme="light"] .handle::before { background: #c5d5ce; }
html[data-theme="light"] .mini-row,
html[data-theme="light"] .day-line { border-top-color: rgba(16, 36, 28, .08); }
html[data-theme="light"] .slot-bar { background: rgba(16, 36, 28, .16); }
html[data-theme="light"] .toast { background: #10241c; color: #f4fbf8; }
html[data-theme="light"] .no-time.active { background: #e7f6f1; }

@media (prefers-reduced-motion: reduce) {
  .sheet, .sk, .backdrop, #views > section, .toast { animation: none; }
  .day, .cta, .nav-btn, .event-card, .tab, .sheet { transition: none; }
}
