/* =========================================================================
 * style.css — single, dependency-free stylesheet for the whole app.
 * Replaces Bootstrap. Implements the subset of utility/layout classes the
 * existing markup uses. Intentionally simple; tweak freely.
 * ====================================================================== */

:root {
    --bg: #f4f6f9;
    --fg: #2b2f33;
    --muted: #6c757d;
    --primary: #2f6fed;
    --primary-dark: #2356c4;
    --danger: #d9534f;
    --success: #2e9e5b;
    --border: #dfe3e8;
    --card: #ffffff;
    --dark: #23272b;
    --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--fg);
    background: var(--bg);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5, h6 { margin: 0 0 .5rem; font-weight: 600; line-height: 1.2; }
.h3 { font-size: 1.5rem; }
.h5 { font-size: 1.1rem; }

img { max-width: 100%; height: auto; }

/* ---------- Layout: container + flex grid ---------- */

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 15px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

[class*="col-"] {
    padding: 0 15px;
    width: 100%;
    flex: 0 0 100%;
    max-width: 100%;
}

/* col-N (12-column) shared across breakpoints; mobile-first = full width,
   widths apply from the small breakpoint up. */
@media (min-width: 768px) {
    .col-sm-1,.col-md-1,.col-lg-1,.col-xl-1 { flex-basis: 8.3333%;  max-width: 8.3333%;  }
    .col-sm-2,.col-md-2,.col-lg-2,.col-xl-2 { flex-basis: 16.6667%; max-width: 16.6667%; }
    .col-sm-3,.col-md-3,.col-lg-3,.col-xl-3 { flex-basis: 25%;      max-width: 25%;      }
    .col-sm-4,.col-md-4,.col-lg-4,.col-xl-4 { flex-basis: 33.3333%; max-width: 33.3333%; }
    .col-sm-5,.col-md-5,.col-lg-5,.col-xl-5 { flex-basis: 41.6667%; max-width: 41.6667%; }
    .col-sm-6,.col-md-6,.col-lg-6,.col-xl-6 { flex-basis: 50%;      max-width: 50%;      }
    .col-sm-7,.col-md-7,.col-lg-7,.col-xl-7 { flex-basis: 58.3333%; max-width: 58.3333%; }
    .col-sm-8,.col-md-8,.col-lg-8,.col-xl-8 { flex-basis: 66.6667%; max-width: 66.6667%; }
    .col-sm-9,.col-md-9,.col-lg-9,.col-xl-9 { flex-basis: 75%;      max-width: 75%;      }
    .col-sm-10,.col-md-10,.col-lg-10,.col-xl-10 { flex-basis: 83.3333%; max-width: 83.3333%; }
    .col-sm-11,.col-md-11,.col-lg-11,.col-xl-11 { flex-basis: 91.6667%; max-width: 91.6667%; }
    .col-sm-12,.col-md-12,.col-lg-12,.col-xl-12 { flex-basis: 100%;  max-width: 100%;     }
}
.col-auto { flex: 0 0 auto; width: auto; max-width: 100%; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* ---------- Text + font utilities ---------- */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }
.text-muted   { color: var(--muted); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.font-weight-normal { font-weight: 400; }
.font-weight-bold   { font-weight: 700; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
small { font-size: 0.85em; }
sub { font-size: 0.8em; }

/* ---------- Spacing utilities (0–5 -> 0,.25,.5,1,1.5,3 rem) ---------- */
.m-0{margin:0}.m-1{margin:.25rem}.m-2{margin:.5rem}.m-3{margin:1rem}.m-4{margin:1.5rem}.m-5{margin:3rem}
.mt-0{margin-top:0}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:1rem}.mt-4{margin-top:1.5rem}.mt-5{margin-top:3rem}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:1rem}.mb-4{margin-bottom:1.5rem}.mb-5{margin-bottom:3rem}
.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:1rem}
.ml-auto{margin-left:auto}.mr-auto{margin-right:auto}
.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-3{margin-top:1rem;margin-bottom:1rem}
.p-2{padding:.5rem}.p-3{padding:1rem}
.pr-2{padding-right:.5rem}
.py-5{padding-top:3rem;padding-bottom:3rem}.px-4{padding-left:1.5rem;padding-right:1.5rem}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1rem; }
label { display: inline-block; margin-bottom: .35rem; font-weight: 500; }

