:root {
  --bg: #07101e;
  --bg-deep: #050b14;
  --surface: #0d1829;
  --surface-raised: #122036;
  --surface-soft: #101c2f;
  --border: #24334a;
  --border-strong: #334763;
  --text: #f4f7fb;
  --text-soft: #b8c3d3;
  --muted: #8190a7;
  --cyan: #4de4c2;
  --cyan-soft: rgba(77, 228, 194, 0.12);
  --blue: #5ba8ff;
  --blue-soft: rgba(91, 168, 255, 0.12);
  --amber: #ffbd59;
  --amber-soft: rgba(255, 189, 89, 0.12);
  --red: #ff7b87;
  --red-soft: rgba(255, 123, 135, 0.11);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
  --radius-large: 24px;
  --radius: 15px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 16% -8%, rgba(61, 125, 203, 0.17), transparent 31rem),
    radial-gradient(circle at 92% 16%, rgba(77, 228, 194, 0.07), transparent 26rem),
    var(--bg);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a,
input[type="time"],
input[type="radio"] + span {
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

button {
  color: inherit;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(91, 168, 255, 0.42);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100vh;
}

.app-header {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(1180px, calc(100% - 48px));
  min-height: 84px;
  margin: 0 auto;
  border-bottom: 1px solid rgba(129, 144, 167, 0.18);
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 11px;
  min-height: 44px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 760;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 1px solid rgba(77, 228, 194, 0.33);
  border-radius: 11px;
  color: var(--cyan);
  background: var(--cyan-soft);
}

.brand-mark svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(129, 144, 167, 0.16);
  border-radius: 13px;
  background: rgba(8, 18, 32, 0.72);
}

.nav-link {
  display: grid;
  place-items: center;
  min-width: 96px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.91rem;
  font-weight: 660;
  transition: color 160ms ease, background 160ms ease;
}

.nav-link:hover {
  color: var(--text-soft);
}

.nav-link.is-active {
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 1px rgba(129, 144, 167, 0.12);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.logout-button {
  justify-self: end;
  color: var(--muted);
}

.logout-button:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-soft);
}

.page-content {
  width: min(1060px, calc(100% - 48px));
  margin: 0 auto;
  padding: 42px 0 70px;
}

.home-content {
  width: min(850px, calc(100% - 48px));
}

.balance-strip {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 28px;
  align-items: center;
  min-height: 106px;
  padding: 20px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  background:
    linear-gradient(105deg, rgba(77, 228, 194, 0.055), transparent 35%),
    rgba(13, 24, 41, 0.92);
  box-shadow: var(--shadow);
}

.balance-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.balance-item--right {
  align-items: flex-end;
  text-align: right;
}

.balance-label,
.result-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.085em;
  text-transform: uppercase;
}

.balance-value {
  color: var(--text);
  font-family: var(--mono);
  font-size: clamp(1.55rem, 4vw, 2.15rem);
  font-weight: 680;
  letter-spacing: -0.055em;
}

.balance-item:first-child .balance-value {
  color: var(--cyan);
}

.balance-item--right .balance-value {
  color: var(--blue);
}

.balance-divider,
.result-divider {
  align-self: stretch;
  background: var(--border);
}

.day-heading,
.stats-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.day-heading {
  flex: 1;
  margin: 44px 2px 20px;
}

