/* ============================================================
   Movement URL Shortener — Global Stylesheet
   Design: Sharp dark utility with high-contrast accents
   Fonts: Syne (display) + DM Sans (body) + DM Mono (code)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Syne:wght@600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* ── Palette ── */
    --bg:          #08090d;
    --surface:     #0f1018;
    --surface2:    #171822;
    --surface3:    #1e2030;
    --border:      #252838;
    --border-soft: #1a1d2a;
    --text:        #e8eaf2;
    --text-soft:   #9299b8;
    --text-muted:  #525878;

    /* ── Accent: Electric Lime ── */
    --accent:      #c8ff47;
    --accent-dark: #a8d93a;
    --accent-dim:  rgba(200,255,71,0.12);
    --accent-glow: rgba(200,255,71,0.08);

    /* ── Status ── */
    --success:     #4ade80;
    --success-bg:  rgba(74,222,128,0.08);
    --danger:      #f87171;
    --danger-bg:   rgba(248,113,113,0.08);
    --info:        #60a5fa;
    --info-bg:     rgba(96,165,250,0.08);

    /* ── Tokens ── */
    --radius:      8px;
    --radius-lg:   14px;
    --radius-xl:   20px;
    --radius-pill: 999px;
    --shadow:      0 8px 32px rgba(0,0,0,0.5);
    --shadow-sm:   0 2px 8px rgba(0,0,0,0.4);
    --trans:       0.18s ease;

    /* ── Fonts ── */
    --font-display: 'Syne', sans-serif;
    --font-body:    'DM Sans', sans-serif;
    --font-mono:    'DM Mono', monospace;
}

/* ── Base ─────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: opacity var(--trans); }
a:hover { opacity: 0.8; }

.mono { font-family: var(--font-mono); font-size: 0.9em; }
.page-wrapper { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Navigation ─────────────────────────────────────────────── */
.nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border-soft);
    position: sticky;
    top: 0;
    z-index: 200;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 58px;
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 28px;
    gap: 16px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.nav-brand-mark {
    width: 28px;
    height: 28px;
    background: var(--accent);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav-link {
    padding: 6px 14px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--trans);
}

.nav-link:hover { color: var(--text); background: var(--surface2); opacity: 1; }
.nav-link.active { color: var(--accent); background: var(--accent-glow); }

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.nav-user-chip {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 12.5px;
    color: var(--text-soft);
}

.nav-user-dot {
    width: 7px;
    height: 7px;
    background: var(--accent);
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Auth pages ──────────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 60% 50% at 10% 60%, rgba(200,255,71,0.04) 0%, transparent 70%),
        radial-gradient(ellipse 50% 40% at 90% 20%, rgba(96,165,250,0.03) 0%, transparent 60%);
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 44px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.auth-head {
    text-align: center;
    margin-bottom: 36px;
}

.auth-logo-mark {
    width: 52px;
    height: 52px;
    background: var(--accent);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 20px;
}

.auth-head h1 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 5px;
    color: var(--text);
}

.auth-head p { color: var(--text-muted); font-size: 13.5px; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-bottom: 7px;
}

.form-input {
    width: 100%;
    padding: 11px 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font-body);
    outline: none;
    transition: border-color var(--trans), box-shadow var(--trans);
}

.form-input::placeholder { color: var(--text-muted); }

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.5;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all var(--trans);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    color: #08090d;
    border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
    background: #d5ff63;
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(200,255,71,0.25);
}

.btn-secondary {
    background: var(--surface2);
    color: var(--text-soft);
    border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--surface3);
    color: var(--text);
    opacity: 1;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
    background: var(--surface2);
    color: var(--text);
    opacity: 1;
}

.btn-danger-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.btn-danger-ghost:hover:not(:disabled) {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(248,113,113,0.2);
    opacity: 1;
}

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-full { width: 100%; }
.btn-icon { padding: 8px; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius);
    border: 1px solid;
    font-size: 13.5px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.5;
}

.alert-success { background: var(--success-bg); border-color: rgba(74,222,128,0.25); color: var(--success); }
.alert-error   { background: var(--danger-bg);  border-color: rgba(248,113,113,0.25); color: var(--danger); }
.alert-info    { background: var(--info-bg);    border-color: rgba(96,165,250,0.25);  color: var(--info); }

