:root {
  --bg: #f6f8ff;
  --ink: #17285b;
  --muted: #7a83a3;
  --line: #dfe5f6;
  --blue: #3778ff;
  --green: #31c86d;
  --red: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #fbfcff 0%, var(--bg) 100%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.phone-shell {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px 104px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 2px 16px;
}

.app-header h1 {
  margin: 0;
  font-size: 2.05rem;
  line-height: 1;
  font-weight: 820;
}

.app-header p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 760;
}

.round-button {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 12px 26px rgba(27, 42, 92, 0.08);
  font-size: 1.25rem;
}

.rail,
.next-plan,
.bottom-tabs {
  display: none;
}

.days-list {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
}

.day-tile {
  grid-column: span 6;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  min-height: 112px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(27, 42, 92, 0.07);
}

.today-tile {
  grid-column: span 12;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  min-height: 148px;
  border-color: rgba(55, 120, 255, 0.42);
}

.tile-main,
.tile-no {
  text-align: left;
}

.tile-main {
  grid-column: span 4;
  display: grid;
  align-content: center;
  gap: 6px;
  min-width: 0;
  padding: 14px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.today-tile .tile-main {
  grid-column: span 10;
  padding: 18px;
}

.tile-no {
  grid-column: span 2;
  display: grid;
  place-items: center;
  border-left: 1px solid var(--line);
  color: #46506f;
  background: #f4f6fc;
  font-size: 1.9rem;
  font-weight: 760;
  cursor: pointer;
}

.today-tile .tile-no {
  grid-column: span 2;
  font-size: 2.2rem;
}

.tile-date {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.2;
  font-weight: 760;
}

.today-chip {
  display: inline-grid;
  place-items: center;
  min-height: 23px;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--blue);
  background: #edf3ff;
  text-transform: uppercase;
}

.manual-chip {
  display: inline-grid;
  place-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #7759d7;
  background: #f0ecff;
}

.day-tile strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1.05rem;
  line-height: 1.12;
  font-weight: 820;
}

.place-trigger {
  display: inline-block;
  justify-self: start;
  width: fit-content;
  max-width: 100%;
  cursor: pointer;
}

.today-tile strong {
  color: var(--blue);
  font-size: 1.8rem;
}

.done-tile .tile-main {
  background: #effaf3;
}

.missed-tile .tile-main {
  background: #fff5f5;
}

.missed-tile .tile-no {
  color: #30384f;
  background: #e9edf7;
}

.free-tile .tile-main,
.free-tile .tile-no {
  color: #98a0b8;
  background: #f6f7fb;
}

.tile-action[data-disabled="true"] {
  cursor: default;
}

.settings-sheet {
  width: 100vw;
  max-width: none;
}

.settings-sheet.offcanvas-end {
  top: 0;
  bottom: 0;
  border-left: 0;
}

.settings-sheet .offcanvas-body {
  overflow-y: auto;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.offcanvas.offcanvas-bottom.place-sheet {
  height: auto;
  max-height: calc(100dvh - 18px);
  border-radius: 24px 24px 0 0;
}

.offcanvas.offcanvas-bottom.place-sheet .offcanvas-body {
  overflow: visible;
  padding-top: 8px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.place-sheet .offcanvas-title,
.settings-sheet .offcanvas-title {
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 820;
}

.sheet-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 720;
}

.place-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.place-option {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  font-weight: 780;
}

.place-option.active {
  border-color: rgba(55, 120, 255, 0.55);
  color: var(--blue);
  background: #edf3ff;
}

.place-option-wide {
  grid-column: span 2;
}

.template-editor {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.weekday-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.weekday-grid .btn {
  border-radius: 12px;
}

.toast {
  border-radius: 16px;
}

@media (max-width: 390px) {
  .phone-shell {
    padding-inline: 10px;
  }

  .days-list {
    gap: 8px;
  }

  .day-tile {
    min-height: 102px;
    border-radius: 15px;
  }

  .tile-main {
    padding: 11px;
  }

  .tile-no {
    font-size: 1.55rem;
  }

  .today-tile strong {
    font-size: 1.55rem;
  }
}