.form-control {
    display: block;
    width: 100%;
    padding: .55rem .75rem;
    font-size: 1rem;
    color: var(--fg);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
.form-control:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47,111,237,.15);
}

textarea.form-control { min-height: 110px; resize: vertical; }

/* Auth forms get a card-like centered panel */
.form-auth {
    background: var(--card);
    padding: 2rem 1.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    margin: 2.5rem auto;
    max-width: 420px;
}

/* Checkbox / radio (custom-control* shim -> native controls) */
.custom-control { position: relative; display: block; margin: .25rem 0; }
.custom-control-input { margin-right: .4rem; }
.custom-control-label { font-weight: 400; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    user-select: none;
    padding: .55rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: #e9ecef;
    color: var(--fg);
    transition: background-color .15s ease-in-out, border-color .15s ease-in-out;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn-lg { padding: .7rem 1.25rem; font-size: 1.1rem; }
.btn-block { display: block; width: 100%; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-dark { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn-default { background: #fff; border-color: var(--border); color: var(--fg); }

/* ---------- Navbar ---------- */
.navbar {
    display: flex;
    align-items: center;
    padding: .6rem 0;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.navbar .container { display: flex; align-items: center; width: 100%; }
.bg-white { background: #fff; }
.bg-dark  { background: var(--dark); }
.navbar-light .nav-link, .navbar-light .navbar-brand { color: var(--fg); }
.navbar-dark  .nav-link, .navbar-dark  .navbar-brand { color: #f1f1f1; }
.shadow-sm { box-shadow: 0 1px 4px rgba(0,0,0,.08); }

.navbar-brand {
    display: inline-flex;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 600;
    margin-right: 1rem;
}
.navbar-brand img { margin-right: .5rem; }

.navbar-nav {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: .25rem;
}
.navbar-collapse { display: flex; flex: 1; align-items: center; justify-content: flex-end; }
.nav-item { list-style: none; }
.nav-link {
    display: block;
    padding: .4rem .75rem;
    border-radius: 6px;
}
.nav-link:hover { text-decoration: none; opacity: .85; }
.navbar-img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; vertical-align: middle; }

/* Mobile toggle */
.navbar-toggler {
    display: none;
    margin-left: auto;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 6px;
    padding: .35rem .6rem;
    cursor: pointer;
    color: inherit;
}
.navbar-toggler-icon::before { content: "\2630"; font-size: 1.1rem; }

/* ---------- Dropdown (toggled by app.js via .show) ---------- */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + .25rem);
    display: none;
    min-width: 180px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
    padding: .35rem 0;
    z-index: 1000;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
    display: block;
    padding: .5rem 1rem;
    color: var(--fg);
    white-space: nowrap;
}
.dropdown-item:hover { background: var(--bg); text-decoration: none; }
.dropdown-toggle .caret { margin-left: .3rem; }

@media (max-width: 767px) {
    .navbar-toggler { display: inline-block; }
    .navbar-collapse {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .navbar-collapse.show { display: flex; }
    .navbar-nav { flex-direction: column; align-items: stretch; width: 100%; }
    .dropdown-menu { position: static; box-shadow: none; border: 0; }
    .navbar .container { flex-wrap: wrap; }
}

/* ---------- Jumbotron / misc ---------- */
.jumbotron {
    background: #fff;
    border-radius: var(--radius);
    padding: 3rem 1.5rem;
    margin: 2rem 0;
    border: 1px solid var(--border);
}

/* ---------- Footer (light, minimal) ---------- */
.site-footer {
    margin-top: 3rem;
    padding: 1.5rem 0;
    background: #fff;
    border-top: 1px solid #e6e8eb;
}
.footer-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
}
.footer-logo img { display: block; }
.footer-text {
    margin: 0;
    font-size: .85rem;
    color: #6b7280;
}
.footer-text a { color: #4b5563; text-decoration: none; }
.footer-text a:hover { text-decoration: underline; }

/* ---------- Header navigation select ---------- */
.nav-controls { display: flex; align-items: center; gap: .6rem; margin-left: auto; }
.nav-select {
    appearance: none;
    -webkit-appearance: none;
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%23555' d='M2 4l4 4 4-4z'/></svg>") no-repeat right .7rem center;
    border: 1px solid #d5d9de;
    border-radius: 8px;
    padding: .5rem 2rem .5rem .9rem;
    font-size: .95rem;
    font-weight: 600;
    color: #2b2f36;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.nav-select:hover { border-color: #b7bdc5; }
.nav-select:focus-visible { outline: none; border-color: #2b6cb0; box-shadow: 0 0 0 3px rgba(43,108,176,.2); }

.nav-avatar-btn {
    background: #fff;
    border: 1px solid #d5d9de;
    border-radius: 8px;
    padding: .25rem .5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}
.nav-avatar-btn:hover { border-color: #b7bdc5; }

/* ---------- Profile card / avatar (profile-edit & profile-card) ---------- */
.picCard { margin-bottom: 1rem; }
.avatar-upload { position: relative; max-width: 200px; margin: 0 auto; }
.avatar-preview {
    width: 160px; height: 160px; margin: 0 auto;
    border-radius: 50%; border: 3px solid var(--border); overflow: hidden;
}
.avatar-preview > div {
    width: 100%; height: 100%;
    background-size: cover; background-position: center; background-repeat: no-repeat;
}
.avatar-edit { text-align: center; margin-top: .5rem; }
.avatar-edit input { display: inline-block; }

/* ---------- CAPTCHA widget ---------- */
.captcha-container {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem 0;
    background: #fafbfc;
}
.captcha-label {
    display: block;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    margin-bottom: .4rem;
}
.captcha-question {
    font-weight: 600;
    margin-bottom: .6rem;
    min-height: 1.4em;
}
.captcha-image-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: .75rem;
    max-width: 100%;
}
.captcha-image {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
}
.refresh-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 34px;
    height: 34px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255,255,255,.9);
    cursor: pointer;
    color: var(--fg);
}
.refresh-btn:hover { background: #fff; }
.refresh-icon { width: 100%; height: 100%; }
.captcha-input { max-width: 320px; }

/* ---------- Admin dashboard ---------- */
.dashboard { max-width: 1100px; margin-top: 1.5rem; }
.dash-head { display: flex; align-items: baseline; gap: .75rem; margin-bottom: 1rem; }
.dash-head h4 { margin: 0; }
.dash-sub { color: var(--muted); font-size: .85rem; }
.dash-toolbar { display: flex; align-items: center; gap: 1rem; margin-bottom: .75rem; }
.dash-search { flex: 1; max-width: 480px; }
.dash-count { color: var(--muted); font-size: .85rem; white-space: nowrap; }

.dash-table-wrap { max-height: 45vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.dash-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.dash-table thead th {
    position: sticky; top: 0; background: #f6f7f9; text-align: left;
    padding: .55rem .75rem; border-bottom: 1px solid var(--border); font-weight: 600; z-index: 1;
}
.dash-table tbody td { padding: .5rem .75rem; border-bottom: 1px solid #eef0f2; }
.dash-table tbody tr { cursor: pointer; }
.dash-table tbody tr:hover { background: #f9fafb; }
.dash-table tbody tr.selected { background: #e7f1ff; }

.dash-actions { display: flex; align-items: center; gap: .5rem; margin: .9rem 0; flex-wrap: wrap; }
.btn-success { background: #1a7f47; border-color: #1a7f47; color: #fff; }
.btn-danger  { background: #b3261e; border-color: #b3261e; color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.dash-status { font-size: .85rem; margin-left: .5rem; }
.dash-status.ok  { color: #1a7f47; }
.dash-status.err { color: #b3261e; }

.dash-detail { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; margin-top: .5rem; }
.dash-detail h5 { margin: 0 0 1rem; }
.dash-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem 1.25rem; }
.dash-fields label { display: flex; flex-direction: column; font-size: .8rem; font-weight: 600; color: var(--muted); gap: .3rem; }
.dash-fields input, .dash-fields select, .dash-fields textarea {
    font-size: .9rem; font-weight: 400; color: var(--fg);
    padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 6px; width: 100%;
}
.dash-fields .dash-wide { grid-column: 1 / -1; }
.field-error { color: #b3261e; font-weight: 400; font-size: .75rem; min-height: .9em; }

.dash-ro-head { margin: 1.25rem 0 .6rem; color: var(--muted); }
.dash-readonly { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem 1rem; font-size: .82rem; color: var(--fg); }
.dash-readonly span { color: var(--muted); word-break: break-word; }

@media (max-width: 720px) {
    .dash-fields, .dash-readonly { grid-template-columns: 1fr; }
}

/* ---------- Developer Console ---------- */
.devc { max-width: 900px; margin-top: 1.5rem; }
.devc-head { display: flex; align-items: baseline; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.devc-head h4 { margin: 0; }
.devc-sub { color: var(--muted); font-size: .85rem; }
.devc-actions { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; position: sticky; top: 0; background: var(--bg, #fff); padding: .5rem 0; z-index: 5; }
.devc-status { font-size: .85rem; }
.devc-status.ok { color: #1a7f47; }
.devc-status.err { color: #b3261e; }

.devc-group { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.devc-group-title { margin: 0 0 .75rem; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.devc-rows { display: flex; flex-direction: column; }
.devc-row { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; padding: .7rem 0; border-top: 1px solid #eef0f2; }
.devc-row:first-child { border-top: 0; }
.devc-row-label label { font-weight: 600; font-size: .95rem; display: block; }
.devc-note { display: block; font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.devc-row-control { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; min-width: 220px; }
.devc-row-control input[type="text"], .devc-row-control input[type="number"], .devc-row-control textarea {
    width: 100%; min-width: 220px; padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 6px; font-size: .9rem; font-family: inherit;
}
.devc-field-error { color: #b3261e; font-size: .75rem; }

/* toggle switch */
.devc-switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.devc-switch input { opacity: 0; width: 0; height: 0; }
.devc-slider { position: absolute; inset: 0; cursor: pointer; background: #cfd4da; border-radius: 26px; transition: background .15s; }
.devc-slider::before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; }
.devc-switch input:checked + .devc-slider { background: #1a7f47; }
.devc-switch input:checked + .devc-slider::before { transform: translateX(20px); }
.devc-switch input:focus-visible + .devc-slider { outline: 2px solid #1a7f47; outline-offset: 2px; }
.devc-locked { font-size: .8rem; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }

.devc-secret-intro { font-size: .88rem; color: var(--muted); max-width: 70ch; }
.devc-secrets { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .5rem; }
.devc-secret { display: flex; justify-content: space-between; align-items: center; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 6px; font-size: .82rem; }
.devc-secret code { font-size: .78rem; }
.devc-secret.is-set span { color: #1a7f47; font-weight: 600; }
.devc-secret.not-set span { color: #b3261e; font-weight: 600; }
@media (max-width: 640px) { .devc-row { grid-template-columns: 1fr; } .devc-row-control { align-items: stretch; } }

/* ---------- Link tracking ---------- */
.lt { max-width: 1080px; margin-top: 1.5rem; }
.lt-head { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.lt-head h4 { margin: 0; }
.lt-sub { color: var(--muted); font-size: .85rem; }
.lt-create { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.5rem; }
.lt-create h5 { margin: 0 0 .8rem; font-size: 1rem; }
.lt-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .8rem 1rem; align-items: end; }
.lt-form label { display: flex; flex-direction: column; font-size: .78rem; font-weight: 600; color: var(--muted); gap: .3rem; }
.lt-form input { padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 6px; font-size: .9rem; }
.lt-opt { font-weight: 400; text-transform: none; }
.lt-err { color: #b3261e; font-size: .72rem; font-weight: 400; }
.lt-status { font-size: .82rem; align-self: center; }
.lt-status.ok { color: #1a7f47; } .lt-status.err { color: #b3261e; }

.lt-table-wrap, .lt-recent-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.lt-table, .lt-recent { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 720px; }
.lt-table th, .lt-recent th { text-align: left; background: #f6f7f9; padding: .55rem .7rem; border-bottom: 1px solid var(--border); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.lt-table td, .lt-recent td { padding: .5rem .7rem; border-bottom: 1px solid #eef0f2; vertical-align: top; }
.lt-table tr.sel { background: #e7f1ff; }
.lt-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; }
.lt-copy { border: 1px solid var(--border); background: #fff; border-radius: 4px; cursor: pointer; margin-left: .3rem; padding: 0 .35rem; }
.lt-dest { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; color: var(--muted); }
.lt-muted { color: var(--muted); }
.lt-badge { font-size: .72rem; padding: .1rem .45rem; border-radius: 10px; font-weight: 600; }
.lt-badge.on { background: #e6f4ec; color: #1a7f47; } .lt-badge.off { background: #f3e6e6; color: #b3261e; }
.lt-row-actions button { border: 1px solid var(--border); background: #fff; border-radius: 5px; cursor: pointer; font-size: .74rem; padding: .18rem .45rem; margin-right: .25rem; }
.lt-empty { text-align: center; color: var(--muted); padding: 1.5rem; }

.lt-detail { margin-top: 1.75rem; border-top: 2px solid var(--border); padding-top: 1.25rem; }
.lt-detail-head { display: flex; justify-content: space-between; align-items: center; }
.btn-line { border: 1px solid var(--border); padding: .4rem .8rem; border-radius: 6px; text-decoration: none; color: var(--fg); font-size: .82rem; }
.lt-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.lt-kpis div { font-size: .8rem; color: var(--muted); }
.lt-kpi { display: block; font-size: 1.7rem; font-weight: 700; color: var(--fg); }
.lt-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; }
.lt-cols h6 { margin: 0 0 .6rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.lt-bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; border-bottom: 1px solid var(--border); }
.lt-bar { flex: 1; display: flex; align-items: flex-end; }
.lt-bar span { width: 100%; background: #1a7f47; border-radius: 2px 2px 0 0; display: block; min-height: 3px; }
.lt-list { list-style: none; padding: 0; margin: 0 0 1.2rem; }
.lt-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-bottom: 1px solid #eef0f2; font-size: .84rem; }
.lt-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) { .lt-cols { grid-template-columns: 1fr; } }

/* ---------- My Account (export / delete) ---------- */
.acct { max-width: 720px; margin-top: 1.5rem; }
.acct-head { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.acct-head h4 { margin: 0; }
.acct-sub, .acct-muted { color: var(--muted); font-size: .9rem; }
.acct-note { color: var(--muted); background: var(--paper-2, #f1ede3); padding: 1rem; border-radius: var(--radius); }
.acct-ok { color: #1a7f47; } .acct-err { color: #b3261e; }
.acct-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; }
.acct-card h5 { margin: 0 0 .4rem; }
.acct-card .acct-muted { margin: 0 0 1rem; }
.acct-danger { border-color: #e3c6c6; background: #fdf7f7; }
.acct-danger h5 { color: #b3261e; }

/* ---------- API clients ---------- */
.apic-warn { background: #fdf6e3; border: 1px solid #ece0b8; color: #7a5c00; padding: .8rem 1rem; border-radius: var(--radius); }
.apic-create { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.apic-create input { flex: 1; min-width: 220px; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 6px; }
.apic-secret { margin-top: 1rem; padding: 1rem; border: 1px dashed #1a7f47; border-radius: 8px; background: #f3fbf6; }
.apic-secret code { background: #fff; padding: .15rem .4rem; border-radius: 4px; word-break: break-all; }
.apic-ref { background: #12161b; color: #d4d8dc; padding: 1rem 1.2rem; border-radius: 8px; overflow-x: auto; font-size: .82rem; line-height: 1.7; }

/* ---------- Dev-console sub-nav + maintenance ---------- */
.devc-subnav { display: flex; gap: .3rem; flex-wrap: wrap; margin: -0.5rem 0 1.25rem; border-bottom: 1px solid var(--border); }
.devc-subnav a { padding: .5rem .9rem; text-decoration: none; color: var(--muted); font-size: .9rem; font-weight: 600; border-bottom: 2px solid transparent; }
.devc-subnav a:hover { color: var(--fg); }
.mnt-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.mnt-btn { border: 1px solid var(--border); background: #fff; border-radius: 5px; cursor: pointer; font-size: .74rem; padding: .18rem .45rem; margin-right: .25rem; text-decoration: none; color: var(--fg); }
.mnt-restore-db { padding: .25rem; border: 1px solid var(--border); border-radius: 5px; font-size: .8rem; }
.mnt-log { background: #12161b; color: #d4d8dc; padding: 1rem; border-radius: 8px; margin-top: 1rem; font-size: .8rem; white-space: pre-wrap; max-height: 300px; overflow: auto; }
.mnt-alert { padding: .5rem .7rem; border-radius: 6px; font-size: .88rem; margin: .3rem 0; }
.mnt-critical { background: #fdeaea; color: #b3261e; } .mnt-warning { background: #fdf6e3; color: #7a5c00; } .mnt-info { background: #eaf1fd; color: #1a4b8f; }
.mnt-dns-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; font-size: .9rem; }

/* ---------- Public profile page ---------- */
.pf { max-width: 880px; margin: 2rem auto; }
.pf-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(16, 22, 26, .06);
}
.pf-cover {
    height: 120px;
    background: linear-gradient(120deg, var(--primary), var(--primary-dark));
}
.pf-head {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    padding: 0 1.5rem 1.25rem;
}
.pf-avatar {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--card);
    background: #fff;
    margin-top: -72px;
    box-shadow: 0 1px 3px rgba(16, 22, 26, .12);
    flex-shrink: 0;
}
.pf-id { flex: 1 1 auto; min-width: 0; }
.pf-name { font-size: 1.6rem; line-height: 1.2; margin: 0; color: var(--fg); word-break: break-word; }
.pf-fullname { color: var(--muted); margin: .2rem 0 0; }
.pf-fullname .fa { margin-right: .25rem; }
.pf-headline { color: var(--fg); margin: .35rem 0 0; }
.pf-role {
    display: inline-block;
    margin-top: .6rem;
    font-size: .72rem;
    font-weight: 600;
    padding: .15rem .55rem;
    border-radius: 999px;
    background: var(--bg);
    color: var(--muted);
    border: 1px solid var(--border);
}
.pf-role-4 { background: #fef3e6; color: #a15c00; border-color: #f3d9b5; }
.pf-role-5 { background: #eaf1fd; color: var(--primary-dark); border-color: #cbdcfa; }
.pf-edit { align-self: flex-end; white-space: nowrap; }
.pf-body {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}
.pf-section-title {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    margin: 0 0 .6rem;
}
.pf-bio { color: var(--fg); line-height: 1.65; margin: 0; word-break: break-word; }
.pf-empty { color: var(--muted); font-style: italic; margin: 0; }
.pf-dl { margin: 0; }
.pf-dl dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-top: .65rem; }
.pf-dl dt:first-child { margin-top: 0; }
.pf-dl dd { margin: .1rem 0 0; color: var(--fg); word-break: break-word; }

@media (max-width: 640px) {
    .pf-head { flex-direction: column; align-items: flex-start; }
    .pf-avatar { margin-top: -72px; }
    .pf-edit { align-self: stretch; text-align: center; }
    .pf-body { grid-template-columns: 1fr; }
}
.pf-message {
    max-width: 480px;
    margin: 4rem auto;
    text-align: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
}
.pf-message h1 { font-size: 1.4rem; margin: 0 0 .5rem; color: var(--fg); }
.pf-message p { color: var(--muted); margin: 0 0 1.25rem; }

/* Username shown beside the header avatar (email + Discord accounts) */
.nav-username { font-weight: 600; font-size: .9rem; color: var(--fg); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) { .nav-username { display: none; } }

/* ---------- OAuth sign-in buttons (login page) ---------- */
.oauth-buttons { display: flex; flex-direction: column; gap: .5rem; margin-top: .85rem; }
.oauth-btn {
    display: block; text-align: center; padding: .6rem .9rem;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: #fff; color: var(--text); text-decoration: none; font-weight: 500;
}
.oauth-btn:hover { background: #f6f7f9; text-decoration: none; }
/* Provider accents — purely cosmetic; unknown providers fall back to the base. */
.oauth-btn-discord   { color: #5662f6; border-color: #5662f6; }
.oauth-btn-google    { color: #1a73e8; border-color: #dadce0; }
.oauth-btn-github    { color: #24292f; border-color: #24292f; }
.oauth-btn-microsoft { color: #0067b8; border-color: #0067b8; }

/* ---------- Connected sign-in methods (profile-edit) ---------- */
.acct-oauth-row {
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
    padding: .55rem 0; border-top: 1px solid var(--border);
}
.acct-oauth-row:first-of-type { border-top: none; }
.acct-oauth-row form { margin: 0; }
.acct-oauth-name   { font-weight: 600; min-width: 8rem; }
.acct-oauth-linked { color: var(--muted); font-size: .9rem; flex: 1 1 auto; }

/* ---------- Dashboard: account-type badge ---------- */
.dash-kind {
    display: inline-block; padding: .05rem .45rem; border-radius: 999px;
    font-size: .74rem; font-weight: 600; letter-spacing: .01em;
    border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.dash-kind-local { background: #f3f4f6; }
.dash-kind-oauth { background: #eef4ff; border-color: #c7d8f7; color: #1a4fa0; }
.dash-table tr.row-oauth td:first-child { font-style: italic; }

/* ---------- Registration: wider card ----------
   The real constraint was .form-auth's max-width:420px, which capped the card
   no matter how wide its column was. The registration form carries more fields
   than the login form AND a 400x200 CAPTCHA, so it gets its own wider measure;
   .form-auth is left alone so the login page is unchanged. */
.form-auth-wide { max-width: 620px; }

/* ---------- Registration: supporting element sizing ----------
   The CAPTCHA image is generated at 400x200. In the old 4/12 column the usable
   width was ~336px, so the browser scaled it down and it became hard to read.
   The registration column is 6/12, which leaves enough room for the image at
   its native size; these rules let the surrounding fields use that width too
   instead of staying stranded at the old narrow measure. */
.form-auth-wide .captcha-container { padding: 1.15rem; }
.form-auth-wide .captcha-image-wrapper { display: block; width: 100%; }
/* Render at native resolution, never upscaled past it. */
.form-auth-wide .captcha-image { width: 400px; max-width: 100%; margin: 0 auto; }
.form-auth-wide .captcha-input { max-width: 400px; }

/* Two-up rows for the short fields, so the taller column does not become a
   single long ladder of inputs. Collapses back to one column on small screens. */
.form-auth-wide .field-pair {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1rem;
}
.form-auth-wide .field-pair > .form-group { flex: 1 1 210px; min-width: 0; }

@media (max-width: 768px) {
    /* Fill the narrower card, but never stretch past the image's native 400px —
       upscaling a CAPTCHA blurs exactly the detail the user has to read. */
    .form-auth-wide .captcha-image { width: 100%; max-width: 400px; }
    .form-auth-wide .field-pair { gap: 0; }
}
