:root {
    --navy: #0a1d37;
    --navy-ink: #071525;
    --blue: #1e40af;
    --blue-soft: #6f87f6;
    --cyan: #22d3ee;
    --surface: #f8f9fb;
    --card: #ffffff;
    --line: #d1d5db;
    --line-soft: #e5e7eb;
    --text: #191c1e;
    --muted: #5f6673;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --shadow: 0 4px 20px rgba(10, 29, 55, 0.05);
    --sidebar: 260px;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--surface);
    color: var(--text);
    font-family: Inter, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    letter-spacing: 0;
}

a {
    color: var(--blue);
    text-decoration: none;
}

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

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: var(--sidebar);
    background: var(--navy);
    color: #d6e3ff;
    display: flex;
    flex-direction: column;
    padding: 28px 20px;
}

.brand {
    color: #fff;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin: 0 0 44px;
}

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: #173bab;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.brand strong {
    display: block;
    font-size: 25px;
    line-height: 1.15;
    font-weight: 800;
}

.brand small,
.user-chip small {
    display: block;
    color: #a9b7cc;
    font-size: 12px;
    font-weight: 600;
}

.nav {
    display: grid;
    gap: 8px;
}

.nav-item {
    min-height: 48px;
    border-radius: 8px;
    color: #627692;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 14px;
    font-weight: 600;
    transition: background 0.18s ease, color 0.18s ease;
}

.nav-item span {
    width: 22px;
    text-align: center;
    font-size: 20px;
}

.nav-item:hover,
.nav-item.active {
    background: #6e86f7;
    color: #102045;
}

.logout {
    margin-top: auto;
}

.main-shell {
    grid-column: 2;
    min-width: 0;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

.topbar {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.top-search {
    width: min(448px, 60vw);
    position: relative;
}

.top-search .icon {
    position: absolute;
    left: 14px;
    top: 8px;
    color: #6b7280;
    font-size: 24px;
}

.top-search input {
    width: 100%;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #f7f8fb;
    padding: 0 14px 0 42px;
}

.top-actions {
    display: flex;
    gap: 18px;
    align-items: center;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: 0;
    background: transparent;
    color: #1f2937;
    font-weight: 800;
    cursor: pointer;
}

.user-chip {
    display: flex;
    gap: 10px;
    align-items: center;
    color: #111827;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #dbeafe;
    color: #0a1d37;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.content {
    width: 100%;
    max-width: 1440px;
    padding: 32px;
    flex: 1;
}

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

.page-head h1,
.auth-card h1 {
    margin: 0;
    font-size: 34px;
    line-height: 1.15;
    font-weight: 800;
}

.page-head p,
.muted {
    color: var(--muted);
    margin: 6px 0 0;
}

.actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.grid {
    display: grid;
    gap: 24px;
}

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

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

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(130px, 1fr));
    gap: 24px;
    margin: 24px 0;
}

.card,
.table-card,
.notice-card,
.filter-bar {
    background: var(--card);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.card {
    padding: 24px;
}

.card h2,
.table-card h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.2;
}

.card h3 {
    margin: 0 0 16px;
    font-size: 18px;
}

