/* ============================================================
   CGN Bug Tracker — Dark theme v5.1 (May 2026)
   Refined professional dashboard aesthetic.
   ============================================================ */

:root {
    /* Surfaces — neutral near-black, no blue tint */
    --bg:           #0a0a0b;
    --bg-elev:      #111113;
    --surface:      #141417;
    --surface-2:    #1a1a1e;
    --surface-3:    #232328;

    /* Borders — hairline whites at low alpha */
    --border:       rgba(255,255,255,0.06);
    --border-hi:    rgba(255,255,255,0.12);
    --border-acc:   rgba(251,102,56,0.4);
    --border-soft:  rgba(255,255,255,0.035);

    /* Text — high-contrast cool whites */
    --text:         #ededee;
    --text-2:       #c4c4c8;
    --text-muted:   #87878e;
    --text-dim:     #5e5e66;

    /* Brand */
    --accent:       #fb6638;
    --accent-hi:    #ff7a4e;
    --accent-soft:  rgba(251,102,56,0.10);
    --accent-line:  rgba(251,102,56,0.22);

    /* Semantic */
    --info:         #5b8bf0;
    --info-soft:    rgba(91,139,240,0.10);
    --info-line:    rgba(91,139,240,0.22);
    --success:      #2dc97e;
    --success-soft: rgba(45,201,126,0.10);
    --success-line: rgba(45,201,126,0.22);
    --warn:         #e3a13a;
    --warn-soft:    rgba(227,161,58,0.10);
    --warn-line:    rgba(227,161,58,0.22);
    --danger:       #ef5350;
    --danger-soft:  rgba(239,83,80,0.10);
    --danger-line:  rgba(239,83,80,0.22);

    /* Status mapping */
    --na-bg:           rgba(255,255,255,0.06);  --na-fg:           var(--text-2);
    --not-looking-bg:  var(--danger-soft);       --not-looking-fg:  var(--danger);
    --in-progress-bg:  var(--warn-soft);         --in-progress-fg:  var(--warn);
    --done-bg:         var(--success-soft);     --done-fg:         var(--success);

    /* Priority */
    --p-low:    var(--text-muted);
    --p-medium: var(--accent);
    --p-high:   var(--danger);

    --radius:    6px;
    --radius-md: 8px;
    --radius-lg: 10px;

    --font-display: 'Cabinet Grotesk', 'Space Grotesk', system-ui, sans-serif;
    --font-body:    'Geist', system-ui, -apple-system, sans-serif;
    --font-mono:    'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
*::selection { background: var(--accent-soft); color: var(--text); }

html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    font-feature-settings: 'cv11', 'ss01';
}

a { color: inherit; text-decoration: none; transition: color 0.12s; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text);
    margin: 0;
}

/* ============================================================
   Top nav
   ============================================================ */
.nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px;
    background: rgba(10,10,11,0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
    height: 56px;
}
.nav-brand {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    letter-spacing: -0.01em;
}
.brand-logo {
    width: 28px; height: 28px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 1px var(--border-hi);
    transition: transform 0.25s ease;
}
.nav-brand:hover .brand-logo { transform: scale(1.06); }
.brand-name { color: var(--text); }

.nav-right { display: flex; align-items: center; gap: 2px; }
.nav-link {
    font-size: 13px;
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: var(--radius);
    transition: all 0.12s;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--accent); }
.nav-link-muted { font-size: 12.5px; color: var(--text-dim); }

.nav-user {
    display: flex; align-items: center; gap: 10px;
    padding-left: 12px; margin-left: 4px;
    border-left: 1px solid var(--border);
}
.avatar {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--text);
    font-size: 10px; font-weight: 500;
    display: flex; align-items: center; justify-content: center;
    letter-spacing: 0.02em;
    border: 1px solid var(--border);
}
.nav-username { font-size: 13px; color: var(--text-2); }

/* ============================================================
   Container & page heads
   ============================================================ */
.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 24px 80px;
}

.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}
.page-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 500;
    letter-spacing: -0.025em;
    line-height: 1.15;
    margin: 0 0 4px;
}
.page-subtitle {
    color: var(--text-muted);
    font-size: 13.5px;
    margin: 0;
}

/* ============================================================
   Stat cards — minimal, no gradients
   ============================================================ */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    transition: border-color 0.15s;
}
.stat:hover { border-color: var(--border-hi); }
.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0 0 6px;
    font-weight: 500;
}
.stat-value {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 500;
    margin: 0;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.stat-value.in-progress { color: var(--warn); }
.stat-value.not-looking { color: var(--danger); }
.stat-value.done        { color: var(--success); }

/* ============================================================
   Filters
   ============================================================ */
.filters {
    display: flex; gap: 8px; align-items: center;
    margin-bottom: 14px; flex-wrap: wrap;
}
.filters .search-wrap {
    position: relative; flex: 1; min-width: 220px;
}
.filters .search-wrap::before {
    content: '';
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%);
    width: 14px; height: 14px;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2387878e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m21 21-4.3-4.3'/></svg>") no-repeat;
    pointer-events: none;
}
.filters input.search { padding-left: 36px; }

/* ============================================================
   Inputs
   ============================================================ */
input[type=text], input[type=password], input[type=email],
input[type=search], input[type=number], select, textarea {
    font-family: var(--font-body);
    font-size: 13.5px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    width: 100%;
    line-height: 1.4;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: var(--surface-2);
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
select {
    cursor: pointer; padding-right: 30px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2387878e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    -webkit-appearance: none; appearance: none;
}
textarea { resize: vertical; min-height: 90px; font-family: var(--font-body); }
input[type=file] { color: var(--text-muted); font-size: 13px; padding: 8px 0; }
input[type=file]::file-selector-button {
    background: var(--surface-2); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 7px 12px; margin-right: 10px; cursor: pointer;
    font-family: var(--font-body); font-size: 12.5px;
    transition: all 0.12s;
}
input[type=file]::file-selector-button:hover {
    background: var(--surface-3); border-color: var(--border-hi);
}

.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-2);
    letter-spacing: -0.005em;
}
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; line-height: 1.4; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ============================================================
   Buttons — flat, crisp
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: all 0.12s;
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover {
    border-color: var(--border-hi);
    background: var(--surface-2);
    color: var(--text);
}
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hi);
    border-color: var(--accent-hi);
    color: #fff;
}
.btn-sm { font-size: 12.5px; padding: 6px 10px; }
.btn-danger {
    color: var(--danger);
    border-color: var(--danger-line);
    background: var(--danger-soft);
}
.btn-danger:hover {
    background: rgba(239,83,80,0.16);
    border-color: var(--danger);
    color: var(--danger);
}

