:root {
    --ink: #243044;
    --muted: #8b95a5;
    --line: #e6ebf2;
    --blue: #4f74b8;
    --green: #2f9d6a;
    --teal: #149a86;
    --paper: #f4f7fb;
    --shadow: 0 18px 50px rgba(30, 60, 100, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: "Segoe UI", "Avenir Next", "Helvetica Neue", sans-serif;
    line-height: 1.45;
    background:
        radial-gradient(circle at 18% 20%, rgba(226, 240, 252, 0.95), transparent 36%),
        radial-gradient(circle at 82% 12%, rgba(90, 140, 190, 0.55), transparent 32%),
        radial-gradient(circle at 70% 88%, rgba(180, 210, 230, 0.8), transparent 34%),
        #8eafcc;
}

body::before {
    content: "";
    position: fixed;
    inset: -40px;
    background:
        radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.35), transparent 28%),
        radial-gradient(circle at 75% 60%, rgba(40, 80, 130, 0.25), transparent 30%);
    filter: blur(18px);
    z-index: -1;
}

a { color: var(--blue); }

h1, h2, h3 {
    margin: 0;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.shell {
    width: calc(100% - 1.25rem);
    min-height: calc(100vh - 1.25rem);
    margin: 0.625rem auto;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 28px 70px rgba(24, 48, 82, 0.28);
    overflow: hidden;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.15rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--ink);
    text-decoration: none;
    font-size: 1.35rem;
}

.brand-mark { height: 36px; width: auto; flex: 0 0 auto; }

.app-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.75rem;
    min-width: 0;
}

.app-menu a {
    text-decoration: none;
    color: #4d5d73;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.42rem 0.8rem;
    border-radius: 999px;
    white-space: nowrap;
}

.app-menu a:hover { background: #f2f6fb; color: var(--ink); }

.app-menu a.is-active {
    background: #e7f0fd;
    color: var(--blue);
}

.logout {
    margin-left: auto;
    color: #6b7c92;
    text-decoration: none;
    font-size: 0.92rem;
    white-space: nowrap;
}

.logout:hover { color: var(--ink); }

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #5d6b80;
    font-size: 0.95rem;
    white-space: nowrap;
}

.avatar {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #f3c7b2;
    color: #6a3b32;
    font-size: 0.78rem;
    font-weight: 700;
}

.presence {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3cba6a;
    border: 2px solid #fff;
}

.welcome-bar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 0.55rem 1.2rem;
    border-top: 1px solid var(--line);
    color: #607089;
    font-size: 0.92rem;
}

.welcome-bar p {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
}

.welcome-bar svg { width: 16px; height: 16px; }

.welcome-note { color: #7d8da3; }

.shell-main:has(.hero) { padding-bottom: 1.5rem; }
.shell-main:not(:has(.hero)) { padding: 1.35rem 1.5rem 1.8rem; }

.hero {
    background: var(--blue);
    text-align: center;
    padding: 2.1rem 1.5rem 1.7rem;
}

.hero h1 {
    color: #fff;
    font-size: clamp(1.6rem, 3vw, 2rem);
    font-weight: 600;
    margin-bottom: 1rem;
}

.hero-search {
    width: min(920px, 100%);
    margin: 0 auto;
    display: flex;
    background: #fff;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(17, 42, 90, 0.15);
}

.hero-search input,
.hero-search select {
    border: 0;
    width: auto;
    background: #fff;
    padding: 0.75rem 0.9rem;
}

.hero-search input { flex: 1; min-width: 0; }
.hero-search select {
    flex: 0 0 9.5rem;
    border-left: 1px solid var(--line);
    color: #607089;
}

.hero-search .btn { border-radius: 0; padding: 0.75rem 1.15rem; }

.tile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.15rem;
    padding: 1.35rem 1.35rem 0.4rem;
}

.tile {
    background: #fff;
    border-radius: 6px;
    box-shadow: var(--shadow);
    min-height: 168px;
}

.tile-open {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    height: 100%;
    padding: 1.2rem 0.8rem 1.1rem;
}

.tile h2 { font-size: 1.05rem; }
.tile p { margin: 0; color: var(--muted); font-size: 0.92rem; }

.tile-icon {
    width: 64px;
    height: 52px;
    display: grid;
    place-items: center;
    margin-bottom: 0.35rem;
}