/* ── Main layout ─────────────────────────────────────────────── */
.main {
    flex: 1;
    max-width: 1160px;
    margin: 0 auto;
    padding: 32px 28px 60px;
    width: 100%;
}

.page-hd {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
}

.page-hd h1 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.page-hd-sub {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

.base-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--accent-glow);
    border: 1px solid var(--accent-dim);
    border-radius: var(--radius-pill);
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Shorten Card ────────────────────────────────────────────── */
.shorten-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.shorten-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent) 0%, transparent 100%);
}

.shorten-card-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.shorten-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    flex-wrap: wrap;
}

.shorten-row .form-input {
    flex: 1;
    min-width: 240px;
    height: 46px;
    font-size: 14px;
}

.alias-wrap {
    display: flex;
    align-items: center;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--trans), box-shadow var(--trans);
    flex-shrink: 0;
    height: 46px;
}

.alias-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.alias-prefix {
    padding: 0 10px 0 14px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    border-right: 1px solid var(--border);
    height: 100%;
    display: flex;
    align-items: center;
    background: var(--surface3);
    flex-shrink: 0;
}

.alias-input {
    background: transparent;
    border: none;
    outline: none;
    padding: 0 14px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 13px;
    width: 120px;
    height: 100%;
}

.alias-input::placeholder { color: var(--text-muted); }

.shorten-row .btn-primary {
    padding: 0 24px;
    height: 46px;
    font-size: 14px;
    flex-shrink: 0;
}

.shorten-hint {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

#shorten-alert { margin-top: 14px; margin-bottom: 0; }

/* ── URL Table ───────────────────────────────────────────────── */
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-head-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-soft);
}

.table-head-bar h2 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.count-badge {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: var(--radius-pill);
    font-family: var(--font-mono);
}

.url-table { width: 100%; border-collapse: collapse; }

.url-table thead th {
    padding: 11px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
}

.url-table tbody tr {
    border-bottom: 1px solid var(--border-soft);
    transition: background var(--trans);
}

.url-table tbody tr:last-child { border-bottom: none; }
.url-table tbody tr:hover { background: rgba(255,255,255,0.018); }

.url-table tbody td {
    padding: 13px 20px;
    vertical-align: middle;
}

.short-link-wrap { display: flex; align-items: center; gap: 8px; }

.short-link {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: -0.01em;
}

.orig-url {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-soft);
    font-size: 13px;
}

.click-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    padding: 3px 9px;
    background: var(--surface2);
    border-radius: var(--radius-pill);
    white-space: nowrap;
}

.date-col {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
}

.actions-col { display: flex; align-items: center; gap: 4px; }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-row td { padding: 0 !important; }

.empty-state {
    padding: 56px 24px;
    text-align: center;
}

.empty-icon {
    width: 56px;
    height: 56px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-soft);
}

.empty-state p { font-size: 13px; color: var(--text-muted); }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 440px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.7);
    animation: modalIn 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.modal-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-soft);
}

.modal-hd h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
}

.modal-close {
    width: 30px;
    height: 30px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 17px;
    transition: all var(--trans);
    line-height: 1;
}

.modal-close:hover { color: var(--text); background: var(--surface3); }

.modal-body { padding: 24px; }

/* ── QR Modal ────────────────────────────────────────────────── */
.qr-url-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 24px;
    overflow: hidden;
}

.qr-url-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.qr-url-text {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--accent);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qr-img-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.qr-img {
    width: 240px;
    height: 240px;
    background: #fff;
    border-radius: var(--radius);
    display: block;
    padding: 10px;
}

.qr-dl-row {
    display: flex;
    gap: 10px;
}

.qr-dl-row .btn { flex: 1; font-size: 12.5px; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast-wrap {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 11px 16px;
    font-size: 13.5px;
    color: var(--text);
    box-shadow: var(--shadow);
    animation: toastIn 0.2s ease;
    max-width: 320px;
    pointer-events: all;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--info); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── Settings ────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-soft);
}

.card-hd h2 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
}

.card-body { padding: 24px; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
}

.stat-num {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 5px;
    letter-spacing: -0.03em;
}

.stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
}

.settings-fields { display: grid; gap: 20px; }

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 1px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.users-table { width: 100%; border-collapse: collapse; }

.users-table th {
    padding: 11px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-soft);
}