/* ============================================================
   Bug table
   ============================================================ */
.bugs-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
table.bugs { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.bugs thead th {
    text-align: left;
    background: var(--bg-elev);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}
table.bugs tbody td {
    padding: 11px 14px;
    border-top: 1px solid var(--border-soft);
    vertical-align: middle;
}
table.bugs tbody tr:first-child td { border-top: none; }
table.bugs tbody tr { transition: background 0.1s; cursor: pointer; }
table.bugs tbody tr:hover { background: var(--surface-2); }
table.bugs .col-ref  { width: 100px; color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; }
table.bugs .col-pri  { width: 36px; text-align: center; }
table.bugs .col-stat { width: 120px; }
table.bugs .col-cat  { width: 130px; }
table.bugs .col-asg  { width: 140px; color: var(--text-muted); }
table.bugs .col-date { width: 100px; color: var(--text-muted); font-size: 12.5px; }
table.bugs .col-done { width: 50px; text-align: center; }
.bug-title-cell { font-weight: 500; color: var(--text); }

.empty-state { padding: 56px 20px; text-align: center; }
.empty-state h3 {
    font-family: var(--font-display);
    font-weight: 500; font-size: 18px;
    color: var(--text); margin: 0 0 4px;
    letter-spacing: -0.02em;
}
.empty-state p { color: var(--text-muted); font-size: 13px; margin: 0; }

/* ============================================================
   Status badges + priority dots
   ============================================================ */
.badge {
    display: inline-flex; align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
    border: 1px solid;
    line-height: 1.5;
    letter-spacing: -0.005em;
}
.badge-na          { background: var(--na-bg);          color: var(--na-fg);          border-color: var(--border-hi); }
.badge-not_looking { background: var(--not-looking-bg); color: var(--not-looking-fg); border-color: var(--danger-line); }
.badge-in_progress { background: var(--in-progress-bg); color: var(--in-progress-fg); border-color: var(--warn-line); }
.badge-done        { background: var(--done-bg);        color: var(--done-fg);        border-color: var(--success-line); }

.priority-dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    vertical-align: middle;
}
.priority-low    { background: var(--p-low); }
.priority-medium { background: var(--p-medium); }
.priority-high   { background: var(--p-high); }

table.bugs input[type=checkbox], .check-cell input[type=checkbox] {
    width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer;
}

/* ============================================================
   Bug detail
   ============================================================ */
.bug-detail {
    display: grid; grid-template-columns: 1fr 260px;
    gap: 20px; align-items: start;
}
.bug-main, .bug-side {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px 28px;
}
.bug-side { padding: 14px 18px; }
.bug-main h1 {
    font-size: 22px;
    margin: 0 0 6px;
    line-height: 1.25;
}
.bug-id {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-dim);
    margin-bottom: 18px;
}
.bug-desc {
    color: var(--text-2);
    line-height: 1.65;
    white-space: pre-wrap;
    margin-bottom: 20px;
    font-size: 14px;
}
.bug-desc:empty::before {
    content: 'No description.';
    color: var(--text-dim);
    font-style: italic;
}

.side-row { padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.side-row:last-child { border-bottom: none; }
.side-label {
    font-size: 10.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 4px;
    font-weight: 500;
}
.side-value { font-size: 13px; color: var(--text); }

.section-title {
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-soft);
}

/* Attachments */
.attachments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px; margin-bottom: 16px;
}
.attachment {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-elev);
    aspect-ratio: 4/3;
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.12s;
}
.attachment:hover { border-color: var(--border-hi); }
.attachment img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attachment-file {
    text-align: center; padding: 10px;
    font-size: 11.5px; color: var(--text-muted);
    word-break: break-word;
}
.attachment-file::before {
    content: ''; display: block;
    width: 22px; height: 22px; margin: 0 auto 8px;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%2387878e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/><polyline points='14 2 14 8 20 8'/></svg>") no-repeat;
}

/* Comments */
.comment { padding: 14px 0; border-bottom: 1px solid var(--border-soft); }
.comment:last-child { border-bottom: none; }
.comment-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.comment-author { font-weight: 500; font-size: 13px; }
.comment-time { font-size: 11.5px; color: var(--text-dim); }
.comment-body { color: var(--text-2); line-height: 1.6; white-space: pre-wrap; font-size: 13.5px; }

/* ============================================================
   Landing page — clean, less ornament
   ============================================================ */
