:root {
    --ink: #16313a;
    --ink-soft: #3d565d;
    --muted: #70838a;
    --line: #dce7e9;
    --line-strong: #c8d9dc;
    --surface: #ffffff;
    --surface-soft: #f7fafb;
    --bg: #f1f6f6;
    --nav: #092f39;
    --primary: #087f8c;
    --primary-dark: #076673;
    --primary-soft: #e7f7f7;
    --accent: #16b8a6;
    --blue: #2879d0;
    --violet: #7557d3;
    --amber: #c78419;
    --success: #087a55;
    --warning: #9a6509;
    --danger: #b64444;
    --shadow-sm: 0 4px 14px rgba(18, 62, 70, .06);
    --shadow: 0 18px 48px rgba(18, 62, 70, .09);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

button,
a {
    -webkit-tap-highlight-color: transparent;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    color: #fff;
    background: rgba(9, 47, 57, .97);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 7px 30px rgba(3, 28, 35, .16);
    backdrop-filter: blur(16px);
}

.topbar-inner {
    width: min(1320px, calc(100% - 40px));
    min-height: 74px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
    flex: 0 0 auto;
}

.brand-mark {
    position: relative;
    display: inline-flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    width: 39px;
    height: 39px;
    padding: 9px;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(145deg, #1ed0bb, #078ba1);
    box-shadow: 0 8px 20px rgba(8, 152, 160, .3);
}

.brand-mark::after {
    content: "";
    position: absolute;
    inset: -45% 45% 30% -25%;
    transform: rotate(28deg);
    background: rgba(255, 255, 255, .18);
}

.brand-mark span {
    z-index: 1;
    width: 5px;
    border-radius: 5px 5px 2px 2px;
    background: #fff;
}

.brand-mark span:nth-child(1) {
    height: 9px;
}

.brand-mark span:nth-child(2) {
    height: 16px;
}

.brand-mark span:nth-child(3) {
    height: 12px;
}

.brand-mark.large {
    width: 46px;
    height: 46px;
    padding: 10px;
    border-radius: 14px;
}

.brand-copy {
    display: grid;
    line-height: 1.15;
}

.brand-copy strong {
    font-size: 15px;
    letter-spacing: -.01em;
}

.brand-copy small {
    margin-top: 4px;
    color: #9bc2c8;
    font-size: 11px;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 3px;
}

.topbar nav > a {
    position: relative;
    padding: 10px 12px;
    border-radius: 9px;
    color: #c8dfe2;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
    transition: .18s ease;
}

.topbar nav > a:hover,
.topbar nav > a.active {
    color: #fff;
    background: rgba(255, 255, 255, .08);
}

.topbar nav > a.active::after {
    content: "";
    position: absolute;
    right: 12px;
    bottom: 4px;
    left: 12px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
}

.user-menu {
    min-height: 42px;
    margin-left: 10px;
    padding: 4px 7px 4px 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 12px;
    background: rgba(255, 255, 255, .055);
}

.user-avatar,
.person-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(145deg, #17b9a8, #11849a);
    font-weight: 800;
}

.user-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.user-name {
    max-width: 110px;
    overflow: hidden;
    display: grid;
    color: #e6f1f2;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-name small {
    margin-top: 3px;
    color: #8fb6bb;
    font-size: 9px;
    font-weight: 550;
}

.user-menu form {
    margin: 0;
}

.link-button {
    padding: 5px 6px;
    border: 0;
    color: #91b8bd;
    background: none;
    font-size: 12px;
    cursor: pointer;
}

.link-button:hover {
    color: #fff;
}

.nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px;
    background: rgba(255, 255, 255, .06);
}

.nav-toggle > span:not(.sr-only) {
    display: block;
    height: 2px;
    margin: 4px 0;
    border-radius: 2px;
    background: #fff;
}

.container {
    width: min(1240px, calc(100% - 40px));
    min-height: calc(100vh - 133px);
    margin: 0 auto;
    padding: 44px 0 72px;
}

.site-footer {
    width: min(1240px, calc(100% - 40px));
    margin: 0 auto;
    padding: 20px 0 26px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.eyebrow {
    color: var(--primary);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .16em;
    text-transform: uppercase;
}

h1 {
    margin: 7px 0 10px;
    font-size: clamp(30px, 4vw, 46px);
    font-weight: 780;
    line-height: 1.08;
    letter-spacing: -.045em;
}

h2 {
    margin: 0;
    font-size: 19px;
    letter-spacing: -.02em;
}

p {
    margin-top: 0;
}

.muted,
.page-heading p {
    color: var(--muted);
}

.small {
    font-size: 12px;
}

.page-heading {
    margin-bottom: 28px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.page-heading p {
    max-width: 690px;
    margin: 0;
    font-size: 15px;
}

.actions,
.form-actions > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.button {
    min-height: 43px;
    padding: 9px 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 11px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 750;
    line-height: 1;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

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

.button.primary {
    color: #fff;
    background: linear-gradient(135deg, #078895, #076c79);
    box-shadow: 0 8px 18px rgba(7, 127, 140, .18);
}

.button.primary:hover {
    background: linear-gradient(135deg, #087985, #055a66);
    box-shadow: 0 10px 24px rgba(7, 127, 140, .24);
}

.button.secondary {
    color: var(--primary-dark);
    border-color: #b9dddd;
    background: #edf9f8;
}

.button.secondary:hover {
    background: #e1f4f3;
}

.button.ghost {
    color: var(--ink-soft);
    border-color: var(--line-strong);
    background: #fff;
}

.button.excel {
    color: #126d4f;
    border-color: #b7dfd0;
    background: #edf9f4;
}

.button.danger {
    color: #fff;
    background: #b94040;
}

.button.danger:hover {
    background: #a43131;
}

.button.danger-ghost {
    color: #a63838;
    border-color: #ecc5c5;
    background: #fff5f5;
}

.button.danger-ghost:hover {
    background: #feeaea;
}

.button:disabled {
    transform: none;
    opacity: .48;
    cursor: not-allowed;
    box-shadow: none;
}

.button.wide {
    width: 100%;
}

.card,
.stat-card {
    border: 1px solid rgba(202, 220, 223, .88);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.card {
    padding: 25px;
}

.stack {
    display: grid;
    gap: 18px;
}

label {
    display: grid;
    gap: 7px;
    color: #2c484f;
    font-size: 12px;
    font-weight: 750;
}

label small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cbdadd;
    border-radius: 10px;
    outline: none;
    color: var(--ink);
    background: #fff;
    transition: border .15s ease, box-shadow .15s ease, background .15s ease;
}

textarea {
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #9aabb0;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #19a2ab;
    box-shadow: 0 0 0 4px rgba(14, 139, 149, .11);
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 600;
}

.checkbox input {
    width: 17px;
    min-height: 17px;
    accent-color: var(--primary);
}

.alert {
    margin-bottom: 22px;
    padding: 14px 17px;
    border: 1px solid;
    border-radius: 13px;
    box-shadow: var(--shadow-sm);
}

.alert ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.alert.success {
    color: #076044;
    border-color: #a9dfcb;
    background: #ebfbf4;
}

.alert.error {
    color: #8a3030;
    border-color: #edbebe;
    background: #fff2f2;
}

.alert.warning {
    color: #79500a;
    border-color: #ead293;
    background: #fff9e9;
}

/* Authentication */
.auth-body {
    background:
        radial-gradient(circle at 10% 15%, rgba(21, 184, 166, .12), transparent 28%),
        radial-gradient(circle at 90% 85%, rgba(21, 125, 143, .11), transparent 30%),
        #eff5f5;
}

.auth-container {
    width: 100%;
    min-height: 100vh;
    padding: 34px;
    display: grid;
    place-items: center;
}

.auth-shell {
    width: min(1080px, 100%);
    min-height: 660px;
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    overflow: hidden;
    border: 1px solid rgba(190, 211, 214, .75);
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 35px 90px rgba(20, 65, 72, .14);
}

.auth-aside {
    position: relative;
    padding: 48px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    background:
        linear-gradient(145deg, rgba(9, 47, 57, .98), rgba(6, 91, 101, .96)),
        var(--nav);
}

.auth-aside::before,
.auth-aside::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .09);
}

.auth-aside::before {
    right: -140px;
    bottom: -180px;
    width: 480px;
    height: 480px;
    box-shadow: 0 0 0 60px rgba(255, 255, 255, .025), 0 0 0 120px rgba(255, 255, 255, .018);
}

.auth-aside::after {
    top: 140px;
    left: -210px;
    width: 380px;
    height: 380px;
}

.auth-aside > * {
    position: relative;
    z-index: 1;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 13px;
    font-size: 16px;
    font-weight: 800;
}

.auth-kicker {
    display: block;
    margin-bottom: 14px;
    color: #6ee7d8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .17em;
    text-transform: uppercase;
}

.auth-aside h2 {
    max-width: 450px;
    margin-bottom: 18px;
    font-size: clamp(34px, 4vw, 50px);
    font-weight: 760;
    line-height: 1.05;
    letter-spacing: -.045em;
}

.auth-aside p {
    max-width: 450px;
    color: #bdd5d8;
    font-size: 15px;
    line-height: 1.7;
}

.auth-trust {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.auth-trust span {
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 999px;
    color: #cbe0e2;
    background: rgba(255, 255, 255, .05);
    font-size: 10px;
    font-weight: 650;
}

.auth-card {
    padding: 56px 52px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-card h1 {
    font-size: clamp(34px, 4vw, 45px);
}

.auth-card > .muted {
    margin-bottom: 28px;
}

.security-note {
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.password-match {
    min-height: 16px;
    color: var(--muted);
    transition: color .15s ease;
}

.password-match.valid {
    color: var(--success);
    font-weight: 700;
}

.password-match.invalid {
    color: var(--danger);
    font-weight: 700;
}

.password-toggle {
    width: max-content;
    margin-top: 18px;
}

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

.permission-card {
    padding: 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f9fbfb;
    cursor: pointer;
}

.permission-card:has(input:checked) {
    border-color: #9fd6d2;
    background: #effaf8;
    box-shadow: 0 0 0 3px rgba(14, 139, 149, .07);
}

.permission-card input {
    width: 18px;
    min-height: 18px;
    margin-top: 2px;
    accent-color: var(--primary);
}

.permission-card span {
    display: grid;
    gap: 3px;
}

.permission-card strong {
    font-size: 13px;
}

.permission-card small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
}

.self-access-note {
    margin: 14px 0 0;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    padding: 20px;
    place-items: center;
    background: rgba(4, 31, 37, .6);
    backdrop-filter: blur(6px);
}

.modal-backdrop:not([hidden]) {
    display: grid;
}

.modal-card {
    width: min(470px, 100%);
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(4, 31, 37, .28);
}

.modal-card h2 {
    margin: 15px 0 8px;
    font-size: 24px;
}

.modal-card > p {
    margin-bottom: 22px;
    color: var(--muted);
}

.modal-icon {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    font-size: 20px;
    font-weight: 900;
}

.modal-icon.danger {
    color: #a43131;
    background: #fee8e8;
}

.modal-actions {
    margin-top: 22px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Dashboard */
.stats-grid {
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.stat-card {
    min-height: 112px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 12px;
    font-size: 20px;
    font-weight: 800;
}

.stat-icon.teal {
    color: #08766e;
    background: #dff7f3;
}

.stat-icon.blue {
    color: var(--blue);
    background: #e8f2fd;
}

.stat-icon.violet {
    color: var(--violet);
    background: #f0ecfd;
}

.stat-icon.amber {
    color: var(--amber);
    background: #fff4df;
}

.stat-card div {
    display: grid;
}

.stat-card strong {
    font-size: 26px;
    line-height: 1.1;
    letter-spacing: -.03em;
}

.stat-card div span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.records-card {
    padding: 0;
    overflow: hidden;
}

.card-heading {
    padding: 22px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--line);
}

.card-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.search-bar {
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
}

.search-input {
    position: relative;
    width: min(520px, 100%);
}

.search-input span {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-52%);
    color: #7e9297;
    font-size: 20px;
}

.search-input input {
    padding-left: 41px;
    background: #fff;
}

.clear-link {
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    padding: 12px 18px;
    color: #6c8086;
    background: #fbfdfd;
    border-bottom: 1px solid var(--line);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

td {
    padding: 15px 18px;
    border-bottom: 1px solid #edf2f3;
    white-space: nowrap;
}

tbody tr {
    transition: background .15s ease;
}

tbody tr:hover {
    background: #f7fbfb;
}

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

.row-number {
    color: #889a9f;
    font-size: 11px;
    font-weight: 700;
}

.person-cell {
    display: flex;
    align-items: center;
    gap: 11px;
}

.person-avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 12px;
}

.person-cell div {
    display: grid;
}

.person-cell strong {
    max-width: 260px;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
}

.person-cell small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.mono {
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 12px;
}

.status {
    padding: 5px 9px;
    display: inline-flex;
    border-radius: 999px;
    color: #536d74;
    background: #edf3f4;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .04em;
}

.status.new {
    color: #087058;
    background: #e5f8f1;
}

.status.admin {
    color: #6546bd;
    background: #f0ebfd;
}

.status.inactive {
    color: #8b5d12;
    background: #fff3db;
}

.row-action {
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
}

.records-tools,
.table-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.records-tools {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.table-actions form {
    margin: 0;
}

.text-danger {
    padding: 0;
    border: 0;
    color: #b43d3d;
    background: none;
    font-size: 11px;
    font-weight: 750;
    cursor: pointer;
}

.text-danger:hover {
    text-decoration: underline;
}

.selection-cell {
    width: 42px;
    text-align: center;
}

.selection-cell input {
    width: 16px;
    min-height: 16px;
    margin: 0;
    accent-color: var(--primary);
}

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

.empty-icon {
    width: 46px;
    height: 46px;
    margin: 0 auto 12px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 24px;
}

.empty strong {
    display: block;
    color: var(--ink);
    font-size: 16px;
}

.empty p {
    margin: 6px 0 17px;
}

.pagination {
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.pagination a {
    color: var(--primary);
    font-weight: 750;
    text-decoration: none;
}

/* Import workflow */
.step-badge,
.review-badge {
    padding: 8px 12px;
    border: 1px solid #b9ddda;
    border-radius: 999px;
    color: #0c736d;
    background: #e9f8f5;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.privacy-banner {
    margin-bottom: 22px;
    padding: 15px 18px;
    display: flex;
    align-items: center;
    gap: 13px;
    border: 1px solid #c6dce7;
    border-radius: 14px;
    background: linear-gradient(90deg, #f0f9fc, #f8fcfd);
}

.privacy-banner p {
    margin: 2px 0 0;
    color: #617981;
    font-size: 11px;
}

.privacy-icon {
    width: 35px;
    height: 35px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 10px;
    color: #187b94;
    background: #dceff5;
    font-size: 20px;
}

.workflow-progress {
    max-width: 570px;
    margin: 0 auto 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.workflow-progress div {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #49656b;
    font-size: 10px;
}

.workflow-progress span {
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--primary);
    font-weight: 800;
}

.workflow-progress i {
    width: 54px;
    height: 1px;
    margin: 0 10px;
    background: #bdd4d7;
}

.workflow-grid {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    gap: 20px;
    align-items: start;
}

.workflow-card {
    padding: 25px;
}

.step-title {
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 16px;
    font-weight: 800;
}

.step-title > span {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 10px;
    color: #08756e;
    background: #dff6f2;
    font-size: 12px;
}

.step-title div {
    display: grid;
}

.step-title small {
    margin-top: 1px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
}

.step-title.compact {
    margin: 7px 0 2px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.code-area {
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 11px;
    line-height: 1.55;
    background: #f7fafb;
}

#prompt {
    margin-bottom: 12px;
}

.payload-area {
    min-height: 250px;
}

.payload-meta {
    margin-top: -8px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    color: var(--muted);
    font-size: 10px;
}

/* Review form */
.review-guide {
    margin-bottom: 20px;
    padding: 16px 20px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #fff;
}

.review-guide div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.review-guide span {
    width: 29px;
    height: 29px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 9px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 11px;
    font-weight: 850;
}

.review-guide p {
    margin: 0;
    color: var(--muted);
    font-size: 10px;
}

.review-guide strong {
    display: block;
    color: var(--ink);
    font-size: 11px;
}

.form-section {
    padding: 27px;
}

.section-heading {
    margin-bottom: 23px;
    padding-bottom: 17px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}

.section-heading > span {
    width: 37px;
    height: 37px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 11px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 10px;
    font-weight: 850;
}

.section-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.form-grid {
    display: grid;
    gap: 18px;
}

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

.form-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.span-two {
    grid-column: span 2;
}

.span-three {
    grid-column: span 3;
}

.economy-summary {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #f8fbfb;
}

.economy-summary div {
    padding: 15px 17px;
    display: grid;
    border-right: 1px solid var(--line);
}

.economy-summary div:last-child {
    border-right: 0;
}

.economy-summary span,
.economy-summary small {
    color: var(--muted);
    font-size: 9px;
}

.economy-summary strong {
    margin: 3px 0;
    font-size: 16px;
}

.economy-summary .negative strong,
.economy-summary .negative small {
    color: var(--danger);
}

.field-muted {
    opacity: .48;
}

details {
    margin-top: 18px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f7fafb;
}

summary {
    font-weight: 750;
    cursor: pointer;
}

pre {
    white-space: pre-wrap;
}

.form-actions {
    position: sticky;
    bottom: 14px;
    z-index: 20;
    padding: 13px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border: 1px solid rgba(203, 220, 222, .9);
    border-radius: 15px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 14px 36px rgba(22, 67, 74, .13);
    backdrop-filter: blur(12px);
}

.save-hint {
    color: var(--muted);
    font-size: 10px;
}

.save-hint b {
    color: var(--danger);
}

@media (max-width: 1100px) {
    .topbar-inner {
        width: min(100% - 28px, 1240px);
    }

    .topbar nav > a {
        padding-inline: 9px;
    }

    .user-name {
        display: none;
    }

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

@media (max-width: 860px) {
    .topbar-inner {
        min-height: 66px;
    }

    .nav-toggle {
        display: block;
    }

    .topbar nav {
        position: absolute;
        top: calc(100% + 1px);
        right: 14px;
        left: 14px;
        padding: 12px;
        display: none;
        align-items: stretch;
        flex-direction: column;
        border: 1px solid rgba(255, 255, 255, .08);
        border-radius: 0 0 15px 15px;
        background: #0a3641;
        box-shadow: 0 18px 35px rgba(3, 28, 35, .2);
    }

    .topbar nav.open {
        display: flex;
    }

    .topbar nav > a {
        padding: 11px 12px;
    }

    .topbar nav > a.active::after {
        top: 8px;
        right: auto;
        bottom: 8px;
        left: 3px;
        width: 2px;
        height: auto;
    }

    .user-menu {
        margin: 5px 0 0;
    }

    .user-name {
        display: grid;
        max-width: none;
    }

    .user-menu form {
        margin-left: auto;
    }

    .auth-container {
        padding: 20px;
    }

    .auth-shell {
        min-height: auto;
        grid-template-columns: 1fr;
    }

    .auth-aside {
        min-height: 260px;
        padding: 32px;
    }

    .auth-aside > div:nth-child(2) {
        margin-top: 35px;
    }

    .auth-aside h2 {
        max-width: 600px;
        margin-bottom: 8px;
        font-size: 31px;
    }

    .auth-aside p {
        margin-bottom: 0;
    }

    .auth-trust {
        display: none;
    }

    .auth-card {
        padding: 38px 32px;
    }

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

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

    .span-three {
        grid-column: span 2;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(100% - 28px, 1240px);
        padding: 28px 0 52px;
    }

    .site-footer {
        width: min(100% - 28px, 1240px);
        flex-direction: column;
        gap: 4px;
    }

    .brand-copy small {
        display: none;
    }

    h1 {
        font-size: 33px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .actions {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .actions .button {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        min-height: 116px;
        padding: 15px;
        align-items: flex-start;
        flex-direction: column;
        gap: 9px;
    }

    .stat-icon {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    .stat-card strong {
        font-size: 23px;
    }

    .card-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .card-heading .button {
        width: 100%;
    }

    .records-tools {
        width: 100%;
        justify-content: stretch;
    }

    .records-tools .button {
        flex: 1 1 auto;
    }

    .search-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .search-input {
        width: 100%;
    }

    .workflow-progress {
        justify-content: space-between;
    }

    .workflow-progress strong {
        display: none;
    }

    .workflow-progress i {
        flex: 1;
    }

    .privacy-banner {
        align-items: flex-start;
    }

    .payload-meta {
        flex-direction: column;
        gap: 3px;
    }

    .review-guide {
        grid-template-columns: 1fr;
        gap: 11px;
    }

    .form-grid.two,
    .form-grid.three {
        grid-template-columns: 1fr;
    }

    .span-two,
    .span-three {
        grid-column: auto;
    }

    .economy-summary {
        grid-template-columns: 1fr;
    }

    .economy-summary div {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .economy-summary div:last-child {
        border-bottom: 0;
    }

    .form-actions {
        bottom: 8px;
        align-items: stretch;
        flex-direction: column;
    }

    .form-actions > div {
        display: grid;
        grid-template-columns: .8fr 1.2fr;
    }

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

    .responsive-table {
        padding: 12px;
        overflow: visible;
        background: #f5f9f9;
    }

    .responsive-table table,
    .responsive-table tbody,
    .responsive-table tr,
    .responsive-table td {
        display: block;
        width: 100%;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table tbody {
        display: grid;
        gap: 12px;
    }

    .responsive-table tr {
        position: relative;
        padding: 16px;
        overflow: hidden;
        border: 1px solid var(--line);
        border-radius: 15px;
        background: #fff;
        box-shadow: var(--shadow-sm);
    }

    .responsive-table td {
        padding: 7px 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 18px;
        border: 0;
        white-space: normal;
        text-align: right;
    }

    .responsive-table td[data-label]::before {
        content: attr(data-label);
        flex: 0 0 auto;
        color: var(--muted);
        font-size: 9px;
        font-weight: 800;
        letter-spacing: .07em;
        text-transform: uppercase;
    }

    .responsive-table .selection-cell {
        position: absolute;
        top: 14px;
        right: 14px;
        z-index: 2;
        width: auto;
        padding: 0;
    }

    .responsive-table .person-cell {
        width: 100%;
        padding-right: 30px;
        text-align: left;
    }

    .responsive-table .person-cell div {
        min-width: 0;
    }

    .responsive-table .person-cell strong {
        white-space: normal;
    }

    .responsive-table .table-actions {
        margin: 8px -16px -16px;
        padding: 13px 16px;
        display: flex;
        justify-content: flex-end;
        border-top: 1px solid var(--line);
        background: #f9fbfb;
    }

    .responsive-table .empty {
        display: block;
        padding: 42px 20px;
        text-align: center;
    }

    .modal-actions {
        display: grid;
        grid-template-columns: .8fr 1.2fr;
    }

    .auth-container {
        padding: 0;
        align-items: stretch;
    }

    .auth-shell {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
    }

    .auth-aside {
        min-height: 225px;
        padding: 25px;
    }

    .auth-aside > div:nth-child(2) {
        margin-top: 28px;
    }

    .auth-aside h2 {
        font-size: 27px;
    }

    .auth-aside p {
        display: none;
    }

    .auth-card {
        padding: 34px 25px 45px;
    }
}