.users-table td {
    padding: 13px 20px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13.5px;
    color: var(--text-soft);
}

.users-table tbody tr:last-child td { border-bottom: none; }

.role-pill {
    display: inline-flex;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.role-admin { background: var(--accent-dim); color: var(--accent); }
.role-user  { background: var(--surface2);   color: var(--text-muted); }

/* ── 404 / Center pages ──────────────────────────────────────── */
.center-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: var(--bg);
    background-image: radial-gradient(ellipse 50% 60% at 50% 50%, rgba(200,255,71,0.04) 0%, transparent 70%);
}

.error-card { text-align: center; max-width: 420px; }

.error-glitch {
    font-family: var(--font-display);
    font-size: 7rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 12px;
    letter-spacing: -0.04em;
}

.error-card h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.error-msg {
    color: var(--text-muted);
    font-size: 13.5px;
    margin-bottom: 28px;
    line-height: 1.7;
}

/* ── Utilities ───────────────────────────────────────────────── */
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted) !important; font-size: 13px; }
.font-mono   { font-family: var(--font-mono); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 680px) {
    .nav-inner { padding: 0 16px; }
    .main { padding: 20px 16px 48px; }
    .auth-card { padding: 32px 24px; }
    .shorten-row { flex-direction: column; }
    .alias-wrap, .shorten-row .btn-primary { width: 100%; }
    .alias-input { flex: 1; width: auto; }
    .orig-url { max-width: 160px; }
    .qr-dl-row { flex-direction: column; }
    .nav-user-chip span:not(.nav-user-dot) { display: none; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .error-glitch { font-size: 5rem; }
}

/* ── Settings page ───────────────────────────────────────────── */
.settings-main {
    max-width: 860px;
    margin: 0 auto;
    padding: 40px 24px 80px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.settings-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 32px;
}

.settings-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

/* Stats tiles (settings page) */
.stat-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}

/* Badges */
.badge-admin {
    display: inline-block;
    background: var(--accent);
    color: var(--bg);
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: .04em;
    padding: 2px 7px;
    border-radius: 20px;
    text-transform: uppercase;
    vertical-align: middle;
}

.badge-user {
    display: inline-block;
    background: var(--surface2);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: .04em;
    padding: 2px 7px;
    border-radius: 20px;
    text-transform: uppercase;
    vertical-align: middle;
}

/* Toggle switch */
.form-group--inline { margin-top: 4px; }

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-input { display: none; }

.toggle-track {
    position: relative;
    width: 42px;
    height: 24px;
    background: var(--surface2);
    border-radius: 999px;
    border: 1px solid var(--border);
    flex-shrink: 0;
    transition: background .18s, border-color .18s;
}

.toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform .18s, background .18s;
}

.toggle-input:checked + .toggle-track {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle-input:checked + .toggle-track::after {
    transform: translateX(18px);
    background: var(--bg);
}

.toggle-text {
    font-size: 14px;
    color: var(--text);
}

/* Table columns */
.td-actions { white-space: nowrap; }
.td-username { font-weight: 600; }
.td-email    { color: var(--text-muted); font-size: 13px; }
.muted       { color: var(--text-muted); font-size: 13px; font-style: italic; }

/* Danger button */
.btn--danger {
    background: #3a1a1a;
    color: #ff6b6b;
    border: 1px solid #5a2a2a;
}
.btn--danger:hover {
    background: #ff6b6b;
    color: #08090d;
    border-color: #ff6b6b;
}

/* Nav active link */
.nav-link--active {
    color: var(--accent);
    font-weight: 600;
}

/* Admin chip */
.user-chip .badge-admin {
    font-size: 9px;
    padding: 1px 5px;
}

@media (max-width: 680px) {
    .settings-main { padding: 20px 16px 48px; }
    .settings-card { padding: 20px 16px; }
    .td-email { display: none; }
}

/* ── Analytics page ──────────────────────────────────────────── */
.analytics-main {
    max-width: 1040px;
    margin: 0 auto;
    padding: 32px 24px 80px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.analytics-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 4px;
}

.back-link {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    display: block;
    margin-bottom: 6px;
}
.back-link:hover { color: var(--accent); }

.analytics-short-code {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 4px;
}
.analytics-short-code a {
    color: var(--accent);
    text-decoration: none;
}
.analytics-short-code a:hover { text-decoration: underline; }

.analytics-orig-url {
    font-size: 13px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 560px;
}

/* Day filter pills */
.day-filter {
    display: flex;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px;
}
.day-btn {
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono);
    padding: 4px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-muted);
    transition: background .15s, color .15s;
}
.day-btn:hover  { color: var(--text); background: var(--surface2); }
.day-btn.active { background: var(--accent); color: var(--bg); }

