:root {
  --navy: #0b0b0d;
  --blue: #ef4b43;
  --blue-dark: #a91f1b;
  --bg: #111216;
  --card: #1b1c21;
  --card-raised: #222329;
  --text: #ececef;
  --muted: #a7a9b0;
  --line: #3c3e45;
  --line-strong: #666870;
  --green: #69c38e;
  --red: #ff6b63;
  --radius: 14px;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 50% -20%, rgba(239, 75, 67, .12), transparent 38rem),
    var(--bg);
  color: var(--text);
}

a { color: var(--blue); }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(239, 75, 67, .45);
  outline-offset: 3px;
}

.site-header {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px max(16px, calc((100vw - 960px) / 2));
  color: #fff;
  background: linear-gradient(180deg, #101114, #080809);
  border-bottom: 1px solid #5b1b19;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .35);
}

.brand {
  color: #f2f2f4;
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-decoration: none;
  text-transform: uppercase;
  text-shadow: 0 0 16px rgba(239, 75, 67, .25);
}

.brand::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 10px;
  background: var(--blue);
  transform: rotate(45deg);
  box-shadow: 0 0 10px rgba(239, 75, 67, .8);
  vertical-align: 2px;
}

.site-header nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 14px;
}

.site-header nav a,
.link-button {
  border: 0;
  padding: 8px 0;
  color: #d8d8dc;
  background: none;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.site-header nav a:hover,
.link-button:hover { color: #fff; }
.site-header nav form { margin: 0; }

.container {
  width: 100%;
  max-width: 960px;
  flex: 1;
  margin: 0 auto;
  padding: 22px 16px 80px;
}

.site-footer {
  padding: 18px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #0b0b0d;
  font-size: .82rem;
  letter-spacing: .04em;
  text-align: center;
}

.footer-made-with {
  margin-top: 6px;
}

.footer-heart {
  color: var(--accent);
  font-size: 1.05em;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-heading h1 {
  margin: 2px 0 6px;
  color: #f6f6f7;
  font-size: clamp(1.55rem, 5vw, 2.1rem);
}

.page-heading p { margin: 0; color: var(--muted); }

.eyebrow {
  color: var(--blue) !important;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.back-link { display: inline-block; margin-bottom: 8px; }

.card,
.auth-card,
.repeat-card,
.totals-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(155deg, var(--card-raised), var(--card));
  box-shadow: 0 10px 28px rgba(0, 0, 0, .24);
}

.card { margin: 16px 0; padding: 18px; }
.card h2 { margin: 0 0 12px; color: #f4f4f5; font-size: 1.15rem; }

.auth-card {
  max-width: 440px;
  margin: 4vh auto;
  padding: 24px;
}

.auth-card--branded {
  position: relative;
  overflow: hidden;
  border-color: #494b52;
}

.auth-card--branded::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--blue), transparent);
  box-shadow: 0 0 16px rgba(239, 75, 67, .65);
}

.login-logo {
  display: block;
  width: 170px;
  max-width: 46vw;
  height: auto;
  margin: 0 auto 16px;
  border-radius: 50%;
  box-shadow: 0 14px 38px rgba(0, 0, 0, .55), 0 0 28px rgba(239, 75, 67, .1);
}

.login-intro { margin-bottom: 20px; text-align: center; }
.login-intro h1 { margin: 4px 0 8px; color: #f5f5f6; }
.login-intro p { margin: 0; color: var(--muted); }
.login-intro .eyebrow { margin-bottom: 6px; }

.stack { display: grid; gap: 15px; }
.section-space { margin-top: 16px; }

label {
  display: grid;
  gap: 6px;
  color: #dfe0e3;
  font-size: .92rem;
  font-weight: 700;
}

input,
select,
textarea,
button,
.button { font: inherit; font-size: 16px; }

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  background: #101115;
}

input:focus,
select:focus,
textarea:focus { border-color: var(--blue); }

textarea { min-height: 100px; resize: vertical; }
.large-textarea { min-height: 220px; }
.field-grid { display: grid; gap: 12px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--blue);
  border-radius: 9px;
  padding: 10px 16px;
  color: #fff;
  background: linear-gradient(180deg, #d33b34, var(--blue-dark));
  box-shadow: 0 4px 12px rgba(169, 31, 27, .22);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover { filter: brightness(1.1); }
.primary { border-color: #e64a42; background: linear-gradient(180deg, #d63b34, #941b18); }
.secondary { border-color: var(--line-strong); color: #ededee; background: #24252b; box-shadow: none; }
.compact { min-height: 40px; padding: 7px 10px; }
.full-width { width: 100%; margin-top: 14px; }
.error, .save-error { color: var(--red); }

.error {
  margin-bottom: 14px;
  border: 1px solid #8e3733;
  border-radius: 8px;
  padding: 12px;
  background: #321817;
}

.status {
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: #dcdde0;
  background: #292a30;
  font-size: .8rem;
  font-weight: 700;
}

.status.finalized { border-color: #2f6b49; color: #8fe0ae; background: #173522; }
.week-list { display: grid; gap: 10px; }

.day-row,
.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  background: var(--card);
  text-decoration: none;
}

.day-row:hover { border-color: var(--blue); background: #202126; }
.day-row span, .history-row div { display: grid; gap: 4px; }
.day-row small, .history-row small { color: var(--muted); font-size: .82rem; }
.day-total { text-align: right; }

.totals-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0;
  padding: 18px;
  border-left: 3px solid var(--blue);
}

.totals-card strong { color: #fff; font-size: 1.25rem; }
.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.finalize-form { display: flex; justify-content: center; margin-top: 22px; }
.section-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-header h2 { margin-bottom: 4px; }
.section-header p { margin: 0; color: var(--muted); font-size: .9rem; }
.repeat-card { margin: 12px 0; padding: 15px; border-radius: 10px; }
.repeat-card legend { padding: 0 6px; color: #f0f0f1; font-weight: 700; }
.repeat-card > label, .repeat-card > .field-grid, .contact-checks, .check-grid { margin-bottom: 12px; }
.danger-link { min-height: 34px; border: 0; padding: 7px 0; color: var(--red); background: transparent; box-shadow: none; }
.check { display: flex; align-items: center; gap: 9px; }
.check input, .contact-checks input, .check-grid input { width: 20px; height: 20px; min-height: 20px; accent-color: var(--blue); }
.contact-checks { display: flex; align-items: center; gap: 14px; padding: 10px 0; }
.contact-checks span { min-width: 82px; font-weight: 700; }
.contact-checks label { display: flex; align-items: center; gap: 5px; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.check-grid label { display: flex; align-items: center; gap: 7px; font-weight: 400; }

.live-total {
  position: sticky;
  bottom: 12px;
  margin-top: 15px;
  border: 1px solid #6f211e;
  border-radius: 9px;
  padding: 13px;
  color: #fff;
  background: rgba(12, 12, 14, .96);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .4);
  text-align: center;
}

.save-state { padding-top: 10px; color: var(--green); font-size: .88rem; font-weight: 700; }
.row-actions { display: flex !important; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px !important; }
.row-actions form { display: inline; }
.row-actions .link-button { color: var(--blue); }
.admin-row { align-items: flex-start; }
.admin-row details summary { color: var(--blue); cursor: pointer; }
.admin-row details form { display: flex; gap: 6px; margin-top: 8px; }
.admin-row details input { min-width: 190px; }
.admin-row details button { min-height: 42px; }
.schedule-entry { margin-bottom: 10px; }
summary { color: #ededee; cursor: pointer; font-weight: 700; }
details.card > summary { font-size: 1.05rem; }

@media (max-width: 680px) {
  .site-header { align-items: flex-start; flex-direction: column; }
  .site-header nav { gap: 12px; font-size: .9rem; }
  .container { padding-top: 16px; }
  .auth-card { margin-top: 18px; padding: 18px; }
  .login-logo { width: 145px; max-width: 42vw; }
  .field-grid.two, .action-grid { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; }
  .day-row, .history-row { padding: 13px; }
  .row-actions { justify-content: flex-start; }
  .history-row { align-items: flex-start; flex-direction: column; }
  .section-header { align-items: stretch; flex-direction: column; }
  .section-header .compact { width: 100%; }
  .sticky-heading { position: sticky; top: 0; z-index: 5; padding: 8px 0; background: var(--bg); }
  .check-grid { grid-template-columns: 1fr; }
  .admin-row details form { flex-direction: column; }
  .admin-row details input { min-width: 0; }
}

@media print {
  :root { color-scheme: light; }
  body { color: #000; background: #fff; }
  .site-header, .site-footer { display: none; }
  .container { max-width: none; padding: 0; }
  .card { border-color: #aaa; color: #000; background: #fff; box-shadow: none; }
}
