:root {
  color-scheme: light;
  --bg: #f4f7f2;
  --paper: #ffffff;
  --ink: #1f2a1f;
  --muted: #5a685a;
  --line: #d7dfd5;
  --accent: #3f7c4d;
  --accent-strong: #2f5d3a;
  --warn: #b02020;
  --theme-color: #3f7c4d;
  --hero-bg:
    linear-gradient(135deg, rgba(63, 124, 77, 0.14), rgba(229, 240, 217, 0.92));
  --hero-border: rgba(63, 124, 77, 0.14);
  --theme-surface: rgba(255, 255, 255, 0.78);
  --theme-surface-hover: rgba(255, 255, 255, 0.92);
  --theme-surface-border: rgba(63, 124, 77, 0.2);
  --theme-text: #23402b;
  --bg-radial-1: #e5f0d9;
  --bg-radial-2: #e9efe6;
  --panel-shadow: 0 6px 18px rgba(31, 42, 31, 0.04);
  --input-bg: #ffffff;
  --metric-bg: #fafdf7;
  --hero-shadow: 0 10px 28px rgba(31, 42, 31, 0.06);
  --table-row-bg: transparent;
  --table-head-bg: transparent;
}

:root[data-theme="night"] {
  color-scheme: dark;
  --bg: #07100d;
  --paper: #101916;
  --ink: #edf6ef;
  --muted: #93a99a;
  --line: #284035;
  --accent: #85c09a;
  --accent-strong: #9ad0ae;
  --warn: #ffb3b3;
  --theme-color: #07100d;
  --hero-bg:
    linear-gradient(135deg, rgba(133, 192, 154, 0.18), rgba(10, 18, 15, 0.96));
  --hero-border: rgba(133, 192, 154, 0.24);
  --theme-surface: rgba(12, 20, 17, 0.92);
  --theme-surface-hover: rgba(17, 27, 22, 0.98);
  --theme-surface-border: rgba(133, 192, 154, 0.26);
  --theme-text: #e4f1e8;
  --bg-radial-1: rgba(133, 192, 154, 0.1);
  --bg-radial-2: rgba(19, 43, 32, 0.46);
  --panel-shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
  --input-bg: #0b1411;
  --metric-bg: #13201a;
  --hero-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
  --table-row-bg: rgba(255, 255, 255, 0.01);
  --table-head-bg: rgba(255, 255, 255, 0.02);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  -webkit-text-size-adjust: 100%;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, var(--bg-radial-1) 0%, transparent 35%),
    radial-gradient(circle at 100% 100%, var(--bg-radial-2) 0%, transparent 45%),
    var(--bg);
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.9rem;
  display: grid;
  gap: 0.68rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.9rem, 2.7vw, 2.4rem);
  line-height: 1.05;
}

.hero {
  background: var(--hero-bg);
  border: 1px solid var(--hero-border);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  box-shadow: var(--hero-shadow);
}

.hero-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
}

.theme-field {
  display: grid;
  gap: 0.2rem;
  min-width: 112px;
  color: var(--theme-text);
  font-size: 0.72rem;
}

.theme-field select {
  height: 36px;
  border-radius: 999px;
  border-color: var(--theme-surface-border);
  background-color: var(--theme-surface);
  color: var(--theme-text);
  background-position:
    calc(100% - 16px) calc(50% - 2px),
    calc(100% - 10px) calc(50% - 2px);
}

.theme-field select:hover {
  background-color: var(--theme-surface-hover);
}

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.subtitle {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.72rem;
  box-shadow: var(--panel-shadow);
}

.card h2 {
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.section-heading h2 {
  margin: 0;
}

.transfer-toolbar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.transfer-toolbar button {
  min-height: 32px;
  padding: 0.32rem 0.75rem;
}

.transfer-status {
  margin: 0 0 0.6rem;
  min-height: 1em;
  font-size: 0.78rem;
  color: var(--muted);
}

.transfer-status.is-error {
  color: var(--warn);
}

.transfer-status.is-success {
  color: var(--accent-strong);
}

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

form > label,
form > .actions {
  min-width: 0;
}

label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.short-break-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

input,
select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.34rem 0.56rem;
  font-size: 15px;
  line-height: 1.2;
  color: var(--ink);
  background: var(--input-bg);
}

select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 2rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 2px),
    calc(100% - 10px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

input:focus,
select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, white);
  border-color: var(--accent);
}

.actions {
  display: grid;
  align-items: end;
}

button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  border-radius: 999px;
  min-height: 36px;
  padding: 0.4rem 0.85rem;
  font-size: 14px;
  touch-action: manipulation;
  cursor: pointer;
}

.mini-toggle {
  width: auto;
  min-height: 29px;
  padding: 0.16rem 0.62rem;
  font-size: 0.75rem;
  line-height: 1;
  white-space: nowrap;
}

.mini-toggle[aria-pressed="false"] {
  background: #fff;
  color: var(--accent-strong);
}

.actions button {
  width: 100%;
}

button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.secondary {
  background: white;
  color: var(--accent-strong);
}

.secondary:hover,
.secondary:focus-visible,
.secondary:active {
  background: white;
  color: var(--accent-strong);
}

.summary-grid {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.metric {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem;
  background: var(--metric-bg);
}

.metric .label {
  font-size: 0.64rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric .value {
  margin-top: 0.15rem;
  font-size: 0.92rem;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
  background: var(--table-row-bg);
}

th,
td {
  padding: 0.45rem 0.4rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--table-head-bg);
}

:root[data-theme="night"] .mini-toggle[aria-pressed="false"] {
  background: #12211b;
  color: var(--accent);
}

:root[data-theme="night"] .secondary {
  background: #13211b;
  color: var(--accent);
}

:root[data-theme="night"] .secondary:hover,
:root[data-theme="night"] .secondary:focus-visible,
:root[data-theme="night"] .secondary:active {
  background: #13211b;
  color: var(--accent);
}

.error {
  margin: 0.35rem 0 0;
  color: var(--warn);
  min-height: 1em;
  font-size: 0.78rem;
}

@media (max-width: 1180px) {
  .page {
    padding: 0.75rem;
  }

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

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

@media (max-width: 700px) {
  .page {
    padding: 0.63rem;
  }

  .hero-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .theme-field {
    min-width: 0;
  }

  .card {
    padding: 0.63rem;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .transfer-toolbar {
    width: 100%;
  }

  form {
    grid-template-columns: 1fr;
  }

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