/* The work time app (index.php): one phone screen, light and dark */
:root {
    --bg: #f1f5f4;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #dbe3e1;
    --brand: #0f766e;
    --brand-text: #ffffff;
    --go: #16a34a;
    --stop: #dc2626;
    --warn: #b45309;
    --warn-bg: #fef3c7;
    --err-bg: #fee2e2;
    --err: #b91c1c;
    --pick: #ccfbf1;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1514;
        --card: #13211f;
        --text: #e2e8f0;
        --muted: #94a3b8;
        --line: #24403c;
        --brand: #14b8a6;
        --brand-text: #04211e;
        --go: #22c55e;
        --stop: #ef4444;
        --warn: #fbbf24;
        --warn-bg: #3a2d0b;
        --err-bg: #3b1212;
        --err: #fca5a5;
        --pick: #134e4a;
    }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
    font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
    padding-bottom: env(safe-area-inset-bottom);
}
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bar {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
    background: var(--brand); color: var(--brand-text);
}
.bar .logo { width: 26px; height: 26px; }
.bar .title { font-weight: 700; font-size: 18px; flex: 1; }
.icon-btn { background: transparent; border: 0; color: inherit; padding: 6px; border-radius: 8px; cursor: pointer; }
.icon-btn svg { width: 24px; height: 24px; display: block; }
.wrap { max-width: 480px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.center { text-align: center; }
h1 { font-size: 20px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.big-icon { width: 64px; height: 64px; color: var(--brand); margin-bottom: 8px; }
.who { margin: 4px 0 14px; }
.who .name { font-weight: 700; font-size: 18px; }
.clock { display: flex; align-items: baseline; gap: 10px; }
#clock { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input[type=text], input[type=password] {
    width: 100%; font-size: 17px; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
input:focus-visible, .btn:focus-visible, .shift:focus-within, .icon-btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.btn {
    display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 16px; min-height: 56px;
    border: 0; border-radius: 14px; font-size: 19px; font-weight: 700; cursor: pointer; color: #fff;
}
.btn svg { width: 26px; height: 26px; }
.btn.primary { background: var(--brand); color: var(--brand-text); }
.btn.go { background: var(--go); }
.btn.stop { background: var(--stop); }
.btn.plain { background: transparent; color: var(--text); border: 1px solid var(--line); min-height: 48px; font-size: 16px; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.go.glow { animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .8); } 50% { box-shadow: 0 0 18px 6px rgba(34, 197, 94, .45); } }
@media (prefers-reduced-motion: reduce) { .btn.go.glow { animation: none; } }
.note { border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 15px; }
.note.error { background: var(--err-bg); color: var(--err); }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.status { display: flex; align-items: center; gap: 12px; }
.status svg { width: 40px; height: 40px; flex: none; }
.status .go { color: var(--go); }
.status .done { color: var(--brand); }
.status .big { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.shifts { display: grid; gap: 8px; margin-top: 8px; }
.shift { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-size: 17px; font-weight: 600; }
.shift input { width: 22px; height: 22px; accent-color: var(--brand); margin: 0; }
.shift.on { background: var(--pick); border-color: var(--brand); }
.mine { margin-top: 12px; padding: 14px; }
.mine .totals { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-bottom: 10px; font-size: 14px; }
.mine .totals b { display: block; font-size: 17px; }
.mine .day { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.mine .day .d { width: 64px; flex: none; font-variant-numeric: tabular-nums; }
.mine .day .t { flex: 1; min-width: 0; }
.mine .day .h { font-weight: 700; font-variant-numeric: tabular-nums; }
.mine .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--line); }
.mine .s-worked { background: var(--go); } .mine .s-late { background: var(--stop); } .mine .s-early { background: var(--warn); }
.mine .s-extra { background: #3b82f6; } .mine .s-absent { background: #06b6d4; } .mine .s-missing { background: var(--text); }
.mine .bad { color: var(--stop); font-weight: 600; }
/* the reminder to end the day on this phone (app.js push) */
.push { margin-top: 12px; padding: 14px; font-size: 15px; }
.push .push-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.push .push-head svg, .push .push-on svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.push .push-on { display: flex; align-items: center; gap: 8px; color: var(--go); font-weight: 600; }
.push .push-row { display: flex; gap: 10px; }
.push .push-row .btn { min-height: 44px; font-size: 15px; margin-top: 10px; }
.push .btn.primary { min-height: 48px; font-size: 17px; margin-top: 10px; }
.push ol { margin: 8px 0 0 20px; padding: 0; }
.push ol li { margin: 4px 0; }
.push svg.inline { width: 18px; height: 18px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.note.ok { background: var(--pick); color: var(--brand); }
[hidden] { display: none !important; }
/* the login QR read inside the app (the Scan button): the camera over the whole screen */
#scanBtn { margin-top: 12px; }
.scan { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; }
.scan[hidden] { display: none; }
.scan video { flex: 1; width: 100%; min-height: 0; object-fit: cover; }
.scan-frame {
    position: absolute; left: 50%; top: 42%; width: min(70vw, 300px); aspect-ratio: 1; transform: translate(-50%, -50%);
    border: 3px solid rgba(255, 255, 255, .9); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); pointer-events: none;
}
.scan-bar {
    position: relative; background: var(--card); color: var(--text); padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column; gap: 12px; text-align: center;
}
.scan-bar .bad { color: var(--err); }
/* Распоред на смени (app.js planInit): its button on the day and its own screen over it */
input[type=text], select { font-family: inherit; }
select {
    width: 100%; font-size: 17px; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
select:focus-visible, .pill:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
#planBtn { margin-top: 12px; }
#planBtn svg { width: 22px; height: 22px; }
#planBtn .count {
    min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--stop); color: #fff; font-size: 14px; line-height: 24px;
}
html.locked, html.locked body { overflow: hidden; }
.screen { position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.screen .bar { position: sticky; top: 0; z-index: 1; }
.screen .bar .title { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.screen .wrap { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.sp { padding: 14px; margin-bottom: 12px; }
.sp h2 { display: flex; align-items: center; gap: 8px; font-size: 16px; margin: 0 0 8px; }
.sp h2 svg { width: 20px; height: 20px; flex: none; }
.sp.waiting { border: 2px solid var(--warn); }
.sp .ask + .ask { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.sp .row { display: flex; gap: 10px; }
.sp .row .btn { min-height: 48px; font-size: 17px; margin-top: 10px; }
.sp .red { color: var(--stop); }
.sp-day { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.sp h2 + .sp-day { border-top: 0; }
.sp-day.today { background: var(--pick); border-radius: 10px; padding-left: 8px; padding-right: 8px; border-top-color: transparent; }
.sp-day.today + .sp-day { border-top-color: transparent; }
.sp-day .date { width: 64px; flex: none; line-height: 1.15; font-variant-numeric: tabular-nums; }
.sp-day .date b { display: block; font-size: 17px; }
.sp-day .date span { font-size: 13px; color: var(--muted); }
.sp-day .date.red, .sp-day .date.red span { color: var(--stop); }
.sp-day .what { flex: 1; min-width: 0; }
.duty-row + .duty-row { margin-top: 6px; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 12px; font-weight: 600; color: var(--text); }
.chip.off, .sp-week td.off { background: repeating-linear-gradient(135deg, transparent 0 4px, rgba(127, 127, 127, .2) 4px 6px); color: var(--muted); }
.c0 { background: rgba(59, 130, 246, .24); } .c1 { background: rgba(16, 185, 129, .26); } .c2 { background: rgba(245, 158, 11, .30); }
.c3 { background: rgba(139, 92, 246, .26); } .c4 { background: rgba(236, 72, 153, .24); } .c5 { background: rgba(20, 184, 166, .26); }
.c6 { background: rgba(239, 68, 68, .22); } .c7 { background: rgba(100, 116, 139, .28); }
.duty { display: inline-block; background: #c2410c; color: #fff; border-radius: 10px; padding: 0 8px; font-size: 13px; font-weight: 600; }
.duty-dot { width: 12px; height: 12px; border-radius: 50%; background: #c2410c; flex: none; }
.pill {
    flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 0 12px;
    border: 1px solid var(--line); border-radius: 22px; background: var(--card); color: var(--brand); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.pill svg { width: 20px; height: 20px; }
.pill[disabled] { opacity: .55; cursor: default; }
.state { flex: none; padding: 2px 8px; border-radius: 10px; font-size: 13px; font-weight: 600; background: var(--line); color: var(--text); }
.state.s-asked { background: var(--warn-bg); color: var(--warn); }
.state.s-accepted { background: var(--pick); color: var(--brand); }
.state.s-declined, .state.s-failed { background: var(--err-bg); color: var(--err); }
.sp-week { overflow-x: auto; margin: 0 -4px; }
.sp-week table { border-collapse: collapse; font-size: 13px; }
.sp-week th, .sp-week td { border: 1px solid var(--line); padding: 4px 5px; text-align: center; min-width: 34px; white-space: nowrap; font-weight: 600; }
.sp-week th { font-weight: 600; color: var(--muted); }
.sp-week th.red { color: var(--stop); }
.sp-week th.n { text-align: left; max-width: 130px; overflow: hidden; text-overflow: ellipsis; color: var(--text); position: sticky; left: 0; background: var(--card); }
.sp-week td.d { box-shadow: inset 0 -3px 0 #c2410c; }
.sp-week tr.me th, .sp-week tr.me td { font-weight: 800; }
.sp.form label:first-of-type { margin-top: 4px; }
.sp.form .preview { margin: 10px 0 0; display: grid; gap: 4px; }
/* Отсуства (app.js leaveInit): the time-off requests' screen */
#leaveBtn { margin-top: 12px; }
#leaveBtn svg { width: 22px; height: 22px; }
input[type=date], input[type=file] {
    width: 100%; font: inherit; font-size: 17px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
input[type=file] { font-size: 15px; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: 14px 0 0; min-height: 44px; }
label.check input { width: 22px; height: 22px; accent-color: var(--brand); margin: 0; }
.lv-dates { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.lv-dates input { min-width: 0; }   /* a date field's own width would push "До" off a narrow phone */
.lv-dates > div[hidden] { display: none; }
.lv-dates:has(> div[hidden]) { grid-template-columns: 1fr; }
.sp.form .btn.primary { margin-top: 14px; }
.lv-left b { font-size: 34px; color: var(--brand); font-variant-numeric: tabular-nums; }
.lv-wait { color: var(--warn); margin-top: 4px; }
.lv-row { padding: 10px 0; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.sp h2 + .lv-row { border-top: 0; }
.lv-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lv-row .pill { justify-self: start; display: inline-flex; }
.state.s-pending { background: var(--warn-bg); color: var(--warn); }
.state.s-approved { background: var(--pick); color: var(--brand); }
.state.s-rejected { background: var(--err-bg); color: var(--err); }