/* Summary tiles */
.analytics-tiles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
.a-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.a-tile-val {
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}
.a-tile-label {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Analytics card */
.analytics-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
}
.analytics-card-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.analytics-card-hd h2 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}
.card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

/* Bar chart */
.chart-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}
.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 4px;
}
.legend-dot--total { background: var(--accent); }
.legend-dot--qr    { background: #5b8fff; }

.bar-chart-wrap {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 140px;
    padding-bottom: 24px; /* room for labels */
    position: relative;
}

.bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 4px;
    cursor: default;
}

.bar-stack {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
    min-height: 2px;
}

.bar-seg {
    width: 100%;
    border-radius: 3px 3px 0 0;
    transition: opacity .15s;
}
.bar-seg--total { background: var(--accent); opacity: .85; }
.bar-seg--qr    {
    background: #5b8fff;
    position: absolute;
    bottom: 0;
    left: 0;
    border-radius: 3px 3px 0 0;
}
.bar-seg--empty { background: var(--surface2); height: 2px; border-radius: 2px; }

.bar-col:hover .bar-seg--total { opacity: 1; }

.bar-label {
    font-size: 9px;
    color: var(--text-muted);
    white-space: nowrap;
    text-align: center;
    width: 100%;
    overflow: hidden;
    margin-top: 2px;
}
.bar-label--hidden { visibility: hidden; }

/* Breakdown bars */
.analytics-breakdown {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.breakdown-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.breakdown-row:last-child { border-bottom: none; }

.breakdown-name {
    font-size: 13px;
    color: var(--text);
    min-width: 90px;
    flex-shrink: 0;
}
.ref-name {
    font-family: var(--font-mono);
    font-size: 11.5px;
    min-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.breakdown-bar-wrap {
    flex: 1;
    height: 6px;
    background: var(--surface2);
    border-radius: 3px;
    overflow: hidden;
}
.breakdown-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width .4s ease;
}
.breakdown-count {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    min-width: 28px;
    text-align: right;
}

.no-data {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    padding: 20px 0 4px;
    margin: 0;
}

/* Recent clicks table */
.clicks-table th, .clicks-table td {
    font-size: 12.5px;
}
.click-time { white-space: nowrap; font-family: var(--font-mono); font-size: 11.5px; }
.click-ip   { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); }
.click-ref  { font-size: 11.5px; color: var(--text-muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.source-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}
.source-badge--qr   { background: #1a2a4a; color: #5b8fff; }
.source-badge--link { background: var(--surface2); color: var(--text-muted); }

@media (max-width: 860px) {
    .analytics-tiles { grid-template-columns: 1fr 1fr; }
    .analytics-breakdown { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .analytics-tiles { grid-template-columns: 1fr 1fr; }
    .analytics-header { flex-direction: column; }
    .click-ref, .click-ip { display: none; }
}

/* ── Inline URL edit ─────────────────────────────────────────── */
.orig-url-cell { min-width: 200px; }

.inline-edit { padding: 4px 0; }

.inline-edit-input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 6px 10px;
    outline: none;
    box-sizing: border-box;
}
.inline-edit-input:focus { box-shadow: 0 0 0 2px rgba(200,255,71,.15); }

.inline-edit-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.btn-accent {
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    cursor: pointer;
    transition: opacity .15s;
}
.btn-accent:hover    { opacity: .85; }
.btn-accent:disabled { opacity: .5; cursor: default; }

/* ── Destination history ─────────────────────────────────────── */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.history-row {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
    opacity: .75;
    transition: opacity .15s;
}
.history-row:last-child  { border-bottom: none; }
.history-row--current    { opacity: 1; }
.history-row:hover       { opacity: 1; }

.history-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.history-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--surface2);
    color: var(--text-muted);
}
.history-badge--current {
    background: rgba(200,255,71,.15);
    color: var(--accent);
}

