:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --accent: #2563eb;
    --accent-soft: #dbeafe;
    --success: #0f766e;
    --danger: #b42318;
    --shadow: 0 18px 40px rgba(15, 23, 42, 0.07);
    --radius: 16px;
    --radius-sm: 12px;
    --font: "Inter", "SF Pro Text", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
}

.app-body {
    background: var(--bg);
}

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

code {
    padding: 2px 6px;
    border-radius: 8px;
    background: #eff6ff;
    font-size: 0.92em;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
    font: inherit;
    color: var(--text);
    background: #ffffff;
    transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 20px) calc(50% - 3px), calc(100% - 14px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 42px;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.45);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

.landing-body,
.login-body {
    min-height: 100vh;
    background: #ffffff;
}

.login-body {
    position: relative;
    overflow: auto;
    background: #eef2f5;
}

.login-body::before,
.login-body::after {
    display: none;
}

.public-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px 20px 40px;
    position: relative;
    z-index: 1;
}

.landing-card,
.login-card {
    width: min(1120px, 100%);
    display: grid;
    gap: 28px;
    grid-template-columns: minmax(0, 1.2fr) minmax(340px, 420px);
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 30px;
    box-shadow: var(--shadow);
    padding: 44px;
}

.landing-copy h1,
.login-copy h1 {
    margin: 10px 0 14px;
    font-size: clamp(2.7rem, 5vw, 4.5rem);
    line-height: 0.95;
    letter-spacing: -0.05em;
}

.landing-copy p,
.login-copy p {
    max-width: 62ch;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.6;
}

.landing-list {
    margin: 24px 0 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.8;
}

.landing-actions,
.form-card {
    align-self: center;
    display: grid;
    gap: 16px;
    padding: 28px;
    border-radius: 22px;
    background: var(--surface-alt);
    border: 1px solid var(--line);
}

.landing-note {
    display: grid;
    gap: 6px;
    color: var(--muted);
}

.eyebrow {
    display: inline-block;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.78rem;
    font-weight: 700;
}

.shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 100vh;
    background: var(--bg);
}

.sidebar {
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 18px;
    padding: 18px 14px;
    background: #f8fafc;
    border-right: 1px solid var(--line);
    position: sticky;
    top: 0;
    height: 100vh;
}

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

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 14px;
    color: var(--text);
}

.brand-logo {
    width: 42px;
    height: auto;
    flex: 0 0 auto;
}

.brand-copy {
    display: grid;
    gap: 2px;
}

.brand-copy strong {
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.brand-copy small {
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.sidebar-new {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 14px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.nav {
    display: grid;
    gap: 6px;
    align-content: start;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 12px;
    color: var(--muted);
    font-weight: 600;
    transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.nav-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.nav-icon svg,
.topbar-icon svg,
.topbar-search-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.nav-link:hover,
.nav-link.active {
    background: #ffffff;
    color: var(--accent);
}

.nav-link.active::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 999px;
    background: var(--accent);
}

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

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid var(--line);
}

.sidebar-user strong {
    display: block;
    font-size: 0.92rem;
}

.sidebar-user small {
    color: var(--muted);
    font-size: 0.82rem;
}

.workspace {
    display: grid;
    grid-template-rows: auto 1fr;
    min-width: 0;
}

.topbar {
    display: grid;
    grid-template-columns: auto minmax(320px, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 18px 28px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(12px);
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-size: 0.88rem;
}

.breadcrumb-item {
    color: var(--muted);
    white-space: nowrap;
}

.breadcrumb-item:last-child {
    color: var(--text);
    font-weight: 600;
}

.breadcrumb-sep {
    color: #cbd5e1;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    min-height: 48px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid var(--line);
}

.topbar-search input {
    border: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.topbar-search input:focus {
    box-shadow: none;
}

.topbar-search-icon {
    color: var(--muted);
    display: inline-flex;
    align-items: center;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--muted);
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.topbar-icon:hover {
    background: #eff6ff;
    color: var(--accent);
    border-color: rgba(37, 99, 235, 0.22);
}

.admin-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding-left: 6px;
}

.admin-chip strong {
    display: block;
    font-size: 0.92rem;
}

.admin-chip small {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
}

.admin-avatar {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    flex: 0 0 auto;
}

.main {
    padding: 26px 28px 34px;
    min-width: 0;
}

.page-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: start;
    margin-bottom: 22px;
}

.page-head h1 {
    margin: 6px 0 8px;
    font-size: clamp(1.9rem, 3.1vw, 2.45rem);
    line-height: 1.02;
    letter-spacing: -0.04em;
}

.page-head p {
    margin: 0;
    color: var(--muted);
    max-width: 72ch;
    line-height: 1.6;
}

.head-actions,
.inline-form,
.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form {
    padding: 8px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid var(--line);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.inline-form input[type="search"] {
    min-width: 240px;
    border: 0;
    padding: 0 6px;
    box-shadow: none;
}

.inline-form input[type="search"]:focus {
    box-shadow: none;
}

.button {
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 12px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 120ms ease, opacity 120ms ease, box-shadow 120ms ease, background 120ms ease;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.16);
}

.button:hover {
    transform: translateY(-1px);
    opacity: 0.96;
}

.sidebar-new:hover,
.button-secondary:hover,
.button-ghost:hover {
    transform: translateY(-1px);
    opacity: 0.98;
}

.button-secondary {
    background: #ffffff;
    color: var(--text);
    border: 1px solid var(--line);
    box-shadow: none;
}

.button-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid rgba(148, 163, 184, 0.26);
    box-shadow: none;
}

.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.button:disabled:hover {
    transform: none;
    opacity: 0.55;
}

.button-full {
    width: 100%;
}

.metric-grid,
.panel-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 24px;
}

