:root {
  --ink: #202020;
  --muted: #8d8d8d;
  --line: #efefef;
  --peach: #fde7df;
  --red: #dc4c3e;
  --paper: #ffffff;
  --frame: #e6e6e6;
  --shadow: 0 18px 50px rgba(32, 32, 32, 0.08);
  --sidebar: 272px;
  --row: 68px;
  --start: 0;
  --end: 1440;
  font-family: Inter, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--frame);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--frame);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }

#app { min-height: 100%; }

.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fade 0.35s ease;
}
.login-card {
  width: min(420px, 100%);
  background: white;
  border-radius: 22px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.login-card h1 {
  margin: 0 0 6px;
  font-size: 2rem;
  letter-spacing: -0.04em;
}
.login-card p { margin: 0 0 22px; color: var(--muted); }
label { display: grid; gap: 6px; margin-bottom: 14px; font-size: 13px; font-weight: 600; }
input, select {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  border: 1px solid #ececec;
  background: #fafafa;
  padding: 0 12px;
  font-size: 16px;
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  margin: 4px 0 12px;
}
.checkline input { width: 18px; height: 18px; }

.btn {
  border: 0;
  border-radius: 12px;
  min-height: 46px;
  padding: 0 16px;
  font-weight: 650;
  background: #f4f4f4;
}
.btn-red { background: var(--red); color: white; width: 100%; }
.btn-red:disabled { opacity: 0.6; }
.alert {
  background: #ffd9d2;
  color: #6d241c;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-weight: 600;
}

.shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  background: white;
  overflow: hidden;
  animation: fade 0.35s ease;
}
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 12px 18px;
  border-right: 1px solid var(--line);
  background: #fcfcfc;
  min-height: 0;
  overflow: auto;
}
.who {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 14px;
  background: transparent;
  border: 0;
  text-align: left;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f3d2cb;
  color: #8a3b32;
  font-weight: 700;
}
.who strong { font-size: 15px; }
.add {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 8px 10px;
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--red);
  font-weight: 650;
  font-size: 15px;
}
.plus {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--red);
  color: white;
  font-size: 18px;
  line-height: 1;
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px 12px;
  padding: 0 10px;
  height: 36px;
  border-radius: 8px;
  background: #f3f3f3;
}
.search input {
  height: 34px;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 14px;
}
.nav { position: relative; }
.nav-pill {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 36px;
  border-radius: 8px;
  background: var(--peach);
  z-index: 0;
  pointer-events: none;
  opacity: 0;
}
.nav.pill-ready .nav-pill {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), height 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}
.nav-btn, .label-link {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #3a3a3a;
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
}
.nav-btn.active, .label-link.active { font-weight: 650; }
.nav-btn .icon, .label-link .hash { width: 18px; text-align: center; color: #666; }
.section-label {
  margin: 16px 10px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.label-link .hash { font-weight: 700; color: color-mix(in srgb, var(--hash, #888), #333 42%); }
.side-empty { margin: 0 10px; color: var(--muted); font-size: 13px; }

.main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: white;
}
.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 26px 8px;
}
.top h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -0.045em;
  font-weight: 700;
}
.sub { margin: 2px 0 0; color: var(--muted); font-size: 15px; }
.tools { display: flex; align-items: center; gap: 8px; }
.tool, .seg button {
  height: 34px;
  border-radius: 8px;
  border: 1px solid #ececec;
  background: white;
  padding: 0 10px;
  font-weight: 600;
  font-size: 13px;
}
.seg { display: flex; border: 1px solid #ececec; border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; }
.seg button.on { background: #f6f6f6; }
.menu-btn, .fab { display: none; }

.board { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.board.is-leaving { animation: view-out 0.16s ease forwards; pointer-events: none; }
.board.is-entering { animation: view-in 0.28s ease; }
.week-head, .allday, .grid {
  display: grid;
  grid-template-columns: 64px repeat(7, minmax(0, 1fr));
}
.week-head, .allday { overflow: hidden; scrollbar-gutter: stable; }
.week-head { border-bottom: 1px solid var(--line); }
.day-head {
  padding: 8px 8px 10px;
  color: #777;
  font-size: 13px;
  font-weight: 600;
}
.day-head b {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  margin-left: 4px;
  border-radius: 8px;
  font-size: 14px;
}
.day-head.today { color: var(--ink); }
.day-head.today b { background: var(--red); color: white; }
.allday { min-height: 42px; border-bottom: 1px solid var(--line); }
.allday .slot, .col { position: relative; border-left: 1px solid #f3f3f3; }
.pill, .event {
  border: 0;
  text-align: left;
  border-radius: 8px;
  background: var(--event, #f4f1ee);
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--event, #ddd), #666 40%);
  animation: card 0.35s ease;
  cursor: pointer;
}
.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  width: calc(100% - 8px);
  margin: 4px;
  padding: 4px 8px 4px 10px;
  font-size: 12.5px;
  font-weight: 650;
}
.grid-scroll { flex: 1; min-height: 0; overflow: auto; scrollbar-gutter: stable; }
.grid { position: relative; height: calc(var(--row) * 24); }
.hours { position: relative; }
.hours span {
  position: absolute;
  right: 8px;
  transform: translateY(-50%);
  color: #b0b0b0;
  font-size: 11px;
  font-weight: 600;
}
.cols { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-column: 2 / -1; height: 100%; }
.hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: #f4f4f4;
  pointer-events: none;
}
.col { height: 100%; }
.event {
  position: absolute;
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  overflow: hidden;
  z-index: 1;
}
.event strong, .task strong { display: block; font-size: 13px; font-weight: 700; letter-spacing: -0.02em; }
.event em, .task em { display: block; margin-top: 2px; color: #777; font-style: normal; font-size: 11px; font-weight: 600; }
.check {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1.5px solid #9a9a9a;
  background: transparent;
  padding: 0;
}
.check.on { background: var(--red); border-color: var(--red); }
.now {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--red);
  z-index: 2;
  pointer-events: none;
}
.now::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
}
.day-board .week-head,
.day-board .allday,
.day-board .grid { grid-template-columns: 64px minmax(0, 1fr); }
.day-board .cols { grid-template-columns: 1fr; }
.strip { display: flex; gap: 6px; padding: 0 16px 8px; overflow: auto; }
.strip button { border: 0; background: transparent; border-radius: 10px; min-width: 44px; padding: 6px 8px; color: #888; font-weight: 700; }
.strip button.on { background: var(--red); color: white; }
.strip small { display: block; font-size: 11px; font-weight: 650; }

.list { padding: 6px 18px 96px; overflow: auto; }
.board > .list { flex: 1; min-height: 0; }
.day-block { margin-bottom: 16px; animation: rise 0.32s ease; }
.day-block h2 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #666;
  font-weight: 700;
}
.day-block h2.today { color: var(--red); }
.task {
  display: flex;
  gap: 10px;
  width: 100%;
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 0;
  background: var(--event, #f7f5f3);
  box-shadow: inset 4px 0 0 color-mix(in srgb, var(--event, #ddd), #666 40%);
  text-align: left;
  cursor: pointer;
}
.late { color: var(--red); font-size: 13px; font-weight: 800; margin: 8px 0; }
.leer-form { display: flex; gap: 8px; padding: 4px 18px 14px; }
.leer-form input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: 1px solid #ececec;
  border-radius: 10px;
  padding: 0 12px;
}
.leer-form .btn { width: auto; }
.leer { align-items: center; }
.leer strong { font-size: 15px; }
.leer.done strong { text-decoration: line-through; color: #999; font-weight: 600; }
.leer .ghost { margin-left: auto; }
.empty {
  margin: 28px;
  color: var(--muted);
}

.labels { padding: 8px 26px 40px; overflow: auto; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
}
.swatch.on { border-color: var(--ink); }
.label-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.label-row b { flex: 1; }
.ghost { border: 0; background: transparent; color: #888; font-weight: 650; }

.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(32, 32, 32, 0.28);
  animation: fade 0.2s ease;
}
.sheet {
  width: min(480px, 100%);
  max-height: min(92dvh, 100%);
  overflow: auto;
  background: white;
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
  animation: rise 0.28s ease;
}
.sheet h2 { margin: 0 0 14px; letter-spacing: -0.04em; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.scrim { display: none; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes card { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes view-out { to { opacity: 0; } }
@keyframes view-in { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 899px) {
  .shell { grid-template-columns: 1fr; }
  .top { flex-direction: column; align-items: stretch; }
  .tools { flex-wrap: wrap; }
  .sidebar {
    position: fixed;
    z-index: 25;
    inset: 0 auto 0 0;
    width: min(84vw, 320px);
    transform: translateX(-105%);
    transition: transform 0.28s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 24; border: 0; background: rgba(0,0,0,0.25); }
  .menu-btn { display: inline-grid; place-items: center; }
  .top { padding: 14px 14px 4px; }
  .top h1 { font-size: 28px; }
  .fab {
    display: grid;
    place-items: center;
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 50%;
    background: var(--red);
    color: white;
    font-size: 30px;
    box-shadow: 0 10px 24px rgba(220, 76, 62, 0.35);
    z-index: 5;
  }
  .week-only { display: none; }
  .list { padding-bottom: 110px; }
}
@media (min-width: 900px) {
  body { padding: 14px; background: #e4e4e4; }
  .shell {
    height: calc(100dvh - 28px);
    border-radius: 16px;
    box-shadow: var(--shadow);
  }
  .phone-only { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.noscript { padding: 24px; }
