/* Platform shell — fixed topbar + collapsible left sidebar.
   Layout only; colors/typography come from style.css variables. */

body.shell { padding-top: 56px; }

.shell-topbar {
    position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 50;
    display: flex; align-items: center; gap: 14px;
    padding: 0 20px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 3px rgba(17, 35, 55, 0.05);
}
.shell-topbar .brand { display: flex; align-items: center; gap: 10px; }
.shell-topbar .brand img.logo { height: 30px; width: 30px; display: block; }
.shell-topbar .brand .title { font-size: 16px; }
.shell-topbar .meta { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.side-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 8px;
    background: none; border: 1px solid transparent; color: var(--muted); cursor: pointer;
}
.side-toggle:hover { background: var(--bg-soft); color: var(--text); }

.user-chip {
    padding: 4px 10px; border-radius: 999px;
    background: var(--bg-soft); border: 1px solid var(--line);
    color: var(--text); font-size: 12.5px;
}
.btn-quiet { opacity: .75; }
.btn-quiet:hover { opacity: 1; }

.shell-sidebar {
    position: fixed; top: 56px; bottom: 0; left: 0; width: 216px; z-index: 40;
    display: flex; flex-direction: column;
    background: var(--bg-elev);
    border-right: 1px solid var(--line);
    overflow-y: auto; padding: 10px 0;
    transition: transform .18s ease;
}
.side-collapsed .shell-sidebar { transform: translateX(-100%); }

.side-group {
    padding: 16px 20px 6px;
    font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
    color: var(--dim);
}
.side-link {
    position: relative; display: flex; align-items: center; gap: 10px;
    padding: 8px 20px;
    color: var(--muted); font-size: 13.5px; text-decoration: none;
    transition: padding-left .15s ease, background .15s ease, color .15s ease;
}
.side-link::before {
    content: ''; position: absolute; left: 0; top: 18%; bottom: 18%; width: 3px;
    background: var(--amber); border-radius: 0 3px 3px 0;
    transform: scaleY(0); transition: transform .15s ease;
}
.side-link:hover, .side-link.active { background: var(--amber-soft); color: var(--text); text-decoration: none; }
.side-link:hover { padding-left: 24px; }
.side-link:hover::before, .side-link.active::before { transform: scaleY(1); }

.side-foot {
    margin-top: auto; padding: 14px 20px;
    font-size: 11px; color: var(--dim);
    border-top: 1px solid var(--line);
}

.shell-content { margin-left: 216px; transition: margin-left .18s ease; }
.side-collapsed .shell-content { margin-left: 0; }

/* Backdrop behind the mobile drawer — desktop never shows it */
.side-backdrop { display: none; }

@media (max-width: 900px) {
    /* Mobile: the sidebar is a drawer, closed by default REGARDLESS of the
       desktop side-collapsed preference persisted in localStorage. Only the
       explicit .side-open state (toggle button, never persisted) shows it. */
    .shell-sidebar,
    .side-collapsed .shell-sidebar { transform: translateX(-100%); }
    .side-open .shell-sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.5); }
    .shell-content { margin-left: 0; }

    .side-backdrop {
        position: fixed; inset: 56px 0 0 0; z-index: 39;
        background: rgba(0, 0, 0, .45);
        opacity: 0; pointer-events: none; transition: opacity .18s ease;
    }
    .side-open .side-backdrop { display: block; opacity: 1; pointer-events: auto; }

    /* Topbar: keep brand + actions on one uncrowded line */
    .shell-topbar { padding: 0 12px; gap: 10px; }
    .shell-topbar .brand .subtitle {
        max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .shell-topbar .meta { gap: 8px; }
}
@media (max-width: 700px) {
    .shell-topbar .meta-text { display: none; }
    .user-chip { display: none; }
}

