/* Bullfrog Shifts — modern light-first UI (7shifts/Homebase feel), dark mode via body.dark */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel2: #f1f3f6;
  --line: #e4e8ed;
  --text: #1d2733;
  --dim: #67737f;
  --green: #3f9e53;
  --green-dk: #2e7d3f;
  --amber: #c98a1b;
  --red: #d64545;
  --blue: #2e77ae;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .07);
  --shadow-lg: 0 10px 40px rgba(16, 24, 40, .18);
  --bar-scrim: rgba(255, 255, 255, .88);
}
body.dark {
  --bg: #0e161f;
  --panel: #17212c;
  --panel2: #1e2a37;
  --line: #2a3949;
  --text: #e9eef4;
  --dim: #93a1af;
  --green: #4fbf63;
  --green-dk: #2e7d3f;
  --amber: #e0a83c;
  --red: #e05c5c;
  --blue: #4da3d6;
  --shadow: none;
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
  --bar-scrim: rgba(14, 22, 31, .88);
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
.hidden { display: none !important; }
h3 { margin: 20px 4px 8px; font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .07em; }

/* ---- login ---- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(370px, 92vw); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 32px 26px; text-align: center; display: grid; gap: 12px; box-shadow: var(--shadow-lg); }
.login-card .logo { font-size: 44px; }
.login-card h1 { font-size: 22px; letter-spacing: -.01em; }
.login-card .sub { color: var(--dim); font-size: 13px; margin-bottom: 6px; }
.login-card input { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; color: var(--text); padding: 12px 14px; font-size: 16px; }
.login-card input:focus { outline: 2px solid var(--green); outline-offset: -1px; }
.err { color: var(--red); font-size: 13px; min-height: 18px; }
#loginForm { display: grid; gap: 12px; }

/* ---- chrome ---- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bar-scrim); backdrop-filter: blur(14px); z-index: 20; }
.brand { font-size: 17px; letter-spacing: -.01em; display: flex; align-items: center; gap: 9px; }
.wm { user-select: none; -webkit-user-drag: none; }
body.dark .wm { filter: invert(1); }
.brand-wm { height: 36px; width: auto; }
.wm-login { width: 190px; margin: 0 auto 4px; }
.who { color: var(--dim); font-size: 12px; margin-left: auto; }
@media (max-width: 719px) { .who { display: none; } .topbar .btn:first-of-type { margin-left: auto; } }
.tabs { display: flex; gap: 6px; padding: 12px 14px 4px; overflow-x: auto; max-width: 1100px; margin: 0 auto; width: 100%; }
.tab { background: transparent; border: none; color: var(--dim); border-radius: 10px; padding: 9px 14px; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.tab:hover { background: var(--panel2); }
.tab.active { background: var(--green-dk); color: #fff; }
.pane { padding: 12px 14px 90px; max-width: 1100px; margin: 0 auto; }
.badge { display: inline-block; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: 1px; }
.install-tip { display: flex; align-items: center; gap: 10px; max-width: 1100px; margin: 6px auto 0; padding: 10px 14px; background: color-mix(in srgb, var(--green) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--green) 35%, var(--line)); border-radius: 12px; font-size: 13px; }
.install-tip span:first-child { flex: 1; }

/* ---- buttons ---- */
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 10px; padding: 10px 16px; font-size: 15px; font-weight: 500; cursor: pointer; box-shadow: var(--shadow); }
.btn.primary { background: var(--green-dk); border-color: var(--green-dk); color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.danger { background: transparent; border-color: var(--red); color: var(--red); box-shadow: none; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn:active { transform: scale(.97); }
.btn.wide { width: 100%; margin-top: 12px; }

/* ---- week nav ---- */
.weeknav { display: flex; align-items: center; gap: 8px; margin: 8px 0 14px; }
.wlabel { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.week-actions { display: flex; gap: 10px; margin-top: 14px; }
.week-actions .primary { margin-left: auto; }

/* ---- schedule grid ---- */
.gridwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
table.sched { border-collapse: collapse; width: 100%; min-width: 760px; }
table.sched th, table.sched td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 6px; vertical-align: top; }
table.sched tr:last-child td { border-bottom: none; }
table.sched th { font-size: 12px; color: var(--dim); font-weight: 600; padding: 10px 6px; background: var(--panel2); position: sticky; top: 0; z-index: 1; }
table.sched th.today, table.sched td.today { background: color-mix(in srgb, var(--green) 8%, var(--panel)); }
table.sched td.name { font-weight: 600; font-size: 13px; white-space: nowrap; padding: 10px 10px; background: var(--panel2); position: sticky; left: 0; z-index: 1; }
table.sched td.name .hrs { display: block; color: var(--dim); font-weight: 400; font-size: 11px; }
table.sched td.cell { min-width: 92px; height: 52px; cursor: default; }
body.manager table.sched td.cell { cursor: pointer; }
body.manager table.sched td.cell:hover { background: color-mix(in srgb, var(--green) 10%, var(--panel)); }
.pill { display: block; color: #fff; border-radius: 8px; padding: 5px 8px; font-size: 12px; font-weight: 600; line-height: 1.3; margin: 2px 0; box-shadow: var(--shadow); }
.pill .role { display: block; font-size: 10px; font-weight: 500; opacity: .85; }
.pill.draft { background: transparent !important; border: 1.5px dashed; box-shadow: none; }
.pill.open { background: transparent !important; border: 1.5px dashed var(--dim); color: var(--dim); }
.pill.open.draft { border-color: var(--amber); color: var(--amber); }
tr.openrow td { background: color-mix(in srgb, var(--dim) 4%, var(--panel)); }
tr.openrow td.name { color: var(--dim); }

/* ---- mobile day view ---- */
.dayview { display: none; }
.day-chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; -webkit-overflow-scrolling: touch; }
.day-chip { flex: 1 0 64px; background: var(--panel); border: 1px solid var(--line); color: var(--dim); border-radius: 12px; padding: 8px 4px; font-size: 12px; line-height: 1.25; text-align: center; cursor: pointer; box-shadow: var(--shadow); }
.day-chip.is-today { border-color: var(--green); }
.day-chip.sel { background: var(--green-dk); border-color: var(--green-dk); color: #fff; font-weight: 600; }
.day-chip i { display: block; font-style: normal; font-size: 10px; margin-top: 2px; opacity: .85; }
.day-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-left: 4px solid var(--green-dk); border-radius: 12px; background: var(--panel); padding: 13px 12px; margin: 7px 0; box-shadow: var(--shadow); }
.day-card .nm { font-weight: 600; min-width: 74px; }
.day-card .tm { color: var(--text); font-size: 14px; flex: 1; }
.day-card .rolechip { font-size: 11px; font-weight: 600; color: #fff; padding: 3px 9px; border-radius: 999px; }
.day-card.draft { border-style: dashed; opacity: .9; }
.day-card.openshift { border-style: dashed; }
.day-card.openshift .nm { color: var(--dim); }
.ical-row .tm { flex: 1; }
.ical-reveal { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.ical-reveal input { flex: 1; min-width: 200px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 8px 10px; font-size: 12px; }
.ical-reveal .hint { width: 100%; margin: 2px 0 0; }
.day-card .draftchip { font-size: 11px; color: var(--amber); border: 1px dashed var(--amber); padding: 2px 8px; border-radius: 999px; }
@media (max-width: 719px) {
  .gridwrap { display: none; }
  .dayview { display: block; }
}

/* ---- today ---- */
.today-head { font-size: 19px; font-weight: 700; margin: 8px 4px 12px; letter-spacing: -.01em; }
.vol-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 16px; font-size: 15px; margin-bottom: 10px; box-shadow: var(--shadow); }
.vol-card b { font-size: 17px; }
.vol-card .detail { color: var(--dim); font-size: 13px; margin-top: 4px; }
.hour-chart { display: flex; align-items: flex-end; gap: 3px; height: 96px; padding: 12px 12px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.hour-chart .bar { flex: 1; background: var(--green); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; opacity: .9; }
.hour-chart .bar.low { background: var(--amber); opacity: .55; }
.hour-chart .bar.now { outline: 2px solid var(--green-dk); }
.hour-chart .bar span { position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%); font-size: 9px; color: var(--dim); }
.shift-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 12px; margin: 7px 0; box-shadow: var(--shadow); }
.shift-row .nm { font-weight: 600; min-width: 90px; }
.shift-row .tm { color: var(--dim); font-size: 13px; }
.shift-row .chip { margin-left: auto; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.chip.ok { background: color-mix(in srgb, var(--green) 16%, var(--panel)); color: var(--green-dk); }
body.dark .chip.ok { color: var(--green); }
.chip.warn { background: color-mix(in srgb, var(--amber) 16%, var(--panel)); color: var(--amber); }
.chip.bad { background: color-mix(in srgb, var(--red) 14%, var(--panel)); color: var(--red); }
.chip.dim { background: var(--panel2); color: var(--dim); }
.chip.cut { background: color-mix(in srgb, var(--blue) 15%, var(--panel)); color: var(--blue); }
.sync-note { color: var(--dim); font-size: 12px; margin-top: 14px; text-align: center; }

/* ---- actuals ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.card { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 14px; box-shadow: var(--shadow); }
.card .v { font-size: 23px; font-weight: 700; letter-spacing: -.02em; }
.card .k { color: var(--dim); font-size: 12px; }
.day-block { margin: 16px 0 6px; }
.day-block h4 { font-size: 12px; color: var(--dim); margin: 0 4px 6px; text-transform: uppercase; letter-spacing: .06em; }
.act-row { display: grid; grid-template-columns: minmax(80px,1fr) auto auto; gap: 4px 12px; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 11px 12px; margin: 6px 0; font-size: 14px; box-shadow: var(--shadow); }
.act-row .nm { font-weight: 600; }
.act-row .sched-t, .act-row .act-t { text-align: right; font-variant-numeric: tabular-nums; }
.act-row .sub { grid-column: 1 / -1; color: var(--dim); font-size: 12px; }
.delta { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.delta.ok { background: color-mix(in srgb, var(--green) 16%, var(--panel)); color: var(--green-dk); }
body.dark .delta.ok { color: var(--green); }
.delta.warn { background: color-mix(in srgb, var(--amber) 16%, var(--panel)); color: var(--amber); }
.delta.bad { background: color-mix(in srgb, var(--red) 14%, var(--panel)); color: var(--red); }

/* ---- day events strip ---- */
table.sched tr.evrow td { padding: 3px 5px; background: color-mix(in srgb, var(--blue) 4%, var(--panel)); height: auto; }
table.sched tr.evrow td.evlabel { text-align: center; font-size: 12px; }
.evwrap { display: flex; flex-wrap: wrap; gap: 3px; }
.evchip { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; font-weight: 600; color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, var(--panel)); border-radius: 6px; padding: 2px 6px; }
.evchip i { font-style: normal; opacity: .7; margin-right: 3px; }
.evchip.more { background: var(--panel2); color: var(--dim); }
#dayEvents .evwrap { margin: 0 0 8px; }
#dayEvents .evchip { font-size: 12px; padding: 4px 9px; }
.evwrap { cursor: pointer; }
.ev-item { display: flex; gap: 12px; align-items: baseline; border-bottom: 1px solid var(--line); padding: 9px 2px; font-size: 15px; }
.ev-item:last-child { border-bottom: none; }
.ev-time { color: var(--blue); font-weight: 600; font-size: 13px; min-width: 58px; flex: none; }

/* ---- availability markers on the grid ---- */
.offmark { display: block; font-size: 10.5px; font-weight: 600; color: var(--dim); background: var(--panel2); border-radius: 7px; padding: 3px 6px; margin: 2px 0; }
.offmark.to { color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, var(--panel)); }
.offmark.pend { color: var(--amber); background: color-mix(in srgb, var(--amber) 12%, var(--panel)); }
.day-card.off { border-left-color: var(--line); background: var(--panel2); box-shadow: none; }
.day-card.off .offmark { background: transparent; padding: 0; font-size: 13px; }

/* ---- availability tab ---- */
.avail-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 10px 12px; margin: 6px 0; box-shadow: var(--shadow); }
.avail-row .dnm { font-weight: 600; min-width: 88px; }
.avail-row select, .avail-row input[type="time"] { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font-size: 14px; }
.avail-row .times { display: flex; align-items: center; gap: 6px; color: var(--dim); }
.to-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.to-form input { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 15px; }
.to-form input[type="text"] { flex: 1; min-width: 140px; }
.hint-inline { color: var(--dim); font-size: 13px; }
.req-actions { margin-left: auto; display: flex; gap: 6px; }
.shift-row.decided { opacity: .6; }

