:root {
    --surface: #f5f7fb;
    --surface-strong: #eef1f9;
    --border: #d6d9e6;
    --primary: #275efe;
    --primary-dark: #1740b6;
    --text: #1d2333;
    --muted: #5c6370;
    --background: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", Tahoma, sans-serif;
    color: var(--text);
    background: var(--surface);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    width: min(1100px, 92vw);
    margin: 0 auto;
}

.admin-header {
    background: linear-gradient(135deg, #0d1b46 0%, #1c2d68 60%, #243a8e 100%);
    color: #fff;
    padding: clamp(2.5rem, 5vw, 4rem) 0;
    box-shadow: 0 18px 40px rgba(17, 23, 48, 0.28);
}

.brand {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: clamp(1.5rem, 3vw, 3rem);
    align-items: center;
    color: inherit;
    text-decoration: none;
}

.brand-logo {
    width: clamp(72px, 10vw, 110px);
    filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.35));
}

.brand-copy h1 {
    margin: 0.4rem 0 0.6rem;
    font-size: clamp(2rem, 4vw, 3rem);
}

.brand-copy p {
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    max-width: 48ch;
    line-height: 1.6;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.65);
}

.admin-main {
    flex: 1;
    padding: clamp(2.5rem, 4vw, 3.5rem) 0 clamp(3.5rem, 6vw, 5rem);
}

.admin-grid {
    display: grid;
    gap: clamp(2rem, 4vw, 3rem);
}

@media (min-width: 960px) {
    .admin-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
    }

    .admin-grid .module.module-email {
        grid-column: span 2;
    }
}

.module {
    background: var(--background);
    border-radius: 22px;
    padding: clamp(1.8rem, 3vw, 2.4rem);
    box-shadow: 0 16px 40px rgba(17, 23, 48, 0.12);
    border: 1px solid rgba(18, 34, 72, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.module-heading h2 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.module-heading p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.module-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}

select,
input[type="email"] {
    font: inherit;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

select:focus,
input[type="email"]:focus {
    outline: none;
    border-color: rgba(39, 94, 254, 0.7);
    box-shadow: 0 0 0 4px rgba(39, 94, 254, 0.12);
}

button {
    font: inherit;
    font-weight: 600;
    border: none;
    border-radius: 999px;
    padding: 0.85rem 1.8rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 12px 30px rgba(39, 94, 254, 0.26);
}

.primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 14px 34px rgba(39, 94, 254, 0.32);
    background: var(--primary-dark);
}

.secondary {
    background: rgba(13, 27, 70, 0.08);
    color: var(--text);
    border: 1px solid rgba(13, 27, 70, 0.12);
}

.secondary:hover:not(:disabled) {
    background: rgba(13, 27, 70, 0.14);
}

.status {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.5;
}

.status.info {
    color: var(--muted);
}

.status.success {
    color: #0e7c53;
}

.status.error {
    color: #b71c1c;
}

.status.subtle {
    color: var(--muted);
    font-size: 0.88rem;
}

.module-admin-tools .module-body {
    gap: 1.25rem;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.1rem 1.4rem;
    border-radius: 18px;
    border: 1px solid rgba(18, 34, 72, 0.08);
    background: var(--surface);
}

.toggle-copy {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.toggle-title {
    margin: 0;
    font-size: 1.05rem;
}

.toggle-description {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.toggle-switch {
    position: relative;
    width: 54px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    display: block;
    width: 100%;
    height: 30px;
    background: rgba(17, 23, 48, 0.2);
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    transition: background 0.25s ease, box-shadow 0.25s ease;
    box-shadow: inset 0 0 0 1px rgba(17, 23, 48, 0.15);
}

.toggle-slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 6px 18px rgba(17, 23, 48, 0.2);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(39, 94, 254, 0.45);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
    box-shadow: 0 8px 20px rgba(39, 94, 254, 0.35);
}

.toggle-switch input:focus-visible + .toggle-slider {
    box-shadow: 0 0 0 4px rgba(39, 94, 254, 0.2);
}

.toggle-switch input:disabled + .toggle-slider {
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: inset 0 0 0 1px rgba(17, 23, 48, 0.12);
}

.email-layout {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 720px) {
    .email-layout {
        grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    }
}

.email-panel {
    background: var(--surface);
    border-radius: 18px;
    padding: 1.5rem;
    border: 1px solid rgba(18, 34, 72, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.panel-title {
    margin: 0;
    font-size: 1.1rem;
}

.email-form {
    display: flex;
    gap: 0.6rem;
}

.email-form input {
    flex: 1;
}

.email-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.email-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #fff;
    border-radius: 999px;
    padding: 0.4rem 0.75rem;
    border: 1px solid rgba(18, 34, 72, 0.1);
    box-shadow: 0 6px 20px rgba(17, 23, 48, 0.1);
    font-size: 0.9rem;
}

.email-chip button {
    padding: 0.2rem;
    border-radius: 50%;
    width: 1.6rem;
    height: 1.6rem;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    background: rgba(29, 35, 51, 0.06);
    border: none;
}

.email-chip button:hover {
    background: rgba(29, 35, 51, 0.16);
}

.preview {
    min-height: 140px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(18, 34, 72, 0.08);
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: auto;
}

.preview-placeholder {
    margin: 0;
    color: var(--muted);
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.preview-table th,
.preview-table td {
    text-align: left;
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid rgba(18, 34, 72, 0.06);
}

.preview-table th {
    font-weight: 600;
    color: var(--muted);
    width: 40%;
    white-space: nowrap;
}

.preview-table tr:last-child th,
.preview-table tr:last-child td {
    border-bottom: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.admin-footer {
    background: var(--surface-strong);
    border-top: 1px solid rgba(18, 34, 72, 0.08);
    padding: 1.5rem 0;
    font-size: 0.95rem;
}

.admin-footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.footer-link:hover {
    text-decoration: underline;
}