* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #f5f7fa;
    color: #243447;
}
header {
    background: linear-gradient(135deg, #4a6fa5, #1e3c72);
    color: #fff;
    padding: 20px 0;
}
.shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 800;
}
.brand span { color: #ffd166; }
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: #fff; color: #1e3c72; }
.btn-outline { background: transparent; border: 1.5px solid #4a6fa5; color: #4a6fa5; }
.btn-success { background: #2a9d8f; color: #fff; }
.btn-danger { background: #dc3545; color: #fff; }
main { padding: 24px 0 40px; }
.card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
    padding: 20px;
    margin-bottom: 20px;
}
.card-hero {
    background:
        radial-gradient(circle at top right, rgba(74, 111, 165, 0.12), transparent 34%),
        linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #dfe8f3;
}
.card-section {
    position: relative;
    overflow: hidden;
    border: 1px solid #e5edf7;
}
.card-section::after {
    content: "";
    position: absolute;
    inset: auto 20px 0 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(196, 213, 234, 0.9), transparent);
    pointer-events: none;
}
.card-checkout { background: linear-gradient(180deg, #ffffff 0%, #f8fcff 100%); }
.card-access { background: linear-gradient(180deg, #ffffff 0%, #fcfbff 100%); }
.card-status { background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%); }
.card-summary { background: linear-gradient(180deg, #ffffff 0%, #f9fdfb 100%); }
h1, h2, h3 { margin: 0 0 12px; color: #1e3c72; }
.muted { color: #6b7a90; }
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.section-header-hero {
    margin-bottom: 14px;
}
.section-heading {
    display: grid;
    gap: 8px;
    min-width: min(100%, 420px);
}
.section-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(74, 111, 165, 0.1);
    color: #345a8a;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.section-eyebrow i {
    font-size: 0.85rem;
}
.section-description {
    max-width: 68ch;
}
.section-body {
    display: grid;
    gap: 0;
}
.card-section.is-collapsed {
    padding-bottom: 16px;
}
.card-section.is-collapsed .section-body {
    display: none;
}
.section-meta {
    font-weight: 700;
    color: #4a6fa5;
    padding-top: 4px;
}
.section-subheading {
    display: grid;
    gap: 6px;
}
.info-box {
    background: #e7f3ff;
    border-left: 4px solid #4a6fa5;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    color: #0c5460;
    font-size: 0.92rem;
    line-height: 1.55;
}
.toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 15px;
}
.field {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    width: 100%;
}
.input-max-280 { max-width: 280px; }
.field:focus {
    outline: 2px solid rgba(30, 60, 114, 0.18);
    border-color: #4a6fa5;
}
.grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 18px;
}
.panel {
    background: #f8fbff;
    border: 1px solid #e5edf7;
    border-radius: 12px;
    padding: 16px;
}
.setting-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.setting-wide { grid-column: 1 / -1; }
.setting-card {
    background: #fff;
    border: 1px solid #e5edf7;
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
    scroll-margin-top: 18px;
}
.setting-card-body {
    display: grid;
    gap: 0;
}
.setting-card.is-collapsed .setting-card-body {
    display: none;
}
.setting-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.setting-card-head h3 {
    margin-bottom: 0;
}
.kv {
    display: grid;
    gap: 10px;
}
.kv-item {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px dashed #dfe7f1;
    padding-bottom: 8px;
    flex-wrap: wrap;
}
.kv-item span { color: #6b7a90; }
.kv-item strong { color: #1e3c72; text-align: right; }
.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #d1ecf1;
    color: #0c5460;
    font-weight: 700;
    font-size: 0.85rem;
}
.status-ok { background: #d4edda; color: #155724; }
.status-warn { background: #fff3cd; color: #856404; }
.status-error { background: #f8d7da; color: #721c24; }
.status-inline {
    display: inline-flex;
    align-items: center;
}
.summary-grid {
    display: grid;
    gap: 12px;
}
.summary-item {
    background: #fff;
    border: 1px solid #e5edf7;
    border-radius: 12px;
    padding: 14px;
}
.summary-item strong {
    display: block;
    color: #1e3c72;
    margin-bottom: 4px;
}
.summary-item span {
    color: #52627a;
    line-height: 1.5;
}
.status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
}
.status-box {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
    border: 1px solid #e5edf7;
    border-radius: 16px;
    padding: 16px 16px 14px;
    min-height: 140px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}
.status-box::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, rgba(74,111,165,0.95), rgba(42,157,143,0.95));
}
.status-box-smtp::before { background: linear-gradient(90deg, #4a6fa5, #7aa2d6); }
.status-box-template::before { background: linear-gradient(90deg, #2a9d8f, #57c1b2); }
.status-box-webhook::before { background: linear-gradient(90deg, #d97706, #f4b860); }
.status-box-scanner::before { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.status-box > * {
    position: relative;
    z-index: 1;
}
.status-box-clickable {
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.status-box-clickable:hover,
.status-box-clickable:focus-visible {
    transform: translateY(-1px);
    border-color: #c3d5ea;
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.1);
    background: linear-gradient(180deg, #ffffff 0%, #f0f7ff 100%);
    outline: none;
}
.section-focus {
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.16), 0 12px 28px rgba(15, 23, 42, 0.08);
    border-color: #9bb8d9;
}
.status-box-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.status-box-head strong {
    color: #1e3c72;
}
.status-box-foot {
    margin-top: 12px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #4a6fa5;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.status-box-foot::after {
    content: "→";
    font-size: 0.95rem;
}
.note {
    margin-top: 10px;
    color: #6b7a90;
    font-size: 0.92rem;
    line-height: 1.5;
}
.config-export {
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 220px;
    overflow: auto;
    margin: 0;
}
.toolbar-margin-top-6 {
    margin-top: 6px;
}
.section-toggle {
    min-width: 132px;
    justify-content: center;
}
.section-toggle-small {
    min-width: 116px;
    padding: 8px 12px;
}
.status-box-foot::after {
    content: "->";
}
@media (max-width: 900px) {
    .grid, .setting-grid, .status-grid { grid-template-columns: 1fr; }
}
