/* Resolvix requester (public) side: light / dark / system.
   Loaded only on non-staff helpdesk pages and scoped to body.rq, so staff pages and the other portal tools are untouched.
   Theme: <html data-theme="light|dark"> forces one; no attribute = follow the device (prefers-color-scheme). */

body.rq {
    --rq-bg: #f5f7fb; --rq-surface: #ffffff; --rq-surface2: #eef2fa; --rq-line: #dbe2ee; --rq-line2: #b3bfd4;
    --rq-text: #1c2733; --rq-sec: #3b4658; --rq-muted: #5b6678;
    --rq-btn: #2f62dc; --rq-btn-hover: #2652bd; --rq-link: #1565c0;
    --rq-info-bg: #eaf1fd; --rq-info-bd: #b4cdf3; --rq-info-tx: #0f4fb3; --rq-info-strong: #8fb2ec;
    --rq-amber-bg: #fff0d6; --rq-amber-tx: #8a5300;
    --rq-green-bg: #dcf5ea; --rq-green-bd: #8fd6bb; --rq-green-tx: #0b7a58; --rq-green-ink: #14513d;
    --rq-red-bg: #fdecea; --rq-red-bd: #f5c2bd; --rq-red-tx: #8a1c13;
    --rq-c0: #1565c0; --rq-c1: #0f9f77; --rq-c2: #6d4fe0; --rq-c3: #c47a00;
    --rq-dot-req: #7c88a8; --rq-dot-staff: #4c8dff;
    color-scheme: light;
}
html[data-theme="dark"] body.rq {
    --rq-bg: #0b0f1a; --rq-surface: #141a29; --rq-surface2: #1a2236; --rq-line: #232b40; --rq-line2: #3a4560;
    --rq-text: #e9edf6; --rq-sec: #c9d1e6; --rq-muted: #9aa4bb;
    --rq-btn: #2f62dc; --rq-btn-hover: #3a70ee; --rq-link: #6ea3ff;
    --rq-info-bg: #121b33; --rq-info-bd: #243a68; --rq-info-tx: #9bbcff; --rq-info-strong: #3b5fb8;
    --rq-amber-bg: #3a2a0b; --rq-amber-tx: #ffc760;
    --rq-green-bg: #0f2e24; --rq-green-bd: #1f5c47; --rq-green-tx: #5ee0b4; --rq-green-ink: #cdeee1;
    --rq-red-bg: #2a1214; --rq-red-bd: #6b2a2e; --rq-red-tx: #ffb4ae;
    --rq-c0: #6ea3ff; --rq-c1: #2dd4a3; --rq-c2: #a78bfa; --rq-c3: #f5a524;
    --rq-dot-req: #7c88a8; --rq-dot-staff: #4c8dff;
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) body.rq {
        --rq-bg: #0b0f1a; --rq-surface: #141a29; --rq-surface2: #1a2236; --rq-line: #232b40; --rq-line2: #3a4560;
        --rq-text: #e9edf6; --rq-sec: #c9d1e6; --rq-muted: #9aa4bb;
        --rq-btn: #2f62dc; --rq-btn-hover: #3a70ee; --rq-link: #6ea3ff;
        --rq-info-bg: #121b33; --rq-info-bd: #243a68; --rq-info-tx: #9bbcff; --rq-info-strong: #3b5fb8;
        --rq-amber-bg: #3a2a0b; --rq-amber-tx: #ffc760;
        --rq-green-bg: #0f2e24; --rq-green-bd: #1f5c47; --rq-green-tx: #5ee0b4; --rq-green-ink: #cdeee1;
        --rq-red-bg: #2a1214; --rq-red-bd: #6b2a2e; --rq-red-tx: #ffb4ae;
        --rq-c0: #6ea3ff; --rq-c1: #2dd4a3; --rq-c2: #a78bfa; --rq-c3: #f5a524;
        --rq-dot-req: #7c88a8; --rq-dot-staff: #4c8dff;
        color-scheme: dark;
    }
}

/* Map the old variable names onto the theme so every older rule (links, hints, meta, empty states) follows it.
   Plain links get their colour from style.css (a { color: var(--blue) }), so the white links in the portal bar are not affected. */