.landing {
    max-width: 580px;
    margin: 64px auto;
    text-align: center;
}
.landing-logo {
    width: 76px; height: 76px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 24px;
    display: block;
    box-shadow: 0 0 0 1px var(--border-hi);
}
.landing-title {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 500;
    letter-spacing: -0.03em;
    margin: 0 0 6px;
}
.landing-sub {
    color: var(--text-muted);
    font-size: 14.5px;
    margin: 0 0 36px;
}
.landing-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 28px;
    text-align: left;
}
.landing-card {
    display: flex; align-items: flex-start; gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 18px;
    transition: all 0.15s;
    color: var(--text);
}
.landing-card:hover {
    border-color: var(--border-hi);
    background: var(--surface-2);
    color: var(--text);
}
.landing-card-primary { border-color: var(--accent-line); }
.landing-card-primary:hover { border-color: var(--accent); background: var(--accent-soft); }
.landing-card-icon {
    width: 32px; height: 32px;
    border-radius: var(--radius);
    background: var(--surface-3);
    color: var(--text);
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.landing-card-primary .landing-card-icon {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.landing-card-title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.015em;
    margin-bottom: 3px;
}
.landing-card-desc {
    color: var(--text-muted);
    font-size: 12.5px;
    line-height: 1.5;
}
.landing-foot {
    color: var(--text-muted);
    font-size: 13px;
}
.landing-foot a { color: var(--accent); font-weight: 500; }

/* ============================================================
   Public submit form — refined category cards
   ============================================================ */
.public-form { max-width: 680px; margin: 0 auto; }
.form-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 22px;
    margin-bottom: 12px;
}
.form-section-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 4px;
    letter-spacing: -0.015em;
    color: var(--text);
}
.form-section-sub {
    color: var(--text-muted);
    font-size: 12.5px;
    margin: 0 0 14px;
}
.opt-tag {
    font-size: 10.5px;
    color: var(--text-dim);
    font-weight: 400;
    margin-left: 6px;
    padding: 1px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.cat-card {
    position: relative;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elev);
    cursor: pointer;
    transition: all 0.12s;
}
.cat-card input[type=radio] {
    position: absolute; opacity: 0; pointer-events: none;
}
.cat-card:hover { border-color: var(--border-hi); }
.cat-card.selected,
.cat-card:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.cat-card-name {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
    color: var(--text);
    letter-spacing: -0.01em;
}
.cat-card-desc {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.4;
}
.cat-card.cat-red    { border-left: 2px solid var(--danger); }
.cat-card.cat-orange { border-left: 2px solid var(--accent); }
.cat-card.cat-amber  { border-left: 2px solid var(--warn); }
.cat-card.cat-green  { border-left: 2px solid var(--success); }
.cat-card.cat-teal   { border-left: 2px solid #14b8a6; }
.cat-card.cat-blue   { border-left: 2px solid var(--info); }
.cat-card.cat-purple { border-left: 2px solid #a855f7; }
.cat-card.cat-pink   { border-left: 2px solid #ec4899; }
.cat-card.cat-gray   { border-left: 2px solid var(--text-muted); }

/* Category pills */
.cat-pill {
    display: inline-flex; align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
    border: 1px solid currentColor;
    letter-spacing: -0.005em;
}
.cat-pill.cat-red    { color: var(--danger);  background: var(--danger-soft);  border-color: var(--danger-line); }
.cat-pill.cat-orange { color: var(--accent);  background: var(--accent-soft);  border-color: var(--accent-line); }
.cat-pill.cat-amber  { color: var(--warn);    background: var(--warn-soft);    border-color: var(--warn-line); }
.cat-pill.cat-green  { color: var(--success); background: var(--success-soft); border-color: var(--success-line); }
.cat-pill.cat-teal   { color: #5eead4; background: rgba(20,184,166,0.10); border-color: rgba(20,184,166,0.22); }
.cat-pill.cat-blue   { color: var(--info);    background: var(--info-soft);    border-color: var(--info-line); }
.cat-pill.cat-purple { color: #c084fc; background: rgba(168,85,247,0.10); border-color: rgba(168,85,247,0.22); }
.cat-pill.cat-pink   { color: #f9a8d4; background: rgba(236,72,153,0.10); border-color: rgba(236,72,153,0.22); }
.cat-pill.cat-gray   { color: var(--text-2); background: rgba(255,255,255,0.05); border-color: var(--border-hi); }

/* ============================================================
   Submit success + reference reveal
   ============================================================ */
.submit-success { max-width: 540px; margin: 48px auto; text-align: center; }
.success-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--success-soft);
    color: var(--success);
    font-size: 26px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 18px;
    border: 1px solid var(--success-line);
}

.reference-box {
    background: var(--surface);
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-md);
    padding: 22px;
    max-width: 420px;
    margin: 0 auto;
}
.ref-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    font-weight: 500;
}
.ref-code {
    font-family: var(--font-mono);
    font-size: 26px;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.02em;
    margin-bottom: 14px;
}
.ref-pill {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    padding: 2px 9px;
    border-radius: var(--radius);
    letter-spacing: 0.02em;
}

/* ============================================================
   Track lookup + progress bar
   ============================================================ */
.track-lookup { max-width: 460px; margin: 56px auto; text-align: center; }
.track-form {
    display: flex; gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 5px;
    max-width: 440px;
    margin: 24px auto 0;
}
.track-form input {
    border: none;
    background: transparent;
    font-size: 14px;
    padding: 9px 12px;
}
.track-form input:focus { box-shadow: none; }
.track-form .btn { padding: 9px 18px; }

.track-header { margin-bottom: 22px; }

.progress-bar {
    display: flex; align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 24px;
    margin-top: 16px;
}
.progress-step {
    display: flex; flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.step-circle {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 500;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    font-variant-numeric: tabular-nums;
}
.step-label {
    font-size: 11.5px;
    color: var(--text-dim);
    font-weight: 500;
    white-space: nowrap;
    letter-spacing: -0.005em;
}
.progress-step.done .step-circle {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.progress-step.done .step-label { color: var(--text-2); }
.progress-step.active .step-circle {
    background: var(--surface-2);
    border-color: var(--accent);
    color: var(--accent);
}
.progress-step.active .step-label {
    color: var(--accent);
    font-weight: 500;
}
.progress-line {
    flex: 1;
    height: 1px;
    background: var(--border);
    margin: 0 6px;
    align-self: center;
    margin-bottom: 24px;
}
.progress-line.done { background: var(--accent); }

@media (max-width: 700px) {
    .progress-bar { padding: 14px 10px; }
    .step-label { font-size: 10px; }
    .step-circle { width: 28px; height: 28px; font-size: 11px; }
}

/* ============================================================
   Auth pages (login, register, change pw)
   ============================================================ */
.auth-wrap {
    min-height: 80vh;
    display: flex; align-items: center; justify-content: center;
    padding: 40px 20px;
}
.auth-card {
    width: 100%; max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 32px 28px;
    text-align: center;
}
.auth-logo {
    width: 64px; height: 64px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 20px;
    display: block;
    box-shadow: 0 0 0 1px var(--border-hi);
}
.auth-card h1 {
    font-size: 20px;
    margin: 0 0 4px;
}
.auth-card .sub {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 22px;
}
.auth-card form { text-align: left; }
.auth-card .btn {
    width: 100%; justify-content: center; padding: 10px;
}
.auth-foot {
    text-align: center; margin-top: 18px;
    font-size: 12.5px; color: var(--text-muted);
}
.auth-foot a { color: var(--accent); font-weight: 500; }

/* ============================================================
   Alerts
   ============================================================ */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    border: 1px solid;
    line-height: 1.5;
}
.alert-error   { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger-line); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: var(--success-line); }
.alert-warn    { background: var(--warn-soft);    color: var(--warn);    border-color: var(--warn-line); }
.alert-info    { background: var(--info-soft);    color: var(--info);    border-color: var(--info-line); }

/* ============================================================
   Admin tabs + user table + toggles
   ============================================================ */
.admin-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 22px;
    overflow-x: auto;
    overflow-y: visible;
    flex-wrap: nowrap;
    scrollbar-width: thin;
}
.admin-tabs::-webkit-scrollbar { height: 4px; }
.admin-tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.admin-tab {
    padding: 9px 14px;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.12s, border-color 0.12s;
    cursor: pointer;
    letter-spacing: -0.005em;
    white-space: nowrap;
    text-decoration: none;
    flex-shrink: 0;
}
.admin-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.admin-tab:hover { color: var(--text); }

.users-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.users-table thead th {
    text-align: left; padding: 10px 14px;
    font-size: 11px; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
}
.users-table td {
    padding: 11px 14px;
    border-top: 1px solid var(--border-soft);
    vertical-align: middle;
}
.user-avatar { display: inline-flex; align-items: center; gap: 10px; }

.role-pill {
    display: inline-flex; align-items: center;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 500;
    border: 1px solid;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.role-admin { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.role-user  { background: var(--info-soft);   color: var(--info);   border-color: var(--info-line); }

/* Toggle switch */
.toggle {
    position: relative;
    width: 32px; height: 18px;
    background: var(--surface-3);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid var(--border);
    flex-shrink: 0;
    display: inline-block;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform 0.15s, background 0.15s;
}
.toggle:has(input:checked) { background: var(--accent); border-color: var(--accent); }
.toggle:has(input:checked)::after { transform: translateX(14px); background: #fff; }

.toggle-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-soft);
    gap: 16px;
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row-text strong { display: block; font-size: 13.5px; margin-bottom: 2px; color: var(--text); }
.toggle-row-text small { color: var(--text-muted); font-size: 12px; }

/* Password reveal box */
.pw-reveal {
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-bottom: 18px;
}
.pw-reveal h3 {
    font-family: var(--font-display);
    font-size: 15px; font-weight: 500;
    margin: 0 0 6px; color: var(--text);
    letter-spacing: -0.015em;
}
.pw-reveal p { font-size: 12.5px; color: var(--text-2); margin: 0 0 10px; }
.pw-code {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-size: 14px; font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.02em;
    word-break: break-all;
}

/* Settings page grid */
.settings-grid {
    display: grid; grid-template-columns: 200px 1fr;
    gap: 28px; align-items: start;
}
.settings-nav { position: sticky; top: 72px; }
.settings-nav a {
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 2px;
    transition: all 0.12s;
}
.settings-nav a:hover { color: var(--text); background: var(--surface-2); }
.settings-nav a.active { color: var(--accent); background: var(--accent-soft); }
.settings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px 26px;
    margin-bottom: 18px;
}
.settings-section h2 {
    font-size: 16px;
    margin: 0 0 4px;
}
.settings-section .desc {
    color: var(--text-muted);
    font-size: 12.5px;
    margin: 0 0 18px;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
    text-align: center;
    padding: 28px 0;
    color: var(--text-dim);
    font-size: 11.5px;
    letter-spacing: 0.04em;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* ============================================================
   Banned page + reference reveal
   ============================================================ */
.ban-page { max-width: 500px; margin: 64px auto; text-align: center; }
.ban-icon {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 32px;
    line-height: 64px;
    margin: 0 auto 18px;
    border: 1px solid var(--danger-line);
}
.ban-title { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.025em; }
.ban-sub { color: var(--text-muted); font-size: 14px; margin: 0 0 24px; }
.ban-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    text-align: left;
    margin: 0 auto 20px;
    max-width: 400px;
}
.ban-row {
    display: flex; justify-content: space-between;
    padding: 9px 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13px;
    gap: 12px;
}
.ban-row:last-child { border-bottom: none; }
.ban-label {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex-shrink: 0;
    font-weight: 500;
}
.ban-value { color: var(--text); text-align: right; word-break: break-word; }
.ban-foot { color: var(--text-muted); font-size: 12.5px; }

.ban-ref-box {
    background: var(--surface);
    border: 1px solid var(--danger-line);
    border-radius: var(--radius-md);
    padding: 18px;
    max-width: 400px;
    margin: 0 auto 20px;
}
.ban-ref-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    font-weight: 500;
}
.ban-ref-code {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 500;
    color: var(--danger);
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

/* ============================================================
   Logs table + IP bans
   ============================================================ */
.log-table {
    width: 100%; border-collapse: collapse; font-size: 12.5px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.log-table thead th {
    text-align: left; padding: 10px 14px;
    background: var(--bg-elev);
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}
.log-table tbody td {
    padding: 9px 14px;
    border-top: 1px solid var(--border-soft);
    vertical-align: top;
}
.log-table tbody tr:hover { background: var(--surface-2); }
.log-table .col-time { color: var(--text-muted); white-space: nowrap; width: 120px; font-size: 11.5px; }
.log-table .col-ip { font-family: var(--font-mono); color: var(--text-muted); font-size: 11.5px; width: 120px; }
.log-table .col-user { width: 130px; }
.log-table .col-action { width: 170px; font-family: var(--font-mono); font-size: 11.5px; }
.log-table .col-details { color: var(--text-muted); font-size: 12px; word-break: break-word; }

.action-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius);
    font-size: 10.5px;
    font-family: var(--font-mono);
    background: var(--surface-3);
    color: var(--text);
    border: 1px solid var(--border);
    letter-spacing: -0.005em;
}
.action-pill.action-warn  { background: var(--warn-soft);    color: var(--warn);    border-color: var(--warn-line); }
.action-pill.action-error { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger-line); }
.action-pill.action-ok    { background: var(--success-soft); color: var(--success); border-color: var(--success-line); }
.action-pill.action-info  { background: var(--info-soft);    color: var(--info);    border-color: var(--info-line); }

