:root {
    --ew-navy: #0B2545;
    --ew-royal: #2563EB;
    --ew-sky: #38BDF8;
    --ew-ink: #0F172A;
    --ew-muted: #475569;
    --ew-bg: #F8FAFC;
    --ew-surface: #FFFFFF;
    --ew-border: #E2E8F0;
    --ew-success: #059669;
    --ew-danger: #DC2626;
    --ew-radius: 10px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--ew-bg);
    color: var(--ew-ink);
    line-height: 1.5;
}

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

h1,
h2,
h3 {
    margin: 0 0 0.5rem;
    line-height: 1.25;
}

p {
    margin: 0 0 0.75rem;
}

.ew-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.ew-muted {
    color: var(--ew-muted);
    font-size: 0.92rem;
}

.ew-mt {
    margin-top: 1rem;
}

.ew-mb {
    margin-bottom: 1rem;
}

.ew-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: inherit;
    font-weight: 700;
}

.ew-brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--ew-navy), var(--ew-royal));
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
}

.ew-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
}

.ew-btn-primary {
    background: var(--ew-royal);
    color: #FFFFFF;
}

.ew-btn-primary:hover {
    background: #1D4ED8;
}

.ew-btn-ghost {
    background: var(--ew-surface);
    color: var(--ew-ink);
    border-color: var(--ew-border);
}

.ew-btn-block {
    width: 100%;
}

.ew-card {
    background: var(--ew-surface);
    border: 1px solid var(--ew-border);
    border-radius: var(--ew-radius);
    padding: 1.1rem;
}

.ew-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.ew-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #EFF6FF;
    color: var(--ew-royal);
}

.ew-badge-trust {
    background: #ECFDF5;
    color: var(--ew-success);
}

.ew-alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.92rem;
}

.ew-alert-error {
    background: #FEF2F2;
    color: var(--ew-danger);
    border: 1px solid #FECACA;
}

.ew-alert-success {
    background: #ECFDF5;
    color: var(--ew-success);
    border: 1px solid #A7F3D0;
}

/* Public Layout */
.ew-pub-header {
    background: var(--ew-surface);
    border-bottom: 1px solid var(--ew-border);
}

.ew-pub-nav-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
}

.ew-pub-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.ew-pub-nav a.is-active {
    font-weight: 700;
    color: var(--ew-navy);
}

.ew-pub-main {
    padding: 1.75rem 1rem;
    min-height: calc(100vh - 140px);
}

.ew-pub-footer {
    border-top: 1px solid var(--ew-border);
    background: var(--ew-surface);
    padding: 1rem 0;
}

.ew-footer-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.88rem;
    color: var(--ew-muted);
}

.ew-footer-links {
    display: flex;
    gap: 1rem;
}

.ew-hero {
    padding: 2rem 0;
}

.ew-eyebrow {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ew-royal);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.ew-hero h1 {
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    color: var(--ew-navy);
    max-width: 780px;
}

.ew-lead {
    font-size: 1.05rem;
    color: var(--ew-muted);
    max-width: 680px;
}

.ew-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.1rem;
}

.ew-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.ew-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.ew-section-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

/* App Shell */
.ew-shell {
    display: flex;
    min-height: 100vh;
}

.ew-sidebar {
    width: 248px;
    background: var(--ew-navy);
    color: #F8FAFC;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-shrink: 0;
}

.ew-shell.is-collapsed .ew-sidebar {
    width: 72px;
}

.ew-shell.is-collapsed .ew-brand-text,
.ew-shell.is-collapsed .ew-org-switcher,
.ew-shell.is-collapsed .ew-nav-section {
    display: none;
}

.ew-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ew-icon-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    border-radius: 6px;
    min-width: 36px;
    min-height: 36px;
    cursor: pointer;
}

.ew-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.ew-nav-section {
    font-size: 0.72rem;
    text-transform: uppercase;
    color: #94A3B8;
    margin: 0.75rem 0 0.25rem;
    padding: 0 0.5rem;
}

.ew-nav-link {
    color: #CBD5E1;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    font-size: 0.9rem;
    display: block;
}

.ew-nav-link:hover,
.ew-nav-link.is-active {
    background: rgba(59, 130, 246, 0.22);
    color: #FFFFFF;
    font-weight: 600;
}

.ew-danger-link {
    color: #FCA5A5;
}

.ew-sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 0.5rem;
}

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

.ew-topbar {
    background: var(--ew-surface);
    border-bottom: 1px solid var(--ew-border);
    padding: 0.7rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.ew-topbar-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ew-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ew-content {
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
    padding: 1.25rem;
}

.ew-lang-bar {
    display: flex;
    gap: 0.25rem;
}

.ew-lang-pill {
    font-size: 0.75rem;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    border: 1px solid var(--ew-border);
    color: var(--ew-muted);
}

.ew-lang-pill.is-active {
    background: var(--ew-navy);
    color: #FFFFFF;
    border-color: var(--ew-navy);
}

.ew-user-chip {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ew-navy);
}

/* Forms & Tables */
.ew-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.ew-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

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

.ew-label-sm {
    font-size: 0.78rem;
    opacity: 0.85;
}

.ew-input,
.ew-select {
    width: 100%;
    min-height: 44px;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--ew-border);
    border-radius: 8px;
    font-size: 0.92rem;
    background: var(--ew-surface);
    color: var(--ew-ink);
}

.ew-input-color {
    width: 64px;
    height: 44px;
    border: 1px solid var(--ew-border);
    border-radius: 8px;
    padding: 2px;
    background: var(--ew-surface);
}

.ew-inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.ew-auth-wrap {
    display: flex;
    justify-content: center;
    padding: 2.5rem 0;
}

.ew-auth-card {
    max-width: 440px;
    width: 100%;
    text-align: center;
}

