:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --text: #1d2433;
    --muted: #6b7486;
    --border: #e1e5ec;
    --primary: #0b6bcb;
    --primary-hover: #0957a5;
    --accent: #ffcb05;
    --danger: #c62828;
    --ok: #1b7f3b;
    --ok-bg: #e5f5ea;
    --off-bg: #f3e5e5;
    --error-bg: #fdecec;
    --success-bg: #e7f6ec;
    --info-bg: #e8f1fb;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08);
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12161d;
        --surface: #1b212b;
        --text: #e6e9ef;
        --muted: #98a1b3;
        --border: #2c3442;
        --primary: #4a9bf0;
        --primary-hover: #6aaef3;
        --danger: #ef5350;
        --ok: #5fd27f;
        --ok-bg: #1d3325;
        --off-bg: #3a2222;
        --error-bg: #3a2020;
        --success-bg: #1d3325;
        --info-bg: #1c2a3b;
        --shadow: none;
    }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.7;
}
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.inline { display: inline; margin: 0; }
.topbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 20px;
    background: var(--surface);
    border-bottom: 3px solid var(--accent);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 16px; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a, .userbox > a {
    padding: 6px 12px;
    border-radius: 8px;
    color: var(--text);
}
.nav a:hover, .userbox > a:hover { background: var(--bg); }
.nav a.active, .userbox > a.active { background: var(--info-bg); color: var(--primary); font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 8px; }
.container { max-width: 1280px; margin: 0 auto; padding: 24px 16px; }
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}
.auth-card {
    max-width: 400px;
    margin: 60px auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}