body.rq { --bg: var(--rq-bg); --card: var(--rq-surface); --text: var(--rq-text); --muted: var(--rq-muted); --line: var(--rq-line); --blue: var(--rq-link); --navy: var(--rq-text); }

body.rq { background: var(--rq-bg); color: var(--rq-text); }
body.rq .wrap { max-width: 600px; }
body.rq .px-bar-in { max-width: 600px; }
body.rq h1 { font-size: 28px; line-height: 1.2; font-weight: 700; color: var(--rq-text); margin: 4px 0 6px; }
body.rq .lead { color: var(--rq-muted); font-size: 15px; margin: 0 0 18px; }
body.rq .foot, body.rq .px-foot { color: var(--rq-muted); font-size: 12px; }
body.rq .foot a, body.rq .px-foot a { color: var(--rq-muted); }
body.rq .back { display: inline-block; font-size: 14px; font-weight: 600; color: var(--rq-link); text-decoration: none; padding: 4px 0; }

/* Settings gear in the top bar */
.rq-gear { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; margin-left: 4px; border: 1px solid rgba(255,255,255,.45); border-radius: 50%; color: #fff; }
.rq-gear:hover { background: rgba(255,255,255,.14); }
.rq-gear.on { background: rgba(255,255,255,.2); }
body.rq-gate .px-nav { display: none; }

/* Buttons and fields */
body.rq .btn { display: inline-flex; align-items: center; justify-content: center; height: 48px; padding: 0 22px; border-radius: 24px; background: var(--rq-btn); color: #fff; font-size: 15px; font-weight: 600; border: 0; }
body.rq .btn:hover { background: var(--rq-btn-hover); }
body.rq .btn-secondary { background: var(--rq-surface); color: var(--rq-text); border: 1px solid var(--rq-line2); }
body.rq .btn-secondary:hover { background: var(--rq-surface2); }
body.rq .btn-block { width: 100%; }
body.rq label { font-size: 13px; font-weight: 600; color: var(--rq-sec); margin: 16px 0 6px; }
body.rq .hint { color: var(--rq-muted); font-weight: 400; }
body.rq input[type=text], body.rq input[type=email], body.rq select, body.rq textarea { background: var(--rq-surface); color: var(--rq-text); border: 1px solid var(--rq-line); border-radius: 14px; font-size: 15px; padding: 12px 14px; min-height: 48px; }
body.rq textarea { min-height: 124px; line-height: 1.5; }
body.rq input[readonly] { background: var(--rq-surface2); }
body.rq input:focus, body.rq select:focus, body.rq textarea:focus { outline: 2px solid var(--rq-info-strong); outline-offset: 0; border-color: var(--rq-info-strong); }
body.rq .actions { gap: 10px; margin-top: 16px; }
body.rq .card { background: var(--rq-surface); border: 1px solid var(--rq-line); border-radius: 18px; box-shadow: none; padding: 16px; }
body.rq .card.plain { background: none; border: 0; padding: 0; }
body.rq .card.reply-hl { background: var(--rq-info-bg); border-color: var(--rq-info-strong); }
body.rq .empty { color: var(--rq-muted); }

/* Notices */
body.rq .notice { border-radius: 16px; padding: 14px; }
body.rq .notice-error { background: var(--rq-red-bg); border-color: var(--rq-red-bd); color: var(--rq-red-tx); }
body.rq .notice-info { background: var(--rq-info-bg); border-color: var(--rq-info-bd); color: var(--rq-info-tx); }
body.rq .notice-ok { background: var(--rq-green-bg); border-color: var(--rq-green-bd); color: var(--rq-green-ink); }
body.rq .notice-ok strong:first-child { color: var(--rq-green-tx); }
body.rq .linkbox input { font-size: 13px; min-height: 44px; border-radius: 12px; }
body.rq .linkbox .btn { height: 44px; padding: 0 16px; font-size: 14px; }
.nudge { display: flex; align-items: center; gap: 12px; background: var(--rq-info-bg); border: 1px solid var(--rq-info-bd); border-radius: 16px; padding: 12px 12px 12px 14px; margin-bottom: 18px; color: var(--rq-info-tx); font-size: 14px; line-height: 1.4; }
.nudge span { flex: 1; min-width: 0; }
body.rq .nudge .btn { height: 36px; padding: 0 16px; font-size: 13px; flex: none; }

/* Category tiles */
body.rq .tiles { gap: 10px; }
body.rq .tile { display: flex; align-items: center; gap: 14px; background: var(--rq-surface); border: 1px solid var(--rq-line); border-radius: 18px; padding: 14px; box-shadow: none; color: var(--rq-text); }
body.rq .tile:hover, body.rq .tile:focus { border-color: var(--rq-info-strong); box-shadow: none; }
.tile-ico { flex: none; width: 46px; height: 46px; border-radius: 14px; background: var(--rq-surface2); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; }
.tile-ico.c0 { color: var(--rq-c0); } .tile-ico.c1 { color: var(--rq-c1); } .tile-ico.c2 { color: var(--rq-c2); } .tile-ico.c3 { color: var(--rq-c3); }
.tile-text { flex: 1; min-width: 0; }
body.rq .tile-name { font-size: 16px; font-weight: 600; color: var(--rq-text); display: inline; }
body.rq .tile-desc { color: var(--rq-muted); font-size: 13px; margin-top: 2px; }
body.rq .tile-chev { flex: none; width: auto; height: auto; background: none; color: var(--rq-muted); font-size: 26px; }
.tile-tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--rq-amber-bg); color: var(--rq-amber-tx); border-radius: 8px; padding: 2px 7px; margin-left: 8px; vertical-align: 2px; }
.rq-note { color: var(--rq-muted); font-size: 13px; line-height: 1.5; padding: 0 4px; margin: 16px 0 0; }

