/* ── Reset & Base ──────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0a0a0c;
    --bg2: #111115;
    --bg3: #18181f;
    --border: #2a2a35;
    --border2: #3a3a48;
    --accent: #5865f2;
    /* Discord blurple */
    --accent2: #7289da;
    --danger: #ed4245;
    --success: #3ba55d;
    --warn: #faa61a;
    --text: #e8e8ef;
    --text2: #9090a8;
    --text3: #55556a;
    --mono: 'JetBrains Mono', monospace;
    --sans: 'Syne', sans-serif;
    --radius: 6px;
    --radius2: 12px;
}

html,
body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg2);
}

::-webkit-scrollbar-thumb {
    background: var(--border2);
    border-radius: 3px;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 12, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 20px;
    color: var(--accent);
    line-height: 1;
}

.logo-text {
    font-family: var(--sans);
    font-size: 17px;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--text);
}

.logo-text strong {
    font-weight: 800;
    color: var(--accent2);
}

.logo-tag {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    background: var(--accent);
    color: #fff;
    padding: 1px 5px;
    border-radius: 3px;
    align-self: flex-start;
    margin-top: 4px;
}

.header-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}

.nav-btn {
    background: none;
    border: none;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--text2);
    padding: 6px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    text-transform: uppercase;
}

.nav-btn:hover {
    color: var(--text);
    background: var(--bg3);
}

.nav-btn.active {
    color: var(--accent2);
    background: rgba(88, 101, 242, 0.12);
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    flex-shrink: 0;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text3);
    transition: background 0.3s;
}

.status-dot.ok {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.status-dot.err {
    background: var(--danger);
}

/* ── Main layout ────────────────────────────────────────────────────────── */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

/* ── Views ──────────────────────────────────────────────────────────────── */
.view.hidden {
    display: none !important;
}

.view-header {
    margin-bottom: 32px;
}

.view-header h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
}

.view-sub {
    margin-top: 6px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text3);
    max-width: 540px;
}

.view-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.15s;
    display: inline-block;
    text-decoration: none;
}

.btn-primary:hover {
    background: var(--accent2);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-ghost {
    background: transparent;
    color: var(--text2);
    border: 1px solid var(--border2);
    padding: 10px 20px;
    border-radius: var(--radius);
    font-family: var(--mono);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-ghost:hover {
    border-color: var(--text2);
    color: var(--text);
}

.btn-icon {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text2);
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    color: var(--text);
    border-color: var(--border2);
}

.btn-danger {
    background: transparent;
    border: none;
    color: var(--danger);
    font-family: var(--mono);
    font-size: 11px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.btn-danger:hover {
    background: rgba(237, 66, 69, 0.12);
}

/* ── Drop Zone ───────────────────────────────────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--border2);
    border-radius: var(--radius2);
    background: var(--bg2);
    padding: 64px 32px;
    text-align: center;
    transition: all 0.2s;
    cursor: default;
    position: relative;
}

.drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(88, 101, 242, 0.06);
}

.drop-icon {
    font-size: 48px;
    color: var(--border2);
    line-height: 1;
    margin-bottom: 16px;
    transition: color 0.2s;
}

.drop-zone.drag-over .drop-icon {
    color: var(--accent2);
}

.drop-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text2);
    margin-bottom: 4px;
}

.drop-sub {
    color: var(--text3);
    font-family: var(--mono);
    font-size: 12px;
    margin-bottom: 16px;
}

/* ── File Preview ────────────────────────────────────────────────────────── */
.file-preview {
    margin-top: 20px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius2);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.fp-info {
    flex: 1;
    min-width: 0;
}

.fp-name {
    display: block;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.fp-size {
    display: block;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text3);
    margin-top: 3px;
}

.fp-chunks {
    font-family: var(--mono);
    font-size: 12px;
}

.fp-label {
    color: var(--text3);
}

.fp-value {
    color: var(--accent2);
    font-weight: 700;
    margin-left: 6px;
}

/* ── Progress ────────────────────────────────────────────────────────────── */
.upload-progress {
    margin-top: 20px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius2);
    padding: 24px;
}

.prog-header {
    display: flex;
    justify-content: space-between;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text2);
    margin-bottom: 12px;
}

#prog-pct {
    color: var(--accent2);
    font-weight: 700;
}