.log-filters {
    display: flex; gap: 8px; align-items: center;
    margin-bottom: 12px; flex-wrap: wrap;
}
.log-filters select, .log-filters input {
    width: auto; min-width: 140px;
    font-size: 12.5px; padding: 6px 10px;
}

.pagination { display: flex; justify-content: center; gap: 4px; margin: 18px 0; }
.pagination a, .pagination span {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12.5px;
    color: var(--text-muted);
    text-decoration: none;
}
.pagination a:hover { border-color: var(--border-hi); color: var(--text); }
.pagination .current { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.pagination .disabled { opacity: 0.4; pointer-events: none; }

.ip-ban-row {
    display: grid;
    grid-template-columns: 150px 1fr 130px 130px 80px;
    gap: 12px;
    align-items: center;
    padding: 11px 14px;
    border-top: 1px solid var(--border-soft);
    font-size: 12.5px;
}
.ip-ban-row:first-of-type { border-top: none; }
.ip-ban-row .ip { font-family: var(--font-mono); font-weight: 500; }
.ip-ban-row .auto-tag {
    display: inline-block;
    font-size: 10px;
    background: var(--warn-soft);
    color: var(--warn);
    padding: 1px 6px;
    border-radius: 999px;
    margin-left: 6px;
    border: 1px solid var(--warn-line);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ============================================================
   Video embeds
   ============================================================ */
.video-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 18px;
}
@media (min-width: 700px) {
    .video-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}
.video-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex; flex-direction: column;
}
.video-card video {
    width: 100%; height: auto; display: block;
    background: #000;
    aspect-ratio: 16/9;
    object-fit: contain;
}
.video-aspect {
    position: relative; width: 100%;
    aspect-ratio: 16/9;
    background: #000;
}
.video-aspect iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-meta {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    font-size: 11.5px;
}
.video-src {
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 10.5px;
}
.video-name {
    color: var(--text-muted); text-decoration: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.video-name:hover { color: var(--accent); }
.video-link-card {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: all 0.12s;
}
.video-link-card:hover { border-color: var(--border-hi); background: var(--surface-2); }
.video-link-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--accent-line);
}
.video-link-host {
    font-weight: 500; font-size: 13px;
    color: var(--text); margin-bottom: 2px;
}
.video-link-url {
    font-size: 11.5px; color: var(--text-muted);
    word-break: break-all; font-family: var(--font-mono);
}