.date-navigation {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-arrow {
  display: grid;
  flex: 0 0 46px;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-top: 21px;
  border: 1px solid var(--border);
  border-radius: 13px;
  color: var(--text-soft);
  background: var(--surface-soft);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 100ms ease;
}

.date-arrow:hover {
  color: var(--cyan);
  border-color: var(--border-strong);
  background: var(--surface-raised);
}

.date-arrow:active {
  transform: translateY(1px);
}

.date-arrow:disabled {
  color: var(--muted);
  border-color: var(--border);
  background: var(--surface-soft);
  cursor: not-allowed;
  opacity: 0.42;
}

.date-arrow svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.today-button {
  min-height: 28px;
  padding: 2px 9px;
  margin-top: 8px;
  border: 1px solid rgba(77, 228, 194, 0.28);
  border-radius: 7px;
  color: var(--cyan);
  background: var(--cyan-soft);
  font-size: 0.76rem;
  font-weight: 680;
  cursor: pointer;
}

.today-button[hidden] {
  display: none;
}

.statistics-navigation {
  margin: -5px 0 29px;
}

.statistics-navigation .date-arrow {
  margin-top: 0;
}

.statistics-period-heading {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.statistics-period-heading .eyebrow {
  margin-bottom: 5px;
}

.statistics-period-heading h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 680;
  line-height: 1.25;
}

.statistics-period-heading .today-button {
  margin-top: 8px;
}

.eyebrow,
.chart-kicker {
  margin: 0 0 7px;
  color: var(--cyan);
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

.day-heading h1,
.stats-heading h1 {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.55rem);
  font-weight: 690;
  letter-spacing: -0.045em;
  line-height: 1.1;
}

.save-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.save-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--muted);
}

.save-indicator--saved .save-dot {
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(77, 228, 194, 0.09);
}

.save-indicator--saving .save-dot {
  background: var(--amber);
  animation: pulse 900ms ease-in-out infinite alternate;
}

.save-indicator--error {
  color: var(--red);
}

.save-indicator--error .save-dot {
  background: var(--red);
}

@keyframes pulse {
  to { opacity: 0.35; }
}

.loading-line {
  display: inline-block;
  height: 1em;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--surface-raised), #1a2b44, var(--surface-raised));
  background-size: 200% 100%;
  animation: loading 1.3s linear infinite;
}

.loading-line--title {
  width: min(470px, 70vw);
}

@keyframes loading {
  to { background-position: -200% 0; }
}

.time-card,
.chart-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  background: rgba(13, 24, 41, 0.94);
  box-shadow: var(--shadow);
}

.time-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.time-row {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(190px, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 106px;
  padding: 20px 26px;
  border-bottom: 1px solid var(--border);
  transition: background 160ms ease;
}

.time-row:hover,
.time-row:focus-within {
  background: rgba(18, 32, 54, 0.58);
}

.step-number {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 700;
  transition: color 160ms ease, border 160ms ease, background 160ms ease;
}

.time-row.is-complete .step-number {
  color: var(--cyan);
  border-color: rgba(77, 228, 194, 0.38);
  background: var(--cyan-soft);
}

.time-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.time-label label {
  color: var(--text);
  font-size: 1rem;
  font-weight: 670;
}

.time-label span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.83rem;
}

.time-controls {
  display: grid;
  grid-template-columns: 124px 52px 30px;
  gap: 9px;
  align-items: center;
}

.time-input {
  width: 124px;
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  color: var(--text);
  background: #091425;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 650;
  color-scheme: dark;
  transition: border-color 160ms ease, background 160ms ease;
}

.time-input:hover,
.time-input:focus {
  border-color: rgba(91, 168, 255, 0.72);
  background: #0b182b;
}

.time-input.is-suggestion {
  color: var(--amber);
  border-color: rgba(255, 189, 89, 0.5);
  background: var(--amber-soft);
}

.now-button {
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-soft);
  background: var(--surface-raised);
  font-size: 0.85rem;
  font-weight: 680;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, transform 100ms ease;
}

.now-button:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.now-button:active,
.suggestion-button:active,
.primary-button:active {
  transform: translateY(1px);
}

.now-button:disabled,
input:disabled {
  opacity: 0.56;
  cursor: wait;
}

.row-check {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: transparent;
  background: rgba(7, 16, 30, 0.7);
}

.row-check svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.time-row.is-complete .row-check {
  color: var(--cyan);
  border-color: rgba(77, 228, 194, 0.28);
  background: var(--cyan-soft);
}