.prog-bar-wrap {
    background: var(--bg3);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.prog-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.prog-detail {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
}

/* ── Upload Result ───────────────────────────────────────────────────────── */
.upload-result {
    margin-top: 20px;
}

.result-card {
    background: var(--bg2);
    border: 1px solid var(--success);
    border-radius: var(--radius2);
    padding: 24px;
}

.result-card h3 {
    color: var(--success);
    font-family: var(--mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 16px;
}

.result-meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.rmeta-item {
    background: var(--bg3);
    border-radius: var(--radius);
    padding: 10px 14px;
}

.rmeta-label {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.rmeta-val {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-top: 2px;
}

.result-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── Stats bar ───────────────────────────────────────────────────────────── */
.stats-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.stat {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 18px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.stat-val {
    font-family: var(--mono);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent2);
}

.stat-lbl {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
}

/* ── Search ──────────────────────────────────────────────────────────────── */
.search-input {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    padding: 8px 14px;
    width: 240px;
    transition: border-color 0.15s;
    outline: none;
}

.search-input:focus {
    border-color: var(--accent);
}

.search-input::placeholder {
    color: var(--text3);
}

/* ── File list ───────────────────────────────────────────────────────────── */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: border-color 0.15s;
    cursor: pointer;
}

.file-item:hover {
    border-color: var(--border2);
}

.fi-icon {
    width: 36px;
    height: 36px;
    background: var(--bg3);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.fi-info {
    flex: 1;
    min-width: 0;
}

.fi-name {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.fi-meta {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    margin-top: 2px;
    display: flex;
    gap: 12px;
}

.fi-badge {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 7px;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text2);
    white-space: nowrap;
}

.fi-badge.ready {
    border-color: var(--success);
    color: var(--success);
}

.fi-badge.uploading {
    border-color: var(--warn);
    color: var(--warn);
}

.fi-badge.error {
    border-color: var(--danger);
    color: var(--danger);
}

.fi-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.btn-download {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text2);
    font-family: var(--mono);
    font-size: 11px;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-download:hover {
    border-color: var(--accent);
    color: var(--accent2);
}

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 24px;
}

.page-btn {
    background: var(--bg2);
    border: 1px solid var(--border);
    color: var(--text2);
    font-family: var(--mono);
    font-size: 12px;
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover,
.page-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ── Settings ────────────────────────────────────────────────────────────── */
.settings-form {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius2);
    padding: 24px;
    margin-bottom: 24px;
}

.section-title {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text3);
    margin-bottom: 16px;
}

.form-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-input {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    padding: 9px 14px;
    flex: 1;
    min-width: 180px;
    outline: none;
    transition: border-color 0.15s;
}

.form-input:focus {
    border-color: var(--accent);
}

.form-input.short {
    max-width: 110px;
    flex: 0;
}

.webhook-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wh-item {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.wh-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    flex-shrink: 0;
}

.wh-dot.off {
    background: var(--text3);
}

.wh-info {
    flex: 1;
    min-width: 0;
}

.wh-name {
    font-weight: 700;
    font-size: 14px;
}

.wh-url {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.wh-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ── Loading / Empty states ──────────────────────────────────────────────── */
.loading-state,
.empty-state {
    padding: 48px;
    text-align: center;
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text3);
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--radius2);
    max-width: 640px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 28px;
    position: relative;
    animation: modal-in 0.2s ease;
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text3);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s;
}

.modal-close:hover {
    color: var(--text);
}

.modal-title {
    font-size: 17px;
    font-weight: 800;
    margin-bottom: 16px;
}

.modal-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--mono);
    font-size: 12px;
}

.modal-row-key {
    color: var(--text3);
}

.modal-row-val {
    color: var(--text);
    font-weight: 700;
}

.chunks-preview {
    margin-top: 16px;
    background: var(--bg3);
    border-radius: var(--radius);
    padding: 14px;
    font-family: var(--mono);
    font-size: 11px;
    max-height: 160px;
    overflow-y: auto;
}

.chunk-row {
    display: flex;
    gap: 12px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
}

.chunk-row:last-child {
    border: none;
}

.chunk-idx {
    color: var(--accent2);
    flex-shrink: 0;
    width: 50px;
}

.chunk-url {
    color: var(--text3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
}

.toast {
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: 12px 18px;
    font-family: var(--mono);
    font-size: 12px;
    max-width: 320px;
    animation: toast-in 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

.toast.info {
    border-color: var(--accent);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(12px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .header-inner {
        gap: 16px;
    }

    .header-nav {
        gap: 2px;
    }

    .nav-btn {
        padding: 6px 8px;
        font-size: 10px;
    }

    .file-item {
        flex-wrap: wrap;
    }

    .fi-actions {
        width: 100%;
    }

    .form-row {
        flex-direction: column;
    }

    .form-input.short {
        max-width: 100%;
    }
}

/* ── Auth screen ──────────────────────────────────────────────────────────── */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px;
}

.auth-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius2);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    animation: modal-in 0.25s ease;
}

.auth-logo {
    font-family: var(--sans);
    font-size: 22px;
    font-weight: 400;
    text-align: center;
    margin-bottom: 28px;
    color: var(--text);
}

.auth-logo strong {
    color: var(--accent2);
    font-weight: 800;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg3);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 28px;
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text3);
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.auth-tab.active {
    background: var(--accent);
    color: #fff;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.form-group input {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    padding: 10px 14px;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus {
    border-color: var(--accent);
}

.auth-error {
    background: rgba(237, 66, 69, 0.1);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--danger);
}

.btn-primary.full {
    width: 100%;
    justify-content: center;
    text-align: center;
}

/* ── Header right ─────────────────────────────────────────────────────────── */
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 12px 4px 4px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text2);
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}

.user-role {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    background: var(--bg2);
    border: 1px solid var(--border2);
    padding: 1px 5px;
    border-radius: 3px;
    color: var(--accent2);
    text-transform: uppercase;
}

