/* MyShift shared styles */
:root {
  --brand: #4f46e5;
  --brand-ink: #ffffff;
  --brand-soft: #eef2ff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #f1f5f9;
  --bg: #f6f7fb;
  --card: #ffffff;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --bad: #dc2626;
  --bad-soft: #fef2f2;
  --info-soft: #eff6ff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .18);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body { font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: 0; }
small, .small { font-size: 13px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

/* Buttons */
.btn {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 9px 14px; font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:hover { background: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); border-color: #fecaca; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.solid-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.lg { padding: 14px 18px; font-size: 16px; border-radius: 12px; }
.btn.block { width: 100%; }

/* Forms */
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label.field .hint { font-weight: 400; color: var(--muted); }
input, select, textarea {
  font: inherit; font-size: 15px; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
textarea { min-height: 80px; resize: vertical; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 500; cursor: pointer; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 640px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card.flat { box-shadow: none; }
.card.pad-lg { padding: 24px; }
.card-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }

/* Pills / badges */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: #2563eb; }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: #fafbff; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 26px; font-weight: 750; margin-top: 4px; letter-spacing: -.02em; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.ok .value { color: var(--ok); } .stat.warn .value { color: var(--warn); } .stat.bad .value { color: var(--bad); }

.bar { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--ok); }
.bar.warn > span { background: var(--warn); } .bar.bad > span { background: var(--bad); }

/* Toast */
#toasts { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; max-width: 90vw; animation: pop .2s ease-out; }
.toast.ok { background: #065f46; } .toast.bad { background: #991b1b; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Modal / sheet */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop .2s; }
.modal.wide { max-width: 860px; }
.modal-head { padding: 18px 20px 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 1px solid var(--line-2); }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-foot { padding: 12px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line-2); }
.x-btn { border: 0; background: var(--line-2); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 18px; line-height: 1; color: var(--ink-2); flex: none; }
@media (max-width: 640px) {
  .overlay { align-items: flex-end; padding: 0; }
  .modal { border-radius: 20px 20px 0 0; max-height: 92vh; }
}

/* Drawer (desktop) */
.drawer-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 400; animation: fade .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: #fff; z-index: 401; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer .modal-body { flex: 1; }

/* Notifications bell */
.bell { position: relative; }
.bell .count { position: absolute; top: -2px; right: -2px; background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.notif-panel { position: absolute; right: 0; top: 44px; width: min(360px, 92vw); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 300; max-height: 70vh; overflow-y: auto; }
.notif { padding: 12px 14px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.notif.unread { background: var(--brand-soft); }
.notif b { display: block; margin-bottom: 2px; }

/* Empty state */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 8px; }

/* Loading */
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Segmented control */
.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* Avatar */
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .dow { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; padding: 4px 0; }
.cal .day { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; min-height: 92px; padding: 6px; font-size: 12px; display: flex; flex-direction: column; gap: 3px; }
.cal .day.other { background: transparent; border-style: dashed; opacity: .5; }
.cal .day.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.cal .day .num { font-weight: 700; font-size: 13px; color: var(--ink-2); }
.cal .chip { border-radius: 6px; padding: 2px 5px; font-size: 11px; font-weight: 600; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.full { background: var(--ok-soft); color: var(--ok); }
.chip.part { background: var(--warn-soft); color: var(--warn); }
.chip.low { background: var(--bad-soft); color: var(--bad); }
.chip.cancelled { background: var(--line-2); color: var(--muted); text-decoration: line-through; }

/* Auth page */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-brand { background: radial-gradient(1200px 600px at 0% 0%, #6366f1 0%, #4338ca 40%, #1e1b4b 100%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-brand .logo { font-size: 28px; font-weight: 800; letter-spacing: -.03em; display: flex; align-items: center; gap: 10px; }
.auth-brand .headline { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; max-width: 520px; }
.auth-brand .points { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; font-size: 16px; opacity: .92; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 400px; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-brand { padding: 28px 22px; } .auth-brand .headline { font-size: 30px; } .auth-brand .points { display: none; } }
.logo-mark { width: 36px; height: 36px; border-radius: 10px; background: #fff; color: #4338ca; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: 18px; }

/* ===== Worker app (mobile first) ===== */
body.worker { background: #f3f4f8; }
.w-app { max-width: 520px; margin: 0 auto; min-height: 100vh; padding-bottom: 88px; }
.w-top { position: sticky; top: 0; z-index: 50; background: rgba(243, 244, 248, .92); backdrop-filter: blur(10px); padding: 14px 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.w-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -.02em; font-size: 18px; }
.w-brand .for { font-weight: 500; font-size: 13px; color: var(--muted); }
.w-view { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.w-tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); }
.w-tabs .inner { display: flex; max-width: 520px; width: 100%; }
.w-tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 10px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; }
.w-tabs a svg { width: 23px; height: 23px; }
.w-tabs a.on { color: var(--brand); }
.hero { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #000)); color: #fff; border-radius: 20px; padding: 20px; box-shadow: var(--shadow); }
.hero .big { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
.shift-card { background: #fff; border-radius: 18px; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; position: relative; overflow: hidden; }
.shift-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c, var(--brand)); }
.shift-card .role { font-size: 17px; font-weight: 700; }
.shift-card .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--ink-2); font-size: 14px; }
.shift-card .meta span { display: inline-flex; align-items: center; gap: 5px; }
.shift-card .pay { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.shift-card .pay small { font-size: 13px; font-weight: 600; color: var(--muted); }
.date-head { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 6px 2px -4px; }
.lock-note { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.info-list { display: flex; flex-direction: column; }
.info-list .it { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.info-list .it:last-child { border-bottom: 0; }
.info-list .it .k { width: 120px; flex: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.info-list .it .v { flex: 1; font-size: 14px; }
.success-tick { width: 72px; height: 72px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: flex; align-items: center; justify-content: center; margin: 6px auto 12px; font-size: 38px; }
.avail-grid { display: grid; grid-template-columns: 60px repeat(3, 1fr); gap: 6px; font-size: 13px; }
.avail-grid .h { font-weight: 600; color: var(--muted); text-align: center; }
.avail-grid .d { font-weight: 600; display: flex; align-items: center; }
.avail-grid button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 0; cursor: pointer; font: inherit; font-size: 12px; color: var(--muted); }
.avail-grid button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.banner { border-radius: 14px; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.banner.warn { background: var(--warn-soft); border: 1px solid #fde68a; }
.banner.info { background: var(--info-soft); border: 1px solid #bfdbfe; }
.banner.bad { background: var(--bad-soft); border: 1px solid #fecaca; }
.banner.ok { background: var(--ok-soft); border: 1px solid #a7f3d0; }
.checklist { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.checklist div { display: flex; gap: 8px; align-items: center; }
#map { height: 60vh; border-radius: 16px; border: 1px solid var(--line); }

/* ===== Desktop shell (client + admin) ===== */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: #0f172a; color: #cbd5e1; padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; color: #fff; font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.side .brand .sub { display: block; font-size: 12px; font-weight: 500; color: #94a3b8; letter-spacing: 0; }
.side .client-logo { max-width: 120px; max-height: 40px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: #cbd5e1; text-decoration: none; font-weight: 550; font-size: 14px; }
.side a.nav:hover { background: rgba(255,255,255,.06); color: #fff; }
.side a.nav.on { background: var(--brand); color: #fff; }
.side a.nav .badge { margin-left: auto; background: var(--bad); color: #fff; font-size: 11px; border-radius: 99px; padding: 1px 7px; font-weight: 700; }
.side .foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.side svg { width: 18px; height: 18px; flex: none; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 28px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; gap: 12px; }
.content { padding: 24px 28px 60px; display: flex; flex-direction: column; gap: 18px; max-width: 1400px; }
.menu-btn { display: none; }
@media (min-width: 901px) { .shell { background: linear-gradient(90deg, #0f172a 250px, var(--bg) 250px); } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 200; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px; }
}
.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.toolbar label.field { min-width: 150px; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.preview-table td.err { color: var(--bad); font-weight: 600; }
.kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--line-2); padding: 2px 6px; border-radius: 6px; }
