/* Shared chrome for the two hand-written signed-in surfaces: the affiliate
   portal (public/affiliates/) and the admin dashboard (public/cc-ops-7f3k.php).
   Neither is part of the Elementor export, so neither gets the site's own
   stylesheet -- several hundred kilobytes of page-builder scaffolding to draw a
   few forms and tables. This is the small version of the same design.

   The tokens are lifted verbatim from bias-visualizer.html, which is itself the
   hand-written page the site's look was last pinned down on, and they match
   affiliate_terms.html. Three surfaces, one vocabulary: if the site's orange
   ever moves, it moves here and in the visualizer, and nothing has quietly
   invented a fourth palette in the meantime.

   Page-specific layout stays inline in each page. What lives here is what both
   of them draw: the palette, the controls, and the range slider. */

:root {
    color-scheme: dark;

    --cc-bg:        #121417;
    --cc-panel:     #181b20;
    --cc-panel-2:   #23272e;
    --cc-line:      rgba(255, 255, 255, .08);
    --cc-line-soft: rgba(255, 255, 255, .06);
    --cc-hover:     rgba(255, 255, 255, .05);

    --cc-text:   #c7ccd4;
    --cc-strong: #fff;
    --cc-bright: #e6e9ee;
    --cc-dim:    #8d949f;

    --cc-accent:      #ff6900;
    --cc-accent-soft: #ff8a3d;
    --cc-accent-wash: rgba(255, 138, 61, .10);

    /* Semantic colours. Green is the site's own accent from the Elementor kit;
       red is the visualizer's error colour. Neither is invented here. */
    --cc-ok:      #61ce70;
    --cc-ok-wash: rgba(97, 206, 112, .10);
    --cc-err:     #ff4d4f;
    --cc-err-wash: rgba(255, 77, 79, .10);
    --cc-warn:      #f0883e;
    --cc-warn-wash: rgba(240, 136, 62, .10);

    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-head: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--cc-bg);
    color: var(--cc-text);
    font: 15px/1.55 var(--font-body);
}

a { color: var(--cc-accent-soft); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
    font-family: var(--font-head);
    color: var(--cc-strong);
    font-weight: 600;
    margin: 0;
}

/* --- surfaces ------------------------------------------------------------ */

.card, .section {
    background: var(--cc-panel);
    border: 1px solid var(--cc-line);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 18px;
}

.card h2, .section h3 { font-size: 17px; margin-bottom: 4px; }

/* Explanatory copy under a heading. Dim on purpose -- it is read once and then
   never again, and it should not compete with the figures below it. */
.hint { margin: 0 0 16px; color: var(--cc-dim); font-size: 13px; line-height: 1.5; }
.hint strong { color: var(--cc-bright); font-weight: 600; }

/* --- controls ------------------------------------------------------------ */

label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--cc-dim); }
label > span { display: block; margin-bottom: 5px; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=datetime-local], input[type=date], input[type=time],
select, textarea {
    width: 100%;
    padding: 9px 11px;
    font: inherit;
    color: var(--cc-strong);
    background: var(--cc-bg);
    border: 1px solid var(--cc-line);
    border-radius: 8px;
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--cc-accent-soft);
    outline-offset: -1px;
}
input::placeholder { color: var(--cc-dim); }

/* The date pickers.
 *
 * A datetime-local input is a text box with a browser-drawn calendar button on
 * the end, and left alone it keeps the browser's own metrics -- a different
 * height and a different inner padding from every other field beside it. The
 * rule above gives it the same box; these two give it the same insides.
 *
 * The picker button is white-on-dark by default in Chromium, which on this
 * palette reads as a bright chip stuck to the field. `filter: invert` is the
 * only handle available on it -- it is a UA shadow-DOM control with no colour
 * property of its own -- and inverting a white glyph gives a dark one, so the
 * opacity is what actually tints it to match the dimmed text beside it. */
input[type=datetime-local]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: .55;
    cursor: pointer;
}
input[type=datetime-local]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
/* Firefox and Chromium disagree about whether the fields inside are inline
   blocks with their own line-height; without this the text sits a pixel high in
   one of them and the field looks subtly misaligned next to a plain input. */
input[type=datetime-local] { line-height: normal; }

