:root {
  --teal: #12275f;        /* brand navy, used for primary actions */
  --teal-dark: #0c1b45;
  --teal-light: #e8eef8;
  --accent: #3f9a9c;      /* brand teal */
  --ink: #1c2430;
  --muted: #6b7684;
  --line: #e3e8ee;
  --bg: #f5f7f9;
  --card: #ffffff;
  --green: #1b7f4b;
  --green-light: #e4f4ea;
  --amber: #9a6b00;
  --amber-light: #fff4d6;
  --red: #b42318;
  --red-light: #fdecea;
  --blue: #1d4ed8;
  --blue-light: #e8eefc;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--teal); }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* Top bar */
.topbar {
  background: #fff;
  color: var(--ink);
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { height: 40px; width: auto; display: block; }
.brand .brand-icon { height: 42px; }
.brand .wordmark { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--teal); line-height: 1; }
.brand .wordmark em { font-style: normal; color: var(--accent); margin-left: 5px; }
.topbar .right { display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--muted); }
.topbar .right a { color: var(--teal); font-weight: 600; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--teal-light); color: var(--teal); }

/* Layout */
.layout { display: flex; min-height: calc(100vh - 64px); }
.sidenav {
  width: 220px; background: var(--card); border-right: 1px solid var(--line);
  padding: 16px 10px; flex-shrink: 0;
}
.sidenav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-weight: 500; margin-bottom: 2px;
}
.sidenav a svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sidenav a.active, .sidenav a:hover { background: var(--teal-light); color: var(--teal); }
.sidenav .badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 999px; }
.main { flex: 1; padding: 24px; max-width: 1100px; }
@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidenav { width: 100%; display: flex; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidenav a { white-space: nowrap; }
  .main { padding: 16px; }
}