/* Status badges */
body.rq .badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 11px; background: var(--rq-info-bg); color: var(--rq-info-tx); }
body.rq .badge-new, body.rq .badge-open { background: var(--rq-info-bg); color: var(--rq-info-tx); }
body.rq .badge-waiting { background: var(--rq-amber-bg); color: var(--rq-amber-tx); }
body.rq .badge-resolved { background: var(--rq-green-bg); color: var(--rq-green-tx); }
body.rq .badge-closed { background: var(--rq-surface2); color: var(--rq-muted); }
body.rq .meta { color: var(--rq-muted); font-size: 13px; line-height: 20px; }

/* Ticket thread as a timeline */
body.rq .thread { gap: 12px; margin: 18px 0; }
.tl-item { display: flex; gap: 10px; --dot: var(--rq-dot-req); --bar: #5b6785; }
.tl-item.tl-staff { --dot: var(--rq-dot-staff); --bar: #4c8dff; }
.tl-time { width: 46px; flex: none; font-size: 11px; line-height: 14px; color: var(--rq-muted); padding-top: 5px; }
.tl-track { position: relative; width: 12px; flex: none; }
.tl-track::after { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 6px; background: var(--dot); }
.tl-item:not(:last-child) .tl-track::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: -12px; width: 2px; background: var(--rq-line); }
body.rq .msg { flex: 1; min-width: 0; position: relative; background: var(--rq-surface); border: 1px solid var(--rq-line); border-left: 1px solid var(--rq-line); border-radius: 16px; box-shadow: none; padding: 12px 20px 12px 14px; }
body.rq .msg::after { content: ""; position: absolute; right: 8px; top: 12px; bottom: 12px; width: 4px; border-radius: 2px; background: var(--bar); }
body.rq .msg-staff { background: var(--rq-info-bg); border-color: var(--rq-info-bd); border-left-color: var(--rq-info-bd); }
body.rq .msg-head { margin-bottom: 4px; font-size: 14px; }
body.rq .msg-head strong { color: var(--rq-text); }
body.rq .msg-body { color: var(--rq-sec); font-size: 14px; line-height: 21px; }

/* My tickets */
body.rq .tlist { gap: 10px; }
body.rq .trow { position: relative; background: var(--rq-surface); border: 1px solid var(--rq-line); border-radius: 16px; box-shadow: none; padding: 14px 22px 14px 14px; color: var(--rq-text); --bar: #4c8dff; }
body.rq .trow:hover { box-shadow: none; border-color: var(--rq-info-strong); }
body.rq .trow::after { content: ""; position: absolute; right: 8px; top: 12px; bottom: 12px; width: 4px; border-radius: 2px; background: var(--bar); }
body.rq .trow-waiting { --bar: #f5a524; }
body.rq .trow-resolved { --bar: #2dd4a3; }
body.rq .trow-closed { --bar: #5b6785; }
body.rq .trow-subject { font-size: 16px; font-weight: 600; color: var(--rq-text); }

/* Guest gate (welcome page) */
.gate { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 18px; min-height: 62vh; padding-top: 8px; }
.gate.gate-left { align-items: stretch; text-align: left; justify-content: flex-start; min-height: 0; padding-top: 0; }
.gate-ico { width: 72px; height: 72px; border-radius: 50%; background: var(--rq-info-bg); border: 1px solid var(--rq-info-strong); color: var(--rq-link); display: flex; align-items: center; justify-content: center; }
.gate-ico.warm { background: var(--rq-surface2); border-color: var(--rq-line); color: var(--rq-c3); width: 64px; height: 64px; }
.gate-btns { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.gate-btn { display: flex; align-items: center; justify-content: center; height: 54px; border-radius: 27px; font-size: 16px; font-weight: 600; text-decoration: none; border: 1px solid transparent; }
body.rq .gate-btn.primary { background: var(--rq-btn); color: #fff; }
body.rq .gate-btn.secondary { background: var(--rq-surface); border-color: var(--rq-line2); color: var(--rq-text); }
body.rq .gate-skip { align-self: center; font-size: 13px; color: var(--rq-muted); text-decoration: underline; padding: 14px 12px; }
.benefits { list-style: none; margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 14px; background: var(--rq-surface); border: 1px solid var(--rq-line); border-radius: 18px; text-align: left; }
.benefits li { position: relative; padding-left: 36px; font-size: 15px; line-height: 22px; color: var(--rq-sec); }
.benefits li::before { content: "\2713"; position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 12px; background: var(--rq-green-bg); color: var(--rq-green-tx); font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* Requester settings */
.rq-sect { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--rq-muted); padding: 0 4px; margin: 22px 0 8px; }
body.rq .opt { display: flex; align-items: center; gap: 14px; min-height: 72px; margin: 0 0 10px; padding: 0 16px; background: var(--rq-surface); border: 1px solid var(--rq-line); border-radius: 18px; cursor: pointer; font-weight: 400; color: var(--rq-text); }
body.rq .opt:has(input:checked) { background: var(--rq-info-bg); border-color: var(--rq-info-strong); }
.opt-thumb { width: 56px; height: 44px; border-radius: 10px; flex: none; box-sizing: border-box; display: flex; flex-direction: column; gap: 4px; padding: 7px; }
.opt-thumb i { display: block; height: 8px; border-radius: 3px; }
.opt-thumb.t-light { background: #f4f6fa; border: 1px solid #c1cbdb; }
.opt-thumb.t-light i { background: #fefefe; border: 1px solid #dae1ed; }
.opt-thumb.t-dark { background: #0a0e19; border: 1px solid #394463; }
.opt-thumb.t-dark i { background: #131928; border: 1px solid #222a3f; }
.opt-thumb.t-system { background: linear-gradient(135deg, #f4f6fa 50%, #0a0e19 50%); border: 1px solid #5a6a8b; }
.opt-text { flex: 1; min-width: 0; }
.opt-name { display: block; font-size: 15px; font-weight: 600; line-height: 20px; }
.opt-sub { display: block; font-size: 13px; color: var(--rq-muted); line-height: 18px; }
body.rq .opt input[type=radio] { width: 20px; height: 20px; margin: 0; padding: 0; flex: none; accent-color: #4c8dff; min-height: 0; }
.acct-link { display: flex; align-items: center; gap: 14px; background: var(--rq-surface); border: 1px solid var(--rq-line); border-radius: 18px; padding: 14px; text-decoration: none; color: var(--rq-text); }
.acct-link:hover { border-color: var(--rq-info-strong); }
.acct-link .acct-t { flex: 1; min-width: 0; }
.acct-link strong { display: block; font-size: 15px; }
.acct-link span.sub { display: block; font-size: 13px; color: var(--rq-muted); margin-top: 2px; }
