:root {
  --bg: #f7f1e8;
  --surface: rgba(255, 252, 247, 0.94);
  --surface-strong: #fffaf4;
  --text: #20303a;
  --muted: #607179;
  --line: rgba(28, 63, 74, 0.12);
  --brand: #1e4d5c;
  --brand-strong: #143845;
  --accent: #bf6c45;
  --success: #2e7a53;
  --warning: #8b602f;
  --danger: #a04436;
  --shadow: 0 18px 44px rgba(24, 52, 63, 0.12);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

html {
  -webkit-text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(191, 108, 69, 0.22), transparent 28%),
    radial-gradient(circle at top right, rgba(30, 77, 92, 0.18), transparent 22%),
    linear-gradient(180deg, #fbf6ef 0%, var(--bg) 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.92rem 1rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 16px;
}

textarea {
  resize: vertical;
}

.page-shell {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
  padding:
    max(1.4rem, env(safe-area-inset-top))
    0
    max(3rem, env(safe-area-inset-bottom));
}

.hero-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-card {
  padding: 2rem;
  margin-bottom: 1.25rem;
}

.hero-copy-wrap {
  max-width: 74ch;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-copy-wrap h1,
.panel h2 {
  margin: 0;
}

.hero-copy {
  max-width: 70ch;
  line-height: 1.65;
  color: var(--muted);
}

.hero-meta,
.button-row,
.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.status-pill,
.item-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
}

.status-pill {
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  color: var(--brand-strong);
}

.item-badge {
  padding: 0.45rem 0.8rem;
}

.item-badge.open {
  background: rgba(191, 108, 69, 0.16);
  color: #8e532f;
}

.item-badge.done {
  background: rgba(46, 122, 83, 0.14);
  color: var(--success);
}

.item-badge.running {
  background: rgba(30, 77, 92, 0.14);
  color: var(--brand);
}

.item-badge.timer {
  background: rgba(30, 77, 92, 0.1);
  color: var(--brand-strong);
}

.item-badge.manual {
  background: rgba(139, 96, 47, 0.14);
  color: var(--warning);
}

.panel {
  padding: 1.5rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.inline-feedback,
.item-meta,
.entry-notes,
.breakdown-meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.live-feedback {
  padding: 0.75rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(30, 77, 92, 0.08);
  color: var(--brand-strong);
}

.feedback-flash {
  animation: feedbackPulse 420ms ease;
}

@keyframes feedbackPulse {
  0% {
    background: rgba(191, 108, 69, 0.22);
  }

  100% {
    background: rgba(30, 77, 92, 0.08);
  }
}

.active-timer-card,
.stat-card,
.hint-box,
.entry-card,
.breakdown-item {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface-strong);
}

.active-timer-card {
  display: grid;
  gap: 0.85rem;
  padding: 1.15rem;
  margin-bottom: 1rem;
}

.timer-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.timer-value {
  font-size: clamp(2rem, 6vw, 3.6rem);
  letter-spacing: 0.05em;
}

.timer-details {
  display: grid;
  gap: 0.35rem;
}

.stack-form,
.field,
.breakdown-list,
.entry-list {
  display: grid;
  gap: 1rem;
}

.field span {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.field-grid {
  display: grid;
  gap: 1rem;
}

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

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

.timer-panel,
.summary-panel,
.manual-panel,
.export-panel {
  min-width: 0;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--muted);
}

.check-row input {
  width: auto;
  margin: 0;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  padding: 0.85rem 1.15rem;
}

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

.secondary-button {
  background: rgba(30, 77, 92, 0.12);
  color: var(--brand-strong);
}

.ghost-button {
  background: rgba(30, 77, 92, 0.08);
  color: var(--brand-strong);
}

.danger-button {
  background: rgba(160, 68, 54, 0.14);
  color: var(--danger);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.stat-card {
  padding: 1rem;
}

.stat-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.stat-card strong {
  font-size: 1.7rem;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
}

.breakdown-item strong {
  font-size: 1.1rem;
}

.hint-box {
  padding: 1rem 1.1rem;
}

.compact-hint {
  align-self: end;
}

.hint-title {
  margin: 0 0 0.35rem;
  font-weight: 700;
}

.entry-list {
  gap: 0.9rem;
}

.entry-card {
  padding: 1rem;
}

.entry-top,
.entry-row,
.entry-actions,
.entry-meta-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.entry-top,
.entry-meta-grid {
  flex-wrap: wrap;
}

.entry-title {
  margin: 0;
  font-size: 1.08rem;
}

.entry-when {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.entry-notes {
  margin-top: 0.8rem;
}

.entry-meta-grid {
  margin-top: 0.85rem;
}

.meta-chip {
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: rgba(30, 77, 92, 0.08);
  color: var(--brand-strong);
  font-size: 0.9rem;
}

.entry-actions {
  flex-wrap: wrap;
  margin-top: 0.95rem;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 24px;
  padding: 1.4rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.48);
}

@media (max-width: 980px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1100px) {
  .page-shell {
    width: min(1360px, calc(100% - 3rem));
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
    gap: 1.5rem;
  }

  .panel {
    padding: 1.7rem;
  }

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

@media (pointer: coarse) {
  .primary-button,
  .secondary-button,
  .ghost-button,
  .danger-button {
    min-height: 48px;
    padding: 0.95rem 1.2rem;
  }

  .status-pill,
  .meta-chip,
  .item-badge {
    min-height: 42px;
  }

  .check-row {
    align-items: flex-start;
  }

  .check-row input {
    margin-top: 0.25rem;
    transform: scale(1.15);
    transform-origin: left top;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 1rem, 1200px);
    padding:
      max(1rem, env(safe-area-inset-top))
      0
      max(1.35rem, env(safe-area-inset-bottom));
  }

  .hero-card,
  .panel {
    padding: 1.2rem;
    border-radius: 24px;
  }

  .field-grid.two-columns,
  .field-grid.three-columns,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .timer-main,
  .entry-row {
    flex-direction: column;
    align-items: start;
  }

  .button-row,
  .export-actions,
  .hero-meta,
  .entry-actions {
    align-items: stretch;
  }

  .button-row {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 0 -0.2rem;
    padding:
      0.3rem 0.2rem
      calc(0.35rem + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(247, 241, 232, 0), rgba(247, 241, 232, 0.95) 32%);
  }

  .active-timer-card,
  .entry-card,
  .hint-box,
  .breakdown-item,
  .stat-card {
    border-radius: 20px;
  }

  .timer-value {
    font-size: clamp(2rem, 11vw, 3rem);
  }

  .button-row button,
  .export-actions button,
  .hero-meta button,
  .entry-actions button {
    width: 100%;
  }
}