.ew-stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ew-stat-label {
    font-size: 0.82rem;
    color: var(--ew-muted);
}

.ew-stat-value {
    font-size: 1.6rem;
    color: var(--ew-navy);
}

.ew-bu-tile {
    padding: 0.8rem;
    border: 1px solid var(--ew-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.ew-empty-state {
    padding: 1.5rem;
    text-align: center;
    color: var(--ew-muted);
    border: 1px dashed var(--ew-border);
    border-radius: 8px;
}

.ew-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-inline-end: 0.4rem;
}

.ew-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.ew-table th,
.ew-table td {
    text-align: start;
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid var(--ew-border);
}

.ew-table th {
    font-size: 0.8rem;
    color: var(--ew-muted);
    text-transform: uppercase;
}

.ew-plan-card.is-featured {
    border-color: var(--ew-royal);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.08);
}

.ew-price-tag {
    margin: 0.8rem 0;
    font-size: 1.45rem;
    color: var(--ew-navy);
}

.ew-price-tag span {
    font-size: 0.88rem;
    color: var(--ew-muted);
    font-weight: 400;
}

.ew-list {
    margin: 0 0 1rem;
    padding-inline-start: 1.15rem;
    font-size: 0.9rem;
    color: var(--ew-muted);
}

@media (max-width: 1023.98px) {

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

    .ew-shell {
        flex-direction: column;
    }

    .ew-sidebar {
        width: 100%;
    }

    .ew-table {
        display: block;
        overflow-x: auto;
    }
}

.ew-id-card { display: flex; flex-direction: column; gap: 0.75rem; }
.ew-id-card-head { display: flex; align-items: center; gap: 0.75rem; }
.ew-avatar {
    width: 44px; height: 44px; border-radius: 50%; color: #FFFFFF;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; flex-shrink: 0;
}
.ew-avatar-lg { width: 64px; height: 64px; font-size: 1.25rem; margin: 0 auto 0.65rem; }
.ew-id-meta { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.88rem; text-align: start; }
.ew-id-meta span { color: var(--ew-muted); }
.ew-verify-card { max-width: 460px; width: 100%; text-align: center; }
.ew-verify-status {
    padding: 0.55rem 0.9rem; border-radius: 8px; font-weight: 700; margin-bottom: 1rem;
}
.ew-verify-status.is-valid { background: #ECFDF5; color: var(--ew-success); border: 1px solid #A7F3D0; }
.ew-verify-status.is-revoked { background: #FEF2F2; color: var(--ew-danger); border: 1px solid #FECACA; }
.ew-verify-profile { margin-bottom: 1rem; }
.ew-doc-body { font-size: 0.92rem; color: var(--ew-ink); }
.ew-toast-root { position: fixed; bottom: 1rem; inset-inline-end: 1rem; z-index: 999; display: flex; flex-direction: column; gap: 0.5rem; }

/* White-Label Branding & Dark Theme */
.ew-brand-logo-img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; background: #FFFFFF; flex-shrink: 0; }
.ew-verify-org-logo { max-height: 44px; max-width: 160px; object-fit: contain; margin: 0 auto; display: block; }
.ew-badge-alert { background: #FEF2F2; color: var(--ew-danger); }
.ew-input-sm { min-height: 36px; max-width: 110px; padding: 0.3rem 0.5rem; }
.ew-checklist-box { display: flex; flex-direction: column; gap: 0.4rem; }

body.ew-theme-dark {
    --ew-bg: #0B141E;
    --ew-surface: #152232;
    --ew-ink: #F8FAFC;
    --ew-muted: #CBD5E1;
    --ew-border: #2A3C52;
}
body.ew-theme-dark .ew-stat-value,
body.ew-theme-dark .ew-user-chip,
body.ew-theme-dark .ew-price-tag { color: #F8FAFC; }

/* EOS OrgChart */
.ew-tree-wrap { overflow-x: auto; }
.ew-tree-root, .ew-tree-children { list-style: none; padding-inline-start: 1.25rem; margin: 0.5rem 0; border-inline-start: 2px solid var(--ew-border); }
.ew-tree-root { border-inline-start: none; padding-inline-start: 0; }
.ew-tree-item { margin: 0.6rem 0; }
.ew-tree-card {
    display: inline-block; min-width: 240px; padding: 0.75rem 0.95rem;
    border: 1px solid var(--ew-border); border-radius: 10px; background: var(--ew-surface);
}
.ew-tree-card.is-me { border-color: #C9A961; box-shadow: 0 0 0 2px rgba(201, 169, 97, 0.25); }
.ew-tree-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; align-items: center; }

/* EOS Roadmap / Gantt */
.ew-gantt-list { display: flex; flex-direction: column; gap: 0.75rem; }
.ew-gantt-row { display: grid; grid-template-columns: 280px 1fr; gap: 1rem; align-items: center; }
.ew-gantt-track { position: relative; height: 30px; background: rgba(148, 163, 184, 0.14); border-radius: 8px; overflow: hidden; }
.ew-gantt-bar {
    position: absolute; top: 3px; height: 24px; border-radius: 6px;
    color: #FFFFFF; font-size: 0.75rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    padding: 0 0.4rem; white-space: nowrap;
}
body.ew-projection .ew-sidebar, body.ew-projection .ew-topbar { display: none !important; }
body.ew-projection .ew-content { max-width: none; }

@media (max-width: 1023.98px) {
    .ew-gantt-row { grid-template-columns: 1fr; }
}

@media print {
    @page { size: A3 landscape; }
    .ew-sidebar, .ew-topbar, .ew-no-print { display: none !important; }
    .ew-content { max-width: none; padding: 0; }
    .ew-id-card { break-inside: avoid; }
    .ew-gantt-bar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}