@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Manrope:wght@400;500;600;700&display=swap");

:root {
    --sidebar-width: 306px;
    --bg: #07090d;
    --bg-soft: #0d1015;
    --panel: rgba(15, 18, 24, 0.9);
    --panel-strong: rgba(18, 21, 28, 0.96);
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.14);
    --text: #f7f1e8;
    --muted: #a69d90;
    --accent: #d6b475;
    --accent-strong: #f3d7a1;
    --danger: #f07a7a;
    --success: #73d4a0;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
    --surface-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
}

html[data-theme="light"] {
    --bg: #f3eee4;
    --bg-soft: #fbf8f2;
    --panel: rgba(255, 255, 255, 0.9);
    --panel-strong: rgba(255, 255, 255, 0.96);
    --line: rgba(35, 28, 18, 0.09);
    --line-strong: rgba(35, 28, 18, 0.18);
    --text: #1d1a15;
    --muted: #6f6558;
    --accent: #b98735;
    --accent-strong: #8f6723;
    --danger: #c85858;
    --success: #318c5c;
    --shadow: 0 18px 44px rgba(143, 103, 35, 0.08);
    --surface-shadow: 0 18px 44px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    font-family: "Manrope", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(214, 180, 117, 0.16), transparent 28%),
        radial-gradient(circle at top right, rgba(81, 116, 182, 0.14), transparent 22%),
        linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 88%, #121826 12%) 48%, var(--bg) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.03), transparent 22%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0.015) 1px, transparent 1px, transparent 70px);
    opacity: 0.35;
}

body.app-body {
    overflow: hidden;
}

body.auth-body {
    overflow: auto;
}

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

button,
input,
select {
    font: inherit;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.app-layout {
    position: relative;
    min-height: 100vh;
    z-index: 1;
}

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    padding: 18px 16px 18px;
    border-radius: 0 28px 28px 0;
    border-left: 0;
    background: linear-gradient(180deg, rgba(10, 12, 17, 0.96), rgba(13, 16, 22, 0.92));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    overflow: hidden;
    transition: width 0.25s ease, padding 0.25s ease;
}

html[data-theme="light"] .sidebar {
    background: linear-gradient(180deg, rgba(255, 250, 242, 0.98), rgba(250, 245, 235, 0.96));
}

.sidebar-top {
    display: grid;
    gap: 14px;
}

.sidebar-brand-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.brand-mark {
    font-family: "Cormorant Garamond", "Baskerville", serif;
    font-size: 38px;
    font-weight: 700;
    line-height: 0.92;
}

