:root {
  --bg: #f4efe6;
  --bg-accent: #efe1cc;
  --panel: rgba(255, 251, 245, 0.92);
  --panel-strong: #fffdf8;
  --line: rgba(89, 62, 37, 0.14);
  --text: #2d241c;
  --muted: #726455;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #c98b2f;
  --danger: #a8432a;
  --shadow: 0 24px 60px rgba(68, 46, 22, 0.12);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --font-body: "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(201, 139, 47, 0.18), transparent 25%),
    linear-gradient(180deg, var(--bg-accent) 0%, var(--bg) 42%, #f8f3eb 100%);
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  border: 0;
}

button {
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.95rem 1rem;
  color: var(--text);
  background: #fff;
  border: 1px solid rgba(89, 62, 37, 0.12);
  border-radius: var(--radius-md);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(15, 118, 110, 0.16);
  border-color: rgba(15, 118, 110, 0.34);
}

textarea {
  resize: vertical;
  min-height: 132px;
}

.app-shell {
  width: min(1100px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 1.1rem 0 2rem;
}

.topbar,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.topbar,
.nav-links,
.panel-heading,
.action-row {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.3rem;
  margin-bottom: 1rem;
}

.topbar h1,
.panel h2 {
  margin: 0;
  letter-spacing: -0.03em;
}

.topbar h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
}

.panel h2 {
  font-size: clamp(1.5rem, 2vw, 2rem);
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-links {
  gap: 0.65rem;
  flex-wrap: wrap;
}

.nav-link,
.button {
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.nav-link {
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.nav-link--active {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  border-color: transparent;
}

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

.panel {
  padding: 1.3rem;
}

.panel--hero {
  background: linear-gradient(180deg, #090909 0%, #151515 100%);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 24px 60px rgba(0, 0, 0, 0.28);
}

.panel--hero .eyebrow,
.panel--hero .helper-text {
  color: rgba(255, 255, 255, 0.76);
}

.panel--hero-compact {
  padding: 1rem 1.3rem;
}

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

.button--timer {
  width: auto;
  color: #111;
  background: linear-gradient(180deg, #facc15 0%, #eab308 100%);
  border-color: rgba(250, 204, 21, 0.5);
  box-shadow: 0 10px 24px rgba(234, 179, 8, 0.18);
}

.button--timer-paused {
  animation: pause-flash 1s steps(2, jump-none) infinite;
}

@keyframes pause-flash {
  0%,
  49% {
    opacity: 1;
    transform: scale(1);
  }

  50%,
  100% {
    opacity: 0.45;
    transform: scale(0.98);
  }
}

.timer-display {
  font-family: "SFMono-Regular", "Roboto Mono", "Menlo", "Consolas", monospace;
  font-size: clamp(2.3rem, 6vw, 4rem);
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums lining-nums;
  text-shadow: 0 1px 12px rgba(255, 255, 255, 0.08);
}

.helper-text {
  color: var(--muted);
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field span {
  font-weight: 600;
}

.field--full {
  grid-column: 1 / -1;
}

.account-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.action-row {
  gap: 0.8rem;
  flex-wrap: wrap;
}

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

.filter-grid--hidden {
  display: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.85rem 1.2rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.button--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}

.button--ghost {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(89, 62, 37, 0.14);
}

.button--link {
  background: transparent;
  border-color: rgba(89, 62, 37, 0.14);
}

.message {
  min-height: 1.5rem;
  margin: 1rem 0 0;
  color: var(--danger);
  font-weight: 600;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal--hidden {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 36, 28, 0.5);
  backdrop-filter: blur(3px);
}

.modal__dialog {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.modal__dialog--wide {
  width: min(760px, 100%);
}

.modal__dialog h2 {
  margin: 0 0 0.6rem;
}

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

.detail-card {
  display: grid;
  gap: 0.3rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.68);
}

.detail-card--full {
  grid-column: 1 / -1;
}

.detail-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-notes {
  margin: 0;
  min-height: 3rem;
  white-space: pre-wrap;
}

.task-link {
  padding: 0;
  color: var(--brand-dark);
  font-weight: 700;
  text-align: left;
  background: transparent;
  border: 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.95rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tfoot td {
  font-weight: 700;
  background: rgba(255, 255, 255, 0.62);
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.row-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.button--small {
  min-height: 38px;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
}

.button--danger {
  color: #fff;
  background: linear-gradient(135deg, var(--danger), #8d351f);
}

.cell-edit {
  min-width: 140px;
  padding: 0.65rem 0.75rem;
}

.memo-input {
  min-height: 148px;
}

.notes-cell {
  min-width: 220px;
  white-space: pre-wrap;
}

.cell-edit--notes {
  min-width: 220px;
  min-height: 96px;
}

@media (max-width: 820px) {
  .form-grid,
  .filter-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-heading {
    align-items: flex-start;
  }
}
