:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eff6ff;
    --navy: #0b1428;
    --navy-soft: #16213a;
    --success: #15803d;
    --success-soft: #ecfdf3;
    --warning: #b45309;
    --warning-soft: #fff7ed;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 16px 38px rgba(15, 23, 42, 0.08);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--bg);
}

body {
    margin: 0;
    min-width: 320px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

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

button,
input,
select {
    font: inherit;
}

button,
select {
    cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #2a73f0, #1258d8);
    color: #ffffff;
    font-weight: 900;
    letter-spacing: -0.03em;
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.35);
}

.brand-mark.small {
    width: 40px;
    height: 40px;
    margin-bottom: 16px;
    border-radius: 12px;
}

.eyebrow {
    display: block;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.btn {
    min-height: 44px;
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    border-color: #d7dee8;
    background: #ffffff;
    color: #334155;
}

.btn-secondary:hover {
    border-color: var(--line-strong);
    background: #f8fafc;
}

.btn-block {
    width: 100%;
}

.alert {
    margin: 0 0 20px;
    padding: 14px 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 750;
    line-height: 1.5;
}

.alert-error {
    border-color: #fecaca;
    background: var(--danger-soft);
    color: #b91c1c;
}

.alert-success {
    border-color: #bbf7d0;
    background: var(--success-soft);
    color: var(--success);
}

.login-page {
    min-height: 100vh;
    background: radial-gradient(circle at 15% 20%, rgba(37, 99, 235, 0.22), transparent 35%), #091020;
}

.login-shell {
    width: 100%;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.89fr);
    align-items: center;
    gap: 8vw;
}

.login-brand {
    max-width: 620px;
    color: #ffffff;
}

.login-brand .brand-mark {
    margin-bottom: 28px;
}

.login-brand .eyebrow {
    color: #60a5fa;
}

.login-brand h1 {
    margin: 14px 0 20px;
    font-size: clamp(40px, 5vw, 66px);
    line-height: 1.05;
    letter-spacing: -0.05em;
}

.login-brand > p {
    max-width: 580px;
    margin: 0;
    color: #c4cddf;
    font-size: 18px;
    line-height: 1.7;
}