.notice-card {
    border-color: #9cc0ff;
    border-left: 4px solid #3b82f6;
    padding: 24px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.notice-icon {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dbeafe;
    color: #2563eb;
    font-weight: 800;
}

.recommend {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 7px 12px;
    color: #111827;
    font-size: 12px;
    font-weight: 700;
}

.kpi {
    min-height: 134px;
    padding: 20px;
}

.kpi label,
.label {
    display: block;
    color: #4b5563;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

.kpi strong {
    display: block;
    margin-top: 8px;
    font-size: 25px;
    line-height: 1.15;
}

.trend {
    display: block;
    margin-top: 12px;
    color: var(--success);
    font-size: 12px;
    font-weight: 700;
}

.trend.warn {
    color: var(--warning);
}

.trend.danger {
    color: var(--danger);
}

.table-card {
    overflow: hidden;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 18px 20px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    background: #f5f6f9;
    color: #001f8f;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

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

.data-table tr:nth-child(odd) td {
    background: #fcfdff;
}

.contact-cell {
    display: flex;
    gap: 14px;
    align-items: center;
}

.cell-muted {
    display: block;
    margin-top: 3px;
    color: #6b7280;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 800;
}

.badge span {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
}

.badge-success {
    color: #059669;
    background: #dcfce7;
    border-color: #a7f3d0;
}

.badge-info {
    color: #2563eb;
    background: #dbeafe;
    border-color: #bfdbfe;
}

.badge-neutral {
    color: #4b5563;
    background: #f3f4f6;
    border-color: #d1d5db;
}

.badge-danger {
    color: #dc2626;
    background: #fee2e2;
    border-color: #fecaca;
}

.btn,
button.btn {
    height: 44px;
    border-radius: 4px;
    padding: 0 18px;
    border: 1px solid var(--line);
    background: #fff;
    color: #111827;
    font-weight: 700;
    display: inline-flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.btn-primary {
    border-color: var(--blue);
    background: var(--blue);
    color: #fff;
}

.btn-muted {
    background: #eef0f3;
}

.btn-danger {
    border-color: var(--danger);
    background: var(--danger);
    color: #fff;
}

.btn-small {
    height: 34px;
    padding: 0 12px;
    font-size: 12px;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 88px;
    padding: 18px 20px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.filter-bar .spacer {
    flex: 1;
}

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

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

.field {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.field label {
    font-size: 13px;
    font-weight: 700;
    color: #4b5563;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #f9fafc;
    color: var(--text);
    padding: 10px 12px;
}

.field textarea {
    min-height: 140px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 0;
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.14);
    background: #fff;
}

.checkbox-line,
.radio-line {
    display: flex;
    gap: 10px;
    align-items: center;
}

.checkbox-line input,
.radio-line input {
    width: 16px;
    height: 16px;
}

.alert {
    border-radius: 8px;
    border: 1px solid;
    padding: 12px 14px;
    margin: 0 0 18px;
    font-weight: 600;
}

.alert-success {
    color: #065f46;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.alert-error,
.alert-danger {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}

.alert-warning {
    color: #92400e;
    background: #fffbeb;
    border-color: #fcd34d;
}

.alert-info {
    color: #1e3a8a;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination a,
.pagination span {
    min-width: 38px;
    height: 38px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #111827;
}

.pagination a.active {
    background: #6f87f6;
    color: #102045;
    font-weight: 800;
}

.table-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--line-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.empty-state {
    padding: 44px 24px;
    color: var(--muted);
    text-align: center;
}

.split-auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(420px, 1fr);
    background: #fff;
}

.auth-panel {
    padding: 44px;
    display: flex;
    align-items: center;
}

.auth-card {
    width: min(100%, 492px);
}

.auth-card .logo {
    width: 40px;
    height: 40px;
    margin-bottom: 82px;
    border-radius: 4px;
    background: #f5f6f8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--blue);
}

.auth-visual {
    background: var(--navy);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 72px;
    overflow: hidden;
    position: relative;
}

.auth-visual:before,
.auth-visual:after {
    content: "";
    position: absolute;
    border: 1px dashed rgba(34, 211, 238, 0.25);
    border-radius: 999px;
}

.auth-visual:before {
    width: 520px;
    height: 520px;
    right: -160px;
    bottom: -190px;
}

.auth-visual:after {
    width: 720px;
    height: 720px;
    right: -260px;
    bottom: -320px;
    border-style: solid;
    border-color: rgba(111, 135, 246, 0.2);
}

.auth-copy {
    position: relative;
    max-width: 560px;
    z-index: 1;
}

.auth-copy h2 {
    font-size: 48px;
    line-height: 1.25;
    margin: 24px 0;
}

.mini-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--cyan);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 800;
}

.security-card {
    width: 260px;
    margin-left: auto;
    margin-bottom: 64px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    padding: 20px;
    transform: rotate(3deg);
}

.security-bar {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.security-bar span {
    display: block;
    width: 76%;
    height: 100%;
    background: var(--cyan);
}

.installer-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px;
    background: linear-gradient(135deg, #eef3fb 0%, #f8f9fb 55%, #c9f5fb 100%);
}

.installer {
    width: min(100%, 1000px);
    min-height: 720px;
    display: grid;
    grid-template-columns: 280px 1fr;
    background: #fff;
    border: 1px solid #c5c6ce;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 80px rgba(10, 29, 55, 0.1);
}

.installer-side {
    background: #f7f8fb;
    border-right: 1px solid #c5c6ce;
    padding: 32px;
}

.installer-side h1 {
    margin: 0;
    font-size: 20px;
}

.steps {
    margin-top: 56px;
    display: grid;
    gap: 18px;
}

.step {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 12px;
    align-items: flex-start;
    color: #777c86;
    font-weight: 700;
}

.step i {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e5e7eb;
    color: #6b7280;
    font-style: normal;
    font-size: 12px;
}

.step.done i {
    background: var(--success);
    color: #fff;
}

.step.active {
    color: var(--blue);
}

.step.active i {
    background: var(--blue);
    color: #fff;
}

.installer-main {
    display: flex;
    flex-direction: column;
}

.installer-content {
    padding: 40px 60px;
    flex: 1;
}

.installer-content h2 {
    font-size: 26px;
    margin: 0 0 10px;
}

.installer-actions {
    border-top: 1px solid var(--line-soft);
    padding: 24px 60px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.req-list {
    display: grid;
    gap: 12px;
    margin-top: 24px;
}

.req {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 14px 16px;
}

.req.ok strong {
    color: var(--success);
}

.req.bad strong {
    color: var(--danger);
}

.settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 24px;
}

.dns-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: #f3f4f6;
    border-radius: 4px;
    padding: 14px;
    margin-bottom: 12px;
}

.dns-item.warn {
    background: #fee2e2;
    border: 1px solid #fecaca;
}

.chart-placeholder {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    background: linear-gradient(to top, #dbe3fb 0 28%, transparent 28%);
    border-bottom: 2px solid #3155e7;
}

.mini-chart {
    min-height: 300px;
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 18px;
    align-items: end;
}

.chart-day {
    display: grid;
    gap: 8px;
    justify-items: center;
}

.chart-stack {
    width: 100%;
    height: 210px;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 4px;
    border-bottom: 2px solid #dbe3fb;
}

.chart-bar {
    width: 14px;
    min-height: 4px;
    border-radius: 2px 2px 0 0;
    background: var(--blue);
}

.chart-bar.open {
    background: var(--cyan);
}

.chart-bar.click {
    background: var(--success);
}

.queue-list {
    display: grid;
    gap: 18px;
}

.queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.dot.warn {
    background: var(--warning);
}

.dot.neutral {
    background: #8b8f98;
}

.campaign-builder {
    min-height: 100vh;
    display: grid;
    grid-template-rows: 64px 1fr 64px;
}

.builder-top,
.builder-bottom {
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.builder-bottom {
    border-top: 1px solid var(--line);
    border-bottom: 0;
}

.builder-steps {
    display: flex;
    align-items: center;
    gap: 18px;
}

.builder-step {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #4b5563;
    font-weight: 700;
}

.builder-step i {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: #eef0f3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-style: normal;
}

.builder-step.active i,
.builder-step.done i {
    background: var(--blue);
    color: #fff;
}

.builder-body {
    padding: 24px;
}

.builder-grid {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr) 290px;
    gap: 24px;
}

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

.block-tile {
    height: 86px;
    border: 1px solid var(--line);
    border-radius: 4px;
    display: grid;
    place-items: center;
    gap: 4px;
    background: #fafbfe;
    font-weight: 700;
}

.email-canvas {
    max-width: 600px;
    margin: 8px auto;
    background: #fff;
    border: 1px solid var(--line);
    padding: 28px;
    box-shadow: var(--shadow);
}

.email-frame {
    width: 100%;
    min-height: 460px;
    border: 0;
    background: #fff;
}

.email-canvas h2 {
    text-align: center;
    margin-top: 0;
}

.email-preview-box {
    min-height: 170px;
    border: 1px dashed #b8bdc7;
    background: #f1f2f4;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7b818c;
    margin: 18px 0;
}

.stats-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
}

.stat-mini {
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
}

.stat-mini strong {
    display: block;
    font-size: 24px;
}

@media (max-width: 1100px) {
    :root {
        --sidebar: 86px;
    }

    .brand strong,
    .brand small,
    .nav-item:not(.active) {
        font-size: 0;
    }

    .nav-item {
        justify-content: center;
        padding: 0;
    }

    .nav-item span {
        font-size: 20px;
    }

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

    .builder-grid,
    .grid.two,
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        width: 100%;
        min-height: 0;
        padding: 16px;
    }

    .brand {
        margin-bottom: 16px;
    }

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

    .main-shell {
        grid-column: 1;
    }

    .topbar {
        padding: 0 16px;
    }

    .top-search {
        width: 100%;
    }

    .user-chip {
        display: none;
    }

    .content {
        padding: 20px 16px;
    }

    .page-head,
    .table-card-head,
    .table-footer,
    .filter-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .kpi-grid,
    .grid.three,
    .form-grid,
    .form-grid.three,
    .stats-strip {
        grid-template-columns: 1fr;
    }

    .data-table {
        min-width: 760px;
    }

    .table-card {
        overflow-x: auto;
    }

    .split-auth,
    .installer {
        grid-template-columns: 1fr;
    }

    .auth-visual,
    .installer-side {
        display: none;
    }

    .auth-panel,
    .installer-content,
    .installer-actions {
        padding: 24px;
    }
}