.sidebar-copy {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.sidebar-icon-button,
.sidebar-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 46px;
    border-radius: 16px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.sidebar-icon-button:hover,
.sidebar-tool:hover {
    transform: translateY(-1px);
    border-color: rgba(214, 180, 117, 0.34);
    background: rgba(214, 180, 117, 0.08);
}

.sidebar-toggle {
    width: 46px;
    flex: 0 0 46px;
}

.sidebar-toggle-bars,
.sidebar-toggle-bars::before,
.sidebar-toggle-bars::after {
    display: block;
    width: 16px;
    height: 2px;
    background: currentColor;
    border-radius: 999px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.sidebar-toggle-bars {
    position: relative;
}

.sidebar-toggle-bars::before,
.sidebar-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
}

.sidebar-toggle-bars::before {
    top: -5px;
}

.sidebar-toggle-bars::after {
    top: 5px;
}

.sidebar-tools {
    display: grid;
}

.tool-mark {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(214, 180, 117, 0.15);
    color: var(--accent-strong);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.tool-text {
    white-space: nowrap;
    font-weight: 700;
}

.sidebar-nav {
    display: grid;
    gap: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 13px 14px;
    border-radius: 18px;
    border: 1px solid var(--line);
    color: var(--text);
    background: rgba(255, 255, 255, 0.025);
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    border-color: rgba(214, 180, 117, 0.34);
    background: rgba(214, 180, 117, 0.08);
    transform: translateX(2px);
}

.nav-badge {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    border-radius: 12px;
    background: rgba(214, 180, 117, 0.14);
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.nav-label {
    font-weight: 700;
    line-height: 1.25;
}

.sidebar-footer {
    display: grid;
    gap: 12px;
    margin-top: auto;
}

.sidebar-user {
    padding: 14px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-user small {
    display: block;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 11px;
    margin-bottom: 8px;
}

.sidebar-user strong {
    display: block;
    word-break: break-word;
    font-size: 17px;
}

.sidebar-logout {
    width: 100%;
    justify-content: center;
}

.content-shell {
    margin-left: var(--sidebar-width);
    height: 100vh;
    overflow-y: auto;
    padding: 24px;
    display: grid;
    gap: 22px;
    align-content: start;
    transition: margin-left 0.25s ease;
}

.toolbar-card,
.panel {
    border-radius: 28px;
    padding: 24px;
}

.toolbar-head {
    margin-bottom: 18px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-strong);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 12px;
    font-weight: 700;
}

.eyebrow::before {
    content: "";
    width: 34px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent));
}

.section-title {
    margin: 14px 0 10px;
    font-family: "Cormorant Garamond", "Baskerville", serif;
    line-height: 0.96;
    letter-spacing: 0.01em;
}

.section-title-medium {
    font-size: clamp(34px, 4vw, 48px);
}

.section-subtitle {
    margin: 0;
    max-width: 76ch;
    color: var(--muted);
    line-height: 1.7;
}

.toolbar-form {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(220px, 0.9fr);
    gap: 16px;
    align-items: end;
}

.toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.field {
    display: grid;
    gap: 10px;
}

.field label {
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 700;
}

.field input,
.field select {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: rgba(6, 8, 11, 0.7);
    color: var(--text);
    padding: 15px 16px;
    outline: none;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

html[data-theme="light"] .field input,
html[data-theme="light"] .field select {
    background: rgba(248, 244, 235, 0.95);
}

.field input:focus,
.field select:focus {
    border-color: rgba(214, 180, 117, 0.72);
    transform: translateY(-1px);
}

.stack {
    display: grid;
    gap: 16px;
}

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

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    border: 0;
    border-radius: 999px;
    padding: 14px 22px;
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.button-primary {
    color: #111;
    background: linear-gradient(135deg, var(--accent-strong), var(--accent));
    box-shadow: 0 14px 32px rgba(214, 180, 117, 0.24);
}

.button-secondary {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line-strong);
}

.progress-shell {
    display: none;
    gap: 14px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.progress-shell.active {
    display: grid;
}

.progress-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.progress-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.spinner {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid rgba(214, 180, 117, 0.28);
    border-top-color: var(--accent-strong);
    animation: spin 0.9s linear infinite;
}

.progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

.progress-value {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #9e7840, var(--accent-strong));
    transition: width 0.3s ease;
}

.message,
.hint,
.results-meta {
    color: var(--muted);
    line-height: 1.65;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 94px;
    padding: 9px 14px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 11px;
    font-weight: 800;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
}

.status-pill.ready,
.status-pill.queued {
    color: var(--muted);
}

.status-pill.running {
    color: var(--accent-strong);
    border-color: rgba(214, 180, 117, 0.28);
}

.status-pill.completed {
    color: var(--success);
    border-color: rgba(115, 212, 160, 0.24);
}

.status-pill.failed {
    color: var(--danger);
    border-color: rgba(240, 122, 122, 0.24);
}

.results-head h2 {
    margin: 14px 0 8px;
    font-family: "Cormorant Garamond", "Baskerville", serif;
    font-size: 42px;
    line-height: 0.96;
}

.results-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.table-export {
    flex: 0 0 auto;
    min-width: 150px;
}

.results-table-shell {
    margin-top: 20px;
}

.table-scroll {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(8, 10, 13, 0.42);
}

html[data-theme="light"] .table-scroll {
    background: rgba(248, 244, 235, 0.7);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

thead th {
    padding: 18px 16px;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-strong);
    border-bottom: 1px solid var(--line);
}

tbody td {
    padding: 18px 16px;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
    line-height: 1.6;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 34px 18px;
}

.profile-panel {
    max-width: 820px;
}

.profile-form {
    margin-top: 22px;
}

.settings-panel {
    max-width: 1240px;
}

.settings-form {
    margin-top: 22px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 22px;
}

.settings-divider {
    height: 1px;
    background: var(--line);
    margin: 4px 0 2px;
}

.settings-test-row {
    display: flex;
    align-items: end;
    gap: 18px;
    justify-content: space-between;
}

.test-email-field {
    flex: 1 1 360px;
}

.settings-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.password-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.password-input {
    min-width: 0;
}

.password-toggle {
    min-height: 52px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
}

.alert {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(240, 122, 122, 0.25);
    background: rgba(240, 122, 122, 0.08);
    color: var(--danger);
}

.alert-success {
    border-color: rgba(115, 212, 160, 0.25);
    background: rgba(115, 212, 160, 0.08);
    color: var(--success);
}

.auth-wrap {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(560px, 100%);
    padding: 28px;
    border-radius: 30px;
}

.auth-card h1 {
    margin: 16px 0 10px;
    font-family: "Cormorant Garamond", "Baskerville", serif;
    font-size: clamp(42px, 6vw, 62px);
    line-height: 0.95;
}

.auth-card p {
    margin: 0 0 22px;
    color: var(--muted);
    line-height: 1.7;
}

.form-footer {
    margin-top: 18px;
    color: var(--muted);
    line-height: 1.7;
    font-size: 14px;
}

body.sidebar-collapsed {
    --sidebar-width: 94px;
}

body.sidebar-collapsed .brand-mark {
    font-size: 0;
}

body.sidebar-collapsed .brand-mark::before {
    content: "LN";
    font-size: 28px;
}

body.sidebar-collapsed .sidebar-copy,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .tool-text,
body.sidebar-collapsed .sidebar-user small,
body.sidebar-collapsed .sidebar-user strong {
    display: none;
}

body.sidebar-collapsed .sidebar {
    padding-inline: 12px;
}

body.sidebar-collapsed .sidebar-tool,
body.sidebar-collapsed .nav-link {
    justify-content: center;
    padding-inline: 0;
}

body.sidebar-collapsed .sidebar-user {
    display: grid;
    place-items: center;
    min-height: 60px;
    padding: 0;
}

body.sidebar-collapsed .sidebar-user::before {
    content: "AD";
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: rgba(214, 180, 117, 0.15);
    color: var(--accent-strong);
    font-weight: 800;
    letter-spacing: 0.08em;
    font-size: 12px;
}

body.sidebar-collapsed .sidebar-logout {
    padding-inline: 0;
}

body.sidebar-collapsed .logout-text {
    font-size: 0;
}

body.sidebar-collapsed .logout-text::after {
    content: "Out";
    font-size: 12px;
}

body.sidebar-collapsed .content-shell {
    margin-left: var(--sidebar-width);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1380px) {
    .toolbar-form {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    body.app-body {
        overflow: auto;
    }

    .sidebar {
        position: sticky;
        top: 0;
        width: auto;
        border-radius: 0 0 24px 24px;
        padding: 16px;
    }

    .content-shell {
        margin-left: 0;
        height: auto;
        overflow: visible;
        padding: 18px 16px 28px;
    }

    .toolbar-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .toolbar-actions {
        grid-column: 1 / -1;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .settings-test-row {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 720px) {
    .sidebar-brand-row {
        align-items: center;
    }

    .sidebar-nav {
        grid-template-columns: 1fr;
    }

    .toolbar-form {
        grid-template-columns: 1fr;
    }

    .progress-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .toolbar-card,
    .panel,
    .auth-card {
        padding: 20px;
        border-radius: 24px;
    }

    .results-head h2 {
        font-size: 34px;
    }

    .results-head {
        flex-direction: column;
        align-items: flex-start;
    }
}