/* ── Quota bar ────────────────────────────────────────────────────────────── */
.quota-bar-wrap {
    margin-top: 8px;
}

.quota-info {
    display: flex;
    gap: 4px;
    align-items: baseline;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    margin-bottom: 5px;
}

.quota-info span:first-child {
    color: var(--accent2);
    font-weight: 700;
}

.quota-sep {
    color: var(--text3);
}

.quota-track {
    height: 3px;
    background: var(--bg3);
    border-radius: 2px;
    width: 200px;
    overflow: hidden;
}

.quota-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-radius: 2px;
    transition: width 0.4s ease;
}

.quota-fill.warn {
    background: linear-gradient(90deg, var(--warn), #e67e22);
}

.quota-fill.danger {
    background: linear-gradient(90deg, var(--danger), #c0392b);
}

/* ── Admin tabs ───────────────────────────────────────────────────────────── */
.admin-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.admin-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text3);
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: -1px;
}

.admin-tab:hover {
    color: var(--text2);
}

.admin-tab.active {
    color: var(--accent2);
    border-bottom-color: var(--accent2);
}

.admin-panel.hidden {
    display: none;
}

.admin-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: center;
}

/* ── User table ───────────────────────────────────────────────────────────── */
.user-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--mono);
    font-size: 12px;
}

.user-table th {
    text-align: left;
    padding: 8px 12px;
    color: var(--text3);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    border-bottom: 1px solid var(--border);
    background: var(--bg2);
}

.user-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text2);
    vertical-align: middle;
}

.user-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.user-table tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    border: 1px solid var(--border);
    color: var(--text2);
}

.badge.admin {
    border-color: var(--accent);
    color: var(--accent2);
}

.badge.active {
    border-color: var(--success);
    color: var(--success);
}

.badge.inactive {
    border-color: var(--danger);
    color: var(--danger);
}

/* ── Plan cards ───────────────────────────────────────────────────────────── */
.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.plan-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius2);
    padding: 20px;
}

.plan-card h3 {
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.plan-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--mono);
    font-size: 12px;
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
}

.plan-row:last-of-type {
    border: none;
}

.plan-key {
    color: var(--text3);
}

.plan-val {
    color: var(--text);
    font-weight: 700;
}

.plan-edit {
    margin-top: 14px;
    display: flex;
    gap: 8px;
}

.plan-input {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--mono);
    font-size: 12px;
    padding: 6px 10px;
    width: 100%;
    outline: none;
}

.plan-input:focus {
    border-color: var(--accent);
}

/* ── Mini inline select ───────────────────────────────────────────────────── */
.inline-select {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text2);
    font-family: var(--mono);
    font-size: 11px;
    padding: 3px 6px;
    cursor: pointer;
    outline: none;
}

/* ── Profile page ─────────────────────────────────────────────────────────── */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.profile-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius2);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-card-wide {
    grid-column: 1 / -1;
}

.profile-card-danger {
    border-color: rgba(237, 66, 69, 0.3);
}

.profile-card-title {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text3);
    margin-bottom: 4px;
}

/* Info card */
.profile-avatar-big {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-family: var(--sans);
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    flex-shrink: 0;
}

.profile-identity {
    flex: 1;
}

.profile-username {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.profile-email {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text3);
    margin-top: 2px;
}

.profile-since {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    margin-top: 6px;
}

.profile-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Stats */
.profile-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.profile-stat-row:last-of-type {
    border: none;
}

.profile-stat-label {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text3);
}

.profile-stat-val {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--accent2);
}

/* Plan */
.plan-current {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.plan-name {
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text);
}

.plan-price {
    font-family: var(--mono);
    font-size: 20px;
    font-weight: 700;
    color: var(--accent2);
    margin-top: 4px;
}

.plan-quota-info {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    margin-top: 6px;
}

.plan-upgrade-note {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    font-style: italic;
}

/* Edit form */
.profile-edit-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.profile-edit-form .form-group:nth-child(3),
.profile-edit-form .form-group:nth-child(4) {
    grid-column: 1 / -1;
}

.profile-edit-form .auth-error,
.profile-edit-form div:last-child {
    grid-column: 1 / -1;
}

/* Danger button */
.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    align-self: flex-start;
}

.btn-danger-outline:hover {
    background: var(--danger);
    color: #fff;
}

@media (max-width: 640px) {
    .profile-edit-form {
        grid-template-columns: 1fr;
    }

    .profile-edit-form .form-group:nth-child(3),
    .profile-edit-form .form-group:nth-child(4) {
        grid-column: 1;
    }
}

/* ── Share ────────────────────────────────────────────────────────────────── */
.btn-share {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text2);
    width: 32px;
    height: 32px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-share:hover {
    border-color: var(--accent);
}

.share-create {
    margin-bottom: 4px;
}

.share-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 12px 0 16px;
}

.share-links-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.share-link-item {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
}

.share-link-item.inactive {
    opacity: 0.5;
}

.share-link-url {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--accent2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.share-link-meta {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    margin-top: 4px;
}