:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --panel: #ffffff;
  --panel-soft: #f0f7f4;
  --ink: #17231f;
  --muted: #66736d;
  --line: #d8dfd9;
  --primary: #116b5b;
  --primary-deep: #0d4f45;
  --primary-soft: #e0f2eb;
  --accent: #d85c49;
  --accent-soft: #fff0ec;
  --gold: #c79b2c;
  --shadow: 0 18px 55px rgba(26, 42, 36, 0.10);
  --radius: 8px;
  --focus: 0 0 0 4px rgba(17, 107, 91, 0.22);
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
}

body {
  margin: 0;
  min-height: 100vh;
  font-size: 17px;
  line-height: 1.45;
}

button,
input {
  font: inherit;
  max-width: 100%;
}

button {
  cursor: pointer;
  min-width: 0;
}

.app-shell {
  min-height: 100vh;
  padding: clamp(16px, 3vw, 36px);
}

.topbar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  max-width: 820px;
  margin: 0 auto 24px;
}

.brand,
.top-summary {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  position: relative;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border: 4px solid var(--primary);
  border-radius: 50%;
  background: var(--panel);
  box-shadow: inset 0 0 0 7px var(--primary-soft);
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  content: "";
  left: 50%;
  top: 50%;
  width: 4px;
  border-radius: 999px;
  background: var(--primary-deep);
  transform-origin: 50% 0;
}

.brand-mark::before {
  height: 16px;
  transform: translate(-50%, 0) rotate(0deg);
}

.brand-mark::after {
  height: 18px;
  transform: translate(-50%, 0) rotate(90deg);
}

.clock-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.02;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  line-height: 1.1;
}

h3 {
  margin-bottom: 0;
  font-size: 1.15rem;
}

.top-summary {
  min-width: 190px;
  justify-content: center;
  flex-direction: column;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: center;
}

.top-summary span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.top-summary strong {
  font-size: 1.75rem;
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 22px;
  max-width: 820px;
  margin: 0 auto;
}

.topbar,
.brand,
.workspace,
.work-panel,
.entry-panel,
.overview-panel,
.field-block,
.step-section,
.form-grid,
.field,
.month-field,
.time-block,
.date-info,
.time-total,
.duration-preview {
  min-width: 0;
}

.work-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.entry-panel {
  padding: clamp(18px, 3vw, 28px);
}

.overview-panel {
  padding: clamp(18px, 3vw, 28px);
}

.overview-summary {
  display: flex;
  align-items: center;
  min-height: 58px;
  color: var(--primary-deep);
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
}

.overview-content {
  padding-top: 16px;
}

.panel-heading,
.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.overview-heading {
  align-items: flex-start;
}

.field-block {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.field span,
.month-field span {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-weight: 800;
}

.field-block legend,
.step-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--ink);
  font-weight: 900;
}

.step-title {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.step-section.is-locked {
  display: none;
}

.step-next {
  width: 100%;
  min-height: 58px;
  margin-top: 16px;
  font-size: 1.08rem;
}

.step-actions {
  display: grid;
  grid-template-columns: minmax(110px, 0.85fr) minmax(160px, 1.15fr);
  gap: 10px;
  margin-top: 16px;
}

.step-actions .button {
  width: 100%;
}

.step-actions .step-next,
.step-actions .save-button {
  margin-top: 0;
}

.step-number {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
}

.child-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 50px;
}

.child-pill {
  position: relative;
}

.child-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.child-pill span {
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  padding: 12px 15px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
}

.child-pill span::before {
  content: "";
  width: 12px;
  height: 12px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--child-color, var(--primary));
}

.child-pill input:checked + span {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.child-pill input:focus-visible + span,
.button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.name-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  min-height: 52px;
}

.name-suggestions:empty {
  display: none;
  min-height: 0;
  margin-top: 0;
}

.suggestion-button {
  min-height: 52px;
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.suggestion-button::before {
  content: "";
  width: 12px;
  height: 12px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--child-color, var(--primary));
}

input {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  inline-size: 100%;
  max-inline-size: 100%;
  min-height: 54px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  padding: 12px 14px;
}

input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  min-inline-size: 0;
}

input[type="time"]::-webkit-date-and-time-value {
  min-width: 0;
  text-align: left;
}

input[type="time"]::-webkit-datetime-edit,
input[type="time"]::-webkit-datetime-edit-fields-wrapper {
  min-width: 0;
}

input:hover {
  border-color: #b8c4bd;
}

.field {
  display: block;
  min-width: 0;
}

.form-grid {
  display: grid;
  gap: 14px;
  margin: 0 0 14px;
}

.date-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.time-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.time-blocks {
  display: grid;
  gap: 12px;
}

.time-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.time-block-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  font-weight: 900;
}

.time-block-heading span {
  color: var(--primary-deep);
}

.time-duration {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--primary-deep);
  font-weight: 900;
}

.add-time-button {
  width: 100%;
  margin-top: 14px;
  min-height: 54px;
}

.time-total {
  margin-top: 12px;
  padding: 14px 16px;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-size: 1.1rem;
  font-weight: 900;
}

