:root {
    color-scheme: light;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #14293d;
    background: #f5f7fb;
    font-synthesis: none;
    --ink: #14293d;
    --muted: #4f6276;
    --line: #d8e1eb;
    --surface: #fff;
    --action: #075d9c;
    --action-hover: #064a79;
    --danger: #a42a28;
    --radius: 0.85rem;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    line-height: 1.55;
}

a {
    color: var(--action);
    text-underline-offset: 0.18em;
}

button, input, textarea, select {
    font: inherit;
}

:focus-visible {
    outline: 3px solid #1374b5;
    outline-offset: 3px;
}

h1, h2, h3, p {
    margin-top: 0;
}

h1, h2, h3 {
    line-height: 1.16;
    letter-spacing: -0.025em;
}

h1 {
    margin-bottom: 0.6rem;
    font-size: clamp(1.85rem, 4vw, 2.7rem);
}

h2 {
    margin-bottom: 0.65rem;
    font-size: 1.35rem;
}

h3 {
    margin-bottom: 0.45rem;
    font-size: 1.05rem;
}

p {
    margin-bottom: 1rem;
}

form {
    margin: 0;
}

.skip-link {
    position: absolute;
    z-index: 1;
    top: 0.3rem;
    left: 0.3rem;
    max-width: calc(100% - 0.6rem);
    padding: 0.5rem 0.75rem;
    transform: translateY(-150%);
    background: #fff;
    border-radius: 0.25rem;
}

.skip-link:focus {
    transform: none;
}

.site-header {
    color: #eff7ff;
    background: #152e45;
    border-bottom: 3px solid #e7b834;
}

.site-header :focus-visible {
    outline-color: #92daf7;
}

.header-inner {
    display: flex;
    width: min(100% - 2rem, 76rem);
    min-height: 4.5rem;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem 1.5rem;
    margin: 0 auto;
    padding: 0.55rem 0;
}

.brand {
    color: inherit;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.055em;
    text-decoration: none;
}

.primary-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem 0.45rem;
}

.primary-nav a, .header-button {
    display: inline-flex;
    min-height: 2.55rem;
    align-items: center;
    padding: 0.5rem 0.7rem;
    color: inherit;
    border: 1px solid transparent;
    border-radius: 0.4rem;
    font-size: 0.93rem;
    font-weight: 650;
    text-decoration: none;
}

.primary-nav a:hover, .primary-nav a[aria-current="page"], .header-button:hover {
    background: #274861;
}

.header-button {
    cursor: pointer;
    background: transparent;
    border-color: #5e778c;
}

.header-account {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    margin-left: auto;
}

.account-name {
    max-width: 14rem;
    overflow-wrap: anywhere;
    color: #d6e6f2;
    font-size: 0.9rem;
}

.main-shell {
    width: min(100% - 2rem, 76rem);
    margin: 0 auto;
    padding: clamp(1.6rem, 5vw, 3.6rem) 0 4rem;
}

.narrow {
    max-width: 50rem;
    margin-right: auto;
    margin-left: auto;
}

.auth-shell {
    max-width: 30rem;
    margin: clamp(0.5rem, 5vw, 4rem) auto 0;
}

.panel {
    min-width: 0;
    padding: clamp(1rem, 3vw, 1.75rem);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.auth-shell .panel {
    padding: clamp(1.2rem, 5vw, 2rem);
    box-shadow: 0 18px 48px -32px #203b62;
}

.narrow > .panel + .panel {
    margin-top: 1rem;
}

.auth-shell h1 {
    font-size: clamp(1.65rem, 6vw, 2.05rem);
}

.stack {
    display: grid;
    gap: 1rem;
}

.stack > :last-child, .panel > :last-child, .page-heading > :last-child {
    margin-bottom: 0;
}

.page-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.8rem 1.5rem;
    margin-bottom: 1.5rem;
}

.page-heading p {
    margin-bottom: 0;
}

.muted, .hint {
    color: var(--muted);
}

.hint {
    margin: 0.2rem 0 0;
    font-size: 0.88rem;
}

.notice {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: #e8f3fb;
    border: 1px solid #add0e9;
    border-radius: 0.55rem;
    overflow-wrap: anywhere;
}

.notice-success {
    color: #1c4a35;
    background: #eaf6ee;
    border-color: #afd9bf;
}

.notice-error {
    color: #791e1e;
    background: #fff1ee;
    border-color: #e7b7ae;
}

.label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 700;
}

.input {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.52rem 0.7rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid #a6b6c7;
    border-radius: 0.45rem;
}

textarea.input {
    min-height: 9rem;
    resize: vertical;
}

.form-grid {
    display: grid;
    gap: 1rem;
}

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

.toolbar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.toolbar .field {
    flex: 1 1 14rem;
    min-width: 0;
}

.toolbar .field-compact {
    flex-basis: 10rem;
    flex-grow: 0;
}

.button {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    color: #fff;
    background: var(--action);
    border: 1px solid var(--action);
    border-radius: 0.45rem;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
}

.button:hover {
    background: var(--action-hover);
    border-color: var(--action-hover);
}

.button-secondary {
    color: var(--action);
    background: #fff;
    border-color: #a7bed5;
}

.button-secondary:hover {
    background: #e9f3fa;
    border-color: #7b9ab8;
}

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

.button-danger:hover {
    background: #842120;
    border-color: #842120;
}

.button-small {
    min-height: 2.3rem;
    padding: 0.3rem 0.65rem;
    font-size: 0.875rem;
}

.actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem 0.9rem;
}

.table-shell {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.record-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.record-table th, .record-table td {
    padding: 0.75rem 0.95rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    overflow-wrap: anywhere;
}

.record-table th {
    color: #304b63;
    background: #edf3fa;
    font-size: 0.9rem;
}

.record-table tbody tr:last-child td {
    border-bottom: 0;
}

.record-table .action-cell {
    min-width: 7rem;
    text-align: right;
}

.empty {
    padding: 1.25rem;
    margin: 0;
    color: var(--muted);
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    margin-top: 1rem;
}

.pagination p {
    margin: 0;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.45rem;
    cursor: pointer;
}

.checkbox input {
    flex: none;
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    accent-color: var(--action);
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
    gap: 0 1rem;
}

fieldset {
    min-width: 0;
    margin: 0;
    padding: 0.75rem 1rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
}

legend {
    padding: 0 0.35rem;
    font-weight: 700;
}

.delete-panel {
    border-color: #e7b7ae;
}

summary {
    cursor: pointer;
    color: var(--action);
    font-weight: 650;
}

details form {
    margin-top: 0.55rem;
}

details form .hint {
    margin-bottom: 0.5rem;
}

.account-actions {
    min-width: 7.5rem;
    gap: 0.55rem;
}

.single-use {
    display: block;
    padding: 0.5rem 0.75rem;
    background: #edf3fa;
    border: 1px solid var(--line);
    border-radius: 0.45rem;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    user-select: all;
}

.mfa-image {
    display: block;
    width: min(100%, 13rem);
    height: auto;
    margin: 0.65rem auto;
}

@media (max-width: 42rem) {
    .columns {
        grid-template-columns: 1fr;
    }

    .header-account {
        margin-left: 0;
    }

    .record-table th, .record-table td {
        padding: 0.6rem 0.7rem;
    }
}