.tile-icon img { width: 42px; height: 42px; object-fit: contain; }

.logo-initials {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--blue);
}

.logo-frame {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    background: var(--paper);
    border-radius: 8px;
}

.logo-frame img { width: 42px; height: 42px; object-fit: contain; }
.logo-frame-lg { width: 84px; height: 84px; }
.logo-frame-lg img { width: 52px; height: 52px; }

.page-head, .sheet-head, .present-hero, .form-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.page-head { margin-bottom: 1.1rem; }
.sheet-head, .present-hero { justify-content: flex-start; margin-bottom: 1rem; }

.lede, .meta, .help, .empty { color: var(--muted); }
.eyebrow {
    margin: 0 0 0.25rem;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

label { display: grid; gap: 0.28rem; font-size: 0.92rem; }

input, textarea, select {
    font: inherit;
    color: inherit;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0.6rem 0.7rem;
    min-width: 0;
    width: 100%;
}

input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
    border: 1.5px solid #c5cede;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

input[type="checkbox"]:checked {
    background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5 6.5 11.5 12.5 4.5'/%3E%3C/svg%3E") center / 12px no-repeat;
    border-color: var(--blue);
}

input[type="checkbox"]:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--blue) 45%, white);
    outline-offset: 2px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem 1rem;
}

.form-grid-3 { grid-template-columns: 1.4fr 1fr 0.7fr; margin-bottom: 0.85rem; }

.form-page,
.solution-form { width: min(920px, 100%); margin-inline: auto; }

.solution-form .form-actions {
    justify-content: flex-start;
    margin-top: 0.4rem;
}

.form-card {
    background: #f7f9fc;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1rem 1.1rem 1.15rem;
    margin: 0 0 1rem;
}

.form-card h2 { font-size: 1.12rem; margin: 0 0 0.2rem; }
.form-card .help { margin: 0 0 0.85rem; }
.form-section { margin-top: 1.5rem; }
.form-section h2, .sheet h2, .present h2 { margin: 1.1rem 0 0.45rem; }