/* Cards, tables, forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card.tight { padding: 12px 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .num { font-size: 26px; font-weight: 700; color: var(--teal); }
.stat .lbl { color: var(--muted); font-size: 13px; }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--ink); }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #c9d2dc; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(15,76,92,0.25); border-color: var(--teal); }
textarea { min-height: 80px; resize: vertical; }
.field { margin-bottom: 12px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: 14px; }
.check input { width: auto; margin-top: 3px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--teal);
  background: var(--teal); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--teal-dark); }
.btn.secondary { background: #fff; color: var(--teal); }
.btn.secondary:hover { background: var(--teal-light); }
.btn.danger { background: #fff; color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red-light); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag.open, .tag.approved, .tag.confirmed, .tag.completed { background: var(--green-light); color: var(--green); }
.tag.pending, .tag.applied { background: var(--amber-light); color: var(--amber); }
.tag.filled { background: var(--blue-light); color: var(--blue); }
.tag.cancelled, .tag.suspended, .tag.declined, .tag.withdrawn { background: var(--red-light); color: var(--red); }

.banner { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.banner.warn { background: var(--amber-light); color: var(--amber); border: 1px solid #f0d78a; }
.banner.info { background: var(--teal-light); color: var(--teal); border: 1px solid #bcd6dc; }
.banner.error { background: var(--red-light); color: var(--red); border: 1px solid #f3b7b2; }
.banner.ok { background: var(--green-light); color: var(--green); border: 1px solid #b7e0c6; }

.shift-card { display: flex; justify-content: space-between; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin-bottom: 10px; }
.shift-card .when { font-weight: 700; font-size: 15px; }
.shift-card .where { color: var(--muted); font-size: 14px; }
.shift-card .rate { font-size: 20px; font-weight: 700; color: var(--accent); text-align: right; }
.shift-card .actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 600px) { .shift-card { flex-direction: column; } .shift-card .rate, .shift-card .actions { text-align: left; justify-content: flex-start; } }

.notif { padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--card); border-radius: 6px; margin-bottom: 8px; }
.notif.unread { background: var(--teal-light); }
.notif .t { font-weight: 600; }
.notif .d { color: var(--muted); font-size: 12px; }

.dist { display: inline-block; background: var(--teal-light); color: var(--teal); font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; margin-left: 6px; white-space: nowrap; }

/* Calendar */
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.cal-head div { padding: 4px 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell { min-height: 92px; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 4px 6px; cursor: pointer; }
.cal-cell:hover { border-color: var(--accent); background: #f6fbfb; }
.cal-cell.empty { border: 0; background: transparent; cursor: default; }
.cal-cell.past { background: #f8f9fb; color: var(--muted); cursor: default; }
.cal-cell.past:hover { border-color: var(--line); background: #f8f9fb; }
.cal-cell.today { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.cal-day { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.cal-add { border: 0; background: var(--teal-light); color: var(--teal); width: 20px; height: 20px; border-radius: 50%; font-size: 15px; line-height: 20px; cursor: pointer; padding: 0; }
.cal-add:hover { background: var(--teal); color: #fff; }
.cal-shift { display: block; font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 5px; margin-bottom: 3px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-shift.open { background: var(--green-light); color: var(--green); }
.cal-shift.filled { background: var(--blue-light); color: var(--blue); }
.cal-shift.completed { background: var(--line); color: var(--muted); }
.cal-shift b { background: var(--amber); color: #fff; border-radius: 999px; padding: 0 5px; font-size: 10px; margin-left: 4px; }
.cal-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; margin: 0 2px 0 8px; }
.cal-key.open { background: var(--green); } .cal-key.filled { background: var(--blue); } .cal-key.completed { background: #c9d2dc; }
@media (max-width: 700px) { .cal-cell { min-height: 56px; padding: 3px 4px; } .cal-shift { font-size: 10px; padding: 1px 4px; } }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(20,30,40,0.5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 12px; padding: 20px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; }
.modal h2 { margin-bottom: 12px; }

/* Landing */
.hero {
  background: #12275f url("cover.jpg") center right / cover no-repeat;
  color: #fff; padding: 56px 20px; position: relative;
}
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(18,39,95,0.92) 0%, rgba(18,39,95,0.75) 45%, rgba(18,39,95,0.15) 100%); pointer-events: none; }
.hero .inner { position: relative; }
.hero h1, .hero p { text-shadow: 0 1px 2px rgba(0,0,0,0.25); }
@media (max-width: 800px) { .hero::before { background: rgba(18,39,95,0.85); } }
.hero .inner { max-width: 1000px; margin: 0 auto; display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center; }
.hero h1 { font-size: 36px; margin-bottom: 12px; }
.hero p { font-size: 17px; opacity: 0.95; }
.hero .inner { grid-template-columns: 1fr; min-height: 380px; align-content: center; }
.hero .inner > div { max-width: 560px; }
.hero-btn { background: #fff; color: var(--teal); border-color: #fff; }
.hero-btn:hover { background: var(--teal-light); }
.hero-btn.secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,0.7); }
.hero-btn.secondary:hover { background: rgba(255,255,255,0.15); }
.auth-section { padding: 0 20px 40px; margin-top: -40px; position: relative; }
.auth-section .inner { max-width: 1000px; margin: 0 auto; display: flex; justify-content: center; }
.auth-card { background: #fff; color: var(--ink); border-radius: 12px; padding: 22px; width: 100%; max-width: 520px; box-shadow: 0 10px 30px rgba(18,39,95,0.15); border: 1px solid var(--line); }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { flex: 1; background: none; border: 0; padding: 10px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--teal); border-bottom-color: var(--teal); }
.features { max-width: 1000px; margin: 0 auto; padding: 40px 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.feature svg { width: 28px; height: 28px; stroke: var(--accent); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 8px; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 20px; }
@media (max-width: 800px) { .hero .inner { grid-template-columns: 1fr; } .hero h1 { font-size: 28px; } }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 100; box-shadow: 0 6px 20px rgba(0,0,0,0.2); }
.toast.error { background: var(--red); }
