:root {
  color-scheme: light;
  --app-width: 30rem;
  --gutter: clamp(1rem, 5vw, 1.5rem);
  --canvas: #f2f2f7;
  --surface: #fff;
  --ink: #161923;
  --muted: #52627a;
  --line: #e2e8f1;
  --control-line: #8190a6;
  --blue: #125bdb;
  --blue-deep: #1743c4;
  --blue-soft: #eaf0ff;
  --navy: #0e244c;
  --success: #166a4e;
  --danger: #a12836;
  --danger-soft: #fff0f1;
  --radius: 1.25rem;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  touch-action: pan-x pan-y;
  min-width: 0;
  color: var(--ink);
  background: var(--canvas);
  font-size: 1rem;
  line-height: 1.5;
}

h1, h2, h3, p {
  margin: 0;
}

button, input, textarea, select {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

svg {
  display: block;
  flex: none;
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.symbol-library {
  position: absolute;
  overflow: hidden;
}

input, textarea, select {
  min-width: 0;
  max-width: 100%;
  min-height: 3rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--control-line);
  border-radius: 0.625rem;
  background: var(--surface);
  color: var(--ink);
}

input[type="date"], input[type="time"] {
  display: block;
  width: 100%;
  appearance: none;
  font-variant-numeric: tabular-nums;
}

textarea {
  display: block;
  width: 100%;
  min-height: 5rem;
  resize: vertical;
}

input::placeholder, textarea::placeholder {
  color: var(--muted);
}

.app-shell {
  width: 100%;
  max-width: var(--app-width);
  min-height: 100vh;
  min-height: 100dvh;
  margin-inline: auto;
  background: var(--canvas);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: max(1rem, env(safe-area-inset-top, 0px)) var(--gutter) 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 1.125rem;
  font-weight: 760;
  letter-spacing: -0.035em;
}

.brand-icon, .shortcut-icon {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  place-items: center;
  border-radius: 0.75rem;
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.brand-icon {
  background: var(--blue);
  color: #fff;
}

.icon-button {
  display: inline-grid;
  width: 2.75rem;
  height: 2.75rem;
  flex: none;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--surface);
  color: var(--muted);
}

.icon-button:active, .text-button:active {
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.icon-button:disabled {
  opacity: 0.5;
}

main {
  padding: 0 var(--gutter) calc(5.5rem + var(--safe-bottom));
}

.page-heading {
  margin: 0.5rem 0 1.125rem;
}

.eyebrow {
  margin-bottom: 0.25rem;
  color: var(--blue-deep);
  font-size: 0.75rem;
  font-weight: 760;
  letter-spacing: 0.095em;
  text-transform: uppercase;
}

h1, h2, h3 {
  color: var(--ink);
  font-weight: 760;
  letter-spacing: -0.033em;
  line-height: 1.18;
}

h1 {
  font-size: clamp(2rem, 8vw, 2.375rem);
  letter-spacing: -0.045em;
}

h2 {
  font-size: 1.1875rem;
}

h3 {
  font-size: 1rem;
}

.bottom-nav {
  position: fixed;
  z-index: 5;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  width: min(100%, var(--app-width));
  margin-inline: auto;
  padding: 0.5rem var(--gutter) calc(0.5rem + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: rgb(255 255 255 / 92%);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.bottom-nav button {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.1875rem;
  min-height: 3rem;
  padding: 0.375rem 0.5rem;
  border: 0;
  border-radius: 0.75rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.25;
}

.bottom-nav button[aria-current="page"] {
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  min-height: 10.375rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--navy) 22%, #173e85 100%);
  color: #fff;
}

.hero .hero-art {
  position: absolute;
  z-index: -1;
  top: 50%;
  right: -0.625rem;
  width: clamp(7rem, 36vw, 11.25rem);
  height: auto;
  transform: translateY(-50%);
  color: #6698f6;
  opacity: 0.62;
  pointer-events: none;
}

.hero-label {
  color: #e1ebff;
  font-size: 0.875rem;
  font-weight: 650;
}

.hero-day-total {
  margin: 0.25rem 0 0.625rem;
  font-size: 0.875rem;
  color: #e0eaff;
}

.hero-day-total strong {
  margin-inline-start: 0.375rem;
  font-variant-numeric: tabular-nums;
}

.hero-total {
  margin: 0.125rem 0 0.625rem;
  font-size: clamp(2.0625rem, 10vw, 2.8125rem);
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  letter-spacing: -0.065em;
  line-height: 1.14;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 1.625rem;
  padding: 0.125rem 0.625rem;
  border: 1px solid #c0d4ff40;
  border-radius: 1rem;
  background: #142e57;
  color: #e1ebff;
  font-size: 0.75rem;
  font-weight: 650;
}

.status-pill::before {
  width: 0.375rem;
  height: 0.375rem;
  flex: none;
  border-radius: 50%;
  background: #a9c2fc;
  content: "";
}

.status-pill[data-state="paused"]::before {
  background: #ffcc7d;
}

.status-pill:is([data-state="working"], [data-state="done"])::before {
  background: #80e9b6;
}

.card-heading, .list-heading, .sheet-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.punch-card {
  margin-top: 1rem;
  padding: 0.75rem 1rem 0.875rem;
  box-shadow: 0 3px 12px #13234006;
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3125rem;
  min-height: 2.75rem;
  padding: 0.375rem 0.5rem;
  border: 0;
  border-radius: 0.625rem;
  background: transparent;
  color: var(--blue-deep);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.25;
}

.text-button .icon {
  width: 1rem;
  height: 1rem;
}

.text-button.danger {
  color: var(--danger);
}

.text-button.danger:active {
  background: var(--danger-soft);
}

.punch-times {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0.375rem 0 1rem;
  padding: 0.75rem 0.25rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: #f7f9fc;
  text-align: center;
}

.punch-times > div + div {
  border-left: 1px solid var(--line);
}

.punch-times dt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
}

.time-marker {
  width: 0.375rem;
  height: 0.375rem;
  flex: none;
  border-radius: 50%;
  background: #637b9d;
}

.time-marker.start { background: var(--blue); }
.time-marker.pause { background: #a97019; }
.time-marker.end { background: var(--success); }

.punch-times dd {
  margin: 0.25rem 0 0;
  padding-inline: 0.25rem;
  font-size: clamp(0.875rem, 4vw, 1rem);
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  overflow-wrap: anywhere;
}

#time-break {
  font-size: clamp(0.6875rem, 3.35vw, 0.875rem);
}

.button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  transition: background-color 150ms ease;
}

.button.primary {
  background: var(--blue);
  color: #fff;
}

.button.primary:active {
  background: var(--blue-deep);
}

.button.primary:disabled {
  background: var(--blue-soft);
  color: var(--muted);
}

.button.secondary {
  border-color: var(--control-line);
  background: var(--surface);
  color: var(--blue-deep);
}

.button.secondary:active {
  background: var(--blue-soft);
}

.button + .button {
  margin-top: 0.5rem;
}

.helper, .muted {
  color: var(--muted);
  font-size: 0.8125rem;
}

.punch-card .helper {
  margin-top: 0.625rem;
  text-align: center;
}

.month-shortcut {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.875rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  text-align: left;
}

.month-shortcut:active {
  background: var(--blue-soft);
}

.shortcut-copy {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 0.0625rem;
}

.shortcut-copy strong, #shortcut-total {
  font-size: 0.875rem;
  line-height: 1.25;
}

