:root {
    --bg: #eef1f5;
    --surface: #ffffff;
    --text: #18202a;
    --muted: #5d6878;
    --line: #d9dee6;
    --focus: #2b5fd9;

    /* Privacy IPTV: black and gold */
    --pv-black: #121212;
    --pv-gold: #d6a930;
    --pv-gold-text: #8a6510;
    --pv-soft: #fbf3dc;

    /* The Service 4 U: highlighter green and blue */
    --sv-green: #3cf27a;
    --sv-blue: #1a8cff;
    --sv-blue-text: #0a5fc2;
    --sv-ink: #03253d;
    --sv-soft: #e4fbec;

    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #11151b;
        --surface: #191f28;
        --text: #e4e9f0;
        --muted: #95a0b2;
        --line: #2a323e;
        --focus: #7aa2ff;
        --pv-gold-text: #e7bd4c;
        --pv-soft: #2a2414;
        --sv-blue-text: #5fd0ff;
        --sv-soft: #12291c;
        color-scheme: dark;
    }
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-variant-numeric: tabular-nums;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Site marks: used on every chip, row and banner */
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.chip.privacy { background: var(--pv-black); color: var(--pv-gold); }
.chip.service { background: var(--sv-green); color: var(--sv-ink); box-shadow: inset 0 -3px 0 var(--sv-blue); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login form { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 28px; width: 100%; max-width: 360px; }
.login h1 { margin: 0 0 18px; font-size: 22px; }
.login label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.login input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
.login button { margin-top: 18px; width: 100%; padding: 11px; border: 0; border-radius: 6px; background: var(--text); color: var(--bg); font: inherit; font-weight: 600; cursor: pointer; }
.err { color: #c0392b; font-size: 14px; margin: 12px 0 0; }

/* Header: takes on the site's colors when one site is selected */
header.top { background: var(--surface); border-bottom: 1px solid var(--line); }
body.site-privacy header.top { background: var(--pv-black); border-bottom: 3px solid var(--pv-gold); color: #f3e7c4; }
body.site-service header.top { background: var(--sv-green); border-bottom: 3px solid var(--sv-blue); color: var(--sv-ink); }
.bar { max-width: 1280px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 17px; text-decoration: none; }
.mainnav { display: flex; gap: 4px; margin-right: auto; }
.mainnav a { text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: 14px; font-weight: 500; }
.mainnav a.on { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--surface); }
.seg a { padding: 6px 12px; text-decoration: none; font-size: 14px; color: var(--muted); border-right: 1px solid var(--line); white-space: nowrap; }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--text); color: var(--bg); }
.seg a.privacy.on { background: var(--pv-black); color: var(--pv-gold); }
.seg a.service.on { background: var(--sv-green); color: var(--sv-ink); box-shadow: inset 0 -3px 0 var(--sv-blue); }
.dayform input, .search input { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
.logout button { background: none; border: 0; color: inherit; opacity: .75; font: inherit; font-size: 14px; cursor: pointer; padding: 0; }

/* "You are viewing" banner */
.viewing { padding: 10px 20px; font-weight: 600; font-size: 15px; }
.viewing .in { max-width: 1280px; margin: 0 auto; }
.viewing.privacy { background: var(--pv-soft); color: var(--pv-gold-text); border-bottom: 1px solid var(--pv-gold); }
.viewing.service { background: var(--sv-soft); color: var(--sv-blue-text); border-bottom: 1px solid var(--sv-blue); }

main { max-width: 1280px; margin: 0 auto; padding: 22px 20px 60px; }
h2 { font-size: 18px; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 14px; margin: -6px 0 12px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { font-size: 13px; font-weight: 600; color: var(--muted); }
td.num, th.num { text-align: right; white-space: nowrap; }
.num small { display: block; color: var(--muted); font-size: 12px; }
.total { font-weight: 700; }
.split { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line); min-width: 120px; }
.split i { display: block; height: 100%; }
.split .privacy { background: var(--pv-gold); }
.split .service { background: var(--sv-green); }

/* Ticket rows: site band on the left, subject in the site's text color */
td.band { width: 6px; padding: 0; }
tr.privacy td.band { background: var(--pv-black); box-shadow: inset -3px 0 0 var(--pv-gold); }
tr.service td.band { background: linear-gradient(var(--sv-green), var(--sv-blue)); }
tr.privacy .subj a, tr.privacy .tnum { color: var(--pv-gold-text); }
tr.service .subj a, tr.service .tnum { color: var(--sv-blue-text); }
.subj a { font-weight: 600; text-decoration: none; }
.subj a:hover { text-decoration: underline; }
.who { color: var(--muted); font-size: 13px; }
.status { font-size: 13px; white-space: nowrap; }
.status.cr { font-weight: 700; }
.acts { white-space: nowrap; text-align: right; }
.btn { display: inline-block; font-size: 13px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 5px; text-decoration: none; margin-left: 4px; background: var(--surface); }
.empty { padding: 26px 14px; color: var(--muted); }
.dberr { background: var(--surface); border: 1px solid #c0392b; border-radius: 10px; padding: 14px; margin-bottom: 18px; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.filters a { text-decoration: none; font-size: 14px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); }
.filters a b { color: var(--text); margin-left: 4px; }
.filters a.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.filters a.on b { color: var(--bg); }
.tixbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.tixbar h2 { margin: 0 auto 0 0; }
.search input { width: 260px; }

/* Single ticket */
.tmeta { display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.tmeta b { color: var(--text); font-weight: 600; }
.msg { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.msg header { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.msg header b { color: var(--text); }
.msg.staff { border-left: 4px solid var(--text); }
body.site-privacy .msg.staff { border-left-color: var(--pv-gold); }
body.site-service .msg.staff { border-left-color: var(--sv-blue); }
.msg.note { background: #fff8db; border-color: #f0d36b; }
@media (prefers-color-scheme: dark) { .msg.note { background: #2b2610; border-color: #6b5a1c; } }
.msg .body { white-space: pre-wrap; word-wrap: break-word; }
.msg .att { font-size: 13px; color: var(--muted); margin-top: 8px; }
.tactions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.flash { border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-weight: 500; }
.flash.ok { background: #e3f6e9; color: #135c2b; border: 1px solid #9bd8ae; }
.flash.err { background: #fde8e6; color: #8a1c12; border: 1px solid #f1a59c; }
@media (prefers-color-scheme: dark) { .flash.ok { background: #12301d; color: #9be3b2; border-color: #245c37; } .flash.err { background: #3a1512; color: #f3a69c; border-color: #6e2a22; } }
.reply { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-top: 18px; }
.reply h3 { margin: 0 0 10px; font-size: 16px; }
.reply textarea { width: 100%; min-height: 160px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; resize: vertical; }
.reply .row { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 10px 0; font-size: 14px; }
.reply select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; max-width: 100%; }
.send { border: 0; border-radius: 6px; padding: 9px 16px; font: inherit; font-weight: 700; cursor: pointer; }
body.site-privacy .send { background: var(--pv-black); color: var(--pv-gold); box-shadow: inset 0 -3px 0 var(--pv-gold); }
body.site-service .send { background: var(--sv-green); color: var(--sv-ink); box-shadow: inset 0 -3px 0 var(--sv-blue); }
.closeform { display: inline; }
.closeform button { font: inherit; font-size: 14px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--text); cursor: pointer; }
.tactions .btn { margin-left: 0; font-size: 14px; padding: 7px 12px; }

@media (max-width: 760px) {
    .hide-sm { display: none; }
    .search input { width: 100%; }
}

/* Header search */
.topsearch input { width: 300px; }
body.site-privacy .topsearch input, body.site-service .topsearch input { border-color: transparent; }

/* Lists and profile */
.pager { display: flex; gap: 8px; margin-top: 12px; }
.pager a { font-size: 14px; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); margin: 6px 0 16px; }
.tabs a { padding: 8px 12px; text-decoration: none; font-size: 14px; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
body.site-privacy .tabs a.on { border-bottom-color: var(--pv-gold); }
body.site-service .tabs a.on { border-bottom-color: var(--sv-blue); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.box h3 { margin: 0 0 10px; font-size: 15px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; }
.figs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.fig { border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.fig b { display: block; font-size: 20px; }
.fig span { font-size: 13px; color: var(--muted); }
.inline-form { display: grid; gap: 8px; }
.inline-form input, .inline-form textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
.inline-form button { justify-self: start; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.pill.Active, .pill.Paid { color: #17803d; border-color: #9bd8ae; }
.pill.Unpaid, .pill.Pending { color: #a15c00; border-color: #f0c47a; }
.pill.Overdue, .pill.Suspended, .pill.Fraud { color: #b42318; border-color: #f1a59c; }
.pill.Terminated, .pill.Cancelled, .pill.Closed, .pill.Inactive { color: var(--muted); }
details.email summary { cursor: pointer; }
details.email iframe { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 6px; background: #fff; margin-top: 8px; }
.resgroup { margin-bottom: 18px; }
.resgroup h3 { font-size: 15px; margin: 0 0 8px; }
tr.privacy .rowlink, tr.privacy .tnum { color: var(--pv-gold-text); }
tr.service .rowlink, tr.service .tnum { color: var(--sv-blue-text); }
.rowlink { font-weight: 600; text-decoration: none; }
.rowlink:hover { text-decoration: underline; }
@media (max-width: 760px) { .topsearch input { width: 100%; } }

/* Duplicate accounts: each site's account in its own colors */
.dupname.privacy { color: var(--pv-gold-text); font-weight: 600; }
.dupname.service { color: var(--sv-blue-text); font-weight: 600; }
.dupbox.privacy { border-top: 4px solid var(--pv-gold); }
.dupbox.service { border-top: 4px solid var(--sv-green); }
.numbers .num b { font-size: 16px; }
details.period { margin-bottom: 10px; }
details.period > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
details.period > summary::-webkit-details-marker { display: none; }
details.period > summary::before { content: '+'; font-weight: 700; width: 14px; color: var(--muted); }
details.period[open] > summary::before { content: '\2212'; }
details.period[open] > summary { border-radius: 10px 10px 0 0; border-bottom: 0; }
details.period[open] > .panel { border-radius: 0 0 10px 10px; }
.plabel { font-weight: 700; font-size: 16px; min-width: 110px; }
.psum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14px; }
.ptotal { color: var(--muted); }
.ptotal b { color: var(--text); }
tr.strong td { font-weight: 700; }
.inline-form label.who { display: grid; gap: 4px; }
.inline-form select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
@media (max-width: 760px) { .box[style*="span 2"] { grid-column: auto !important; } }
.filters a b.amt { font-weight: 600; }
.duebar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 12px; font-size: 14px; }
.duebar > b { font-size: 20px; margin-right: 8px; }

/* Reports: income chart, each month's bar split by site */
.chartpanel { padding: 16px 12px 8px; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 240px; min-width: 520px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart .colval { font-size: 11px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; }
.chart .stack { width: 100%; max-width: 46px; display: flex; flex-direction: column; border-radius: 4px 4px 0 0; overflow: hidden; min-height: 0; }
.chart .stack i { display: block; width: 100%; }
.chart .stack i.privacy { background: var(--pv-gold); }
.chart .stack i.service { background: linear-gradient(var(--sv-green), var(--sv-blue)); }
.chart .collabel { font-size: 12px; color: var(--muted); margin-top: 6px; white-space: nowrap; }
.split.mix .m-bitcoin, .key.m-bitcoin { background: #f7931a; }
.split.mix .m-card, .key.m-card { background: #5b6bd6; }
.split.mix .m-other, .key.m-other { background: #9aa3b2; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; vertical-align: -1px; }
.mailframe { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
