@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&family=Lato:wght@400;500;700&display=swap');

:root {
  --bg-dark:    #04404D;
  --bg-forest:  #33453C;
  --accent:     #C9B2A0;
  --mint:       #C1D7D4;
  --text-dark:  #2A2A2A;
  --text-light: #FFFFFF;
  --bg-page:    #F4F5F7;
  --bg-card:    #FFFFFF;
  --border:     #E2E8F0;
  --success:    #15803D;
  --error:      #B91C1C;
  --warning:    #92400E;
  --shadow:     0 1px 4px rgba(0,0,0,.08);
  --radius:     12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Lato', system-ui, sans-serif;
  background: var(--bg-page);
  color: var(--text-dark);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  background: var(--bg-dark);
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.topbar-logo img {
  height: 36px;
  object-fit: contain;
}
.topbar-logo-text {
  font-family: 'Merriweather', serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.03em;
  line-height: 1.2;
}
.topbar-logo-sub {
  font-size: 10px;
  color: var(--mint);
  font-family: 'Lato', sans-serif;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-actions a {
  color: var(--mint);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}
.topbar-actions a:hover { color: var(--accent); }
.badge-count {
  background: var(--accent);
  color: var(--bg-dark);
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: 4px;
}

/* ── Bottom nav (mobile) ─────────────────────────────────────────────────── */
.bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottomnav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px 10px;
  text-decoration: none;
  color: #94A3B8;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  position: relative;
}
.bottomnav a.active { color: var(--bg-dark); }
.bottomnav a.active svg { color: var(--bg-dark); }
.bottomnav svg { width: 22px; height: 22px; stroke: currentColor; fill: none;
                 stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottomnav .dot {
  position: absolute; top: 8px; left: calc(50% + 6px);
  width: 7px; height: 7px; background: #EF4444;
  border-radius: 50%; border: 2px solid #fff;
}

/* ── Main content ────────────────────────────────────────────────────────── */
.main-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 88px;
}
.page-title {
  font-family: 'Merriweather', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--bg-dark);
  margin-bottom: 4px;
}
.page-sub {
  font-size: 13px;
  color: #64748B;
  margin-bottom: 20px;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #94A3B8;
  margin-bottom: 10px;
}
.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.card-row:last-child { border-bottom: none; }

/* ── Stat tiles ──────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.stat-tile {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-tile .num {
  font-size: 28px;
  font-weight: 700;
  color: var(--bg-dark);
  font-family: 'Merriweather', serif;
}
.stat-tile .lbl {
  font-size: 11px;
  color: #64748B;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 2px;
}

/* ── Hero banner ─────────────────────────────────────────────────────────── */
.hero-banner {
  background: linear-gradient(135deg, var(--bg-dark), var(--bg-forest));
  color: var(--text-light);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 20px;
}
.hero-banner .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--mint);
  margin-bottom: 4px;
}
.hero-banner .value {
  font-family: 'Merriweather', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}
.hero-banner .sub {
  font-size: 13px;
  color: rgba(255,255,255,.75);
}