.history-dates {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.history-by {
    font-size: 11.5px;
    color: var(--text-muted);
    font-style: italic;
}

.history-url {
    font-family: var(--font-mono);
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-url a {
    color: var(--text);
    text-decoration: none;
}
.history-url a:hover { color: var(--accent); text-decoration: underline; }

.history-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.history-stat {
    font-size: 12px;
    color: var(--text-muted);
}
.history-stat strong {
    color: var(--text);
    font-weight: 600;
}

@media (max-width: 560px) {
    .inline-edit-actions { flex-direction: column; }
}

/* ── Link description ────────────────────────────────────────── */
.link-desc {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
}
.link-desc--empty { display: none; }

.inline-edit-input--desc {
    margin-top: 6px;
    font-family: var(--font-body);
}

.shorten-row--desc { margin-top: 8px; }
.shorten-row--desc .form-input { font-size: 13px; }

.analytics-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    font-style: italic;
}

/* ── QR Builder Modal ────────────────────────────────────────── */
.qr-builder-overlay { align-items: center; justify-content: center; padding: 16px; }

.qr-builder-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    width: 100%;
    max-width: 860px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,.6);
}

.qr-builder-hd {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 22px 28px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.qr-builder-hd h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 800;
    margin: 0 0 4px;
    color: var(--text);
}
.qr-builder-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.qr-builder-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Left controls panel ─────────────────────────────────────── */
.qr-controls {
    width: 300px;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 20px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.qr-section {}

.qr-section-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* Presets */
.qr-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.preset-btn {
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.preset-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

/* Dot/corner style grid */
.dot-style-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.dot-style-btn {
    font-size: 11.5px;
    padding: 7px 10px;
    border-radius: 8px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    text-align: left;
    transition: all .15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dot-style-btn:hover  { border-color: var(--accent); color: var(--text); }
.dot-style-btn.active {
    background: rgba(200,255,71,.12);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

/* Colors */
.color-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}
.color-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: opacity .2s;
}
.color-label {
    font-size: 11px;
    color: var(--text-muted);
}
.color-field input[type="color"] {
    width: 100%;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface2);
    cursor: pointer;
    padding: 3px;
}
.qr-toggle { margin-top: 8px; }

/* Logo upload */
.logo-upload-area {
    border: 1.5px dashed var(--border);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    margin-bottom: 12px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.logo-upload-area:hover { border-color: var(--accent); background: rgba(200,255,71,.04); }

#logo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.logo-upload-icon { font-size: 1.4rem; }
#logo-placeholder span:nth-child(2) { font-size: 12.5px; color: var(--text); font-weight: 500; }
.logo-upload-hint { font-size: 11px; color: var(--text-muted); }

#logo-preview-wrap {
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
#logo-preview-img {
    max-width: 80px;
    max-height: 60px;
    border-radius: 6px;
    object-fit: contain;
}
.logo-clear-btn {
    font-size: 11px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    padding: 3px 8px;
    cursor: pointer;
}
.logo-clear-btn:hover { color: #ff6b6b; border-color: #ff6b6b; }

.qr-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.slider-label { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.qr-slider-row input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
}
.slider-val { font-size: 12px; font-family: var(--font-mono); color: var(--text-muted); min-width: 32px; text-align: right; }

/* ── Right preview panel ─────────────────────────────────────── */
.qr-preview-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 24px;
    gap: 16px;
}

.qr-preview-wrap {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,.15);
    display: flex;
    align-items: center;
    justify-content: center;
}
.qr-preview-wrap canvas,
.qr-preview-wrap svg { display: block; }

.qr-scan-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    letter-spacing: .04em;
}

.qr-dl-row {
    display: flex;
    gap: 10px;
}

.qr-save-btn {
    font-size: 12px;
    opacity: .7;
}
.qr-save-btn:hover { opacity: 1; }

/* Mobile: stack controls above preview */
@media (max-width: 660px) {
    .qr-builder-body  { flex-direction: column; overflow-y: auto; }
    .qr-controls      { width: auto; border-right: none; border-bottom: 1px solid var(--border); }
    .qr-preview-col   { padding: 20px 16px; }
    .color-grid       { grid-template-columns: 1fr 1fr; }
    .dot-style-grid   { grid-template-columns: 1fr 1fr 1fr; }
}
