:root {
  color-scheme: light;
  --background: #f3f6f4;
  --paper: #fff;
  --ink: #142824;
  --muted: #536660;
  --line: #d7e0dc;
  --accent: #096953;
  --accent-dark: #065341;
  --contrast: #112925;
  --focus: #0a7760;
  --radius: 0.9rem;
  font-family: "Segoe UI", Inter, system-ui, sans-serif;
  font-size: 100%;
  color: var(--ink);
  background: var(--background);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 18rem; line-height: 1.5; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.55; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.topbar { background: var(--contrast); color: #f7fcfa; }
.topbar-inner {
  max-width: 82rem;
  min-height: 4.35rem;
  margin: auto;
  padding: 0.7rem clamp(1rem, 4vw, 3rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.brand, .account-bar { display: flex; align-items: center; gap: 0.8rem; }
.brand { font-size: 1.2rem; font-weight: 720; letter-spacing: -0.025em; white-space: nowrap; }
.brand-mark {
  width: 1.8rem;
  height: 1.8rem;
  position: relative;
  border-radius: 0.46rem;
  background: #75dbb7;
}
.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  left: 0.49rem;
  height: 0.21rem;
  background: var(--contrast);
  border-radius: 1rem;
  transform: rotate(-25deg);
}
.brand-mark::before { top: 0.61rem; width: 0.85rem; }
.brand-mark::after { top: 1.02rem; width: 0.59rem; }
.account-bar { min-width: 0; }
#account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar :focus-visible { outline-color: #8adfc0; }

.shell { max-width: 82rem; margin: auto; padding: clamp(1.5rem, 4vw, 3.5rem) clamp(1rem, 4vw, 3rem) 5rem; }
.initial-status { padding: 1rem 0; color: var(--muted); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.1; letter-spacing: -0.055em; font-weight: 740; }
h2 { font-size: 1.24rem; line-height: 1.3; letter-spacing: -0.025em; }
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1.35rem 2rem;
  margin-bottom: 1.55rem;
}
.page-header p, .auth-intro p { color: var(--muted); margin-top: 0.65rem; }
#period-caption::first-letter { text-transform: uppercase; }
.period-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 0.7rem; }
.month-label input { min-width: 10rem; }

.button {
  min-height: 2.75rem;
  border: 1px solid transparent;
  border-radius: 0.52rem;
  font-size: 0.93rem;
  font-weight: 675;
  padding: 0.56rem 0.94rem;
  line-height: 1.25;
}
.button-primary { background: var(--accent); color: white; border-color: var(--accent); }
.button-primary:hover:not(:disabled) { background: var(--accent-dark); }
.button-secondary { background: #f9fcfa; border-color: var(--line); color: var(--ink); }
.button-secondary:hover:not(:disabled) { background: #eaf2ee; }
.button-top { background: transparent; color: white; border-color: #6f8d83; white-space: nowrap; }
.button-top:hover:not(:disabled) { background: #24463d; }
.button-danger { color: #922d26; background: #fff7f5; border-color: #e8c8c1; }
.button-danger:hover:not(:disabled) { background: #ffeae6; }

.summary-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 0.8rem; margin-bottom: 1.3rem; }
.summary, .panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.summary { display: flex; flex-direction: column; gap: 0.22rem; padding: 0.94rem 1.1rem; }
.summary span { color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.summary strong { font-size: clamp(1.25rem, 3vw, 2rem); line-height: 1.22; letter-spacing: -0.045em; font-variant-numeric: tabular-nums; }
.panel { min-width: 0; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.95fr) minmax(17.5rem, 1fr); gap: 1.3rem; align-items: start; }
.forms-column { display: grid; gap: 1.1rem; }
.form-panel, .auth-panel { padding: 1.2rem; }
.form-panel h2 { margin-bottom: 0.9rem; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid var(--line);
}
.progress-note { color: var(--muted); font-size: 0.88rem; }
.empty-state { color: var(--muted); padding: 3rem 1.2rem; }
.shift-rows { margin: 0; padding: 0; list-style: none; }
.shift-row { padding: 1.02rem 1.2rem; }
.shift-row + .shift-row { border-top: 1px solid var(--line); }
.shift-heading { display: flex; justify-content: space-between; gap: 0.5rem 1rem; align-items: start; }
.shift-name { margin: 0; font-size: 1.05rem; line-height: 1.38; overflow-wrap: anywhere; }
.shift-date, .shift-meta { color: var(--muted); font-size: 0.93rem; }
.shift-date { white-space: nowrap; }
.shift-meta { margin-top: 0.26rem; overflow-wrap: anywhere; }
.shift-details { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.45rem 0.9rem; margin-top: 0.76rem; }
.route-status { border-radius: 0.32rem; padding: 0.25rem 0.45rem; font-size: 0.87rem; font-weight: 670; background: #eef2f0; color: #3c544b; }
.route-status[data-state="verified"] { background: #e3f4ed; color: #07573f; }
.route-status[data-state="failed"] { background: #fae9e4; color: #862c24; }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.row-actions .button { min-height: 2.45rem; font-size: 0.86rem; }
.row-message { color: var(--muted); margin-top: 0.45rem; font-size: 0.92rem; overflow-wrap: anywhere; }

.stack { display: grid; gap: 0.82rem; }
label { display: grid; gap: 0.25rem; font-size: 0.9rem; font-weight: 650; }
input, select {
  width: 100%;
  min-width: 0;
  min-height: 2.8rem;
  background: white;
  color: var(--ink);
  border: 1px solid #bfcfc7;
  border-radius: 0.52rem;
  padding: 0.45rem 0.66rem;
  font-size: 1rem;
  font-weight: 400;
}
input::placeholder { color: #65766e; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.checkbox-label input { width: 1rem; min-height: 0; height: 1rem; margin: 0; accent-color: #0b6653; }
.select-wrap { display: block; position: relative; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 0.86rem;
  top: 48%;
  width: 0.46rem;
  height: 0.46rem;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: translateY(-50%) rotate(45deg);
  pointer-events: none;
}
select { appearance: none; padding-right: 1.95rem; }
.form-message {
  background: #e3f4ed;
  color: #07573f;
  padding: 0.55rem 0.68rem;
  border-radius: 0.46rem;
  font-size: 0.91rem;
  overflow-wrap: anywhere;
}
.form-message[data-error="true"] { background: #fae9e4; color: #862c24; }
.dashboard-message { margin-bottom: 0.9rem; }

.auth-view {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(17rem,26rem);
  max-width: 55rem;
  margin: clamp(1.5rem, 8vh, 5rem) auto;
  gap: clamp(1.7rem, 6vw, 4.4rem);
  align-items: start;
}
.auth-intro { padding-top: 1.3rem; }
.auth-intro p { max-width: 30ch; font-size: 1.08rem; }
.auth-panel h2 { margin: 1.1rem 0 0.85rem; }
.switcher { display: grid; grid-template-columns: 1fr 1fr; padding: 0.2rem; gap: 0.18rem; background: #edf3ef; border-radius: 0.57rem; }
.switcher button { border: 0; border-radius: 0.4rem; padding: 0.56rem 0.45rem; background: transparent; color: var(--muted); font-size: 0.9rem; font-weight: 650; }
.switcher button[aria-pressed="true"] { background: white; color: var(--ink); box-shadow: 0 1px 2px #11292524; }

@media (max-width: 50rem) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .forms-column { grid-row: 1; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; }
  .auth-view { max-width: 28rem; grid-template-columns: 1fr; }
  .auth-intro { padding-top: 0; }
}
@media (max-width: 34rem) {
  .forms-column { grid-template-columns: 1fr; }
  .summary-grid { gap: 0.4rem; }
  .summary { padding: 0.65rem 0.5rem; }
  .summary span { font-size: 0.82rem; }
  .period-actions { width: 100%; align-items: stretch; }
  .month-label, #download { flex: 1; }
  #download { align-self: end; }
  .shift-heading { flex-wrap: wrap; }
}