label { display: block; margin-bottom: 12px; font-weight: 500; }
input[type=text], input[type=password], input[type=date], input[type=search], input[type=file], select, textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 8px; }
.badge {
    display: inline-block;
    padding: 0 8px;
    border-radius: 99px;
    background: var(--info-bg);
    color: var(--primary);
    font-size: 12px;
}
.tag { display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: 12px; }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-off { background: var(--off-bg); color: var(--danger); }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid var(--border); }
.alert-error { background: var(--error-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--ok); }
.alert-info { background: var(--info-bg); color: var(--primary); }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0 14px;
    align-items: end;
}
.form-actions { margin-bottom: 12px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; background: var(--bg); }
.row-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.row-form input, .row-form select { margin-top: 0; width: auto; min-width: 90px; padding: 4px 8px; }
@media (max-width: 640px) {
    .topbar { padding: 10px 12px; gap: 8px; }
    .container { padding: 16px 12px; }
    .auth-card { margin: 24px auto; padding: 20px; }
}
.small { font-size: 12px; }
.is-hidden { display: none !important; }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
textarea { font-family: Consolas, monospace; font-size: 13px; }
.dim td { opacity: .55; }
.file-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.result-list { list-style: none; padding: 0; margin: 0; }
.result-list li { padding: 10px 12px; border-radius: 8px; margin-bottom: 8px; border: 1px solid var(--border); }
.result-list li.ok { background: var(--success-bg); }
.result-list li.fail { background: var(--error-bg); color: var(--danger); }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 8px; }
.kv span { display: block; color: var(--muted); font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border-inline-start: 4px solid var(--accent); }
.stat-label { font-weight: 700; }
.stat-value { font-size: 15px; margin: 2px 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.page-head h1 { margin: 0; }
.now-chip { background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 4px 14px; font-weight: 600; }
.updates { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; font-size: 13px; }
.update-pill { background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 2px 12px; }
.filter-grid { display: grid; grid-template-columns: auto 1fr 1fr 1.4fr auto; gap: 0 12px; align-items: end; }
.filter-grid label { margin-bottom: 10px; }
.filter-grid .f-date { grid-column: auto; }
.f-actions { display: flex; gap: 6px; margin-bottom: 10px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 10px; align-self: end; }
.seg label { margin: 0; font-weight: 500; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 14px; cursor: pointer; white-space: nowrap; }
.seg input:checked + span { background: var(--primary); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 6px; }
.day { display: flex; flex-direction: column; align-items: center; padding: 6px 4px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); line-height: 1.4; }
.day small { color: var(--muted); font-size: 11px; }
.day:hover { background: var(--bg); }
.day.today { border-color: var(--accent); border-width: 2px; }
.day.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.day.active small { color: #e6f0fb; }
.week-nav { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; }
.result-info { margin: 0 0 12px; }
.empty { text-align: center; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.oc-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.oc-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: linear-gradient(to right, var(--info-bg), transparent); }
.oc-card h3 { margin: 0 0 2px; font-size: 16px; }
.oc-when { text-align: right; font-size: 12px; color: var(--muted); }
.shift { font-weight: 600; color: var(--text); }
.people { list-style: none; margin: 0; padding: 0; }
.people li { padding: 10px 14px; border-bottom: 1px dashed var(--border); }
.people li:last-child { border-bottom: 0; }
.person { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pname { font-weight: 600; }
.role { font-size: 11px; padding: 0 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--border); }
.role-main { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.role-backup { background: var(--off-bg); color: var(--danger); border-color: transparent; }
.phone-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.phone { font-family: Consolas, monospace; font-size: 15px; font-weight: 600; letter-spacing: .5px; margin-inline-end: auto; }
.btn-call { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-call:hover { background: var(--ok); filter: brightness(1.1); }
.email { display: inline-block; margin-top: 2px; color: var(--muted); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1d2433; color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 960px) {
    .filter-grid { grid-template-columns: 1fr 1fr; }
    .seg, .f-q, .f-actions { grid-column: 1 / -1; }
    .span-2 { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
    .filter-grid { grid-template-columns: 1fr; }
    .days { grid-template-columns: repeat(4, 1fr); }
    .cards { grid-template-columns: 1fr; }
}
.install-card { max-width: 760px; margin: 30px auto; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 8px; }
.checklist li.ok { background: var(--ok-bg); color: var(--ok); }
.checklist li.fail { background: var(--error-bg); color: var(--danger); }
.btn-lg { padding: 12px 20px; font-size: 16px; margin-bottom: 30px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, #2f6bff, #8b5cf6); box-shadow: inset 0 0 0 4px rgba(255,255,255,.35); }
.menu { display: flex; align-items: center; gap: 20px; flex: 1; }
.menu-toggle { display: none; margin-left: auto; width: 40px; height: 36px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; padding: 8px 9px; flex-direction: column; justify-content: space-between; }
.menu-toggle span { display: block; height: 2px; border-radius: 2px; background: var(--text); transition: transform .2s, opacity .2s; }
.menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.narrow-card { max-width: 420px; margin: 40px auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
@media (max-width: 860px) {
    .topbar { flex-wrap: nowrap; position: relative; gap: 10px; }
    .menu-toggle { display: flex; }
    .menu { display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 40; flex-direction: column; align-items: stretch; gap: 0; background: var(--surface); border-bottom: 3px solid var(--accent); box-shadow: 0 10px 24px rgba(16,24,40,.12); padding: 8px 12px 12px; }
    .menu.open { display: flex; }
    .nav { flex-direction: column; gap: 2px; }
    .nav a { padding: 10px 12px; }
    .userbox { justify-content: space-between; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 10px; }
}
body.auth-page { background: #fff; }
.login-split { display: grid; grid-template-columns: 58% 42%; min-height: 100vh; }
.login-visual { background: #141414 url("login-bg.jpg") 62% center / cover no-repeat; }
.login-panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 24px 24px; background: #fff; color: #1d2433; position: relative; }
.login-box { width: 100%; max-width: 400px; margin: auto 0; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 44px; }
.login-logo { width: 64px; height: 64px; flex: none; }
.login-title { font-size: 24px; font-weight: 600; color: #1d2433; line-height: 1.25; }
.login-sub { font-size: 17px; color: #7a8294; }
.login-form label { font-size: 16px; font-weight: 500; color: #1d2433; margin: 0 0 8px; }
.login-form .req { color: #e5484d; margin-right: 2px; }
.input-icon { position: relative; margin-bottom: 26px; }
.input-icon svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: #b4bac6; color: #b4bac6; pointer-events: none; }
.input-icon input { margin: 0; height: 48px; padding-left: 42px; border: 1px solid #c9ced8; border-radius: 6px; background: #fff; color: #1d2433; font-size: 15px; }
.input-icon input:focus { outline: 2px solid #2f6bff; outline-offset: -1px; border-color: #2f6bff; }
.btn-login { width: 100%; height: 52px; margin-top: 56px; border: 0; border-radius: 6px; background: #2f6bff; color: #fff; font-size: 18px; font-weight: 500; }
.btn-login:hover { background: #1f58e6; }
.login-foot { color: #8c93a3; font-size: 13px; text-align: center; padding-top: 24px; }
.login-panel .alert-error { background: #fdecec; color: #c62828; border-color: #f5c2c2; }
.login-panel .alert-success { background: #e7f6ec; color: #1b7f3b; border-color: #bfe5cb; }
@media (max-width: 860px) {
    .login-split { grid-template-columns: 1fr; }
    .login-visual { display: none; }
    .login-panel { padding: 28px 16px 16px; }
    .login-brand { margin-bottom: 28px; }
    .btn-login { margin-top: 24px; }
}
.user-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.user-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.user-card.is-off { opacity: .75; }
.uc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.uc-name { font-weight: 700; font-size: 15px; word-break: break-word; }
.uc-meta { color: var(--muted); font-size: 12px; }
.uc-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.user-card form { margin: 0; }
.user-card label { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.user-card input, .user-card select { margin-top: 2px; padding: 6px 8px; }
.uc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.uc-actions { display: flex; gap: 6px; margin-top: 6px; }
.uc-actions .btn { flex: 1; }
.uc-section { border-top: 1px dashed var(--border); padding-top: 10px; }
.tag-owner { background: #fff4cc; color: #8a6500; }
.uc-locked { background: var(--bg); border: 1px dashed var(--border); border-radius: 8px; padding: 10px 12px; color: var(--muted); font-size: 13px; }
.settings-list { max-width: 720px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.setting-row h2 { margin: 0 0 2px; }
.setting-row p { margin: 0; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; margin: 0; cursor: pointer; flex: none; }
.switch input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.slider { width: 46px; height: 26px; border-radius: 99px; background: #c9ced8; position: relative; transition: background .2s; }
.slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s; }
.switch input[type=checkbox]:checked + .slider { background: var(--ok); }
.switch input[type=checkbox]:checked + .slider::after { transform: translateX(20px); }
.switch input[type=checkbox]:focus-visible + .slider { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch-label { font-weight: 600; min-width: 28px; }
