/* Walker Bros employee portal — shared styles (mobile-first) */
:root {
  --red: #c1272d;
  --red-dark: #9e1f24;
  --brown: #4a2c17;
  --cream: #faf6ee;
  --card: #ffffff;
  --ink: #2b2015;
  --muted: #8a7a6a;
  --line: #eadfce;
  --green: #2f7d32;
  --green-soft: #e6f2e6;
  --amber: #b26a00;
  --amber-soft: #fdf1dd;
  --gray-soft: #f0ece4;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(74, 44, 23, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
}

/* ---------- striped awning ---------- */
.awning {
  position: relative;
  height: 26px;
  margin-bottom: 22px;
  background: repeating-linear-gradient(90deg,
    var(--red) 0 28px, #fff 28px 56px);
}
.awning::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 26px;
  height: 13px;
  background:
    radial-gradient(ellipse 14px 13px at 14px 0, #fff 12px, transparent 13px) 28px 0 / 56px 13px repeat-x,
    radial-gradient(ellipse 14px 13px at 14px 0, var(--red) 12px, transparent 13px) 0 0 / 56px 13px repeat-x;
  filter: drop-shadow(0 2px 2px rgba(74,44,23,.15));
}

/* ---------- layout ---------- */
main { max-width: 520px; margin: 0 auto; padding: 0 14px 60px; }
main.wide { max-width: 940px; }

header.app-header {
  max-width: 940px;
  margin: 2px auto 0;
  padding: 0 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--brown); letter-spacing: .2px; }