.shortcut-copy small {
  color: var(--muted);
  font-size: 0.75rem;
}

#shortcut-total {
  color: var(--blue-deep);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.month-shortcut .chevron {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--muted);
}

.month-card {
  padding: 0.875rem;
}

.month-picker {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
}

#month-label {
  text-align: center;
}

#month-label::first-letter {
  text-transform: uppercase;
}

.month-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.875rem;
  padding: 0.875rem;
  border-radius: 0.75rem;
  background: var(--blue-soft);
}

.month-overview > div {
  min-width: 0;
}

.month-overview strong {
  display: block;
  margin-top: 0.125rem;
  color: var(--blue-deep);
  font-size: clamp(1.125rem, 5vw, 1.5rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}

#month-pending {
  margin: 0.625rem 0.25rem 0;
}

.list-heading {
  margin: 1rem 0 0.375rem;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 0.375rem;
  padding: 1.75rem 1rem;
  text-align: center;
}

.empty-state .shortcut-icon {
  margin-bottom: 0.375rem;
}

.empty-state p {
  color: var(--muted);
  font-size: 0.875rem;
}

.entry-list {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.entry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-height: 3.75rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--line);
  border-radius: 0.875rem;
  background: var(--surface);
  text-align: left;
}

.entry-row:active {
  background: var(--blue-soft);
}

