:root {
    --navy: #102338;
    --blue: #1459d9;
    --cyan: #43c6d7;
    --ink: #172333;
    --muted: #64748b;
    --line: #dfe6ee;
    --paper: #ffffff;
    --canvas: #f1f5f9;
    --danger: #b42318;
    --success: #16825d;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 85% 5%, rgba(67, 198, 215, .15), transparent 24rem),
        linear-gradient(150deg, #edf3f8, #f8fafc 55%, #eef5f7);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    min-height: 100vh;
}

.page-shell { width: min(940px, calc(100% - 32px)); margin: 0 auto; padding: 56px 0 28px; }
.admin-shell { width: min(1180px, calc(100% - 32px)); }
.hero, .admin-header { display: flex; align-items: center; gap: 20px; margin-bottom: 28px; }
.hero h1, .admin-header h1, .login-card h1 { margin: 2px 0 7px; font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: -.045em; color: var(--navy); }
.hero p, .admin-header p { margin: 0; color: var(--muted); }
.brand-mark {
    display: grid; place-items: center; flex: 0 0 72px; height: 72px; border-radius: 20px;
    background: linear-gradient(135deg, var(--navy), var(--blue)); color: white; font-size: 1.45rem;
    font-weight: 800; box-shadow: 0 12px 28px rgba(16, 35, 56, .2);
}
.eyebrow { margin: 0; color: var(--blue) !important; text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 800; }
.card {
    background: rgba(255, 255, 255, .94); border: 1px solid rgba(216, 226, 236, .9);
    border-radius: 24px; padding: clamp(22px, 5vw, 42px); box-shadow: 0 22px 60px rgba(29, 54, 81, .09);
}
.card-heading { display: flex; justify-content: space-between; }
.admin-header { justify-content: space-between; }
.card h2 { margin: 4px 0 0; font-size: 1.65rem; color: var(--navy); }
.availability { color: var(--success); font-size: .84rem; font-weight: 700; }
.availability i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #26b887; margin-right: 6px; box-shadow: 0 0 0 5px rgba(38,184,135,.12); }
.support-form { display: grid; gap: 22px; margin-top: 28px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
label { display: grid; gap: 8px; color: #334155; font-size: .85rem; font-weight: 750; }
input, select, textarea {
    width: 100%; border: 1px solid #ccd7e3; border-radius: 11px; background: #fbfdff; color: var(--ink);
    padding: 12px 14px; font: inherit; font-weight: 500; outline: none; transition: border .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(20,89,217,.1); }
textarea { resize: vertical; line-height: 1.55; }
.captcha-field small { color: var(--muted); font-weight: 500; }
.wide { grid-column: 1 / -1; }
.button {
    display: inline-flex; align-items: center; justify-content: center; width: fit-content; border: 0; border-radius: 11px;
    padding: 12px 20px; background: linear-gradient(135deg, var(--blue), #274bc3); color: white;
    text-decoration: none; font: inherit; font-weight: 800; cursor: pointer; box-shadow: 0 9px 20px rgba(20,89,217,.2);
}
.button:hover { filter: brightness(1.06); }
.secondary { background: white; color: var(--navy); border: 1px solid var(--line); box-shadow: none; }
.danger { background: #fff2f0; color: var(--danger); box-shadow: none; }
.alert { padding: 13px 16px; border-radius: 11px; margin: 20px 0; font-weight: 650; font-size: .9rem; }
.alert.error { background: #fff1f0; color: var(--danger); border: 1px solid #ffd2cc; }
.alert.success { background: #eaf9f3; color: #116648; border: 1px solid #bcebd9; }
.blocked, .success-card { text-align: center; padding-block: 64px; }
.blocked p, .success-card p { color: var(--muted); line-height: 1.7; max-width: 620px; margin-inline: auto; }
.status-icon { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 20px; border-radius: 50%; background: #fff1f0; color: var(--danger); font-size: 1.7rem; font-weight: 900; }
.success-card .status-icon { background: #e9faf3; color: var(--success); }
.success-card .button { margin-top: 14px; }
.contact-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px 28px; margin-top: 24px; }
.contact-row a { color: var(--blue); font-weight: 800; text-decoration: none; }
footer { padding: 24px; text-align: center; color: #8493a5; font-size: .8rem; }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.login-card { max-width: 500px; margin: 6vh auto; }
.login-card .support-form { margin-top: 24px; }
.hint { color: var(--muted); font-size: .82rem; line-height: 1.55; }
.header-actions { display: flex; gap: 10px; }
.header-actions form { margin: 0; }
.admin-form { display: grid; gap: 22px; }
.settings-section { margin-bottom: 22px; padding: 30px; }
.section-title { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 24px; }
.section-title > span { display: grid; place-items: center; min-width: 38px; height: 38px; border-radius: 10px; color: var(--blue); background: #eaf1ff; font-size: .76rem; font-weight: 900; }
.section-title h2 { margin: 0; font-size: 1.25rem; }
.section-title p { margin: 5px 0 0; color: var(--muted); font-size: .88rem; }
.toggle { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 9px; margin: -8px 0 20px; }
.toggle input { width: 18px; height: 18px; }
.save-bar { position: sticky; bottom: 18px; display: flex; justify-content: flex-end; z-index: 4; padding: 12px; pointer-events: none; }
.save-bar .button { pointer-events: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { padding: 13px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: .68rem; }
td small { display: block; margin-top: 5px; color: var(--muted); }
.badge { display: inline-block; padding: 4px 8px; border-radius: 99px; background: #edf1f5; text-transform: capitalize; font-weight: 800; }
.badge.sent { background: #e8f8f1; color: #13704f; }
.badge.failed { background: #fff0ef; color: var(--danger); }
.badge.disabled { background: #f1f3f5; color: #687386; }
.error-cell { max-width: 280px; color: var(--danger); font-size: .75rem; }
code { background: #eef2f6; padding: 2px 5px; border-radius: 5px; }
.connection-summary { display: grid; gap: 0; margin: 0; }
.connection-summary div { display: grid; grid-template-columns: 160px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.connection-summary div:last-child { border-bottom: 0; }
.connection-summary dt { color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.connection-summary dd { margin: 0; overflow-wrap: anywhere; font-weight: 650; }
.test-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.test-grid .settings-section { margin: 0; }
.test-result { margin-bottom: 22px; border-left: 5px solid var(--success); }
.test-result.test-failure { border-left-color: var(--danger); }
.test-result details { margin-top: 20px; }
.test-result summary { color: var(--blue); cursor: pointer; font-weight: 800; }
.test-result pre { max-height: 340px; overflow: auto; padding: 16px; border-radius: 10px; background: #101b2a; color: #dce8f5; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .78rem; }
.diagnostic-help { margin: 8px 0 0; font-size: .8rem; font-weight: 500; line-height: 1.5; }

/* Client portal */
.client-page {
    position: relative;
    overflow-x: hidden;
    background:
        linear-gradient(135deg, rgba(7, 25, 48, .98), rgba(12, 57, 108, .95) 47%, rgba(15, 108, 132, .9)),
        #0b2746;
    color: #1d2d40;
}
.client-page::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .18;
    background-image:
        linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, #000, transparent 75%);
}
.client-backdrop { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.client-backdrop span { position: absolute; display: block; border-radius: 50%; filter: blur(2px); }
.client-backdrop span:nth-child(1) {
    width: 440px; height: 440px; top: -180px; right: -90px;
    background: radial-gradient(circle, rgba(78, 220, 235, .3), transparent 68%);
}
.client-backdrop span:nth-child(2) {
    width: 520px; height: 520px; bottom: -260px; left: -180px;
    background: radial-gradient(circle, rgba(57, 107, 255, .3), transparent 68%);
}
.client-backdrop span:nth-child(3) {
    width: 220px; height: 220px; top: 35%; left: 7%;
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 0 0 40px rgba(255,255,255,.025), 0 0 0 80px rgba(255,255,255,.018);
}
.client-shell { position: relative; z-index: 1; width: min(1000px, calc(100% - 36px)); padding-top: 64px; }
.client-page .hero { align-items: flex-start; margin-bottom: 34px; color: white; }
.client-page .brand-mark {
    position: relative;
    flex-basis: 82px;
    height: 82px;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(255,255,255,.22), rgba(255,255,255,.08));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 20px 45px rgba(0,0,0,.22);
    backdrop-filter: blur(16px);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.8rem;
}
.client-page .hero-copy { max-width: 720px; }
.client-page .hero h1 {
    margin: 3px 0 9px;
    color: white;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.6rem, 7vw, 4.7rem);
    font-weight: 700;
    line-height: .98;
    letter-spacing: -.055em;
    text-wrap: balance;
    text-shadow: 0 8px 30px rgba(0,0,0,.18);
}
.client-page .hero > .hero-copy > p:not(.eyebrow) {
    max-width: 630px;
    color: rgba(235, 246, 255, .82);
    font-size: 1.03rem;
    line-height: 1.65;
}
.client-page .hero .eyebrow { color: #78e5ef !important; }
.hero-points { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 19px; }
.hero-points span {
    padding: 7px 11px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 999px;
    background: rgba(255,255,255,.07);
    color: rgba(255,255,255,.84);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .025em;
    backdrop-filter: blur(10px);
}
.client-page .card {
    border-color: rgba(255,255,255,.55);
    background: #fff;
    box-shadow: 0 32px 80px rgba(3, 18, 36, .34), inset 0 1px 0 white;
}
.client-page .request-card { border-radius: 30px; padding: clamp(25px, 5vw, 48px); }
.client-page .card-heading {
    align-items: flex-start;
    padding-bottom: 25px;
    border-bottom: 1px solid #e2eaf2;
}
.client-page .card h2 {
    color: #102b47;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: clamp(1.9rem, 4vw, 2.45rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.04em;
}
.client-page .request-card .eyebrow { color: #1764c5 !important; }
.card-intro {
    max-width: 570px;
    margin: 9px 0 0;
    color: #536b83;
    font-size: .98rem;
    font-weight: 500;
    line-height: 1.55;
}
.client-page .availability {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 3px;
    padding: 8px 12px;
    border: 1px solid #a9dfc7;
    border-radius: 999px;
    background: #eaf9f2;
    color: #08734f;
    font-weight: 800;
    white-space: nowrap;
}
.client-page .availability i { margin-right: 0; }
.client-page .support-form { margin-top: 30px; }
.client-page .form-grid { gap: 22px 20px; }
.client-page label { color: #253b51; letter-spacing: .01em; }
.client-page input,
.client-page select,
.client-page textarea {
    min-height: 49px;
    border-color: #cedae6;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 35, 56, .03);
}
.client-page textarea { min-height: 150px; }
.client-page input:hover,
.client-page select:hover,
.client-page textarea:hover { border-color: #9eb2c7; }
.client-page input:focus,
.client-page select:focus,
.client-page textarea:focus {
    border-color: #1674d1;
    box-shadow: 0 0 0 4px rgba(22,116,209,.11), 0 8px 24px rgba(22,116,209,.08);
}
.client-page .captcha-field {
    grid-template-columns: minmax(200px, .55fr) minmax(140px, .45fr);
    align-items: center;
    padding: 17px 19px;
    border: 1px dashed #b7c9da;
    border-radius: 15px;
    background: #f3f8fc;
}
.client-page .captcha-field input { grid-column: 2; grid-row: 1 / span 2; }
.client-page .captcha-field small { grid-column: 1; }
.submit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    padding-top: 5px;
}
.submit-row p { margin: 0; max-width: 430px; color: var(--muted); font-size: .77rem; line-height: 1.5; }
.client-page .button {
    min-height: 50px;
    padding-inline: 24px;
    border-radius: 13px;
    background: linear-gradient(135deg, #1167d8, #1645bc);
    box-shadow: 0 13px 26px rgba(20, 77, 190, .25);
}
.client-page .button span { margin-left: 9px; font-size: 1.2rem; transition: transform .2s; }
.client-page .button:hover span { transform: translateX(3px); }
.client-page footer { color: rgba(226, 240, 250, .62); letter-spacing: .035em; }

/* Admin workspace */
.admin-page {
    position: relative;
    overflow-x: hidden;
    background: #eef3f8;
    background-attachment: fixed;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.admin-page::before {
    content: "";
    position: fixed;
    inset: 0 0 auto;
    height: 335px;
    pointer-events: none;
    background:
        radial-gradient(circle at 88% 0, rgba(73, 205, 220, .22), transparent 28rem),
        linear-gradient(120deg, #081d35, #0f3b68 68%, #0f6479);
}
.admin-backdrop {
    position: fixed;
    inset: 0 0 auto;
    height: 335px;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: linear-gradient(to bottom, #000, transparent 92%);
}
.admin-page .admin-shell { position: relative; z-index: 1; padding-top: 48px; }
.admin-page .admin-hero {
    min-height: 145px;
    margin-bottom: 24px;
    padding: 25px 28px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 25px;
    background: rgba(8, 31, 56, .72);
    box-shadow: 0 22px 55px rgba(1, 13, 28, .22);
    backdrop-filter: blur(14px);
}
.admin-page .admin-hero h1 {
    margin: 3px 0 8px;
    color: white;
    font-family: inherit;
    font-size: clamp(2rem, 4.4vw, 3.25rem);
    font-weight: 800;
    line-height: 1.04;
    letter-spacing: -.045em;
    text-shadow: 0 6px 20px rgba(0,0,0,.15);
}
.admin-page .admin-hero p:not(.eyebrow) { color: #d8e5ef; font-weight: 500; }
.admin-page .admin-hero .eyebrow { color: #74e1ec !important; }
.admin-page .header-actions .button {
    min-width: 125px;
    border-color: rgba(255,255,255,.78);
    background: #fff;
    color: #123352;
    box-shadow: 0 8px 20px rgba(0,0,0,.14);
}
.admin-page .header-actions .button:hover { background: #eaf4fc; }
.admin-page .header-actions .danger {
    border-color: #ffd2ce;
    background: #fff1f0;
    color: #a9231c;
}
.admin-page .card {
    border-color: rgba(211, 222, 233, .9);
    border-radius: 22px;
    background: rgba(255,255,255,.965);
    box-shadow: 0 18px 45px rgba(14, 38, 65, .09);
}
.admin-page .settings-section {
    position: relative;
    overflow: hidden;
    padding: 31px;
}
.admin-page .settings-section::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(to bottom, #1b67da, #33beca);
    opacity: .8;
}
.admin-page .section-title > span {
    border: 1px solid #d9e7fb;
    border-radius: 12px;
    background: linear-gradient(145deg, #edf5ff, #e2efff);
    box-shadow: 0 6px 15px rgba(31, 91, 175, .1);
}
.admin-page .section-title h2 {
    color: #122b46;
    font-family: inherit;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -.025em;
}
.admin-page input,
.admin-page select,
.admin-page textarea {
    min-height: 47px;
    border-color: #cdd9e5;
    border-radius: 12px;
    background: #fbfdff;
}
.admin-page textarea { min-height: 92px; }
.admin-page input:focus,
.admin-page select:focus,
.admin-page textarea:focus {
    border-color: #176bd3;
    box-shadow: 0 0 0 4px rgba(23,107,211,.1);
}
.admin-page input[readonly],
.admin-page input:disabled { background: #f0f4f8; color: #66788a; }
.admin-page .toggle {
    width: fit-content;
    padding: 9px 13px;
    border: 1px solid #d9e4ee;
    border-radius: 999px;
    background: #f6f9fc;
}
.admin-page .toggle input { accent-color: #176bd3; }
.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.admin-stats div {
    display: grid;
    gap: 5px;
    padding: 18px 20px;
    border: 1px solid rgba(206, 219, 232, .9);
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(13, 39, 68, .075);
}
.admin-stats span {
    color: #65768a;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.admin-stats strong { color: #0c2947; font-size: 1.03rem; font-weight: 800; }
.admin-page .save-bar {
    bottom: 14px;
    margin-top: -10px;
}
.admin-page .save-bar::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid rgba(204, 218, 231, .9);
    border-radius: 17px;
    background: rgba(255,255,255,.86);
    box-shadow: 0 14px 35px rgba(13, 35, 58, .12);
    backdrop-filter: blur(15px);
}
.admin-page .save-bar .button { position: relative; }
.admin-page .table-wrap {
    border: 1px solid #e0e7ee;
    border-radius: 14px;
    background: white;
}
.admin-page table { min-width: 980px; }
.admin-page th {
    padding-block: 14px;
    background: #f1f6fa;
    color: #5f7083;
}
.admin-page td { padding-block: 15px; }
.admin-page tbody tr:hover { background: #f7fbff; }
.admin-page .badge { border: 1px solid rgba(0,0,0,.04); }
.admin-page .alert {
    border-radius: 14px;
    box-shadow: 0 9px 24px rgba(19, 42, 67, .08);
}
.admin-page .login-card {
    margin-top: 9vh;
    padding: 42px;
    border-color: rgba(255,255,255,.45);
    box-shadow: 0 32px 80px rgba(1, 15, 32, .32);
}
.admin-page .login-card h1 {
    font-family: inherit;
    font-size: clamp(2rem, 6vw, 3.1rem);
    font-weight: 800;
}
.diagnostics-page .admin-shell { width: min(1050px, calc(100% - 32px)); }
.diagnostics-page .test-grid .settings-section { min-height: 230px; }
.diagnostics-page .test-grid form { display: flex; flex-direction: column; }
.diagnostics-page .test-grid .button { margin-top: auto; }
.diagnostics-page .connection-summary div { padding: 14px 4px; }
.diagnostics-page .test-result { border-left-width: 6px; }

@media (max-width: 700px) {
    .page-shell { padding-top: 28px; }
    .hero, .admin-header { align-items: flex-start; }
    .brand-mark { width: 54px; height: 54px; flex-basis: 54px; border-radius: 15px; }
    .form-grid { grid-template-columns: 1fr; }
    .wide { grid-column: auto; }
    .card-heading, .admin-header { display: grid; gap: 16px; }
    .header-actions { flex-wrap: wrap; }
    .settings-section { padding: 22px; }
    .connection-summary div, .test-grid { grid-template-columns: 1fr; }
    .client-shell { width: min(100% - 24px, 1000px); padding-top: 30px; }
    .client-page .hero { gap: 14px; margin-bottom: 24px; }
    .client-page .brand-mark { width: 58px; height: 58px; flex-basis: 58px; border-radius: 17px; font-size: 1.25rem; }
    .client-page .hero h1 { font-size: clamp(2.15rem, 12vw, 3.25rem); }
    .hero-points { display: none; }
    .client-page .request-card { border-radius: 22px; }
    .client-page .captcha-field { grid-template-columns: 1fr; }
    .client-page .captcha-field input,
    .client-page .captcha-field small { grid-column: 1; grid-row: auto; }
    .submit-row { align-items: stretch; flex-direction: column; }
    .submit-row .button { width: 100%; }
    .admin-page { background: #eef3f8; }
    .admin-page::before { height: 390px; }
    .admin-page .admin-shell { width: min(100% - 22px, 1180px); padding-top: 20px; }
    .admin-page .admin-hero { padding: 21px; border-radius: 20px; }
    .admin-page .admin-hero h1 { font-size: clamp(2rem, 11vw, 3rem); }
    .admin-page .header-actions .button { width: 100%; }
    .admin-page .header-actions form { width: 100%; }
    .admin-page .header-actions form .button { width: 100%; }
    .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-page .settings-section { padding: 24px 20px; }
    .admin-page .login-card { margin-top: 5vh; padding: 28px 23px; }
}