.login-features {
    margin-top: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.login-features span {
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #dbe7f3;
}

.login-card {
    padding: 38px;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 28px 70px rgba(2, 6, 17, 0.45);
}

.login-head h2 {
    margin: 0;
    font-size: 28px;
}

.login-head p {
    margin: 8px 0 24px;
    color: var(--muted);
}

.login-card label {
    display: block;
    margin-bottom: 18px;
    color: #334155;
    font-size: 14px;
    font-weight: 750;
}

.login-card input {
    width: 100%;
    height: 48px;
    margin-top: 8px;
    padding: 0 14px;
    border: 1px solid #d7dee8;
    border-radius: 12px;
    background: #ffffff;
    color: var(--text);
}

.login-card input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.security-note {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.app-shell {
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
    width: 260px;
    height: 100vh;
    padding: 24px 18px;
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--navy);
    color: #ffffff;
}

.sidebar-brand {
    padding: 0 6px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand strong,
.sidebar-brand span {
    display: block;
}

.sidebar-brand strong {
    font-size: 16px;
}

.sidebar-brand span {
    margin-top: 3px;
    color: #94a3b8;
    font-size: 12px;
}

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

.sidebar-nav a {
    min-height: 46px;
    padding: 11px 14px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #a9b5c7;
    font-size: 14px;
    font-weight: 750;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav a:hover {
    background: var(--navy-soft);
    color: #ffffff;
}

.sidebar-nav a.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

.sidebar-nav a span {
    width: 20px;
    flex: 0 0 20px;
    text-align: center;
    font-size: 18px;
}

.sidebar-foot {
    margin-top: auto;
    padding: 16px 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #1d64d3;
    font-weight: 900;
}

.sidebar-foot strong,
.sidebar-foot span {
    display: block;
}

.sidebar-foot strong {
    font-size: 13px;
}

.sidebar-foot span {
    margin-top: 2px;
    color: #94a3b8;
    font-size: 12px;
}

.main-content {
    min-width: 0;
}

.topbar {
    min-height: 96px;
    padding: 16px 36px;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
}

.topbar h1 {
    margin: 4px 0 0;
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

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

.content {
    width: 100%;
    padding: 32px 36px 50px;
}

.stat-grid {
    margin-bottom: 24px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.stat-card {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.stat-card span,
.stat-card small {
    display: block;
    color: var(--muted);
}

.stat-card strong {
    display: block;
    margin: 10px 0 6px;
    font-size: 32px;
    line-height: 1;
}

.panel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--panel);
    box-shadow: var(--shadow-sm);
}

.panel-head {
    padding: 24px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.panel-head h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.3;
}

.panel-head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.filters input,
.filters select {
    height: 42px;
    padding: 0 12px;
    border: 1px solid #d7dee8;
    border-radius: 10px;
    background: #ffffff;
    color: var(--text);
}

.filters input {
    width: 260px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

th,
td {
    padding: 16px 20px;
    border-top: 1px solid #eef2f6;
    text-align: left;
    white-space: nowrap;
}

th {
    background: #f8fafc;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

td {
    font-size: 14px;
}

.tenant-identity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tenant-identity strong,
.tenant-identity span {
    display: block;
}

.tenant-identity span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.tenant-logo {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 900;
}

.badge,
.health {
    padding: 6px 10px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    background: #eef2f6;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
}

.badge-active,
.health-healthy {
    background: var(--success-soft);
    color: var(--success);
}

.badge-provisioning {
    background: var(--primary-soft);
    color: var(--primary);
}

.badge-failed,
.health-critical {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-suspended,
.health-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge-draft,
.badge-archived,
.health-unknown {
    background: #f1f5f9;
    color: #64748b;
}

.link-action {
    color: var(--primary);
    font-weight: 800;
}

.link-action:hover {
    color: var(--primary-dark);
}

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

.customer-form {
    width: 100%;
}

.form-layout {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    align-items: start;
    gap: 24px;
}

.form-main {
    min-width: 0;
    display: grid;
    gap: 24px;
}

.form-side {
    min-width: 0;
}

.form-panel .panel-head {
    border-bottom: 1px solid #eef2f6;
}

.field-grid {
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.field-stack {
    padding: 24px;
    display: grid;
    gap: 18px;
}

.field-grid label,
.field-stack label {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #334155;
    font-size: 13px;
    font-weight: 800;
}

.field-grid input,
.field-grid select,
.field-stack input,
.field-stack select {
    width: 100%;
    min-width: 0;
    height: 46px;
    padding: 0 13px;
    border: 1px solid #d7dee8;
    border-radius: 11px;
    background: #ffffff;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field-grid input:hover,
.field-grid select:hover,
.field-stack input:hover,
.field-stack select:hover {
    border-color: var(--line-strong);
}

.field-grid input:focus,
.field-grid select:focus,
.field-stack input:focus,
.field-stack select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.field-grid input[readonly] {
    border-color: #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    cursor: not-allowed;
}

.field-grid small,
.field-stack small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
}

.module-grid {
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.module-card {
    min-width: 0;
    min-height: 76px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    position: relative;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.module-card:hover {
    border-color: #93c5fd;
    background: #f8fbff;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.07);
}

.module-card:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.module-card input[type="checkbox"] {
    width: 1px;
    height: 1px;
    margin: 0;
    position: absolute;
    opacity: 0;
}

.module-check {
    width: 28px;
    height: 28px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: #ffffff;
    color: transparent;
    font-size: 15px;
    font-weight: 900;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.module-card input[type="checkbox"]:checked ~ .module-check {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}

.module-card strong,
.module-card small {
    display: block;
}

.module-card strong {
    color: #1e293b;
    font-size: 14px;
    line-height: 1.35;
}

.module-card small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.module-card.module-required {
    border-color: #bfdbfe;
    background: var(--primary-soft);
    cursor: default;
}

.module-card.module-required:hover {
    transform: none;
    box-shadow: none;
}

.sticky-card {
    position: sticky;
    top: 120px;
    box-shadow: var(--shadow-md);
}

.sticky-card > .btn-block {
    width: calc(100% - 48px);
    margin: 0 24px 24px;
}

.system-summary {
    margin: 0 24px 24px;
    padding: 18px;
    border: 1px solid #e7edf5;
    border-radius: 14px;
    display: grid;
    gap: 14px;
    background: #f8fafc;
}

.system-summary span,
.system-summary strong {
    display: block;
}

.system-summary span {
    min-width: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.system-summary strong {
    margin-top: 4px;
    overflow-wrap: anywhere;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.45;
    text-transform: none;
}

@media (max-width: 1180px) {
    .form-layout {
        grid-template-columns: minmax(0, 1fr) 310px;
    }

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

@media (max-width: 1020px) {
    .app-shell {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .sidebar {
        width: 220px;
        padding-right: 14px;
        padding-left: 14px;
    }

    .content {
        padding-right: 24px;
        padding-left: 24px;
    }

    .topbar {
        padding-right: 24px;
        padding-left: 24px;
    }

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

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

    .sticky-card {
        position: static;
    }

    .form-side {
        order: -1;
    }
}

@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: 1fr;
        padding: 24px;
    }

    .login-brand {
        display: none;
    }

    .login-card {
        width: 100%;
        max-width: 520px;
        margin: 0 auto;
    }

    .app-shell {
        display: block;
    }

    .sidebar {
        width: 100%;
        height: auto;
        min-height: 0;
        padding: 14px;
        position: relative;
        overflow: visible;
    }

    .sidebar-brand {
        padding-bottom: 14px;
    }

    .sidebar-nav {
        margin: 0 -2px;
        padding: 0 2px 2px;
        flex-direction: row;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
    }

    .sidebar-nav a {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .sidebar-foot {
        display: none;
    }

    .topbar {
        min-height: 86px;
        padding: 14px 18px;
    }

    .content {
        padding: 20px 14px 40px;
    }

    .panel-head {
        align-items: stretch;
        flex-direction: column;
    }

    .filters {
        width: 100%;
    }

    .filters input {
        flex: 1 1 240px;
        width: auto;
    }
}

@media (max-width: 680px) {
    .topbar {
        align-items: flex-start;
    }

    .topbar h1 {
        font-size: 23px;
    }

    .topbar-actions {
        flex: 0 0 auto;
    }

    .topbar-actions .btn {
        min-height: 40px;
        padding: 9px 12px;
        font-size: 13px;
    }

    .stat-grid,
    .field-grid,
    .module-grid {
        grid-template-columns: 1fr;
    }

    .field-grid,
    .field-stack,
    .module-grid {
        padding: 18px;
    }

    .form-main {
        gap: 18px;
    }

    .form-layout {
        gap: 18px;
    }

    .form-panel .panel-head {
        padding: 20px 18px;
    }

    .sticky-card > .btn-block {
        width: calc(100% - 36px);
        margin: 0 18px 18px;
    }

    .system-summary {
        margin: 0 18px 18px;
    }
}

@media (max-width: 520px) {
    .login-card {
        padding: 26px 22px;
        border-radius: 20px;
    }

    .sidebar-brand .brand-mark {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }

    .sidebar-nav a {
        min-height: 42px;
        padding: 9px 11px;
        font-size: 13px;
    }

    .topbar {
        gap: 12px;
    }

    .topbar .eyebrow {
        font-size: 10px;
    }

    .topbar h1 {
        font-size: 21px;
    }

    .topbar-actions .btn-secondary {
        display: none;
    }

    .stat-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .filters input,
    .filters select,
    .filters .btn {
        width: 100%;
        flex: 1 1 100%;
    }

    .panel {
        border-radius: 15px;
    }

    .module-card {
        min-height: 70px;
    }
}


/* PLATFORM ADMIN PASSWORD LIFECYCLE | 2026-06-12 */
.password-page {
    min-height: calc(100vh - 96px);
    display: grid;
    place-items: start center;
}

.password-card {
    width: 100%;
    max-width: 620px;
    margin-top: 32px;
}

.password-alert {
    margin: 0 24px 20px;
}

.password-form {
    padding: 24px;
    display: grid;
    gap: 20px;
}

.password-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #334155;
    font-size: 13px;
    font-weight: 800;
}

.password-form input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid #d7dee8;
    border-radius: 11px;
    background: #ffffff;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
}

.password-form input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.password-form small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
}

@media (max-width: 680px) {
    .password-page {
        min-height: 0;
    }

    .password-card {
        margin-top: 0;
    }

    .password-form {
        padding: 18px;
    }

    .password-alert {
        margin: 0 18px 18px;
    }
}
