:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --over: #047857;
  --under: #b91c1c;
  --holiday: #7c3aed;
  --holiday-soft: #f3e8ff;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}
a { color: var(--accent); }
h1 { font-size: 1.4rem; margin: 0 0 .75rem; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.wrap { max-width: 900px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 20px; padding-bottom: 48px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.site-header { background: var(--accent); color: #fff; }
.header-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-top: 12px; padding-bottom: 12px; }
.brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.nav a, .nav button.link { color: #fff; text-decoration: none; opacity: .9; font-size: .95rem; }
.nav a:hover, .nav button.link:hover { opacity: 1; text-decoration: underline; }

form.inline { display: inline; margin: 0; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
button.link.danger { color: var(--under); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card.narrow { max-width: 420px; margin: 32px auto; }

.btn { display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--text); text-decoration: none; font: inherit; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:hover { filter: brightness(.96); }

input[type=text], input[type=email], input[type=password], input[type=time], input[type=date], input:not([type]) {
  font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; width: 100%; background: #fff;
}
label { display: block; font-size: .85rem; color: var(--muted); }
label input { margin-top: 4px; color: var(--text); }
label.check { display: flex; gap: 8px; align-items: center; }
label.check input { width: auto; margin: 0; }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; }

/* allauth default pages (password change/reset) */
main form p { margin: 0 0 12px; }
main form button[type=submit]:not(.link):not(.btn) { padding: 8px 14px; border-radius: 8px; border: 0; background: var(--accent); color: #fff; font: inherit; cursor: pointer; }

.messages { list-style: none; padding: 0; margin: 0 0 14px; }
.msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 6px; background: var(--accent-soft); }
.msg-error { background: #fee2e2; }
.errors { background: #fee2e2; color: var(--under); border-radius: 8px; padding: 8px 12px; font-size: .9rem; }
.errors p { margin: 2px 0; }
.notice { background: var(--warn-soft); border: 1px solid #fcd34d; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; }
.viewing { background: #e0f2fe; border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; font-size: .9rem; }
.viewing a { margin-left: 6px; }

.over { color: var(--over); }
.under { color: var(--under); }

/* Dashboard */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 14px; }
.tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.tile-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tile-value { font-size: 1.8rem; font-weight: 700; margin: 4px 0; }
.tile-value.small { font-size: 1.1rem; }
.tile-value .of { font-size: 1rem; font-weight: 400; color: var(--muted); }
.tile-sub { font-size: .85rem; color: var(--muted); }
.tile.balance.over { border-color: #6ee7b7; background: #ecfdf5; }
.tile.balance.over .tile-value { color: var(--over); }
.tile.balance.under { border-color: #fca5a5; background: #fef2f2; }
.tile.balance.under .tile-value { color: var(--under); }
.bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin: 6px 0; }
.bar span { display: block; height: 100%; background: var(--accent); }

.holiday-list { list-style: none; padding: 0; margin: 0; }
.holiday-list li { padding: 4px 0; }
.holiday-list .date { display: inline-block; min-width: 90px; font-weight: 600; }

.table-scroll { overflow-x: auto; }
table.weeks { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.weeks th, table.weeks td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
table.weeks th { font-size: .78rem; text-transform: uppercase; color: var(--muted); font-weight: 600; }
table.weeks .num { text-align: right; }
table.weeks tr.current { background: #f0fdfa; }

.pill { display: inline-block; font-size: .72rem; padding: 2px 8px; border-radius: 999px; font-weight: 600; margin-left: 4px; vertical-align: middle; }
.pill.holiday { background: var(--holiday-soft); color: var(--holiday); }
.pill.ok { background: #d1fae5; color: var(--over); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.today { background: var(--accent-soft); color: var(--accent); }

/* Week view */
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.week-title { text-align: center; }
.week-title h1 { margin: 0; font-size: 1.2rem; }
.week-summary { display: flex; flex-wrap: wrap; gap: 8px 22px; font-weight: 600; }
.week-summary .label { display: block; font-size: .75rem; font-weight: 400; color: var(--muted); text-transform: uppercase; }

.day.is-holiday { border-left: 4px solid var(--holiday); }
.day.is-today { box-shadow: 0 0 0 2px var(--accent-soft); }
.day.is-disabled { opacity: .55; }
.day-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.day-head h2 { display: inline; margin-right: 4px; }
.day-head .pill { margin: 4px 4px 0 0; }
.day-total { font-weight: 700; font-size: 1.05rem; }

.shifts { list-style: none; padding: 0; margin: 10px 0; }
.shifts li { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; padding: 6px 0; border-top: 1px dashed var(--border); }
.shifts .time { font-weight: 600; font-variant-numeric: tabular-nums; }
.shifts .dur { color: var(--muted); }
.shifts .notes { color: var(--muted); font-style: italic; }
.shifts .actions { margin-left: auto; display: flex; gap: 12px; font-size: .9rem; }

.add-shift { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; align-items: end; }
.add-shift .errors { grid-column: 1 / -1; }
.add-shift .grow { grid-column: 1 / -1; }
@media (min-width: 640px) {
  .add-shift { grid-template-columns: 120px 120px 1fr auto; }
  .add-shift .grow { grid-column: auto; }
}
.submit-week p { margin-top: 0; }