/* ── Pills / badges ─────────────────────────────────────────────────────── */
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pill-teal    { background: rgba(4,64,77,.12); color: var(--bg-dark); }
.pill-gold    { background: rgba(201,178,160,.2); color: #78350F; }
.pill-green   { background: #DCFCE7; color: #15803D; }
.pill-red     { background: #FEE2E2; color: #B91C1C; }
.pill-amber   { background: #FEF3C7; color: #92400E; }
.pill-grey    { background: #F1F5F9; color: #64748B; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 10px 18px;
  text-decoration: none;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--bg-dark); color: #fff; }
.btn-primary:hover { opacity: .88; }
.btn-accent  { background: var(--accent); color: var(--bg-dark); }
.btn-accent:hover { opacity: .88; }
.btn-outline { background: transparent; color: var(--bg-dark); border: 1.5px solid var(--bg-dark); }
.btn-outline:hover { background: rgba(4,64,77,.06); }
.btn-sm      { font-size: 12px; padding: 6px 12px; border-radius: 6px; }
.btn-danger  { background: #FEE2E2; color: #B91C1C; }
.btn-full    { width: 100%; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group  { margin-bottom: 16px; }
label        { display: block; font-size: 13px; font-weight: 700; color: #374151; margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 15px;
  font-family: 'Lato', sans-serif;
  color: var(--text-dark);
  background: #fff;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--bg-dark);
  box-shadow: 0 0 0 3px rgba(4,64,77,.1);
}
textarea { resize: vertical; min-height: 80px; }
.form-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  border-radius: 8px; padding: 10px 14px;
  font-size: 13px; font-weight: 500; margin-bottom: 14px;
  border-left: 4px solid;
}
.alert-success { background: #F0FDF4; border-color: #15803D; color: #14532D; }
.alert-error   { background: #FEF2F2; border-color: #B91C1C; color: #7F1D1D; }
.alert-info    { background: rgba(193,215,212,.2); border-color: var(--bg-dark); color: var(--bg-dark); }

/* ── Availability grid ───────────────────────────────────────────────────── */
.avail-week  { margin-bottom: 20px; }
.avail-label { font-size: 12px; font-weight: 700; color: #64748B; text-transform: uppercase;
               letter-spacing: .06em; margin-bottom: 8px; }
.avail-days  { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; }
.avail-day   {
  border-radius: 10px; padding: 8px 4px;
  text-align: center; font-size: 11px; font-weight: 700;
  cursor: pointer; transition: transform .1s;
  border: 2px solid transparent;
}
.avail-day .dow  { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: #94A3B8; margin-bottom: 2px; }
.avail-day .dom  { font-size: 15px; font-weight: 700; }
.avail-day.available    { background: #DCFCE7; color: #15803D; border-color: #22C55E; }
.avail-day.unavailable  { background: #FEE2E2; color: #B91C1C; border-color: #EF4444; }
.avail-day.unset        { background: #F1F5F9; color: #94A3B8; border-color: #E2E8F0; }
.avail-day.past         { opacity: .4; cursor: default; }
.avail-day.today        { border-color: var(--bg-dark) !important; }
.avail-day:active:not(.past) { transform: scale(.93); }
.avail-day.holiday      { background: #FEF3C7; color: #92400E; border-color: #FDE68A; }
.avail-time             { font-size: 9px; font-weight: 700; color: inherit; margin-top: 2px;
                          letter-spacing: .02em; text-align: center; white-space: nowrap;
                          overflow: hidden; text-overflow: ellipsis; }

/* ── Hours allowance banner ──────────────────────────────────────────────── */
.hours-banner {
  background: var(--bg-dark);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 20px;
}
.hours-banner-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
}
.hours-item   { text-align: center; flex: 1; }
.hours-num    { font-family: 'Merriweather', serif; font-size: 22px; font-weight: 700;
                color: var(--accent); }
.hours-num.num-green { color: #86EFAC; }
.hours-num.num-amber { color: #FDE68A; }
.hours-lbl    { font-size: 10px; font-weight: 700; text-transform: uppercase;
                letter-spacing: .06em; color: var(--mint); margin-top: 2px; }
.hours-divider { width: 1px; height: 40px; background: rgba(255,255,255,.15); }

/* ── Availability modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 200; display: flex; align-items: flex-end; justify-content: center;
  padding: 0 0 0 0;
}
.modal-box {
  background: #fff; border-radius: 20px 20px 0 0;
  padding: 24px 20px 32px; width: 100%; max-width: 480px;
  box-shadow: 0 -8px 40px rgba(0,0,0,.2);
  max-height: 85vh; overflow-y: auto;
}
.modal-title {
  font-family: 'Merriweather', serif; font-size: 17px; font-weight: 700;
  color: var(--bg-dark); margin-bottom: 18px;
}

/* ── Toggle switch ───────────────────────────────────────────────────────── */
.toggle-label   { display: flex; align-items: center; cursor: pointer; }
.toggle-label input[type=checkbox] { display: none; }
.toggle-track {
  width: 40px; height: 22px; background: #CBD5E1; border-radius: 11px;
  position: relative; transition: background .2s; flex-shrink: 0;
}
.toggle-track::after {
  content: ''; position: absolute; left: 2px; top: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .2s;
}
.toggle-label input:checked + .toggle-track             { background: var(--bg-dark); }
.toggle-label input:checked + .toggle-track::after      { transform: translateX(18px); }

/* ── Rota grid (desktop owner view) ─────────────────────────────────────── */
.rota-wrap   { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rota-table  { border-collapse: collapse; min-width: 560px; width: 100%; }
.rota-table th {
  background: var(--bg-dark); color: var(--text-light);
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  padding: 8px 10px; text-align: center;
}
.rota-table td {
  border: 1px solid var(--border); padding: 8px 10px;
  vertical-align: top; font-size: 13px;
}
.rota-table tr:hover td { background: rgba(4,64,77,.03); }
.shift-chip {
  background: rgba(4,64,77,.1); color: var(--bg-dark);
  border-radius: 6px; padding: 3px 8px;
  font-size: 11px; font-weight: 700;
  display: block; margin-bottom: 4px;
}

/* ── Rota shift cards (lb4) ──────────────────────────────────────────────── */
.shift-card {
  background: rgba(4,64,77,.07); border-radius: 8px;
  padding: 6px 8px; margin-bottom: 6px;
  border: 1.5px solid transparent;
}
.shift-card.shift-no-manager {
  border-color: #DC2626; background: #FEF2F2;
}
.shift-time {
  font-size: 12px; font-weight: 700; color: var(--bg-dark);
  margin-bottom: 3px;
}
.shift-assignee, .shift-assignee-mgr {
  font-size: 11px; color: #64748B; padding: 1px 0;
}
.shift-assignee-mgr { color: var(--bg-dark); font-weight: 600; }
.avail-hint { margin-top: 3px; }
.pill-purple { background: #EDE9FE; color: #5B21B6; }
.alert-warning { background: #FFFBEB; border-color: #D97706; color: #78350F; }

/* ── Notice dot on topbar ────────────────────────────────────────────────── */
.notice-dot {
  width: 8px; height: 8px; background: var(--accent);
  border-radius: 50%; display: inline-block; margin-left: 4px;
  vertical-align: middle;
}

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--bg-dark) 0%, var(--bg-forest) 100%);
  padding: 24px;
}
.login-card {
  background: #fff; border-radius: 20px; padding: 32px 28px;
  width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo img { height: 60px; }
.login-title {
  font-family: 'Merriweather', serif; font-size: 20px; font-weight: 700;
  color: var(--bg-dark); text-align: center; margin-bottom: 4px;
}
.login-sub { text-align: center; color: #64748B; font-size: 13px; margin-bottom: 24px; }

/* ── Desktop adjustments ─────────────────────────────────────────────────── */
@media (min-width: 640px) {
  .main-wrap { padding-bottom: 32px; }
  .bottomnav { display: none; }
  .topnav-links { display: flex; gap: 20px; }
  .topnav-links a {
    color: var(--mint); text-decoration: none; font-size: 13px; font-weight: 600;
    padding: 4px 8px; border-radius: 6px; transition: background .15s;
  }
  .topnav-links a:hover  { background: rgba(255,255,255,.1); }
  .topnav-links a.active { color: var(--accent); }
}
@media (max-width: 639px) {
  .topnav-links { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