.solution-form label { font-weight: 600; color: #3d4c61; }
.solution-form .help-text { color: var(--muted); font-size: 0.84rem; margin-top: 0.25rem; }
.solution-form ul { list-style: none; padding: 0; margin: 0.25rem 0 0; color: #8d2430; font-size: 0.85rem; }

.account-fields {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 0.75rem 1rem;
}

.collection-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.steps-list { counter-reset: step; }

.step-item {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    counter-increment: step;
}

.step-mark {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #e7f0fd;
    color: var(--blue);
    font-size: 0.82rem;
    font-weight: 700;
}

.step-mark::before { content: counter(step); }

.btn-text {
    border: 0;
    background: transparent;
    color: #8d2430;
    padding: 0.2rem 0.15rem;
}

.temporary-password-card {
    border-color: #b7c9f2;
    background: #f4f8ff;
}

.copy-field,
.created-account dd {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    flex-wrap: wrap;
}

.copy-field input {
    flex: 1 1 16rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.created-account {
    margin: 0.9rem 0 0;
    display: grid;
    gap: 0.75rem;
}

.created-account dt {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.created-account dd { margin: 0; }

.created-account code {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.45rem 0.6rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.badge {
    display: inline-block;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.12rem 0.4rem;
    border-radius: 99px;
    background: var(--paper);
}
.badge-ready { color: var(--green); }
.badge-draft { color: #b7791f; }
.badge-archived { color: var(--muted); }

.account-list, .steps { margin: 0.2rem 0 0; padding-left: 1.1rem; }
.account-list li { margin-bottom: 0.65rem; }
.account-list span { display: block; color: var(--muted); }
.steps-lg li { margin: 0.45rem 0; }

.access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.9rem;
}

.access-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
    background: #fff;
    box-shadow: var(--shadow);
}
.access-card.is-open { border-color: var(--blue); }
.access-card h3 { margin-bottom: 0.35rem; }
.access-card code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: var(--paper);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}
.access-card dd { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin: 0 0 0.55rem; }
.access-card dt { font-size: 0.78rem; color: var(--muted); }

.btn {
    font: inherit;
    border: 0;
    border-radius: 3px;
    padding: 0.6rem 0.95rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    background: transparent;
    color: inherit;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-ghost { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.btn-soft {
    background: color-mix(in srgb, var(--blue) 10%, #fff);
    color: var(--blue);
    border: 1px solid color-mix(in srgb, var(--blue) 22%, #fff);
}
.btn-sm {
    padding: 0.38rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 8px;
}
.btn-danger {
    background: #fff;
    color: #b42318;
    border: 1px solid #f0c9c5;
}

.alert { padding: 0.7rem 0.9rem; border-radius: 6px; margin: 0 0 0.8rem; }
.shell-main:has(.hero) .alert { margin: 0.8rem 1.2rem; }
.alert-success { background: #e8f7ef; color: #176b45; }
.alert-warning { background: #fff4e8; color: #8a4b12; }
.alert-error { background: #fdecee; color: #8d2430; }

.login-split {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

.login-visual {
    display: grid;
    place-items: center;
    padding: 3rem;
    background: #274ee2;
}

.login-visual img {
    width: min(360px, 70%);
    height: auto;
}

.page-login .login-panel {
    max-width: none;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 8vw;
    background: #fff;
}

.page-login .login-panel h1 { margin-bottom: 0.35rem; font-size: 2rem; }
.page-login .login-panel form { display: grid; gap: 0.35rem; margin-top: 1.4rem; }
.page-login .login-panel .btn { justify-content: center; margin-top: 0.8rem; width: 100%; }

@media (max-width: 800px) {
    .login-split { grid-template-columns: 1fr; }
    .login-visual { min-height: 220px; padding: 1.75rem 1.25rem; }
    .page-login .login-panel { padding: 2rem 1.25rem 2.5rem; }
}

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 0.85rem 0.85rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table th { font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: #7a8798; font-weight: 700; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: #f8fbfe; }
.data-table th:last-child,
.data-table td:last-child { text-align: right; }
.cell-muted { color: var(--muted); }
.table-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 28px rgba(36, 48, 68, 0.05);
}
.table-card .data-table { margin: 0; }

.action-group {
    display: inline-flex;
    align-items: stretch;
    border-radius: 999px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 0 rgba(36, 48, 68, 0.04), 0 8px 20px rgba(36, 48, 68, 0.06);
    border: 1px solid #dce4ee;
}
.action-btn {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    white-space: nowrap;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    color: var(--ink);
    text-decoration: none;
    background: #fff;
    border: 0;
    border-right: 1px solid #dce4ee;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
}
.action-group .action-btn:last-child { border-right: 0; }
.action-btn svg {
    width: 14px !important;
    height: 14px !important;
    max-width: 14px;
    max-height: 14px;
    flex: 0 0 14px;
    display: block;
}
.action-btn:hover { background: #f3f7fc; }
.action-btn-accent {
    background: #274ee2;
    color: #fff;
}
.action-btn-accent:hover { background: #1e3fc4; color: #fff; }

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-end;
    white-space: nowrap;
}
.table-actions form { display: inline; }
.table-actions button.btn { font: inherit; }

.check-fieldset { border: 0; padding: 0; margin: 0.75rem 0 0; }
.check-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.check-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin: 0;
    padding: 0.7rem 0.85rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}
.check-row:hover { border-color: #b7c4d8; }
.check-row:has(input:checked) {
    border-color: color-mix(in srgb, var(--blue) 55%, #d9e2f2);
    background: color-mix(in srgb, var(--blue) 6%, #fff);
}
.check-row span { line-height: 1.25; }
.collection-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.85rem;
    margin: 0.7rem 0;
    display: grid;
    gap: 0.45rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.empty { padding: 1.2rem 1.4rem; }

@media (max-width: 900px) {
    .tile-grid { grid-template-columns: repeat(2, 1fr); }
    .welcome-bar { align-items: flex-start; flex-direction: column; gap: 0.25rem; }
    .topbar { flex-wrap: wrap; }
    .app-menu { order: 3; width: 100%; margin-left: 0; }
    .logout { margin-left: 0; }
}

@media (max-width: 640px) {
    .shell { width: calc(100% - 0.75rem); min-height: calc(100vh - 0.75rem); margin: 0.375rem auto; }
    .tile-grid, .form-grid, .form-grid-3, .account-fields, .step-item { grid-template-columns: 1fr; }
    .hero-search { flex-direction: column; }
    .hero-search select { border-left: 0; border-top: 1px solid var(--line); flex-basis: auto; }
}