/* ============================================================
   Misc admin / category edit
   ============================================================ */
.cat-edit-row {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 8px;
}
.cat-edit-grid {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr 1fr 70px;
    gap: 10px;
    margin-bottom: 10px;
}
.cat-edit-grid input, .cat-edit-grid select {
    padding: 6px 9px; font-size: 12.5px;
}
.cat-edit-foot {
    display: flex; align-items: center; gap: 10px;
    border-top: 1px solid var(--border-soft);
    padding-top: 10px;
}
.micro-label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
    font-weight: 500;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .bug-detail { grid-template-columns: 1fr; }
    .field-row { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .settings-nav { position: static; display: flex; gap: 4px; overflow-x: auto; }
    .settings-nav a { white-space: nowrap; }
    .nav { padding: 10px 16px; }
    .container { padding: 22px 16px 60px; }
    .page-title { font-size: 22px; }
    .landing-actions { grid-template-columns: 1fr; }
    table.bugs .col-asg, table.bugs .col-date, table.bugs .col-cat { display: none; }
    .cat-edit-grid { grid-template-columns: 1fr 1fr; }
    .ip-ban-row { grid-template-columns: 1fr; }
    .log-table .col-ip, .log-table .col-user { display: none; }
}

/* ============================================================
   v6 — Roles & permissions UI
   ============================================================ */