/* Login page */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--bg);
}
.login-card {
    width: 340px; padding: 32px;
    background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px;
}
.login-card .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-card .brand img.logo { height: 40px; width: 40px; display: block; }
.login-card label { display: block; margin: 14px 0 5px; font-size: 12.5px; color: var(--muted); }
.login-card input {
    width: 100%; padding: 9px 11px; box-sizing: border-box;
    background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px;
    color: var(--text); font-size: 14px;
}
.login-card input:focus { outline: none; border-color: var(--amber); }
.login-card .submit {
    width: 100%; margin-top: 20px; padding: 10px;
    background: var(--amber); color: #fff; font-weight: 600;
    border: none; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.login-card .submit:hover { filter: brightness(1.08); }
.login-error {
    margin-top: 14px; padding: 9px 11px; border-radius: 8px; font-size: 13px;
    background: rgba(248, 113, 113, .12); border: 1px solid rgba(248, 113, 113, .4); color: var(--red);
}
.login-hint { margin-top: 14px; font-size: 12px; color: var(--dim); }

/* Users admin */
.users-table { width: 100%; border-collapse: collapse; }
.users-table th, .users-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.users-table th { color: var(--dim); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; }
.form-grid label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.form-grid input, .form-grid select {
    width: 100%; padding: 8px 10px; box-sizing: border-box;
    background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; color: var(--text);
}
.inline-form { display: inline; }

@media print {
    .shell-topbar, .shell-sidebar, .side-toggle { display: none !important; }
    body.shell { padding-top: 0; }
    .shell-content { margin-left: 0; }
}

/* ── view-as switcher (admin) ─────────────────────────────────────────── */
.viewas { display: flex; align-items: center; gap: 8px; }
.viewas select { padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px;
    background: var(--bg-elev, #fff); color: var(--text); font-size: 12.5px; max-width: 160px; }
.viewas-on { background: var(--amber-soft); border: 1.5px solid var(--amber);
    border-radius: 999px; padding: 3px 6px 3px 12px; }
.viewas-chip { font-size: 12.5px; font-weight: 600; color: var(--amber); white-space: nowrap; }
.viewas-on .btn { padding: 2px 10px; font-size: 12px; }

/* ── Edit menu mode (admin) ───────────────────────────────────────────── */
.menu-editing .side-link { cursor: grab; border: 1px dashed var(--line); border-radius: 6px; margin: 2px 6px; }
.menu-editing .side-link:active { cursor: grabbing; }
.menu-editbar { padding: 12px 14px; border-top: 1px solid var(--line); margin-top: 10px; }
.menu-edithint { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }

/* ── topbar time zones ────────────────────────────────────────────────── */
.tz-strip { display: flex; gap: 14px; margin: 0 18px; font-size: 12px; color: var(--muted);
    font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.tz { display: inline-flex; gap: 5px; align-items: baseline; }
.tz-city { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }
@media (max-width: 1100px) { .tz-strip { display: none; } }
.menu-dropline { height: 0; border-top: 2px solid var(--red, #d92d20); margin: 1px 8px; border-radius: 1px; }
.menu-editing .side-link.menu-dragging { opacity: .45; }

/* ── js tooltip ([data-tip]) ──────────────────────────────────────────── */
.js-tip { position: absolute; z-index: 2000; max-width: 360px; background: var(--text);
    color: #fff; font-size: 12.5px; line-height: 1.45; padding: 9px 13px; border-radius: 9px;
    box-shadow: 0 6px 22px rgba(0,0,0,.22); white-space: pre-line; pointer-events: none; }

/* ── unreleased / brainstorming marker (modules.json "flag": "wip") ────── */
/* right-edge orange line so it never fights the ::before hover/active bar */
.side-wip::after {
    content: ''; position: absolute; right: 0; top: 18%; bottom: 18%; width: 3px;
    background: var(--brand-orange, #ff8c00); border-radius: 3px 0 0 3px;
}

/* ── new problem reports (Reported problems entry, _problems_lib.php) ──── */
.side-link.side-alert { color: var(--red); font-weight: 700; }
.side-link.side-alert::after {
    content: ''; position: absolute; right: 0; top: 18%; bottom: 18%; width: 3px;
    background: var(--red); border-radius: 3px 0 0 3px;
}
.side-count {
    margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 999px;
    background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 16px;
    text-align: center; font-variant-numeric: tabular-nums;
}
.side-toggle.has-alert { position: relative; }
.side-toggle.has-alert::after {
    content: ''; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px;
    border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--bg-elev, #fff);
}

/* Ticket Flow: back bar (?key=), jump link after ticket keys, highlighted row */
.tf-back { margin: 0 0 12px; }
.tf-back a { display: inline-block; font-size: 13px; padding: 5px 12px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-weight: 600; }
.tf-jump { font-size: 11px; margin-left: 3px; color: var(--dim); text-decoration: none; }
.tf-jump:hover { color: var(--amber); }
.tf-hl { outline: 2px solid var(--brand-orange); outline-offset: 2px; background: var(--amber-soft) !important; }