.entry-copy {
  display: grid;
  min-width: 0;
  gap: 0.125rem;
}

.entry-copy strong, .entry-total {
  font-size: 0.875rem;
}

.entry-copy strong {
  text-transform: capitalize;
}

.entry-meta {
  color: var(--muted);
  font-size: 0.75rem;
}

.entry-total {
  color: var(--blue-deep);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

#export-csv {
  margin-top: 0.875rem;
}

.sheet {
  position: fixed;
  inset: auto 0 0;
  width: min(100%, var(--app-width));
  max-width: none;
  max-height: 92vh;
  max-height: 92dvh;
  margin: 0 auto;
  padding: 0.875rem var(--gutter) calc(1rem + var(--safe-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 1.5rem 1.5rem 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 -0.5rem 2rem #13234018;
}

.sheet::backdrop {
  background: rgb(15 23 42 / 45%);
}

.sheet[open] {
  animation: sheet-enter 240ms var(--ease-out) both;
}

@keyframes sheet-enter {
  from { opacity: 0; transform: translateY(1rem); }
  to { opacity: 1; transform: translateY(0); }
}

.button, .bottom-nav button {
  transition: transform 150ms var(--ease-out), background-color 150ms ease-out;
}

.button:active, .bottom-nav button:active {
  transform: scale(0.98);
}

.pending-shift {
  margin-bottom: 0.875rem;
}

.restore-review {
  margin-top: 0.875rem;
  padding: 0.875rem;
  border: 1px solid var(--line);
  border-radius: 0.875rem;
  background: var(--canvas);
}

.restore-review .backup-actions {
  margin-top: 0.75rem;
}

.sheet-heading {
  margin-bottom: 0.875rem;
}

.sheet-heading h2 {
  font-size: 1.375rem;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.fields label {
  display: block;
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 700;
}

.fields .wide {
  grid-column: 1 / -1;
}

.fields input, .fields textarea {
  width: 100%;
  margin-top: 0.3125rem;
  font-size: 1rem;
  font-weight: 500;
}

.optional {
  color: var(--muted);
  font-weight: 500;
}

.sheet .helper {
  margin-top: 0.75rem;
}

.sheet .helper:empty {
  display: none;
}

.sheet form > .button {
  margin-top: 1rem;
}

.sheet .danger {
  width: 100%;
  margin-top: 0.375rem;
}

.form-error {
  margin-top: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.875rem;
}

.settings-group {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.settings-group p {
  margin-top: 0.375rem;
}

.backup-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.backup-actions .button {
  margin: 0;
  padding-inline: 0.375rem;
  font-size: 0.875rem;
}

.toast {
  position: fixed;
  z-index: 10;
  right: 0;
  bottom: calc(4.75rem + var(--safe-bottom));
  left: 0;
  width: max-content;
  max-width: min(calc(100% - 2rem), calc(var(--app-width) - 2rem));
  margin: 0 auto;
  padding: 0.625rem 0.875rem;
  border-radius: 0.75rem;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 0.25rem 1rem #13234025;
  font-size: 0.875rem;
  font-weight: 650;
  text-align: center;
  pointer-events: none;
}

.toast:empty {
  opacity: 0;
}

@media (min-width: 32rem) {
  body {
    background: #e7edf6;
  }

  .app-shell {
    box-shadow: 0 0 2.5rem #13234012;
  }
}

@media (max-width: 22rem) {
  .hero .hero-art {
    right: -1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

#edit-today {
  display: flex;
  width: 100%;
  justify-content: center;
  margin-top: 0.375rem;
}