/* ---- person card ---- */
.person-lines { display: grid; gap: 6px; margin: 4px 0 6px; }
.pline { font-size: 15px; }
.pline a { color: var(--blue); text-decoration: none; }
.pline.dim, .dim { color: var(--dim); font-size: 13px; }
body.manager table.sched td.name { cursor: pointer; }
body.manager table.sched td.name:hover { background: color-mix(in srgb, var(--green) 10%, var(--panel2)); }
.staff-row .nm-click { cursor: pointer; }

/* ---- staff ---- */
.hint { color: var(--dim); font-size: 13px; margin: 8px 4px 12px; }
.staff-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 10px 12px; margin: 7px 0; box-shadow: var(--shadow); }
.staff-row .drag { color: var(--dim); font-size: 19px; cursor: grab; touch-action: none; padding: 12px 14px; margin: -10px -4px -10px -10px; user-select: none; -webkit-user-select: none; }
.staff-row .drag:active { cursor: grabbing; }
body.drag-lock { user-select: none; -webkit-user-select: none; cursor: grabbing; }
.staff-row.dragging { opacity: .92; box-shadow: var(--shadow-lg); transform: scale(1.01); position: relative; z-index: 5; }
.staff-row .nm { font-weight: 600; flex: 1; }
.staff-row .nm small { display: block; color: var(--dim); font-weight: 400; }
.staff-row select { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.staff-row.off { opacity: .45; }
.switch { position: relative; width: 46px; height: 27px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: .15s; cursor: pointer; }
.switch .sl:before { content: ""; position: absolute; width: 21px; height: 21px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .sl { background: var(--green-dk); }
.switch input:checked + .sl:before { transform: translateX(19px); }

/* ---- sheet ---- */
.sheet-wrap { position: fixed; inset: 0; background: rgba(15, 23, 32, .45); z-index: 50; display: grid; align-items: end; }
.sheet { background: var(--panel); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line); padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); max-width: 560px; width: 100%; margin: 0 auto; max-height: 88dvh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.sheet h2 { font-size: 18px; margin-bottom: 14px; letter-spacing: -.01em; }
.sheet .row { display: grid; grid-template-columns: 84px 1fr; align-items: center; gap: 10px; margin: 10px 0; }
.sheet label { color: var(--dim); font-size: 13px; }
.sheet input, .sheet select { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; color: var(--text); padding: 10px 12px; font-size: 16px; width: 100%; }
.sheet input:focus, .sheet select:focus { outline: 2px solid var(--green); outline-offset: -1px; }
.seg { display: flex; gap: 6px; }
.segbtn { flex: 1; background: var(--panel2); border: 1px solid var(--line); color: var(--dim); border-radius: 10px; padding: 10px; font-size: 14px; cursor: pointer; }
.segbtn.active { background: var(--green-dk); border-color: var(--green-dk); color: #fff; font-weight: 600; }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; align-items: center; }
.sheet-actions .spacer { flex: 1; }
@media (min-width: 720px) {
  .sheet-wrap { align-items: center; padding: 20px; }
  .sheet { border-radius: 20px; border: 1px solid var(--line); }
}

/* ---- toast ---- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); border-radius: 999px; padding: 10px 20px; font-size: 14px; font-weight: 500; z-index: 90; box-shadow: var(--shadow-lg); }
