:root {
  --bg: #f6f4ef;
  --rail: #fffcf8;
  --ink: #1e1b16;
  --muted: #6e675f;
  --line: rgba(30, 27, 22, 0.08);
  --line-strong: rgba(30, 27, 22, 0.16);
  --amber: #1e1b16;
  --amber-deep: #1e1b16;
  --ink-on-amber: #f7f5f0;
  --now: #1d6a94;
  --bad: #b42318;
  --ok: #157a45;
  --cell: 32px;
  --gutter: 320px;
  --row: 72px;
  --font: "Fira Sans", "Segoe UI", sans-serif;
  --mono: "Fira Code", Consolas, monospace;
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  overflow: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 auto 0 0;
  width: 3px;
  background: #157a45;
  z-index: 30;
}

button, input, a { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.top, .tools {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 18px 8px 20px;
}
.tools { padding-top: 2px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 210px; }
.mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 13px;
  color: #157a45;
  background: linear-gradient(180deg, #f8fdf9 0%, #e6f5eb 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 0 0.5px rgba(21, 122, 69, 0.22),
    0 8px 16px rgba(21, 122, 69, 0.08);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.kicker {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.bookbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "apps add"
    "books add";
  align-items: start;
  row-gap: 10px;
  column-gap: 6px;
  min-width: 0;
}
.books, .chips, .apps {
  position: relative;
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  padding: 4px;
  border-radius: 16px;
  background: rgba(255, 252, 248, 0.76);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 0 0 1px rgba(30, 27, 22, 0.05);
  backdrop-filter: blur(14px);
}
.slide {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  border-radius: 12px;
  background: #fff;
  box-shadow:
    0 1px 1px rgba(30, 27, 22, 0.04),
    0 8px 18px rgba(30, 27, 22, 0.07);
  pointer-events: none;
  transition: transform 480ms var(--spring), width 480ms var(--spring), height 480ms var(--spring);
}
.add-book {
  grid-area: add;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #32302c 0%, #1e1b16 100%);
  color: #f7f5f0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 1px 1px rgba(30, 27, 22, 0.12),
    0 8px 16px rgba(30, 27, 22, 0.14);
  transition: transform 160ms var(--spring), box-shadow 180ms var(--spring);
}
.add-book:hover { transform: translateY(-1px); }
.add-book:active { transform: scale(0.94); }
.add-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 22px 10px;
}
.add-form[hidden] { display: none; }
.add-field { flex: 1; min-width: 220px; }
.add-apps {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.app-pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid rgba(30, 27, 22, 0.1);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, #fbfaf7 100%);
  color: var(--muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96), 0 1px 1px rgba(30, 27, 22, 0.04);
  transition: transform 160ms var(--spring), color 160ms var(--spring), border-color 160ms var(--spring), box-shadow 180ms var(--spring);
}
.app-pick:hover { color: var(--ink); transform: translateY(-1px); }
.app-pick:active { transform: scale(0.97); }
.app-pick.is-on {
  color: var(--ink);
  border-color: rgba(30, 27, 22, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 0 0 2px rgba(30, 27, 22, 0.05),
    0 8px 16px rgba(30, 27, 22, 0.06);
}
.app-pick .plate { width: 24px; height: 24px; flex-basis: 24px; border-radius: 7px; box-shadow: inset 0 1px 0 rgba(255,255,255,.96), 0 0 0 .5px rgba(30,27,22,.08), 0 4px 10px rgba(30,27,22,.05); }
.app-pick .app-logo { width: 14px; height: 14px; }
.app-pick .app-text { font-size: 13px; font-weight: 600; }
.add-form input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  padding: 0 12px;
  outline: none;
}
.add-form input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.add-form button {
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}
.add-form button[type="submit"] { background: var(--ink); color: var(--ink-on-amber); }
#add-error { margin: 0; color: var(--bad); font-size: 13px; }
#add-error:empty { display: none; }
.books button, .texty, .chips button, .apps button, .seg {
  min-height: 44px;
}
.book-item {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.books button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  padding: 0 13px;
  transition: color 180ms var(--spring), transform 160ms var(--spring);
}
.books .book-label {
  max-width: 180px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.book-app {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #fff 0%, #f6f3ed 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.96), 0 0 0 .5px rgba(30,27,22,.08), 0 4px 10px rgba(30,27,22,.05);
}
.book-app .app-logo { width: 14px; height: 14px; }
.book-del {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  transition: transform 160ms var(--spring), color 160ms var(--spring), border-color 160ms var(--spring);
  color: var(--muted);
  background: linear-gradient(180deg, #fff 0%, #f6f3ed 100%);
  border: 1px solid rgba(30, 27, 22, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 1px 1px rgba(30, 27, 22, 0.08);
}
.book-del:hover { color: var(--bad); }
.book-del:active { transform: scale(0.95); }
.book-meta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.book-more {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: color-mix(in srgb, var(--muted) 90%, white);
  background: linear-gradient(180deg, #fff 0%, #f6f3ed 100%);
  border: 1px solid rgba(30, 27, 22, 0.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.96), 0 1px 1px rgba(30,27,22,.08);
  transition: transform 160ms var(--spring), color 160ms var(--spring), border-color 160ms var(--spring);
}
.book-more:hover { color: var(--ink); }
.book-more:active { transform: scale(0.95); }
.book-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 20;
  min-width: 208px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 252, 248, 0.98);
  border: 1px solid rgba(30, 27, 22, 0.08);
  box-shadow:
    0 18px 38px rgba(30, 27, 22, 0.12),
    0 2px 4px rgba(30, 27, 22, 0.04),
    inset 0 1px 0 rgba(255,255,255,.94);
  backdrop-filter: blur(20px);
}
.book-menu[hidden] { display: none; }
.menu-title {
  margin: 0 0 8px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.menu-apps {
  display: grid;
  gap: 3px;
}
.menu-app {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 12px;
  color: var(--muted);
  transition: background 160ms var(--spring), color 160ms var(--spring), transform 160ms var(--spring);
}
.menu-app:hover { background: rgba(30, 27, 22, 0.05); color: var(--ink); }
.menu-app:active { transform: scale(0.98); }
.menu-app.is-on {
  background: linear-gradient(180deg, rgba(255,255,255,.94) 0%, rgba(246,243,237,.92) 100%);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.94), 0 0 0 1px rgba(30,27,22,.05);
}
.menu-app .plate {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 7px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.96), 0 0 0 .5px rgba(30,27,22,.08), 0 4px 10px rgba(30,27,22,.05);
}
.menu-app .app-logo {
  width: 14px;
  height: 14px;
  object-fit: contain;
  display: block;
}
.menu-sep {
  height: 1px;
  margin: 7px 0;
  background: rgba(30, 27, 22, 0.08);
}
.menu-danger {
  width: 100%;
  min-height: 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--bad);
  transition: background 160ms var(--spring), transform 160ms var(--spring);
}
.menu-danger:hover { background: rgba(180, 35, 24, 0.06); }
.menu-danger:active { transform: scale(0.98); }
.books button.is-on { color: var(--ink); }
.books button:hover { color: var(--ink); }
.books button:active { transform: scale(0.96); }

.apps,
.books {
  min-width: 0;
}
.apps {
  grid-area: apps;
  padding: 3px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.apps::-webkit-scrollbar { display: none; }
.books { grid-area: books; flex-wrap: nowrap; }
.apps button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  background: transparent;
  border: 0;
  border-radius: 12px;
  color: color-mix(in srgb, var(--muted) 88%, white);
  transition: color 180ms var(--spring), transform 160ms var(--spring);
}
.apps .app-logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
  display: block;
}
.apps .app-text {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.apps button.is-on { color: var(--ink); }
.apps button:hover { color: var(--ink); }
.apps button:hover .plate { transform: translateY(-1px); }
.apps button:active { transform: scale(0.96); }
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding: 4px 0 0;
}
.note { margin: 3px 0 0; color: color-mix(in srgb, var(--muted) 92%, white); font-size: 13px; white-space: nowrap; }
.texty {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 0;
  color: var(--ink);
  text-decoration: none;
  padding: 0 2px 0 0;
  border-radius: 12px;
  transition: transform 120ms ease-out;
}
.texty:hover { background: transparent; }
.texty:hover .plate { transform: translateY(-1px); }
.texty:active { transform: scale(0.97); }
.texty:active .plate { transform: none; }
.sync {
  margin: 0;
  min-width: 100px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: -0.02em;
  color: color-mix(in srgb, var(--muted) 88%, white);
}
.sync.is-ok { color: var(--ok); }
.sync.is-bad { color: var(--bad); }

.icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.plate {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 9px;
  background: linear-gradient(180deg, #fff 0%, #f6f3ed 100%);
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 0 0 0.5px rgba(30, 27, 22, 0.1),
    0 1px 1px rgba(30, 27, 22, 0.04),
    0 8px 16px rgba(30, 27, 22, 0.06);
  transition: transform 180ms var(--spring), box-shadow 180ms var(--spring);
}
.texty:hover .plate {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 0 0 0.5px rgba(30, 27, 22, 0.12),
    0 2px 4px rgba(30, 27, 22, 0.06),
    0 10px 18px rgba(30, 27, 22, 0.08);
}
#reload { --plate-a: #f5fbf7; --plate-b: #e4f4eb; --glyph: #157a45; }
#now-btn { --plate-a: #f5fafc; --plate-b: #e3f1f8; --glyph: #1d6a94; }
#now-btn [data-label] { font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -0.03em; }
#density { --plate-a: #fff; --plate-b: #f3efe8; --glyph: #5c564e; }
#sheet-link { --plate-a: #fff; --plate-b: #f3f1ec; --glyph: #1e1b16; }
#reload .plate,
#now-btn .plate,
#density .plate,
#sheet-link .plate {
  background: linear-gradient(180deg, var(--plate-a) 0%, var(--plate-b) 100%);
  color: var(--glyph);
}
.texty.is-busy .icon { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.search {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 13px;
  background: linear-gradient(180deg, #fff 0%, #fbfaf7 100%);
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 0 0 0.5px rgba(30, 27, 22, 0.1),
    0 6px 14px rgba(30, 27, 22, 0.05);
  transition: box-shadow 280ms var(--spring), color 180ms var(--spring);
}
.search input {
  width: 168px;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  outline: none;
  box-shadow: none;
}
.search input::placeholder { color: var(--muted); }
.search:focus-within {
  border-color: transparent;
  color: var(--ink);
  box-shadow: 0 0 0 4px rgba(30, 27, 22, 0.08);
}
.books button:focus-visible,
.texty:focus-visible,
.chips button:focus-visible,
.seg:focus-visible,
.hour:focus-visible,
.day:focus-visible,
.flag:focus-visible,
.size:focus-visible,
.board:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}
.chips button {
  position: relative;
  z-index: 1;
  background: transparent;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  padding: 0 12px;
  transition: color 180ms var(--spring), transform 160ms var(--spring);
}
.chips button.is-on { color: var(--ink); background: transparent; }
.chips button:hover, .chips button.is-on:hover { color: var(--ink); }
.chips button:active { transform: scale(0.96); }
.count { margin: 0; color: color-mix(in srgb, var(--muted) 88%, white); font-family: var(--mono); font-size: 12px; }
.tool-gap { flex: 1; }

.daymap[hidden] { display: none; }
.daymap-key {
  flex: 0 0 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  line-height: 14px;
}
.daymap-key .is-alt { color: var(--now); }
.daymap-hours {
  flex: 1;
  display: grid;
  gap: 3px;
}
.seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 4px 0;
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(30, 27, 22, 0.1);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 15px;
}
.seg-alt { color: var(--now); font-size: 11px; }
.seg:hover { background: #f3f0ea; }
.seg.is-now { background: #e7f2f8; color: var(--now); box-shadow: inset 0 0 0 1px #1d6a94; }

.board {
  flex: 1;
  min-height: 0;
  overflow: auto;
  outline: none;
}
.board:focus-visible { outline-offset: -3px; }
.ruler {
  position: sticky;
  top: 0;
  z-index: 5;
  width: max-content;
  min-width: 100%;
  background: var(--bg);
}
.line {
  display: grid;
  grid-template-columns: var(--gutter) repeat(var(--slots), var(--cell));
  width: max-content;
  min-width: 100%;
}
.line[hidden] { display: none; }
.gutter {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--rail);
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}
.ruler .gutter { z-index: 6; background: var(--bg); }
.ruler-gutter {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 1px;
  padding: 8px 12px 6px 18px;
}
.zone { font-family: var(--mono); font-size: 12px; line-height: 16px; letter-spacing: 0.08em; }
.zone-alt { color: var(--now); letter-spacing: 0.04em; }
.zone-min { color: var(--muted); font-size: 11px; line-height: 14px; letter-spacing: 0; }
.hour {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 10px 0 7px;
  border: 0;
  border-bottom: 1px solid rgba(30, 27, 22, 0.1);
  background: #fbfaf7;
  text-align: left;
  cursor: pointer;
}
.hour + .hour::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #d5cfc4;
}
.hlabel {
  padding-left: 8px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 16px;
  font-weight: 550;
  letter-spacing: -0.04em;
}
.halt {
  padding-left: 8px;
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 14px;
  color: #3d7ea3;
}
.hmins {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 6px;
  color: #9a9186;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 12px;
  letter-spacing: 0.04em;
  text-align: center;
}
.hmins span.is-now { position: relative; color: var(--now); font-weight: 600; }
.hmins span.is-now::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--now);
  box-shadow: 0 0 0 3px rgba(29, 106, 148, 0.16);
  animation: now-pulse 2.4s ease-out infinite;
}
@keyframes now-pulse {
  50% { box-shadow: 0 0 0 6px rgba(29, 106, 148, 0); }
}
.hour:hover { background: #f4f1eb; }
.hour.is-now { background: #f4f8fb; }
.hour.is-now .hlabel { color: var(--now); }
.hour.is-now::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 2px;
  background: var(--now);
}

.tour { --tone: #157a45; --tone-bright: #1f9d58; --on-tone: #f4fff8; }
.tour.tone-nlh { --tone: #157a45; --tone-bright: #1f9d58; --on-tone: #f4fff8; }
.tour.tone-nlh.is-hu { --tone: #0c4e2c; --tone-bright: #0c4e2c; }
.tour.tone-plo { --tone: #0e6f94; --tone-bright: #3aa3d4; --on-tone: #f4fbff; }
.tour.tone-plo.is-hu { --tone: #0b4e6a; --tone-bright: #15779a; }
.tour.tone-plo5 { --tone: #1e40af; --tone-bright: #2563eb; --on-tone: #f5f8ff; }
.tour.tone-plo5.is-hu { --tone: #1e3a8a; --tone-bright: #1e3a8a; }
.tour.tone-plo6 { --tone: #0f766e; --tone-bright: #0d9488; --on-tone: #f3fffd; }
.tour.tone-plo6.is-hu { --tone: #115e59; --tone-bright: #0f766e; }
.tour.tone-aof { --tone: #b42318; --tone-bright: #dc3b32; --on-tone: #fff7f6; }
.tour.tone-aof.is-hu { --tone: #7f1d1d; --tone-bright: #991b1b; }
.tour .gutter {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 16px;
  min-height: var(--row);
  background: color-mix(in srgb, var(--tone) 9%, var(--rail));
  box-shadow: inset 4px 0 0 var(--tone-bright);
}
.tour.is-hu .gutter { background: color-mix(in srgb, var(--tone) 18%, var(--rail)); }
.ring {
  position: relative;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
}
.ring svg { width: 46px; height: 46px; transform: rotate(-90deg); }
.ring-track, .ring-fill { fill: none; stroke-width: 2.4; }
.ring-track { stroke: #e4ddd2; }
.ring-fill {
  stroke: var(--tone);
  stroke-linecap: butt;
  transition: stroke-dashoffset 180ms ease;
}
.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  line-height: 1;
}
.ring-h { font-family: var(--mono); font-size: 14px; color: var(--muted); }
.ring-of { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.02em; }
.ring-h.is-long { font-size: 11px; }
.ring.is-live .ring-h { color: var(--ink); }
.ring.is-live .ring-fill { stroke-linecap: round; }
.who { min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.who-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.label { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.tag {
  flex: 0 0 auto;
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 550;
  line-height: 22px;
  letter-spacing: 0.01em;
}
.tag-type { background: var(--tone); color: var(--on-tone); }
.tag-limit {
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(30, 27, 22, 0.16);
}
.name {
  flex: 1;
  margin: 0;
  min-width: 0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.3;
  white-space: nowrap;
}
body.gutter-capped .name { white-space: normal; }
.idbit { flex: 0 0 auto; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.size {
  flex: 0 0 auto;
  min-width: 28px;
  height: 22px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  background: transparent;
  font-family: var(--mono);
  font-size: 13px;
}
.size { border-radius: 6px; }
.size:hover { border-color: var(--tone, var(--ink)); }
.size-edit, .slot-edit {
  width: 100%;
  height: 100%;
  min-height: 28px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: center;
  font-family: var(--mono);
  font-size: 14px;
  padding: 0;
  outline: 2px solid var(--ink);
}
.week { display: flex; align-items: center; gap: 2px; }
.day, .flag {
  min-width: 22px;
  height: 20px;
  min-height: 20px;
  padding: 0 4px;
  border: 0;
  border-radius: 5px;
  background: #ece7de;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 20px;
  transition: background 180ms var(--spring), color 180ms var(--spring), transform 160ms var(--spring);
}
.day:active, .flag:active, .size:active { transform: scale(0.94); }
.day.is-on, .flag.is-on {
  background: var(--tone);
  color: var(--on-tone);
}
.day:hover, .flag:hover { color: var(--ink); }
.day.is-on:hover, .flag.is-on:hover { color: var(--on-tone); }
.flag { letter-spacing: -0.03em; }

.slot {
  position: relative;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  min-height: 0;
  width: calc(100% - 6px);
  margin: 0 3px;
  border-radius: 8px;
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(30, 27, 22, 0.1);
  color: transparent;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}
.slot:hover { background: rgba(30, 27, 22, 0.04); }
.slot:nth-child(4n + 6)::before {
  content: "";
  position: absolute;
  left: -3px;
  top: -56px;
  bottom: -56px;
  width: 1px;
  background: #d5cfc4;
  pointer-events: none;
}
.slot.heat-1 { color: #3a3122; background: #f3ead4; box-shadow: none; }
.slot.heat-1:hover { background: #eadfc4; }
.slot.heat-2 { color: #2c220c; background: #efc56a; box-shadow: none; }
.slot.heat-2:hover { background: #e6b84e; }
.slot.heat-3 { color: #fff8ef; background: #a65610; box-shadow: none; }
.slot.heat-3:hover { background: #944c0e; }
.slot.heat-4 { color: #fff8ef; background: #6b3414; box-shadow: none; }
.slot.heat-4:hover { background: #5c2c10; }
.slot.is-zero {
  color: #8a8178;
  background: transparent;
  box-shadow: inset 0 0 0 1px #d5cec3;
}
.slot.is-range { outline: 1.5px solid var(--ink); outline-offset: 1px; }
.slot.is-on { outline: 2px solid var(--ink); outline-offset: 1px; }
.slot.is-now { box-shadow: inset 0 -2px 0 var(--now); }
.slot.is-now::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -64px;
  bottom: -64px;
  width: 2px;
  transform: translateX(-1px);
  border-radius: 1px;
  background: var(--now);
  pointer-events: none;
  z-index: 2;
}
.slot.is-zero.is-now { box-shadow: inset 0 0 0 1px #d5cec3, inset 0 -2px 0 var(--now); }

.loading, .empty { margin: 0; padding: 36px 22px; color: var(--muted); }
.foot {
  display: flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 18px 6px 22px;
  border-top: 1px solid var(--line);
}
.foot:has(#selection:empty) { display: none; }
.foot p { margin: 0; }
#selection { color: var(--muted); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
::selection { background: #d7eadc; color: #10281a; }

@media (max-width: 980px) {
  .top, .tools { flex-wrap: wrap; }
  .top-actions { margin-left: 0; width: 100%; }
  .note { max-width: none; }
  :root { --row: 72px; }
}
@media (pointer: coarse) {
  :root { --cell: 36px; --row: 64px; }
  .day, .flag { min-width: 28px; min-height: 32px; height: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
body[data-density="tight"] {
  --cell: 28px;
  --row: 68px;
}

/* RandomEco planning workspace */
:root {
  --bg: #f4f7f6;
  --rail: #fff;
  --ink: #182d2a;
  --muted: #526863;
  --line: #dce5e1;
  --now: #006a6a;
  --font: "Segoe UI", Arial, sans-serif;
  --mono: Consolas, monospace;
}
body::before { display: none; }
.top {
  display: grid;
  grid-template-columns: minmax(205px, .8fr) minmax(240px, 2fr) auto;
  padding: 20px clamp(14px, 2vw, 36px);
  background: #123c38;
  color: #f5faf7;
  border-bottom: 3px solid #a3d8ad;
}
.mark {
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 15px 15px 15px 4px;
  background: #c9efb9; color: #163e36; box-shadow: none;
  font: 750 28px/1 var(--font); letter-spacing: -.12em;
}
.mark span { align-self: center; transform: translateY(3px); }
.kicker { font-size: 10px; color: #bbdace; font-weight: 700; letter-spacing: .2em; }
h1 { font-size: clamp(23px, 2vw, 32px); font-weight: 650; }
.note { color: #c8ded6; white-space: normal; }
.bookbar { color: var(--ink); }
.apps, .books, .chips { border-radius: 10px; background: #eaf0ed; box-shadow: none; backdrop-filter: none; }
.slide { border-radius: 7px; box-shadow: 0 1px 4px #123c3826; }
.top-actions { flex-wrap: wrap; justify-content: flex-end; max-width: 300px; }
.top-actions .texty, .top-actions .sync { color: #e6f1eb; }
.top-actions .sync.is-bad { color: #ffc6ac; }
.top-actions .sync.is-ok { color: #bde9b7; }
#retry { border: 1px solid #ffd6be; border-radius: 6px; background: #fff1e7; color: #742d16; }
.plate { background: #edf4ef; box-shadow: none; border-radius: 7px; }
.tools { background: white; border-bottom: 1px solid var(--line); padding: 12px clamp(14px,2vw,36px); gap: 12px; }
.search { border-radius: 8px; box-shadow: inset 0 0 0 1px #cddbd4; background: #f8faf9; }
.tour .gutter, .tour.is-hu .gutter { background: #fff; border-left: 3px solid var(--tone); }
.tag-type { background: color-mix(in srgb,var(--tone) 10%,white); color: var(--tone); }
.slot { font-variant-numeric: tabular-nums; font-weight: 600; }
.slot.heat-1, .slot.heat-1:hover { background: #dfefe8; color: #254c40; }
.slot.heat-2, .slot.heat-2:hover { background: #acd8c5; color: #133d30; }
.slot.heat-3, .slot.heat-3:hover { background: #3d8274; color: #fff; }
.slot.heat-4, .slot.heat-4:hover { background: #194e47; color: #fff; }
.slot[class*="heat-"]:hover { filter: brightness(.94); }
.slot.is-on { outline-color: #1753a5; }
@media (max-width: 980px) {
  .top { grid-template-columns: minmax(180px,1fr) auto; gap: 10px; padding: 10px 14px; }
  .bookbar { grid-area: 2 / 1 / 3 / -1; }
  .top-actions { width: auto; }
}
@media (max-width: 600px) {
  .brand { min-width: 0; }
  .top { grid-template-columns: minmax(0,1fr) auto; }
  .top-actions { max-width: 140px; gap: 3px; }
  .top-actions .texty { font-size: 0; }
  .top-actions .sync { font-size: 11px; }
  .tools { gap: 6px; padding: 7px 10px; }
  .chips { max-width: 100%; }
  .ring { display: none; }
  .week { overflow-x: auto; }
}
.books { flex-wrap: wrap; min-width: 0; gap: 2px; }
.books .slide { display: none; }
.books button.is-on { background: white; border-radius: 7px; box-shadow: 0 1px 3px #143a3422; }
@media (max-width: 600px) {
  .top, .tools, .daymap { flex-shrink: 0; }
  .books { flex-wrap: nowrap; overflow-x: auto; }
  .bookbar:has(.book-menu:not([hidden])) .books { flex-wrap: wrap; overflow: visible; }
}

.unsaved { border: 2px dashed #a93e20 !important; }
