:root {
    --bg: #f7f5fb;
    --bg-accent: linear-gradient(180deg, #4c1d95 0%, #7c3aed 100%);
    --panel: #ffffff;
    --panel-soft: #f7f3ff;
    --text: #1f1633;
    --muted: #6b6280;
    --border: #e9e2f7;
    --primary: #7c3aed;      /* Violet 600 */
    --primary-dark: #6d28d9; /* Violet 700 */
    --danger: #be3f3f;
    --success: #2b7a57;
    --shadow: 0 14px 34px rgba(31, 22, 51, 0.08);
    --shadow-soft: 0 8px 18px rgba(31, 22, 51, 0.05);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #fbfaff 0%, var(--bg) 100%);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    background: var(--bg-accent);
    color: #fff;
    padding: 28px 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    overflow-y: auto;
    min-height: 100vh;
}

.sidebar h1 {
    margin: 6px 0;
    font-size: 1.6rem;
    line-height: 1.1;
}

.sidebar-role {
    margin: 8px 0 0;
    color: rgba(255, 255, 255, 0.78);
    font-weight: 700;
}

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

.sidebar-brand,
.sidebar-hint {
    padding: 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-hint {
    display: grid;
    gap: 6px;
}

.sidebar-hint strong {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.68);
}

.sidebar-hint span {
    font-size: 1rem;
    font-weight: 700;
}

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

.nav a {
    padding: 13px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.nav a:hover {
    background: rgba(255, 255, 255, 0.10);
}

.nav-link-active {
    background: rgba(255, 255, 255, 0.16) !important;
    border-color: rgba(255, 255, 255, 0.18) !important;
    font-weight: 800;
}

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

.nav-group-title {
    padding: 0 4px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.62);
    font-weight: 700;
}

.nav-link-secondary {
    background: rgba(255, 255, 255, 0.03) !important;
    color: rgba(255, 255, 255, 0.86);
}

.content {
    padding: 34px;
    max-width: 1440px;
    width: 100%;
}

.content-auth {
    /* Span both grid columns when there is no sidebar */
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    padding: 32px;
    margin: 0 auto;
    background: linear-gradient(180deg, #fbf9ff 0%, #f3efff 100%);
}

.login-card,
.panel,
.stat-card {
    background: var(--panel);
    border-radius: 22px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(16, 32, 51, 0.04);
}

.login-card {
    width: min(520px, 100%);
    padding: 32px;
    display: grid;
    gap: 24px;
}

.login-layout {
    width: min(520px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    align-items: stretch;
}

.login-hero { display: none; }

.login-hero::before,
.login-hero::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
}

.login-hero::before {
    width: 220px;
    height: 220px;
    top: -80px;
    right: -60px;
}

.login-hero::after {
    width: 160px;
    height: 160px;
    bottom: -60px;
    left: -30px;
}

.login-brand,
.login-feature-grid,
.login-trust {
    position: relative;
    z-index: 1;
}

.login-brand .eyebrow {
    color: #c4b5fd;
}

.login-brand h1 {
    margin: 0 0 14px;
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.02;
    max-width: 12ch;
    overflow-wrap: anywhere;
}

.login-brand .muted {
    color: rgba(255, 255, 255, 0.76);
    max-width: 58ch;
    font-size: 1.03rem;
    line-height: 1.6;
}

.login-feature-grid { display: none; }

.login-feature {
    display: grid;
    gap: 8px;
    padding: 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.login-feature strong {
    font-size: 0.98rem;
}

.login-feature span {
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.5;
    font-size: 0.92rem;
}

.login-trust { display: none; }

.trust-chip {
    display: inline-flex;
    align-items: center;
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.88rem;
    font-weight: 700;
}

.login-card-ux {
    width: 100%;
    min-width: 0;
    padding: 34px;
    border: 1px solid rgba(124, 58, 237, 0.10);
}

.login-card-head {
    display: grid;
    gap: 10px;
}

.login-card-head h2 {
    margin: 4px 0 0;
    font-size: 1.9rem;
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 700;
}

.muted {
    color: var(--muted);
    line-height: 1.6;
}

.form-grid {
    display: grid;
    gap: 18px;
}

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

label {
    display: grid;
    gap: 8px;
    font-weight: 600;
}

label span {
    font-size: 0.95rem;
    color: #2a2041;
}

input,
select,
textarea,
button {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 12px 14px;
    font: inherit;
}

input,
select,
textarea {
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input::placeholder,
textarea::placeholder {
    color: #8b9aaa;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(109, 40, 217, 0.7);
    box-shadow: 0 0 0 4px rgba(109, 40, 217, 0.15);
    background: #fcfeff;
}

button,
.button-link {
    background: var(--primary);
    color: #fff;
    border: 0;
    cursor: pointer;
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(124, 58, 237, 0.18);
    transition: box-shadow 0.15s ease, background 0.15s ease;
}

button:hover,
.button-link:hover {
    box-shadow: 0 10px 22px rgba(124, 58, 237, 0.24);
}

.button-submit {
    width: 100%;
    min-height: 52px;
    font-size: 1rem;
    box-shadow: 0 16px 28px rgba(124, 58, 237, 0.28);
}

.button-submit:hover {
    background: var(--primary-dark);
}

.button-link.secondary {
    background: var(--panel-soft);
    color: var(--text);
    box-shadow: none;
    border: 1px solid var(--border);
}

.button-danger {
    background: var(--danger);
}

.page-head,
.panel-head,
.form-actions,
.details-grid,
.stats,
.actions {
    display: flex;
    gap: 16px;
}

.page-head,
.panel-head {
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.page-head {
    padding: 4px 2px 0;
}

.page-head h2,
.panel h3 {
    margin: 0;
    letter-spacing: -0.02em;
}

.stats {
    margin-bottom: 26px;
    flex-wrap: wrap;
}

.stat-card {
    padding: 24px;
    min-width: 220px;
    flex: 1;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #6d28d9, #a78bfa);
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
    font-weight: 600;
}

.stat-card strong {
    font-size: 1.7rem;
    letter-spacing: -0.03em;
}

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

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    text-align: left;
    padding: 16px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

thead th {
    background: #f8fafc;
    color: #274158;
    font-size: 0.83rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

tbody tr:hover {
    background: #f9fbfd;
}

td small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-active {
    background: rgba(38, 124, 84, 0.10);
    color: var(--success);
}

.badge-inactive {
    background: rgba(182, 56, 56, 0.10);
    color: var(--danger);
}

.alert {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 20px;
    font-weight: 700;
    box-shadow: var(--shadow-soft);
}

.alert-success {
    background: rgba(38, 124, 84, 0.10);
    color: var(--success);
}

.alert-error {
    background: rgba(182, 56, 56, 0.10);
    color: var(--danger);
}

.full {
    grid-column: 1 / -1;
}

.credentials {
    background: var(--panel-soft);
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--border);
}

.credentials p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

code {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.92em;
    background: rgba(16, 32, 51, 0.06);
    border-radius: 8px;
    padding: 2px 6px;
}

.login-help {
    display: grid;
    gap: 14px;
}

.login-footnote {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

.details-grid {
    align-items: stretch;
}

.details-grid article {
    flex: 1;
}

.resource-list {
    display: grid;
    gap: 14px;
}

.resource-card {
    display: grid;
    gap: 6px;
    padding: 18px;
    border-radius: 16px;
    background: var(--panel-soft);
    border: 1px solid var(--border);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.resource-card:hover {
    border-color: var(--primary);
    background: #fbfdff;
}

.resource-card strong {
    font-size: 1rem;
}

.resource-card span {
    color: var(--muted);
}

.resource-card-disabled {
    pointer-events: none;
    opacity: 0.65;
}

.detail-list {
    display: grid;
    gap: 14px;
}

.detail-list div {
    display: grid;
    gap: 4px;
}

.detail-list dt {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--muted);
}

.detail-list dd {
    margin: 0;
    font-weight: 700;
}

.note-box {
    min-height: 180px;
    background: var(--panel-soft);
    border-radius: 18px;
    padding: 20px;
    line-height: 1.6;
    border: 1px solid var(--border);
}

.note-box p {
    margin-top: 0;
}

.note-box p:last-child {
    margin-bottom: 0;
}

.integration-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 360px);
    gap: 22px;
    align-items: stretch;
}

.integration-hero-copy {
    display: grid;
    gap: 14px;
}

.integration-hero-copy h3 {
    margin: 0;
    font-size: 2rem;
    letter-spacing: -0.03em;
}

.integration-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.integration-pill {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--panel-soft);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 600;
}

.integration-hero-card {
    background: var(--panel-soft);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    display: grid;
    gap: 14px;
}

.clean-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 10px;
    color: var(--muted);
}

.step-list {
    display: grid;
    gap: 14px;
}

.step-item {
    display: grid;
    gap: 6px;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
}

.step-item span {
    color: var(--muted);
}

.integration-cta-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.inline-form select {
    min-width: 180px;
    width: auto;
}

.inline-form .button-link {
    padding: 10px 14px;
}

@media (max-width: 1100px) {
    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-feature-grid {
        grid-template-columns: 1fr;
    }

    .login-hero,
    .login-card-ux {
        padding: 24px;
    }

    .login-brand h1 {
        max-width: none;
    }
}

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

    .sidebar {
        padding: 24px;
        min-height: auto;
    }

    .page-head,
    .panel-head,
    .details-grid,
    .actions,
    .integration-cta-panel {
        flex-direction: column;
        align-items: stretch;
    }

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

    .content {
        padding: 20px;
    }

    .content-auth {
        min-height: auto;
        padding: 20px;
    }

    .integration-hero {
        grid-template-columns: 1fr;
    }

    .table-wrap {
        border-radius: 16px;
    }

    th,
    td {
        padding: 14px 12px;
    }
}