button, .btn {
    display: inline-block;
    font: inherit;
    padding: 9px 16px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--cc-text);
    background: var(--cc-panel-2);
    border: 1px solid var(--cc-line);
}
button:hover, .btn:hover { background: var(--cc-hover); color: var(--cc-strong); }

button.primary {
    background: var(--cc-accent);
    border-color: var(--cc-accent);
    color: #fff;
    font-weight: 500;
}
button.primary:hover { background: var(--cc-accent-soft); border-color: var(--cc-accent-soft); }

/* A button that is really a link: used where an action has to be a POST for
   CSRF reasons but reads as a link in the sentence around it. */
button.link {
    border: none;
    background: none;
    padding: 0;
    color: var(--cc-accent-soft);
    text-decoration: underline;
}
button.link:hover { background: none; color: var(--cc-accent-soft); }
button.danger, button.link.danger { color: var(--cc-err); }

/* --- range slider -------------------------------------------------------- */
/* Matched to bias-visualizer.html: a 3px hairline track with a small round
   thumb, rather than the browser default, which is chunky and blue and belongs
   to no theme at all. Every vendor pseudo-element has to be listed separately
   -- grouping them into one selector makes browsers drop the whole rule. */

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 22px;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
    height: 3px;
    background: rgba(255, 255, 255, .14);
    border-radius: 3px;
}
input[type=range]::-moz-range-track {
    height: 3px;
    background: rgba(255, 255, 255, .14);
    border-radius: 3px;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    margin-top: -5.5px;
    border-radius: 50%;
    background: var(--cc-accent-soft);
    border: 2px solid var(--cc-panel);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .18);
}
input[type=range]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--cc-accent-soft);
    border: 2px solid var(--cc-panel);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .18);
}
input[type=range]:focus { outline: none; }
input[type=range]:focus-visible {
    outline: 2px solid var(--cc-accent-soft);
    outline-offset: 3px;
    border-radius: 3px;
}
input[type=range]:disabled { cursor: not-allowed; opacity: .5; }

/* --- figures ------------------------------------------------------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat {
    background: var(--cc-bg);
    border: 1px solid var(--cc-line);
    border-radius: 10px;
    padding: 14px;
}
.stat .n {
    font-family: var(--font-head);
    font-size: 24px;
    font-weight: 600;
    color: var(--cc-strong);
    font-variant-numeric: tabular-nums;
}
.stat .l {
    font-size: 12px;
    color: var(--cc-dim);
    margin-top: 3px;
}

/* --- tables -------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--cc-line-soft); }
/* Sentence case, not capitals. Set apart from the rows by weight and colour
   instead -- a table of shouted headings is harder to skim, not easier. */
th {
    font-size: 13px;
    color: var(--cc-dim);
    font-weight: 600;
}
td { color: var(--cc-text); }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

code, code.code {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    color: var(--cc-strong);
}
code.code { font-size: 15px; font-weight: 600; letter-spacing: .04em; }

/* --- messages ------------------------------------------------------------ */

.msg, .notice {
    padding: 11px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid var(--cc-line);
    background: var(--cc-panel-2);
    color: var(--cc-bright);
}
.msg.ok  { border-color: rgba(97, 206, 112, .35);  background: var(--cc-ok-wash);  color: var(--cc-ok); }
.msg.err { border-color: rgba(255, 77, 79, .35);   background: var(--cc-err-wash); color: var(--cc-err); }
.notice  { border-left: 3px solid var(--cc-warn); background: var(--cc-warn-wash); color: var(--cc-bright); }
.notice.err { border-color: rgba(255,77,79,.35); border-left-color: var(--cc-err); background: var(--cc-err-wash); }
.notice b { display: block; margin-bottom: 2px; color: var(--cc-strong); }

/* Status chips beside a code or an account. */
.pill {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid var(--cc-line);
    color: var(--cc-dim);
    /* Capitalised, not upper-cased: the statuses come out of the database
       lowercase ('active', 'expired'), and a chip reading "active" looks
       unfinished next to a heading. */
    text-transform: capitalize;
}
.pill.on  { color: var(--cc-ok);  border-color: rgba(97, 206, 112, .45); }
.pill.off { color: var(--cc-err); border-color: rgba(255, 77, 79, .45); }