/* Role list (admin_roles.php) */
.role-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}
.role-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    transition: border-color 0.12s;
}
.role-card:hover { border-color: var(--border-hi); }
.role-card.editing {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.role-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.role-card-desc {
    color: var(--text-muted);
    font-size: 12.5px;
    line-height: 1.4;
    margin-bottom: 10px;
}
.role-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

/* Role-coloured pills (used in admin.php user table + roles list) */
.role-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
    border: 1px solid currentColor;
    letter-spacing: -0.005em;
}
.role-pill.role-color-orange { color: var(--accent);  background: var(--accent-soft);  border-color: var(--accent-line); }
.role-pill.role-color-red    { color: var(--danger);  background: var(--danger-soft);  border-color: var(--danger-line); }
.role-pill.role-color-amber  { color: var(--warn);    background: var(--warn-soft);    border-color: var(--warn-line); }
.role-pill.role-color-green  { color: var(--success); background: var(--success-soft); border-color: var(--success-line); }
.role-pill.role-color-teal   { color: #5eead4;        background: rgba(20,184,166,0.10); border-color: rgba(20,184,166,0.22); }
.role-pill.role-color-blue   { color: var(--info);    background: var(--info-soft);    border-color: var(--info-line); }
.role-pill.role-color-purple { color: #c084fc;        background: rgba(168,85,247,0.10); border-color: rgba(168,85,247,0.22); }
.role-pill.role-color-pink   { color: #f9a8d4;        background: rgba(236,72,153,0.10); border-color: rgba(236,72,153,0.22); }
.role-pill.role-color-gray   { color: var(--text-2);  background: rgba(255,255,255,0.05); border-color: var(--border-hi); }

/* Permission checkbox grid */
.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    margin-top: 8px;
    margin-bottom: 14px;
}
.perm-group {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
}
.perm-group-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-soft);
}
.perm-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 7px 0;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-2);
    transition: color 0.1s;
}
.perm-check:hover { color: var(--text); }
.perm-check input[type=checkbox] {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
    margin-top: 1px;
    flex-shrink: 0;
}
.perm-check input[type=checkbox]:disabled { opacity: 0.4; cursor: not-allowed; }
.perm-check span { line-height: 1.4; }
.perm-check strong {
    display: block;
    font-weight: 500;
    color: var(--text);
    font-size: 13px;
    margin-bottom: 1px;
}
.perm-check code {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    background: var(--surface-3);
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: -0.005em;
}

/* Wildcard checkbox — separated, highlighted */
.perm-wildcard {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: var(--radius);
    margin-top: 4px;
}
.perm-wildcard input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.perm-wildcard strong { color: var(--accent); }
.perm-wildcard code {
    background: var(--bg);
    color: var(--accent);
    border: 1px solid var(--accent-line);
}

/* ============================================================
   v7 — color-driven status/priority badges
   ============================================================ */