.shortcut-row,
.toolbar,
.month-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.shortcut-row {
  margin-top: 8px;
}

.quick-date {
  margin-top: 14px;
}

.date-info {
  margin-top: 12px;
  padding: 14px 16px;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-size: 1.1rem;
  font-weight: 900;
}

.quick-date > span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 800;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 10px 15px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.button.primary {
  background: var(--primary);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--primary-deep);
}

.button.secondary {
  border-color: var(--primary);
  color: var(--primary-deep);
}

.button.subtle,
.button.chip,
.button.icon-button {
  border-color: var(--line);
  background: var(--panel);
}

.button.chip:hover,
.button.subtle:hover,
.button.icon-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.button.danger {
  border-color: #efb3a8;
  background: var(--accent-soft);
  color: #8e2d20;
}

.icon-button {
  width: 52px;
  padding-inline: 0;
  font-size: 1.25rem;
}

.save-button {
  width: 100%;
  margin-top: 16px;
  min-height: 58px;
  font-size: 1.08rem;
}

.duration-preview {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  margin-top: 16px;
  padding: 16px;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, var(--panel-soft));
}

.duration-preview span,
.duration-preview small {
  color: var(--muted);
  font-weight: 700;
}

.duration-preview strong {
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1;
}

.field-message,
.form-error {
  min-height: 1.4em;
  margin: 8px 0 0;
  color: #8e2d20;
  font-weight: 700;
}

.child-manager {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.child-manager summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  width: max-content;
  color: var(--primary-deep);
  font-weight: 800;
  cursor: pointer;
}

.child-manager-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.child-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.month-controls {
  display: grid;
  grid-template-columns: auto minmax(190px, 1fr) auto auto;
  align-items: end;
  margin-bottom: 18px;
}

.month-field input {
  min-width: 0;
}

.totals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.total-card {
  min-height: 98px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 7px solid var(--total-color, var(--primary));
  border-radius: var(--radius);
  background: #ffffff;
}

.total-card.total-all {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.total-card span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.total-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.65rem;
  line-height: 1;
}

.list-heading {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.list-heading span {
  color: var(--muted);
  font-weight: 800;
}

.entry-list {
  display: grid;
  gap: 12px;
}

.entry-card {
  display: grid;
  grid-template-columns: minmax(82px, auto) minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.entry-date {
  display: grid;
  place-items: center;
  min-height: 74px;
  padding: 9px;
  border-radius: var(--radius);
  background: var(--panel-soft);
  text-align: center;
}

.entry-date strong {
  font-size: 1.75rem;
  line-height: 1;
}

.entry-date span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.entry-main {
  min-width: 0;
}

.entry-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-weight: 900;
}

.entry-child::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--child-color, var(--primary));
}

.entry-time {
  color: var(--ink);
  font-weight: 800;
}

.entry-note {
  overflow-wrap: anywhere;
  margin-top: 4px;
  color: var(--muted);
}

.entry-total {
  min-width: 92px;
  text-align: right;
}

.entry-total strong {
  display: block;
  font-size: 1.45rem;
}

.entry-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 9px;
}

.entry-actions .button {
  min-height: 42px;
  padding: 8px 11px;
  font-size: 0.95rem;
}

.empty-state {
  display: grid;
  gap: 4px;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 10;
  max-width: min(92vw, 440px);
  padding: 13px 18px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #ffffff;
  font-weight: 800;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .topbar,
  .workspace {
    max-width: 720px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .entry-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .app-shell {
    padding: 12px;
  }

  .topbar {
    flex-direction: column;
  }

  .top-summary {
    min-width: 0;
  }

  .brand-mark {
    width: 52px;
    height: 52px;
  }

  .panel-heading,
  .overview-heading,
  .list-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar,
  .shortcut-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .form-grid,
  .month-controls {
    grid-template-columns: 1fr;
  }

  .entry-panel,
  .overview-panel {
    padding: 16px;
  }

  .time-block {
    padding: 10px;
  }

  .step-actions {
    grid-template-columns: 1fr;
  }

  .icon-button,
  .this-month,
  .toolbar .button {
    width: 100%;
  }

  .entry-card {
    grid-template-columns: 1fr;
  }

  .entry-date {
    grid-template-columns: auto 1fr;
    place-items: center start;
    column-gap: 10px;
    min-height: 58px;
    text-align: left;
  }

  .entry-total {
    text-align: left;
  }

  .entry-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 380px) {
  .app-shell {
    padding: 10px;
  }

  .entry-panel,
  .overview-panel {
    padding: 14px;
  }

  .time-block {
    padding: 8px;
  }

  .toolbar,
  .shortcut-row,
  .entry-actions {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 1.85rem;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .app-shell {
    padding: 0;
  }

  .entry-panel,
  .toolbar,
  .month-controls,
  .top-summary,
  .toast,
  .entry-actions,
  .child-manager {
    display: none !important;
  }

  .topbar,
  .workspace {
    display: block;
    max-width: none;
  }

  .overview-panel {
    border: 0;
    box-shadow: none;
  }

  .entry-card,
  .total-card {
    break-inside: avoid;
  }
}