.suggestion-button {
  grid-column: 2 / -1;
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 8px;
  min-height: 38px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 189, 89, 0.28);
  border-radius: 10px;
  color: var(--amber);
  background: var(--amber-soft);
  font-size: 0.8rem;
  font-weight: 680;
  cursor: pointer;
}

.suggestion-button[hidden] {
  display: none;
}

.suggestion-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.allocation-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 27px 26px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 16, 30, 0.28);
}

.allocation-copy h2 {
  margin: 0 0 3px;
  font-size: 1rem;
  font-weight: 680;
}

.allocation-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(300px, 100%);
  padding: 4px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #091425;
}

.segmented-control label {
  position: relative;
  cursor: pointer;
}

.segmented-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented-control span {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 680;
  transition: color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.segmented-control label:hover span {
  color: var(--text-soft);
}

.segmented-control input:checked + span {
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 1px rgba(129, 144, 167, 0.15);
}

.segmented-control input:focus-visible + span {
  outline: 3px solid rgba(91, 168, 255, 0.42);
  outline-offset: 2px;
}

.day-result {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 25px;
  align-items: center;
  min-height: 94px;
  padding: 19px 26px;
  background: linear-gradient(90deg, rgba(77, 228, 194, 0.04), rgba(91, 168, 255, 0.04));
}

.day-result > div:not(.result-divider) {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.day-result > div:last-child {
  align-items: flex-end;
  text-align: right;
}

.day-result strong {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 680;
}

.day-result strong.is-positive { color: var(--cyan); }
.day-result strong.is-negative { color: var(--red); }
.day-result strong.is-overtime { color: var(--blue); }
.day-result strong.is-neutral { color: var(--text-soft); }

.inline-message {
  margin: 0;
  padding: 13px 26px;
  border-top: 1px solid rgba(255, 123, 135, 0.25);
  color: #ffadb5;
  background: var(--red-soft);
  font-size: 0.88rem;
}

.inline-message[hidden] {
  display: none;
}

/* Login */
.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(430px, 100%);
}

.login-card {
  position: relative;
  overflow: hidden;
  padding: 44px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0, rgba(77, 228, 194, 0.09), transparent 18rem),
    rgba(13, 24, 41, 0.96);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.42);
}

.brand-mark--large {
  width: 52px;
  height: 52px;
  margin-bottom: 28px;
  border-radius: 15px;
}

.brand-mark--large svg {
  width: 33px;
  height: 33px;
}

.login-card h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.045em;
}

.login-intro {
  margin: 10px 0 28px;
  color: var(--text-soft);
  font-size: 0.95rem;
}

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

.login-card label {
  color: var(--text-soft);
  font-size: 0.86rem;
  font-weight: 660;
}

.login-card input {
  width: 100%;
  height: 52px;
  padding: 0 15px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  color: var(--text);
  background: #091425;
}

.login-card input:focus {
  border-color: var(--blue);
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding: 0 17px;
  margin-top: 8px;
  border: 0;
  border-radius: 11px;
  color: #04120f;
  background: var(--cyan);
  font-weight: 760;
  cursor: pointer;
  transition: filter 160ms ease, transform 100ms ease;
}

.primary-button:hover {
  filter: brightness(1.07);
}

.primary-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.primary-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.form-error {
  padding: 11px 13px;
  margin: 4px 0 0;
  border: 1px solid rgba(255, 123, 135, 0.28);
  border-radius: 10px;
  color: #ffadb5;
  background: var(--red-soft);
  font-size: 0.86rem;
}

/* Statistics */
.stats-content {
  padding-top: 48px;
}

.stats-heading {
  margin-bottom: 29px;
}

.period-label {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.period-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(9, 20, 37, 0.8);
}

.period-tabs button {
  min-width: 82px;
  min-height: 42px;
  padding: 0 13px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 0.87rem;
  font-weight: 680;
  cursor: pointer;
}

.period-tabs button:hover {
  color: var(--text-soft);
}

.period-tabs button.is-active {
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 1px rgba(129, 144, 167, 0.16);
}