/* Status badges by color (replaces hardcoded badge-{slug} classes) */
.badge-color-gray   { background: rgba(255,255,255,0.06); color: var(--text-2);   border-color: var(--border-hi); }
.badge-color-red    { background: var(--danger-soft);    color: var(--danger);    border-color: var(--danger-line); }
.badge-color-orange { background: var(--accent-soft);    color: var(--accent);    border-color: var(--accent-line); }
.badge-color-amber  { background: var(--warn-soft);      color: var(--warn);      border-color: var(--warn-line); }
.badge-color-green  { background: var(--success-soft);   color: var(--success);   border-color: var(--success-line); }
.badge-color-teal   { background: rgba(20,184,166,0.10); color: #5eead4;          border-color: rgba(20,184,166,0.22); }
.badge-color-blue   { background: var(--info-soft);      color: var(--info);      border-color: var(--info-line); }
.badge-color-purple { background: rgba(168,85,247,0.10); color: #c084fc;          border-color: rgba(168,85,247,0.22); }
.badge-color-pink   { background: rgba(236,72,153,0.10); color: #f9a8d4;          border-color: rgba(236,72,153,0.22); }

/* Priority dots by color */
.priority-color-gray   { background: var(--text-muted); }
.priority-color-red    { background: var(--danger); }
.priority-color-orange { background: var(--accent); }
.priority-color-amber  { background: var(--warn); }
.priority-color-green  { background: var(--success); }
.priority-color-teal   { background: #14b8a6; }
.priority-color-blue   { background: var(--info); }
.priority-color-purple { background: #a855f7; }
.priority-color-pink   { background: #ec4899; }

/* Role badge colors (matches role.color column) */
.role-color-gray   { background: rgba(255,255,255,0.06); color: var(--text-2);   border-color: var(--border-hi); }
.role-color-red    { background: var(--danger-soft);    color: var(--danger);    border-color: var(--danger-line); }
.role-color-orange { background: var(--accent-soft);    color: var(--accent);    border-color: var(--accent-line); }
.role-color-amber  { background: var(--warn-soft);      color: var(--warn);      border-color: var(--warn-line); }
.role-color-green  { background: var(--success-soft);   color: var(--success);   border-color: var(--success-line); }
.role-color-teal   { background: rgba(20,184,166,0.10); color: #5eead4;          border-color: rgba(20,184,166,0.22); }
.role-color-blue   { background: var(--info-soft);      color: var(--info);      border-color: var(--info-line); }
.role-color-purple { background: rgba(168,85,247,0.10); color: #c084fc;          border-color: rgba(168,85,247,0.22); }
.role-color-pink   { background: rgba(236,72,153,0.10); color: #f9a8d4;          border-color: rgba(236,72,153,0.22); }

/* ============================================================
   v7 — Kill the native white spinner on number inputs (dark mode)
   ============================================================ */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Same for date / datetime — Chrome's date picker icon is dark-mode unfriendly */
input[type=date]::-webkit-calendar-picker-indicator,
input[type=datetime-local]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

/* details/summary tweak so the disclosure triangle is the right color */
details > summary {
    list-style: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
    content: '▸';
    color: var(--text-muted);
    margin-right: 6px;
    font-size: 10px;
    display: inline-block;
    transition: transform 0.15s;
}
details[open] > summary::before { transform: rotate(90deg); }

/* Permission groups for admin_roles.php */
.perm-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 8px;
}
@media (min-width: 700px) {
    .perm-grid { grid-template-columns: 1fr 1fr; }
}
.perm-group {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
}
.perm-group-title {
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
    margin-bottom: 8px;
}
.perm-check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 6px 0;
    border-top: 1px solid var(--border-soft);
    font-size: 12.5px;
    cursor: pointer;
}
.perm-check:first-of-type { border-top: none; padding-top: 0; }
.perm-check input[type=checkbox] {
    width: auto;
    accent-color: var(--accent);
    margin-top: 3px;
    flex-shrink: 0;
}
.perm-check strong {
    display: block;
    font-weight: 500;
    color: var(--text);
}
.perm-check code {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    padding: 1px 5px;
    background: var(--surface-3);
    border-radius: 3px;
    margin-top: 2px;
    display: inline-block;
}
.perm-check input:disabled + span { opacity: 0.55; }
.perm-wildcard {
    margin-top: 14px;
    padding: 12px 14px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: var(--radius);
    border-top: 1px solid var(--accent-line);
}

/* Role list cards on admin_roles.php */
.role-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 10px;
}
@media (min-width: 800px) {
    .role-list { grid-template-columns: 1fr 1fr; }
}
.role-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    transition: border-color 0.15s;
}
.role-card.editing { border-color: var(--accent); }
.role-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.role-card-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    line-height: 1.5;
}
.role-card-actions {
    display: flex;
    gap: 6px;
}

/* ============================================================
   v8 — Discord OAuth button + Discord ban styling
   ============================================================ */

.btn-discord {
    background: #5865f2;
    border-color: #5865f2;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 0;
    font-weight: 500;
}
.btn-discord:hover {
    background: #4752c4;
    border-color: #4752c4;
    color: #fff;
}
.btn-discord svg { color: #fff; }

/* "or" divider used between password form and Discord button on login.php */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--text-dim);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Make the auth card a touch wider when Discord is enabled — 380px is tight */
@media (min-width: 420px) {
    .auth-card { max-width: 420px; }
}

/* ============================================
   @-mention autocomplete popup
   ============================================ */
.mention-popup {
    position: absolute;
    z-index: 1000;
    display: none;
    background: var(--surface-2);
    border: 1px solid var(--border-hi);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    max-height: 320px;
    overflow-y: auto;
    font-size: 13px;
}
.mention-popup .mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    cursor: pointer;
    transition: background 0.05s;
}
.mention-popup .mention-item.is-highlighted,
.mention-popup .mention-item:hover {
    background: var(--surface-3);
}
.mention-popup .mention-item img,
.mention-popup .mention-item .avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.mention-popup .mention-name {
    flex: 1;
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mention-popup .mention-handle {
    color: var(--text-muted);
    font-size: 11.5px;
    font-family: var(--font-mono);
    flex-shrink: 0;
}
.mention-popup .mention-role-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.mention-role-dot.role-color-red    { background: #ed4245; }
.mention-role-dot.role-color-orange { background: #fb6638; }
.mention-role-dot.role-color-amber  { background: #f59e0b; }
.mention-role-dot.role-color-green  { background: #10b981; }
.mention-role-dot.role-color-teal   { background: #06b6d4; }
.mention-role-dot.role-color-blue   { background: #3b82f6; }
.mention-role-dot.role-color-purple { background: #9b59b6; }
.mention-role-dot.role-color-pink   { background: #ec4ba5; }
.mention-role-dot.role-color-gray   { background: #99aab5; }

/* Reply attachment UI ---------------------------------------------------- */
.reply-attach-zone {
    position: relative;
    border-radius: var(--radius);
    transition: outline 0.1s;
    outline: 2px dashed transparent;
    outline-offset: -2px;
}
.reply-attach-zone.reply-attach-dragover {
    outline-color: var(--accent);
    background: rgba(251, 102, 56, 0.04);
}
.reply-attach-input {
    /* Hide the actual input; the label is the clickable picker */
    position: absolute; left: -9999px; opacity: 0; pointer-events: none;
}
.reply-attach-picker {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border: 1px dashed var(--border);
    border-radius: 6px;
    transition: all 0.1s;
    background: none;
    font-family: inherit;
}
.reply-attach-picker:hover { color: var(--text); border-color: var(--text-muted); }
.reply-attach-hint {
    font-size: 11px; color: var(--text-dim); margin-left: 8px;
}
.reply-attach-previews {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.reply-attach-thumb {
    position: relative;
    width: 96px; height: 96px;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface-2);
    flex-shrink: 0;
}
.reply-attach-thumb img {
    width: 100%; height: 100%; object-fit: cover;
}
.reply-attach-meta {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    color: #fff;
    font-size: 9.5px;
    padding: 4px 6px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.reply-attach-remove {
    position: absolute;
    top: 2px; right: 2px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: rgba(0,0,0,0.7); color: #fff;
    border: none; cursor: pointer;
    font-size: 14px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
.reply-attach-remove:hover { background: var(--danger); }

/* Inline image rendering inside comment/message bodies ------------------- */
.reply-image {
    max-width: 100%;
    max-height: 480px;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-top: 8px;
    display: block;
    background: var(--surface-2);
}
.reply-image-row {
    display: flex; flex-wrap: wrap; gap: 10px;
    margin-top: 10px;
}
.reply-image-row a {
    display: block;
    text-decoration: none;   /* don't underline the wrapping link */
    max-width: 480px;
    flex-shrink: 0;
}
.reply-image-row .reply-image {
    max-height: 320px;
    margin-top: 0;
}

/* Pagination ------------------------------------------------------------ */
.pagination {
    display: flex; gap: 4px; flex-wrap: wrap;
    margin: 18px 0 6px;
    justify-content: center;
}
.page-link {
    display: inline-block;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.1s;
    min-width: 36px;
    text-align: center;
}
.page-link:hover {
    color: var(--text);
    border-color: var(--text-muted);
}
.page-link-current {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
    font-weight: 600;
}
.page-link-current:hover { color: #fff; }
.page-link-disabled {
    color: var(--text-dim);
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent;
}
.page-link-gap {
    border: none;
    background: transparent;
    cursor: default;
    color: var(--text-dim);
}

/* Read receipts — "Seen by" pile under each ticket reply ------------------ */
.read-by {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
}
.read-by-pile {
    display: flex;
    align-items: center;
}
.read-by-pile img,
.read-by-pile .read-by-fallback {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--surface);
    margin-left: -5px;
    background: #5865f2;
    color: #fff;
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}
.read-by-pile img:first-child,
.read-by-pile .read-by-fallback:first-child {
    margin-left: 0;
}
.read-by-more {
    margin-left: 6px;
    font-size: 10.5px;
    color: var(--text-dim);
}

/* Explicit Read / Not read split under each reply ------------------------- */
.read-status {
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.read-status-label {
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 500;
}
.read-status-label.read-status-all {
    color: #10b981;
    font-weight: 600;
}
.read-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.read-group-label {
    font-size: 11px;
    font-weight: 600;
    min-width: 70px;
}
.read-group-label-yes { color: #10b981; }
.read-group-label-no  { color: var(--text-dim); }
/* Unread avatars: greyed and dimmed so the difference is obvious */
.read-by-pile-unread img,
.read-by-pile-unread .read-by-fallback {
    filter: grayscale(1);
    opacity: 0.55;
}

/* ============================================================
   Responsive — comprehensive overrides for mobile, tablet,
   and "weird laptop resolution" cases.
   Breakpoints:
     1024px  — bug/ticket sidebar stacks below content
     768px   — tablet: tighter padding, nav collapses
     480px   — phone: maximum compaction
   ============================================================ */

@media (max-width: 1024px) {
    /* Bug & ticket detail pages: drop the 260px sidebar to single column */
    .bug-detail {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .bug-main, .bug-side { padding: 18px 18px; }
    /* Page container takes more horizontal space */
    main, .page-wrap { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 900px) {
    /* Two-column form rows stack */
    .field-row { grid-template-columns: 1fr; gap: 8px; }
    /* Filter rows: allow wrapping */
    .filters { flex-wrap: wrap; gap: 8px; }
    .filters select, .filters .search-wrap, .filters input { min-width: 0; flex: 1 1 140px; }
    /* Stat cards: 2 columns instead of 4 */
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
    /* Pagination: tighter buttons */
    .page-link { padding: 6px 10px; min-width: 32px; font-size: 12.5px; }
}

@media (max-width: 768px) {
    /* Nav: allow horizontal scroll instead of overflow */
    .nav { padding: 10px 14px; height: auto; min-height: 56px; flex-wrap: wrap; gap: 6px; }
    .nav-right {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 2px;
    }
    .nav-link { padding: 5px 8px; font-size: 12.5px; }
    .nav-user { padding-left: 8px; margin-left: 0; }
    .brand-name { font-size: 13px; }

    /* Tables: horizontal scroll instead of overflow */
    .bugs-card, .tickets-card { overflow-x: auto; }
    table { font-size: 12.5px; }
    th, td { padding: 8px 10px !important; white-space: nowrap; }

    /* Cards / containers: reduce padding */
    .bug-main, .bug-side { padding: 16px 14px; }
    .bug-main h1 { font-size: 19px; }

    /* Comments / replies */
    .comment { padding: 12px 14px; }
    .comment-body { font-size: 13.5px; }

    /* Image attachments: respect viewport width */
    .reply-image { max-height: 280px; }
    .reply-image-row .reply-image { max-height: 180px; }

    /* Reply form attach UI */
    .reply-attach-thumb { width: 80px; height: 80px; }

    /* Read receipt panel */
    .read-status { padding: 8px 10px; gap: 6px; }
    .read-group { gap: 6px; }
    .read-group-label { min-width: 60px; font-size: 10.5px; }

    /* Buttons: don't shrink text */
    .btn { font-size: 13px; }
    .btn-sm { font-size: 12px; padding: 5px 9px; }

    /* Field labels & inputs */
    .field label { font-size: 12.5px; }
    input, select, textarea { font-size: 14px; /* prevents iOS zoom on focus */ }

    /* Admin tabs: scroll horizontally */
    .admin-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Status pill / badge row on bug header — wrap nicely */
    .bug-main > div:first-child { flex-wrap: wrap; gap: 6px; }
}

@media (max-width: 480px) {
    .nav { padding: 8px 10px; }
    .nav-link { padding: 4px 6px; font-size: 12px; }
    .brand-logo { width: 24px; height: 24px; }
    .brand-name { display: none; }   /* logo only on phones */

    main, .page-wrap { padding-left: 10px; padding-right: 10px; }
    .bug-main, .bug-side { padding: 14px 12px; }
    .bug-main h1 { font-size: 17px; }

    /* Pagination on phones: just prev / current / next */
    .page-link:not(.page-link-current):not([class*="Prev"]):not([class*="Next"]) {
        /* keep current + nav buttons; rely on JS or just allow wrapping */
    }
    .pagination { gap: 2px; }

    /* Stat cards: single column on phones */
    .stats-grid { grid-template-columns: 1fr !important; }

    /* Comment avatars smaller */
    .comment-head .avatar { width: 22px; height: 22px; font-size: 9.5px; }
    .comment-head { flex-wrap: wrap; gap: 5px; }
    .comment-time { font-size: 10.5px; margin-left: 0 !important; }

    /* Make read pile smaller */
    .read-by-pile img, .read-by-pile .read-by-fallback { width: 16px; height: 16px; }
}

/* Universal — prevent horizontal overflow from long content */
img, video { max-width: 100%; height: auto; }
pre, code { white-space: pre-wrap; word-break: break-word; }
body { overflow-x: hidden; }

/* File attachment download cards (non-image attachments) ------------------ */
.reply-file-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    margin: 4px 6px 4px 0;
    transition: border-color 0.1s, background 0.1s;
    max-width: 320px;
}
.reply-file-card:hover {
    border-color: var(--accent);
    background: var(--surface);
    color: var(--text);
}
.reply-file-card-icon {
    width: 36px; height: 36px;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}
.reply-file-card-meta {
    display: flex; flex-direction: column; gap: 2px;
    min-width: 0;
}
.reply-file-card-name {
    font-size: 13px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 240px;
}
.reply-file-card-size {
    font-size: 11px;
    color: var(--text-muted);
}

/* Non-image preview thumb in the upload UI */
.reply-attach-thumb-file {
    display: flex !important;
    align-items: center; justify-content: center;
    background: var(--surface-3) !important;
}
.reply-attach-icon {
    width: 48px; height: 48px;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    letter-spacing: 0.5px;
}
