:root {
  color-scheme: light;
  --background: #fbf8f3;
  --paper: #fffefb;
  --ink: #27231f;
  --muted: #655e55;
  --line: #e9e2d8;
  --pink: #f6c1cf;
  --yellow: #fff0b6;
  --radius: 25px;
  font-family: "Trebuchet MS", "Aptos", system-ui, sans-serif;
  color: var(--ink);
  background: var(--background);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #793e75;
  outline-offset: 3px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.25rem, 5vw, 3.9rem); line-height: 1.02; letter-spacing: -.065em; overflow-wrap: anywhere; }
h2 { font-size: clamp(1.25rem, 2.5vw, 1.65rem); letter-spacing: -.035em; }
.muted { color: var(--muted); }

.button {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 13px;
  border: 1px solid transparent;
  font-weight: 700;
  line-height: 1.2;
}
.button:disabled { opacity: .57; }
.button.primary { background: var(--ink); color: #fffefb; }
.button.primary:hover:not(:disabled) { background: #493831; }
.button.secondary { background: var(--paper); border-color: var(--line); }
.button.secondary:hover:not(:disabled) { background: #f8ede4; }
.button > span:first-child { flex-shrink: 0; }
.button .start-caption { flex-shrink: 1; }
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  font-size: 1.25rem;
  line-height: 1;
}
.icon-button:hover { background: #f4e7de; }
.plus { background: #f8eee4; }

.workspace { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 30px;
  height: 100vh;
  padding: 28px 19px 21px;
  background: var(--paper);
  border-right: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -.045em;
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  position: relative;
  display: inline-block;
  border-radius: 13px;
  background: var(--pink);
}
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: #3d292f; }
.brand-mark::before { width: 19px; height: 7px; top: 15px; left: 10px; border-radius: 50%; transform: rotate(45deg); }
.brand-mark::after { width: 7px; height: 19px; top: 9px; left: 16px; border-radius: 50%; transform: rotate(45deg); }
.navigation { display: grid; gap: 5px; }
.navigation button, .logout-button, .project-list button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 12px;
}
.navigation button, .logout-button {
  display: flex;
  align-items: center;
  min-height: 41px;
  gap: 11px;
  padding: 9px 11px;
  font-weight: 700;
}
.navigation button:hover, .logout-button:hover, .project-list button:hover { background: #faf1e9; }
.navigation button[aria-current] { background: #f8e5dc; }
.nav-icon { width: 16px; height: 16px; flex: 0 0 16px; }
.grid-icon {
  background: linear-gradient(var(--ink) 0 0) left top / 6px 6px,
    linear-gradient(var(--ink) 0 0) right top / 6px 6px,
    linear-gradient(var(--ink) 0 0) left bottom / 6px 6px,
    linear-gradient(var(--ink) 0 0) right bottom / 6px 6px;
  background-repeat: no-repeat;
  border-radius: 2px;
}
.bars-icon {
  background: linear-gradient(var(--ink) 0 0) left bottom / 3px 6px,
    linear-gradient(var(--ink) 0 0) center bottom / 3px 11px,
    linear-gradient(var(--ink) 0 0) right bottom / 3px 16px;
  background-repeat: no-repeat;
}
.sidebar-projects { min-height: 0; display: flex; flex-direction: column; }
.sidebar-caption { display: flex; align-items: center; justify-content: space-between; padding-left: 10px; gap: 8px; }
.sidebar-caption h2 { color: var(--muted); font-size: .82rem; letter-spacing: 0; }
.project-list, .history-list, .stats-project-list { margin: 0; list-style: none; padding: 0; }
.project-list { margin-top: 7px; overflow-y: auto; }
.project-list button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  overflow-wrap: anywhere;
  color: var(--muted);
}
.project-list button[aria-current] { color: var(--ink); font-weight: 700; }
.project-list button::before { content: ""; width: 8px; height: 8px; border: 1px solid #ad877c; border-radius: 50%; flex: 0 0 8px; }
.project-list button[aria-current]::before { background: #ad6174; border-color: #ad6174; }
.logout-button { margin-top: auto; color: var(--muted); }
.logout-button span { font-size: 1.3rem; line-height: 1; }

.main { width: 100%; max-width: 1360px; padding: 35px clamp(22px, 4vw, 62px) 65px; margin-inline: auto; }
.toolbar { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 15px; }
.project-select-label { min-width: 0; width: min(260px, 57%); }
.toolbar select { padding-block: 8px; min-height: 43px; }
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  min-height: 245px;
  padding: clamp(24px, 5vw, 54px);
  border-radius: 34px 34px 53px 34px;
  background: var(--yellow);
}
.hero-content { width: 68%; z-index: 1; }
.hero-content > p { margin: 15px 0 22px; max-width: 31ch; color: #514739; line-height: 1.55; }
.hero-metrics { display: flex; flex-wrap: wrap; gap: 14px 40px; margin-top: 23px; }
.hero-metrics > div { display: grid; gap: 4px; }
.hero-metrics span { color: #5f5343; font-size: .83rem; }
.hero-metrics strong { font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.clock-art { position: absolute; width: 260px; height: 226px; right: 3%; top: 50%; transform: translateY(-50%); pointer-events: none; }
.clock-art span { position: absolute; display: block; }
.art-orbit { width: 206px; height: 103px; bottom: 29px; right: 10px; border: 2px solid #a68458; border-radius: 50%; transform: rotate(-24deg); }
.art-clock {
  width: 136px;
  height: 142px;
  left: 57px;
  top: 34px;
  background: #ee99af;
  border: 1px solid #ad6174;
  border-radius: 49% 51% 43% 57% / 51% 48% 52% 49%;
  transform: rotate(12deg);
  box-shadow: 0 9px 0 #d47f98;
}
.art-clock::before { content: ""; position: absolute; inset: 12px; border-radius: 46% 54% 44% 56%; background: #fff2d8; border: 1px solid #ad6174; }
.art-clock::after {
  content: "";
  position: absolute;
  left: 65px;
  top: 38px;
  width: 31px;
  height: 38px;
  border-bottom: 5px solid #603d46;
  border-left: 5px solid #603d46;
  border-radius: 4px;
  transform: rotate(-18deg);
  transform-origin: 2px 36px;
}
.art-star { left: 9px; top: 38px; width: 55px; height: 59px; background: #c3b4ec; transform: rotate(-17deg); clip-path: polygon(50% 0%, 66% 34%, 100% 50%, 66% 66%, 50% 100%, 34% 66%, 0 50%, 34% 34%); }
.art-bean { top: 48px; right: 12px; width: 43px; height: 31px; background: #bdcea2; border: 1px solid #8d9e75; border-radius: 58% 42% 64% 36%; transform: rotate(24deg); }

.section { margin-top: 34px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.stage-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.stage-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  min-height: 220px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  --tone: #f7d1db;
}
.stage-card:nth-child(4n + 2) { --tone: #fbe8ae; }
.stage-card:nth-child(4n + 3) { --tone: #e2d9f7; }
.stage-card:nth-child(4n + 4) { --tone: #dce7c8; }
.stage-card.is-active { border-color: #9b5267; box-shadow: inset 0 0 0 1px #9b5267; }
.stage-card-top { display: flex; align-items: start; justify-content: space-between; margin-bottom: 4px; }
.stage-symbol { position: relative; display: grid; place-items: center; width: 43px; height: 43px; border-radius: 13px 16px 17px 12px; background: var(--tone); }
.stage-symbol::after { content: ""; width: 20px; height: 18px; border: 2px solid #594941; border-radius: 47% 53% 39% 61%; transform: rotate(-17deg); }
.stage-card:nth-child(4n + 2) .stage-symbol::after { border-radius: 8px 12px 12px 8px; transform: rotate(25deg); }
.stage-card:nth-child(4n + 3) .stage-symbol::after { width: 16px; height: 16px; border-radius: 4px; transform: rotate(45deg); }
.stage-card:nth-child(4n + 4) .stage-symbol::after { width: 23px; height: 12px; transform: rotate(-32deg); }
.stage-card h3 { font-size: 1rem; line-height: 1.25; overflow-wrap: anywhere; }
.stage-total { font-size: 1.47rem; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.stage-average { font-size: .8rem; margin-bottom: 7px; }
.stage-start { width: 100%; margin-top: auto; background: var(--tone); font-size: .88rem; }
.stage-start:hover:not(:disabled) { filter: brightness(.96); }
.stage-card.is-active .stage-start { opacity: 1; }
.play-icon { width: 0; height: 0; border-block: 5px solid transparent; border-left: 8px solid currentColor; }
.is-active .play-icon, .stop-icon { width: 9px; height: 9px; border: 0; border-radius: 2px; background: currentColor; }
.empty-block { padding: 21px; border: 1px dashed #d8ccbd; border-radius: 17px; color: var(--muted); }

.active-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 17px;
  padding: 13px 15px;
  margin-bottom: 15px;
  border-radius: 19px;
  border: 1px solid #e7b3c1;
  background: #fae5eb;
}
.active-label { display: flex; align-items: center; gap: 10px; flex: 1 1 145px; min-width: 0; overflow-wrap: anywhere; }
.active-label p:first-child { font-weight: 800; }
.active-label .muted { font-size: .82rem; margin-top: 2px; }
.active-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: #a84562; box-shadow: 0 0 0 4px #f3c8d4; margin-left: 4px; }
.clock-value { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.2rem; white-space: nowrap; }
.notice { margin-bottom: 13px; padding: 12px 15px; background: #f8e5e0; border-radius: 12px; }
#load-state { padding: 12px 0; }

.history-list, .stats-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.history-list:empty { display: none; }
.history-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 9px 16px; align-items: center; padding: 13px 17px; }
.history-row + .history-row { border-top: 1px solid var(--line); }
.history-title { font-weight: 700; overflow-wrap: anywhere; }
.history-detail { color: var(--muted); font-size: .83rem; line-height: 1.4; margin-top: 3px; }
.history-total { font-weight: 800; font-variant-numeric: tabular-nums; }
.history-edit { justify-self: end; padding: 6px 10px; min-height: 35px; font-size: .82rem; }
.history-delivery { color: var(--muted); font-size: .77rem; grid-column: 1 / -1; }
.history-delivery.needs-attention { color: #8b344d; }

.stats-view > h1 { margin-bottom: 23px; }
.stats-grid { display: grid; grid-template-columns: minmax(190px, .8fr) minmax(0, 1.5fr); gap: 16px; align-items: start; }
.stats-card { padding: 20px; min-width: 0; }
.stats-card > .muted { margin: 8px 0 12px; font-size: .86rem; }
.stats-project-list li { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.stats-project-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.stats-project-list strong { flex-shrink: 0; }
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
th, td { text-align: left; padding: 10px 5px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
th { font-size: .75rem; color: var(--muted); }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { text-align: right; padding-right: 0; }
tbody tr:last-child td { border-bottom: 0; }

dialog {
  width: min(480px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  border: 1px solid var(--line);
  border-radius: 23px;
  padding: 22px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 20px 70px #33241940;
}
dialog::backdrop { background: #31241c70; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 15px; }
#editor-fields, #login-form { display: grid; gap: 13px; }
#editor-fields p { line-height: 1.45; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 17px; }
label { display: grid; gap: 5px; font-size: .84rem; font-weight: 700; }
input, select { display: block; min-width: 0; width: 100%; min-height: 41px; border: 1px solid #d8ccbe; border-radius: 11px; padding: 8px 10px; background: #fffefa; color: var(--ink); }
input:disabled { background: #f0eae2; }
.form-error { color: #8b344d; font-size: .86rem; margin-top: 6px; }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-shell { display: grid; grid-template-columns: 1fr .85fr; width: min(820px, 100%); min-height: 490px; border: 1px solid var(--line); border-radius: 33px; overflow: hidden; background: var(--paper); }
.login-panel { display: flex; flex-direction: column; justify-content: space-between; gap: 35px; padding: clamp(22px, 5vw, 49px); }
.login-content { margin-block: auto; }
.login-content h1 { margin-bottom: 22px; font-size: clamp(2rem, 5vw, 3rem); }
.login-content button { margin-top: 6px; }
.login-illustration { background: var(--yellow); position: relative; overflow: hidden; }
.login-illustration .clock-art { right: 50%; transform: translate(50%, -50%) scale(1.13); }

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 201px minmax(0, 1fr); }
  .main { padding-inline: 26px; }
  .stage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid { grid-template-columns: 1fr; }
}
@media (max-width: 740px) {
  .workspace { display: block; }
  .sidebar { height: auto; position: static; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 13px 17px; border-right: 0; border-bottom: 1px solid var(--line); }
  .navigation { grid-row: 2; grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .logout-button { grid-column: 2; grid-row: 1; font-size: .84rem; padding-inline: 6px; }
  .sidebar-projects { display: none; }
  .main { padding: 19px 17px 40px; }
  .hero { min-height: 205px; border-radius: 24px 24px 39px 24px; }
  .hero .clock-art { transform: translateY(-47%) scale(.74); transform-origin: right center; right: 0; }
  .hero-content { width: 73%; }
}
@media (max-width: 480px) {
  .main { padding-inline: 12px; }
  .hero { min-height: 191px; padding: 20px; }
  h1 { font-size: 2.06rem; }
  .hero .clock-art { transform: translateY(-47%) scale(.46); right: -3px; opacity: .86; }
  .hero-content { width: 77%; }
  .hero-metrics { gap: 11px 16px; }
  .hero-metrics strong { font-size: 1.33rem; }
  .hero-content > p { font-size: .9rem; }
  .stage-grid { gap: 8px; }
  .stage-card { padding: 11px; border-radius: 17px; min-height: 206px; }
  .stage-card h3 { font-size: .93rem; }
  .stage-start { font-size: .77rem; padding: 7px 5px; gap: 5px; }
  .stage-total { font-size: 1.24rem; }
  .stage-average { font-size: .75rem; }
  .button.secondary { font-size: .8rem; padding-inline: 8px; }
  .history-row { gap: 8px; padding: 12px; grid-template-columns: minmax(0, 1fr) auto; }
  .history-edit { grid-column: 1; justify-self: start; }
  .login-shell { grid-template-columns: 1fr; min-height: 0; }
  .login-panel { padding: 23px; }
  .login-illustration { display: none; }
}