.brand .sub { font-weight: 500; color: var(--muted); font-size: .8rem; display: block; margin-top: -2px; }
.header-right { display: flex; align-items: center; gap: 12px; }
#greeting { color: var(--brown); font-weight: 600; }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 14px 0;
}
.card h2 { margin: 0 0 10px; font-size: 1.05rem; color: var(--brown); }
.card h3 { margin: 14px 0 6px; font-size: .95rem; color: var(--brown); }
.hint { color: var(--muted); font-size: .85rem; margin: 4px 0 10px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, transform .05s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost { background: #fff; color: var(--brown); border-color: var(--line); }
.btn-ghost:hover { background: var(--gray-soft); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #276a2a; }
.btn-big { width: 100%; padding: 14px 16px; font-size: 1.05rem; }
.btn-small { padding: 6px 12px; font-size: .85rem; border-radius: 9px; }
.btn-link {
  background: none; border: none; color: var(--red); font-weight: 600;
  cursor: pointer; font-size: .85rem; padding: 4px 6px;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- forms ---------- */
.field { display: block; margin: 10px 0; }
.field > span { display: block; font-size: .85rem; font-weight: 600; color: var(--brown); margin-bottom: 4px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--red);
  outline-offset: 1px;
  border-color: var(--red);
}
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; margin: 10px 0; }
.error { color: var(--red-dark); font-weight: 600; font-size: .9rem; }
.success { color: var(--green); font-weight: 600; font-size: .9rem; }
.hidden { display: none !important; }

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--gray-soft);
  border-radius: 12px;
  padding: 4px;
  margin: 12px 0;
  overflow-x: auto;
}
.tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: .92rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.tabs button.active { background: #fff; color: var(--brown); box-shadow: var(--shadow); }

/* ---------- badges ---------- */
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .2px;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-gray { background: var(--gray-soft); color: var(--muted); }
.badge-red { background: #fbe4e5; color: var(--red-dark); }

/* ---------- countdown ---------- */
.countdown-card { text-align: center; border-color: var(--red); }
.countdown-label { font-size: .9rem; color: var(--muted); }
.countdown {
  font-variant-numeric: tabular-nums;
  font-size: 2rem;
  font-weight: 800;
  color: var(--red-dark);
  margin: 4px 0;
}
.countdown.small { font-size: 1.1rem; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}
.row-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.row-title { font-weight: 700; }
.row-sub { color: var(--muted); font-size: .84rem; margin-top: 2px; }
.row-note { font-size: .9rem; margin-top: 4px; }
.row-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.row.cancelled { opacity: .6; background: var(--gray-soft); }

/* ---------- schedule (employee) ---------- */
.day-row {
  display: flex;
  gap: 12px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.day-row:last-child { border-bottom: none; }
.day-row.today { background: var(--amber-soft); border-radius: 8px; }
.day-name { min-width: 84px; font-weight: 700; color: var(--brown); font-size: .9rem; }
.day-name .date { display: block; font-weight: 500; color: var(--muted); font-size: .78rem; }
.day-shifts { flex: 1; }
.shift-pill {
  display: inline-block;
  background: var(--green-soft);
  color: var(--green);
  border-radius: 8px;
  padding: 3px 10px;
  font-size: .88rem;
  font-weight: 600;
  margin: 2px 4px 2px 0;
}
.shift-pill.other {
  background: var(--gray-soft);
  color: var(--muted);
  font-weight: 500;
}
.day-off { color: var(--muted); font-size: .88rem; }

/* ---------- manager schedule builder ---------- */
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.week-nav .label { font-weight: 800; color: var(--brown); text-align: center; flex: 1; }
.week-nav .label .sub { display: block; font-weight: 500; font-size: .8rem; color: var(--muted); }
.publish-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.day-block { border-top: 1px solid var(--line); padding: 10px 0; }
.day-block h4 { margin: 0 0 6px; color: var(--brown); font-size: .95rem; }
.assign-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; padding: 5px 8px; border-radius: 8px;
}
.assign-row:nth-child(odd) { background: var(--gray-soft); }
.assign-x {
  border: none; background: none; color: var(--red); font-weight: 800;
  font-size: 1rem; cursor: pointer; padding: 2px 8px;
}
.add-assign { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.add-assign select { flex: 1; min-width: 110px; width: auto; padding: 8px 10px; font-size: .9rem; }

/* ---------- per-role schedule grids ---------- */
.role-sec { border-top: 1px solid var(--line); padding: 12px 0 6px; }
.role-sec:first-child { border-top: none; padding-top: 0; }
.role-sec h3 { margin: 0 0 8px; font-size: 1.02rem; color: var(--brown); }
.role-sec .role-count { font-weight: 500; font-size: .8rem; color: var(--muted); }
.grid-scroll { overflow-x: auto; }
table.role-grid { border-collapse: collapse; width: 100%; font-size: .84rem; }
.role-grid th, .role-grid td {
  border: 1px solid var(--line);
  padding: 4px 5px;
  vertical-align: top;
  min-width: 92px;
}
.role-grid th {
  background: var(--gray-soft);
  color: var(--brown);
  font-size: .8rem;
  text-align: center;
}
.role-grid th .th-date { display: block; font-weight: 500; color: var(--muted); font-size: .75rem; }
.role-grid .emp-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  font-weight: 700;
  min-width: 108px;
  box-shadow: 1px 0 0 var(--line);
}
.role-grid th.emp-col { background: var(--gray-soft); text-align: left; }
.cell-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  background: var(--green-soft);
  color: var(--green);
  border-radius: 8px;
  padding: 2px 2px 2px 8px;
  font-weight: 600;
  margin: 2px 0;
  white-space: nowrap;
}
.cell-pill .assign-x { padding: 0 5px; font-size: .9rem; }
select.cell-add {
  width: 100%;
  margin-top: 2px;
  padding: 3px 4px;
  font-size: .78rem;
  border-style: dashed;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
}
.off-flag {
  color: var(--amber);
  font-size: .74rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ---------- employees tab: tap-to-toggle role chips ---------- */
.role-picker { margin-top: 8px; }
.role-toggle {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.role-toggle:hover { border-color: var(--brown); }
.role-toggle.on {
  background: var(--green-soft);
  color: var(--green);
  border-color: var(--green);
}

/* ---------- roles chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 8px 6px 14px;
  font-weight: 600; font-size: .9rem; color: var(--brown);
}
.chip button {
  border: none; background: var(--gray-soft); color: var(--red-dark);
  border-radius: 999px; width: 22px; height: 22px; cursor: pointer;
  font-weight: 800; line-height: 1;
}
.add-inline { display: flex; gap: 8px; margin-top: 12px; }
.add-inline input { flex: 1; }

/* ---------- switch builder / lights ---------- */
.check-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.check-list label {
  display: flex; gap: 10px; align-items: center;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; cursor: pointer; background: #fff;
}
.check-list label:has(input:checked) { border-color: var(--red); background: #fdf3f3; }
.check-list input { width: auto; accent-color: var(--red); transform: scale(1.25); }
.check-list .warn { color: var(--amber); font-size: .8rem; font-weight: 700; margin-left: auto; }
.lights { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.approval-card { border: 2px solid var(--amber); }
.off-pill { background: var(--amber-soft) !important; color: var(--amber) !important; }
.kind-badge { background: #ece4f7; color: #5b3a8e; }

/* ---------- history ---------- */
.history { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 6px; }
.history .h-item { font-size: .82rem; color: var(--muted); padding: 2px 0; }
.history .h-item b { color: var(--ink); }

/* ---------- splash ---------- */
.splash { text-align: center; padding-top: 6px; }
.splash .photo img {
  width: 100%; max-height: 240px; object-fit: cover;
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.splash h1 { margin: 16px 0 0; color: var(--brown); font-size: 2rem; letter-spacing: .3px; }
.splash .subtitle { margin: 2px 0 20px; color: var(--muted); }
.entry-buttons { display: flex; flex-direction: column; gap: 10px; max-width: 340px; margin: 0 auto; }
.login-card { max-width: 340px; margin: 18px auto; text-align: left; }

/* ---------- QR ---------- */
.qr-wrap { text-align: center; }
.qr-wrap svg { width: 260px; height: 260px; }
.qr-url { font-family: Consolas, monospace; font-size: .85rem; word-break: break-all; color: var(--brown); }

/* ---------- developer mode ---------- */
#devBtn {
  position: fixed; top: 4px; right: 10px; z-index: 1000;
  width: 32px; height: 32px; border-radius: 999px;
  border: 2px solid #fff; background: var(--ink); color: #fff;
  cursor: pointer; font-size: 15px; line-height: 1;
  box-shadow: var(--shadow);
}
#devPanel {
  position: fixed; top: 44px; right: 10px; z-index: 1000;
  width: min(380px, calc(100vw - 20px));
  max-height: 78vh; overflow-y: auto;
  background: #fff; border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .3);
  padding: 14px;
}
#devPanel h3 { margin: 0 0 4px; color: var(--brown); font-size: 1rem; }
#devPanel .row { margin-top: 8px; }
.dev-clock {
  font-variant-numeric: tabular-nums; font-weight: 800;
  color: var(--red-dark); margin: 8px 0 6px;
}
.dev-sec { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 10px; }

@media print {
  body * { visibility: hidden; }
  #qrPrint, #qrPrint * { visibility: visible; }
  #qrPrint { position: absolute; left: 0; top: 0; width: 100%; text-align: center; }
}

@media (min-width: 700px) {
  .entry-buttons { flex-direction: row; }
  .entry-buttons .btn { flex: 1; }
}