.period-tabs button:disabled {
  cursor: wait;
}

.stats-layout {
  display: grid;
  gap: 18px;
}

.charts-stack {
  display: grid;
  gap: 18px;
}

.chart-card {
  position: relative;
  min-width: 0;
}

.chart-card--overtime { border-color: rgba(91, 168, 255, 0.24); }
.chart-card--flex { border-color: rgba(255, 189, 89, 0.24); }
.chart-card--balance { border-color: rgba(77, 228, 194, 0.24); }

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 25px;
  padding: 24px 26px 10px;
}

.chart-kicker {
  margin-bottom: 3px;
  color: var(--muted);
}

.chart-header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 1.16rem;
  letter-spacing: -0.025em;
}

.chart-title-mark {
  display: inline-block;
  width: 22px;
  height: 4px;
  border-radius: 99px;
}

.chart-title-mark--overtime { background: var(--blue); }
.chart-title-mark--flex { background: var(--amber); }
.chart-title-mark--balance { background: var(--cyan); }

.chart-description {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.chart-wrap {
  position: relative;
  min-height: 320px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: var(--border-strong) transparent;
}

.chart-wrap svg {
  display: block;
  width: 100%;
  min-width: 650px;
  height: auto;
  overflow: visible;
  cursor: crosshair;
}

.chart-wrap svg[hidden] {
  display: none;
}

.chart-grid line {
  stroke: #26344a;
  stroke-width: 1;
  stroke-dasharray: 3 7;
}

.axis-label {
  fill: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 560;
}

.x-labels line {
  stroke: var(--border-strong);
}

.zero-line {
  stroke: #53627a;
  stroke-width: 1.25;
}

.chart-line {
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.chart-line--balance {
  stroke-width: 3;
}

.chart-crosshair {
  stroke: rgba(244, 247, 251, 0.35);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.chart-marker {
  stroke: #0d1829;
  stroke-width: 2.5;
}

.chart-marker--overtime { fill: var(--blue); }
.chart-marker--flex { fill: var(--amber); }
.chart-marker--balance { fill: var(--cyan); }

.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.chart-loading[hidden] {
  display: none;
}

.chart-loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: chart-dot 900ms ease-in-out infinite alternate;
}

.chart-loading--overtime { color: var(--blue); }
.chart-loading--flex { color: var(--amber); }
.chart-loading--balance { color: var(--cyan); }

.chart-loading span:nth-child(2) { animation-delay: 150ms; }
.chart-loading span:nth-child(3) { animation-delay: 300ms; }

@keyframes chart-dot {
  to { transform: translateY(-7px); opacity: 0.42; }
}

.chart-tooltip {
  position: absolute;
  z-index: 4;
  display: grid;
  gap: 5px;
  width: 208px;
  padding: 12px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: rgba(5, 11, 20, 0.96);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  transform: translateX(-50%);
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-tooltip > strong {
  padding-bottom: 5px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
  font-size: 0.76rem;
  text-transform: capitalize;
}

.tooltip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  font-size: 0.73rem;
}

.tooltip-row i {
  color: var(--muted);
  font-style: normal;
}

.tooltip-row b {
  font-family: var(--mono);
  font-weight: 650;
}

.tooltip-row--overtime b { color: var(--blue); }
.tooltip-row--flex b { color: var(--amber); }
.tooltip-row--balance b { color: var(--cyan); }

.stats-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.total-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  min-height: 132px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(13, 24, 41, 0.94);
}

.total-card::before {
  position: absolute;
  top: 0;
  right: 0;
  width: 62px;
  height: 62px;
  border-radius: 0 0 0 62px;
  content: "";
  opacity: 0.1;
}

.total-card--flex::before { background: var(--amber); }
.total-card--overtime::before { background: var(--blue); }
.total-card--balance::before { background: var(--cyan); }

.total-card > span {
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 660;
}

.total-card strong {
  margin: 4px 0 1px;
  font-family: var(--mono);
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  font-weight: 690;
  letter-spacing: -0.045em;
}

.total-card--flex strong { color: var(--amber); }
.total-card--overtime strong { color: var(--blue); }
.total-card--balance strong { color: var(--cyan); }

.total-card small {
  color: var(--muted);
  font-size: 0.72rem;
}

.inline-message--page {
  margin-top: 18px;
  border: 1px solid rgba(255, 123, 135, 0.25);
  border-radius: 11px;
}

@media (max-width: 900px) {
  .total-card {
    min-height: 128px;
  }
}

@media (max-width: 720px) {
  .app-header {
    grid-template-columns: 1fr auto;
    width: min(100% - 30px, 650px);
    padding: 12px 0 10px;
  }

  .brand {
    font-size: 0.82rem;
  }

  .main-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    margin-top: 8px;
  }

  .nav-link {
    flex: 1;
    min-width: 0;
  }

  .page-content,
  .home-content {
    width: min(100% - 30px, 650px);
    padding-top: 28px;
  }

  .balance-strip {
    gap: 15px;
    min-height: 92px;
    padding: 16px 17px;
    border-radius: 18px;
  }

  .balance-label {
    font-size: 0.68rem;
    line-height: 1.35;
  }

  .balance-value {
    font-size: clamp(1.28rem, 6.5vw, 1.7rem);
  }

  .day-heading {
    align-items: flex-start;
    margin-top: 34px;
  }

  .day-heading h1,
  .stats-heading h1 {
    font-size: 1.75rem;
  }

  .save-indicator {
    padding-top: 2px;
    font-size: 0;
  }

  .save-indicator .save-dot {
    width: 9px;
    height: 9px;
  }

  .time-card,
  .chart-card {
    border-radius: 18px;
  }

  .time-row {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 8px 12px;
    min-height: 134px;
    padding: 18px 16px;
  }

  .step-number {
    grid-row: 1;
    width: 34px;
    height: 34px;
  }

  .time-controls {
    grid-column: 2;
    grid-template-columns: minmax(118px, 1fr) 54px 30px;
    width: 100%;
  }

  .time-input {
    width: 100%;
  }

  .suggestion-button {
    grid-column: 2;
    justify-self: stretch;
    justify-content: center;
    text-align: center;
  }

  .allocation-panel {
    align-items: stretch;
    flex-direction: column;
    gap: 17px;
    padding: 22px 17px;
  }

  .segmented-control {
    width: 100%;
  }

  .day-result {
    gap: 15px;
    padding: 17px;
  }

  .result-label {
    font-size: 0.65rem;
  }

  .day-result strong {
    font-size: 0.88rem;
  }

  .stats-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 20px;
  }

  .period-tabs {
    width: 100%;
  }

  .period-tabs button {
    min-width: 0;
    padding: 0 6px;
    font-size: 0.79rem;
  }

  .chart-header {
    padding: 20px 18px 8px;
  }

  .stats-totals {
    grid-template-columns: 1fr;
  }

  .total-card {
    min-height: 112px;
  }
}

@media (max-width: 430px) {
  .login-page {
    align-items: start;
    padding: 16px;
  }

  .login-shell {
    margin-top: 7vh;
  }

  .login-card {
    padding: 30px 23px;
    border-radius: 22px;
  }

  .balance-strip {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .balance-divider {
    display: none;
  }

  .balance-item--right {
    padding-left: 12px;
    border-left: 1px solid var(--border);
  }

  .time-controls {
    grid-template-columns: minmax(105px, 1fr) 50px 27px;
    gap: 6px;
  }

  .time-input {
    padding: 0 8px;
    font-size: 0.94rem;
  }

  .now-button {
    padding: 0 8px;
  }

  .day-result {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .result-divider {
    display: none;
  }

  .day-result > div:last-child {
    align-items: flex-start;
    padding-top: 13px;
    border-top: 1px solid var(--border);
    text-align: left;
  }

  .period-tabs button {
    font-size: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