.metric-card,
.panel,
.form-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 24px rgba(15, 23, 42, 0.04);
}

.metric-card {
    padding: 22px;
}

.metric-label {
    display: block;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.75rem;
    margin-bottom: 10px;
}

.metric-card strong {
    display: block;
    font-size: 2.6rem;
    line-height: 1;
    letter-spacing: -0.06em;
    margin-bottom: 8px;
}

.metric-card small {
    color: var(--muted);
}

.panel {
    padding: 22px;
    margin-bottom: 24px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.panel h2 {
    margin: 0;
    font-size: 1.28rem;
    letter-spacing: -0.03em;
}

.panel-head span {
    color: var(--muted);
    font-size: 0.95rem;
}

.panel-copy {
    display: grid;
    gap: 8px;
    max-width: 62ch;
}

.panel-copy p {
    margin: 0;
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.55;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.data-table th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr {
    transition: background 140ms ease;
}

.data-table tbody tr:hover {
    background: #f8fbff;
}

.data-table .table-control {
    min-width: 100%;
}

.status {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef2ff;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.status-success,
.status-success.status-success,
.status-success.status-successful,
.status-success.status-enabled,
.status-success.status-enabled {
    background: #dff5eb;
    color: var(--success);
}

.status-failed,
.status-failed.status-failed,
.status.status-failed {
    background: #fde6e2;
    color: var(--danger);
}

.status-pending,
.status.status-pending,
.status-processing,
.status.status-processing {
    background: #fef3c7;
    color: #a16207;
}

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

.login-auth {
    width: min(760px, 100%);
    padding: 24px 24px 32px;
    background: transparent;
    border-radius: 0;
}

.login-brandmark {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.login-logo {
    display: block;
    width: auto;
    height: 64px;
    object-fit: contain;
}

.login-card {
    width: min(620px, 100%);
    min-height: 0;
    margin: 0 auto;
    padding: 38px 36px 28px;
    border: 1px solid #d6dae1;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
}

.login-card-head {
    text-align: center;
}

.login-card-head h1 {
    margin: 0;
    color: #0f172a;
    font-size: clamp(2rem, 4vw, 2.7rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.login-form {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.login-form--request {
    justify-content: center;
    gap: 18px;
    width: min(460px, 100%);
    margin: 32px auto 0;
}

.login-form--verify {
    justify-content: center;
    gap: 18px;
    width: min(520px, 100%);
    margin: 30px auto 0;
}

.login-form-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-input {
    width: 100%;
    height: 56px;
    padding: 0 18px;
    border: 1px solid #c9cfd7;
    border-radius: 14px;
    background: #ffffff;
    color: #111827;
    font-size: 1rem;
    font-weight: 500;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.login-input:focus,
.login-code-slot:focus {
    outline: none;
    border-color: #1d63d4;
    box-shadow: 0 0 0 3px rgba(29, 99, 212, 0.14);
}

.login-primary-button,
.login-secondary-button {
    width: 100%;
    min-height: 54px;
    border-radius: 14px;
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.login-primary-button {
    border: none;
    background: #3976bb;
    color: #ffffff;
}

.login-secondary-button {
    border: 1px solid #d1d5db;
    background: #f8fafc;
    color: #374151;
}

.login-primary-button:hover:not(:disabled),
.login-secondary-button:hover:not(:disabled),
.login-link-button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.login-primary-button:disabled,
.login-secondary-button:disabled,
.login-link-button:disabled {
    opacity: 0.72;
    cursor: not-allowed;
    transform: none;
}

.login-link-button {
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.login-code-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-code-slot-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-code-slot {
    width: 52px;
    height: 48px;
    padding: 0 0 0 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #ffffff;
    text-align: left;
    font-size: 1.08rem;
    font-weight: 700;
    color: #0f172a;
    font-family: "SFMono-Regular", "SF Mono", "Menlo", monospace;
    text-transform: uppercase;
}

.login-code-divider {
    width: 14px;
    height: 2px;
    border-radius: 999px;
    background: #c4c8ce;
}

.login-code-message {
    margin: 0;
    color: #4b5563;
    text-align: center;
    font-size: 0.92rem;
    line-height: 1.55;
}

.login-code-message strong {
    display: block;
    margin-top: 4px;
    color: #111827;
    font-weight: 700;
}

.login-alert {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
}

.login-alert--error {
    color: #b42318;
    background: #fef3f2;
    border: 1px solid #fecdca;
}

.login-form-actions {
    width: min(520px, 100%);
    margin: 16px auto 0;
}

.login-action-form {
    width: 100%;
    margin: 0;
}

.login-action-form--inline {
    display: flex;
    justify-content: center;
}

.login-resend-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

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

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

.field span {
    font-size: 0.86rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
}

.field input,
.field select,
.field textarea {
    margin: 0;
}

.field-wide {
    grid-column: 1 / -1;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 12px;
    align-self: end;
    min-height: 58px;
    padding: 0 4px;
}

.checkbox-field span {
    font-size: 1rem;
    text-transform: none;
    letter-spacing: 0;
}

.checkbox-field input {
    appearance: none;
    width: 22px;
    height: 22px;
    margin: 0;
    border: 1.5px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    position: relative;
    flex: 0 0 auto;
    box-shadow: none;
}

.checkbox-field input:focus {
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
    border-color: rgba(37, 99, 235, 0.45);
}

.checkbox-field input:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-field input:checked::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 2px;
    width: 5px;
    height: 11px;
    border: solid #ffffff;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash-public {
    width: min(760px, 100%);
    margin-inline: auto;
}

.flash {
    border-radius: 14px;
    padding: 14px 16px;
    font-weight: 600;
    border: 1px solid transparent;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.flash-error {
    background: #fef2f2;
    color: var(--danger);
    border-color: #fecaca;
}

.flash-success {
    background: #ecfdf3;
    color: var(--success);
    border-color: #bbf7d0;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
}

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

.source-meta {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.source-meta strong {
    color: var(--text);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

@media (max-width: 960px) {
    .landing-card,
    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .topbar {
        grid-template-columns: 1fr;
        justify-items: stretch;
    }

    .topbar-actions {
        justify-content: space-between;
    }

    .topbar-search {
        order: 3;
    }

    .main {
        padding: 22px;
    }

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

    .sidebar-user,
    .admin-chip {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .public-shell,
    .main {
        padding: 16px;
    }

    .landing-card,
    .panel,
    .form-card {
        padding: 18px;
        border-radius: 20px;
    }

    .page-head h1,
    .landing-copy h1,
    .login-copy h1 {
        font-size: 2.1rem;
    }

    .topbar {
        padding: 14px 16px;
    }

    .inline-form {
        width: 100%;
    }

    .inline-form input[type="search"] {
        min-width: 0;
    }

    .login-auth {
        width: min(760px, 100%);
        padding: 18px 14px 22px;
    }

    .login-card {
        width: 100%;
        min-height: 0;
        padding: 28px 20px 22px;
        border-radius: 18px;
    }

    .login-logo {
        height: 52px;
    }

    .login-card-head h1 {
        font-size: 1.9rem;
    }

    .login-input,
    .login-primary-button,
    .login-secondary-button {
        min-height: 50px;
        height: auto;
        border-radius: 12px;
        font-size: 0.95rem;
    }

    .login-code-row {
        gap: 6px;
        flex-wrap: wrap;
    }

    .login-code-slot-wrap {
        gap: 6px;
    }

    .login-code-slot {
        width: 44px;
        height: 44px;
        padding-left: 12px;
        border-radius: 10px;
        font-size: 1rem;
    }
}
