/* SMARTIE self-service portal shared shell and design tokens.
 * Dependency-free: system fonts and CSS-only surfaces, no external assets. */

:root {
    color-scheme: dark;
    --bg: #080d16;
    --card: #151d2b;
    --surface-raised: #141c2a;
    --surface-subtle: #101724;
    --text: #e8edf7;
    --text-strong: #f6f8fc;
    --muted: #9aa6ba;
    --accent: #7fa4f7;
    --accent-strong: #638ce8;
    --focus: #a9c1ff;
    --ok: #6edf89;
    --err: #ff8a8a;
    --border: #273247;
    --border-strong: #35435d;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input { font: inherit; }

button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 3px;
}

.portal-page {
    background:
        radial-gradient(circle at 9% 3%, rgba(76, 112, 194, 0.18), transparent 34rem),
        radial-gradient(circle at 94% 88%, rgba(64, 174, 157, 0.07), transparent 32rem),
        var(--bg);
}

#app {
    width: 100%;
    max-width: 468px;
    margin: 0 auto;
    padding: 28px;
}

.portal-page #app {
    max-width: 1220px;
    padding: clamp(20px, 4vw, 48px);
}

.card,
.portal-panel {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.2);
}

.card {
    max-width: 440px;
    margin: min(15vh, 120px) auto 0;
    padding: 28px;
}

.card + .card { margin-top: 16px; }

.card h1,
.portal-panel h1,
.team-workspace h2 {
    margin: 0;
    color: var(--text-strong);
    font-weight: 730;
    letter-spacing: -0.02em;
}

.card h1 { margin-bottom: 16px; font-size: 21px; }

.btn {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    font-weight: 670;
}

.btn:hover { border-color: #617499; }

.btn-primary {
    border-color: var(--accent-strong);
    background: linear-gradient(145deg, #759cf3, #587fd7);
    color: #07101f;
}

.card .btn-primary { width: 100%; margin-top: 8px; }

#otp input {
    width: 100%;
    min-height: 48px;
    margin-bottom: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: #0b111c;
    color: var(--text);
    font-size: 18px;
    letter-spacing: 4px;
    text-align: center;
}

.error {
    margin: 0 0 12px;
    color: var(--err);
    font-size: 13px;
}

.notice {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 13px;
}

.muted { color: var(--muted); }

.linklike {
    min-height: 34px;
    padding: 6px 4px;
    border: 0;
    background: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 13px;
    font-weight: 650;
}

.linklike:hover { color: #b7caff; }
.linklike:disabled { color: var(--muted); cursor: default; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.portal-shell { width: 100%; }

.portal-header {
    display: flex;
    min-height: 56px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
    padding: 0 4px;
}

.portal-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-strong);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.17em;
    text-decoration: none;
}

.portal-brand__mark {
    display: inline-grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid rgba(166, 193, 255, 0.5);
    border-radius: 11px;
    background: linear-gradient(145deg, #9dbaff, #6289e8);
    color: #07101e;
    font-size: 17px;
    letter-spacing: 0;
}

.portal-header__workspace {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--muted);
    font-size: 13px;
}

.portal-signout { min-height: 40px; padding-inline: 9px; }

.portal-panel { padding: clamp(20px, 3vw, 30px); }

.portal-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.portal-section-heading h1 { font-size: 20px; }

.portal-eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.portal-download { flex: 0 0 auto; }

.credentials-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.credential-item {
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-subtle);
}

.credential-item .k {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 680;
}

.credential-item .v {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    overflow-wrap: anywhere;
    color: var(--text-strong);
    font-size: 13px;
}

.credential-actions { display: inline-flex; flex: 0 0 auto; gap: 5px; }
.pw-mask { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 2px; }

.team-workspace { margin-top: 34px; }

.team-workspace__heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 18px;
}

.team-workspace h2 { font-size: clamp(22px, 3vw, 30px); }

.team-workspace__heading > div:first-child > p:last-child {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.team-metrics {
    display: flex;
    flex: 0 0 auto;
    gap: 10px;
}

.team-metrics > div {
    min-width: 140px;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(17, 24, 37, 0.75);
}

.team-metrics span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 680;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.team-metrics strong {
    display: block;
    margin-top: 5px;
    color: var(--text-strong);
    font-size: 17px;
}

.team-readonly {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-subtle);
}

.invite-form {
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-subtle);
}

.invite-form__heading {
    margin: 0 0 10px;
    color: var(--text-strong);
    font-size: 14px;
    font-weight: 650;
}

.invite-form__row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.invite-form__row input[type="email"] {
    flex: 1 1 220px;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    outline: none;
    background: #090f1b;
    color: var(--text);
    font: inherit;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.invite-form__row input[type="email"]:hover { border-color: var(--accent); }
.invite-form__row input[type="email"]:focus {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 3px rgba(111, 152, 246, 0.18);
}

.invite-form__row select {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 9px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: #090f1b;
    color: var(--text);
    font: inherit;
}

.invite-form__submit { flex: 0 0 auto; width: auto; margin-top: 0; min-height: 42px; padding-inline: 16px; }

.invite-form .error,
.invite-form .notice { margin: 10px 0 0; }

@media (max-width: 460px) {
    .invite-form__row { flex-direction: column; }
    .invite-form__row input[type="email"],
    .invite-form__row select,
    .invite-form__submit { width: 100%; }
}

@media (max-width: 760px) {
    #app,
    .portal-page #app { padding: 18px; }
    .portal-header { align-items: flex-start; }
    .portal-header__workspace { align-items: flex-end; flex-direction: column; gap: 2px; text-align: right; }
    .portal-section-heading,
    .team-workspace__heading { align-items: stretch; flex-direction: column; }
    .credentials-grid { grid-template-columns: 1fr; }
    .portal-download { width: 100%; }
    .team-metrics { width: 100%; }
    .team-metrics > div { flex: 1 1 0; min-width: 0; }
}

@media (max-width: 460px) {
    .portal-page #app { padding: 14px; }
    .portal-header__workspace > span { display: none; }
    .portal-panel { padding: 18px; }
    .team-metrics { flex-direction: column; }
    .credential-item .v { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; }
}
