:root {
  color-scheme: light;
  --bg: #f4f0e8;
  --panel: #ffffff;
  --ink: #182123;
  --muted: #657176;
  --line: #d9dedc;
  --primary: #153b3f;
  --primary-2: #21676d;
  --accent: #cf6f3e;
  --danger: #9f2f2f;
  --ok: #2f7d54;
  --shadow: 0 18px 50px rgba(24, 33, 35, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(160deg, rgba(21, 59, 63, 0.12), transparent 34%),
    linear-gradient(20deg, rgba(207, 111, 62, 0.14), transparent 30%),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 760;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.app-shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.timer-panel,
.summary-panel,
.storage-panel,
.entries-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(217, 222, 220, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.timer-panel {
  padding: 22px;
}

.summary-panel,
.storage-panel,
.entries-panel {
  margin-top: 14px;
  padding: 18px;
}

.topline,
.section-head,
.button-row,
.entry-actions,
.summary-values,
.storage-actions,
.login-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topline,
.section-head {
  justify-content: space-between;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary-2);
  font-size: 0.76rem;
  font-weight: 820;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.9rem, 8vw, 3.3rem);
  line-height: 0.96;
}

h2 {
  font-size: 1.15rem;
}

.status-pill {
  min-width: 88px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #e7efed;
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 800;
  text-align: center;
}

.status-pill.running {
  background: #dff1e7;
  color: var(--ok);
}

.auth-panel {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.auth-title {
  margin: 0;
  font-weight: 840;
}

.auth-detail {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.login-form {
  display: grid;
  gap: 7px;
}

.login-row {
  align-items: stretch;
}

.login-row .text-input {
  flex: 1;
}

.timer-face {
  display: grid;
  place-items: center;
  min-height: 190px;
  margin: 20px 0;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  text-align: center;
}

.timer {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.7rem, 16vw, 6.2rem);
  font-weight: 840;
  line-height: 1;
}

.timer-meta {
  width: 100%;
  min-height: 22px;
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.text-input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  outline: none;
}

.text-input:focus {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 3px rgba(33, 103, 109, 0.14);
}

.button-row {
  margin-top: 14px;
}

.button-row button {
  flex: 1;
}

.primary-btn {
  background: var(--primary);
  color: white;
}

.danger-btn {
  background: var(--danger);
  color: white;
}

.ghost-btn {
  min-width: 78px;
  padding: 0 13px;
  border: 1px solid var(--line);
  background: white;
  color: var(--primary);
}

.file-btn {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 760;
}

.storage-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.storage-detail {
  display: grid;
  gap: 9px;
  margin: 14px 0 0;
}

.storage-detail div {
  display: grid;
  grid-template-columns: minmax(92px, 0.35fr) 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.storage-detail dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 780;
}

.storage-detail dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 720;
}

.storage-path {
  overflow-wrap: anywhere;
}

.summary-list,
.entry-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.summary-card,
.entry-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.summary-card {
  padding: 14px;
}

.summary-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 830;
}

.summary-total {
  font-variant-numeric: tabular-nums;
  color: var(--primary-2);
}

.summary-values {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.metric {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: white;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
}

.metric strong {
  display: block;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
}

.metric.over strong {
  color: var(--accent);
}

.progress {
  height: 10px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e9e7;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--ok), var(--accent));
}

.entry-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px;
}

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

.entry-note {
  margin: 0;
  font-weight: 820;
}

.entry-time {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.entry-duration {
  font-variant-numeric: tabular-nums;
  color: var(--primary-2);
  font-weight: 850;
  text-align: right;
}

.icon-btn {
  width: 42px;
  min-height: 42px;
  border: 1px solid var(--line);
  background: white;
  color: var(--danger);
}

.empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (min-width: 780px) {
  .app-shell {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 14px;
    align-items: start;
    padding-top: 28px;
  }

  .timer-panel {
    position: sticky;
    top: 20px;
  }

  .summary-panel,
  .storage-panel,
  .entries-panel {
    margin-top: 0;
  }

  .storage-panel,
  .entries-panel {
    grid-column: 2;
  }
}

@media (max-width: 430px) {
  .timer-panel,
  .summary-panel,
  .storage-panel,
  .entries-panel {
    padding: 15px;
  }

  .summary-values,
  .storage-detail div,
  .login-row {
    grid-template-columns: 1fr;
  }

  .login-row {
    display: grid;
  }

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

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