/* Base form controls. The in-app forms (profile, contact) rely on these;
   the sign-in pages use their own .auth-* classes further down. */

input {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    box-sizing: border-box;
}

button {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    cursor: pointer;
}

/* ==========================================================================
   Authenticated app shell (dashboard, files, profile, about, contact)
   ========================================================================== */

:root {
    --ink: #0f172a;
    --muted: #64748b;
    --accent: #4f46e5;
    --accent-dark: #4338ca;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --warning: #b45309;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --border: #e5e7eb;
    --surface: #ffffff;
    --page-bg: #f3f5fa;
    --sidebar-bg: #111827;
    --sidebar-hover: #1f2937;
}

body.app-body {
    display: block;
    margin: 0;
    justify-content: normal;
    background: var(--page-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: #e5e7eb;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: sticky;
    top: 0;
    /* Exactly one screen tall, padding included, so Logout stays visible. */
    box-sizing: border-box;
    height: 100vh;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 24px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.brand-name {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: #fff;
    text-decoration: none;
}

.sidebar-nav a.active {
    background: var(--accent);
    color: #fff;
}

.nav-icon {
    font-size: 15px;
    width: 18px;
    text-align: center;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 12px;
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 8px;
    color: #fca5a5;
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 500;
}

.logout-link:hover {
    background: rgba(220, 38, 38, 0.15);
    text-decoration: none;
}

/* --- Main column --- */

.main-column {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 64px;
    flex-shrink: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
}

.user-chip {
    background: #eef2ff;
    color: var(--accent-dark);
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
}

.content {
    padding: 32px;
    max-width: 1080px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

/* --- Typography helpers --- */

.page-heading {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 6px;
}

.page-subheading {
    color: var(--muted);
    margin: 0 0 28px;
    font-size: 15px;
}

.breadcrumb {
    color: var(--muted);
    font-size: 13.5px;
    margin-bottom: 10px;
}

.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

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

.flash-stack {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
}

.flash-success {
    background: var(--success-bg);
    color: #14532d;
}

.flash-error {
    background: var(--danger-bg);
    color: #7f1d1d;
}

/* --- Memes under messages --- */

.meme {
    margin: 14px 0 4px;
    text-align: center;
}

.meme img {
    display: inline-block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.flash .meme {
    margin: 10px 0 2px;
    text-align: left;
}

.flash .meme img {
    max-width: min(280px, 100%);
}

/* --- Stat cards --- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
}

.stat-value-small {
    font-size: 17px;
    color: var(--success);
}

/* --- Action / info cards --- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.action-card,
.info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    text-decoration: none;
    color: var(--ink);
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    border-color: var(--accent);
    text-decoration: none;
}

.action-card-large {
    padding: 30px;
}

.action-icon {
    font-size: 22px;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #eef2ff;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.action-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}

.action-desc {
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.4;
}

/* --- Panels & tables --- */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.panel h2 {
    font-size: 16px;
    margin: 0 0 16px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.panel-header h2 {
    margin: 0;
}

.panel-link {
    color: var(--accent);
    font-size: 13.5px;
    text-decoration: none;
    font-weight: 600;
}

.panel-link:hover {
    text-decoration: underline;
}

.panel-meta {
    color: var(--muted);
    font-size: 13px;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.file-table th {
    text-align: left;
    color: var(--muted);
    font-weight: 600;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.file-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

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

.file-action-cell {
    text-align: right;
}

.empty-state {
    color: var(--muted);
    font-size: 14px;
    padding: 12px 0;
}

.empty-state a {
    color: var(--accent);
}

/* --- Buttons --- */

.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background: var(--accent-dark);
    text-decoration: none;
    color: #fff;
}

.btn-small {
    padding: 7px 14px;
    font-size: 13px;
}

.btn-primary {
    width: auto;
}

/* --- Dropzone / upload --- */

.dropzone {
    border: 2px dashed #c7d2fe;
    border-radius: 14px;
    background: #f8fafc;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    margin-bottom: 16px;
}

.dropzone:hover,
.dropzone-active {
    background: #eef2ff;
    border-color: var(--accent);
}

.dropzone-icon {
    font-size: 26px;
    color: var(--accent);
    margin-bottom: 10px;
}

.dropzone-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.dropzone-sub {
    color: var(--muted);
    font-size: 13.5px;
}

.progress-wrap {
    margin-bottom: 24px;
}

.progress-track {
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.2s ease;
}

.progress-label {
    margin-top: 8px;
    font-size: 13px;
    color: var(--muted);
}

/* --- Search --- */

.search-row {
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    max-width: 320px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
}

/* --- Badges --- */

.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
}

.badge-success {
    background: var(--success-bg);
    color: #166534;
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

/* Profile header MFA status: all methods on, all but one, only one, none.
   Solid fills with text colours chosen for readable contrast. */
.badge-mfa-full {
    background: #15803d;
    color: #fff;
}

.badge-mfa-partial {
    background: #fde047;
    color: #713f12;
}

.badge-mfa-single {
    background: #f59e0b;
    color: #451a03;
}

.badge-mfa-none {
    background: #dc2626;
    color: #fff;
}

/* --- Two-factor method list --- */

.panel-note {
    color: var(--muted);
    font-size: 13.5px;
    margin: 0 0 16px;
}

.method-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.method-row:last-child {
    border-bottom: none;
}

.method-name {
    font-weight: 600;
    font-size: 14.5px;
    margin-bottom: 4px;
}

.method-desc {
    color: var(--muted);
    font-size: 13px;
}

.method-action {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.method-action form {
    margin: 0;
}

.btn-outline {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger);
}

/* --- Profile --- */

.profile-panel {
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-email {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
}

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

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--muted);
}

/* --- Contact --- */

.contact-layout {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 20px;
}

.contact-form {
    display: flex;
    flex-direction: column;
}

.contact-form textarea {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    box-sizing: border-box;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 8px;
    resize: vertical;
}

.contact-form input {
    border: 1px solid var(--border);
    border-radius: 8px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin-top: 14px;
}

.form-label:first-child {
    margin-top: 0;
}

.contact-info .contact-line {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contact-info .contact-line:last-child {
    border-bottom: none;
}

.contact-label {
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

@media (max-width: 860px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .sidebar-brand {
        border-bottom: none;
        padding: 0 8px 0 0;
        margin-bottom: 0;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-footer {
        border-top: none;
        padding-top: 0;
    }

    .contact-layout {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 20px;
    }
}
/* ==========================================================================
   Sign-in, sign-up, verification and error pages. Built from the same
   tokens and components as the app shell so both halves look like one app.
   Class selectors here outrank the legacy element rules (input, button) at
   the top of this file, which the in-app forms still rely on.
   ========================================================================== */

body.auth-body {
    display: block;
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 50% -120px, #e0e7ff 0, rgba(224, 231, 255, 0) 520px),
        var(--page-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
}

.auth-shell {
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 56px 16px 32px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    text-decoration: none;
}

.auth-brand-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.07);
}

.auth-eyebrow {
    display: inline-block;
    margin-bottom: 14px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 6px;
}

.auth-subtitle {
    color: var(--muted);
    font-size: 14.5px;
    line-height: 1.5;
    margin: 0 0 24px;
}

.auth-subtitle strong {
    color: var(--ink);
}

.auth-card .flash {
    margin-bottom: 20px;
    line-height: 1.4;
}

.auth-card .flash .meme {
    text-align: center;
}

.auth-card .flash .meme img {
    max-width: 100%;
}

.auth-card > .meme {
    margin: 0 0 20px;
}

.setup-panel .flash {
    margin-bottom: 20px;
}

/* --- Forms --- */

.auth-form {
    margin: 0;
}

.auth-field {
    margin-bottom: 16px;
}

.auth-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.auth-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.auth-label-row .auth-label {
    margin-bottom: 0;
}

.auth-label-row a {
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.auth-label-row a:hover {
    text-decoration: underline;
}

.auth-input {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 11px 14px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: var(--ink);
    font-family: inherit;
    font-size: 15px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input::placeholder {
    color: #9ca3af;
}

.auth-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px #e0e7ff;
}

.auth-input-code {
    padding: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 22px;
    letter-spacing: 0.35em;
    text-align: center;
}

.auth-submit {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 8px 0 0;
    padding: 12px 18px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.auth-submit:hover {
    background: var(--accent-dark);
    color: #fff;
    text-decoration: none;
}

.auth-submit:focus-visible,
.method-choice:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px #c7d2fe;
}

/* --- Links under the form --- */

.auth-switch {
    margin: 22px 0 0;
    text-align: center;
    font-size: 14px;
    color: var(--muted);
}

.auth-switch a,
.auth-links a,
.auth-link-btn {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.auth-switch a:hover,
.auth-links a:hover,
.auth-link-btn:hover {
    text-decoration: underline;
}

.auth-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px 18px;
    margin-top: 22px;
    font-size: 14px;
}

.auth-links form {
    margin: 0;
}

.auth-link-btn {
    width: auto;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
}

.auth-footer {
    margin: 24px 0 0;
    font-size: 12.5px;
    color: var(--muted);
    text-align: center;
}

.auth-footer a {
    color: var(--muted);
}

.auth-status {
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

/* --- Verification method chooser (cards like the dashboard's) --- */

.method-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
}

.method-choice {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    margin: 0;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--ink);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.method-choice:hover:not(:disabled) {
    border-color: var(--accent);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.method-choice .action-icon {
    margin: 0;
    flex-shrink: 0;
}

.method-choice-text {
    flex: 1;
    min-width: 0;
}

.method-choice-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
}

.method-choice-desc {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    color: var(--muted);
}

.method-choice-arrow {
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
}

.method-choice:disabled {
    background: #f8fafc;
    cursor: not-allowed;
}

.method-choice:disabled .action-icon {
    background: #f1f5f9;
    filter: grayscale(1);
    opacity: 0.6;
}

.method-choice:disabled .method-choice-title {
    color: var(--muted);
}

.badge-muted {
    flex-shrink: 0;
    background: #f1f5f9;
    color: var(--muted);
}

/* --- Authenticator setup (sign-in and profile) --- */

.setup-steps {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
    counter-reset: setup-step;
}

.setup-steps li {
    position: relative;
    margin-bottom: 10px;
    padding-left: 34px;
    font-size: 14px;
    line-height: 1.5;
}

.setup-steps li::before {
    counter-increment: setup-step;
    content: counter(setup-step);
    position: absolute;
    left: 0;
    top: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #eef2ff;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-frame {
    display: flex;
    justify-content: center;
    margin: 0 0 14px;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.qr-frame img {
    display: block;
    width: 200px;
    height: 200px;
}

.manual-key {
    margin: 0 0 20px;
    font-size: 13.5px;
    color: var(--muted);
    text-align: center;
}

.manual-key summary {
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
}

.manual-key code {
    display: block;
    margin-top: 10px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    letter-spacing: 0.06em;
    word-break: break-all;
}

/* In-app setup pages use the same pieces inside a narrower panel. */
.setup-panel {
    max-width: 460px;
}

.setup-panel .auth-submit {
    margin-top: 4px;
}

@media (max-width: 480px) {
    .auth-shell {
        padding-top: 32px;
    }

    .auth-card {
        padding: 24px 20px;
    }
}
