:root {
    color-scheme: light;
    --ink: #131823;
    --muted: #657081;
    --line: #dfe5ee;
    --brand: #4f6fd8;
    --brand-dark: #162a6c;
    --ok: #107b52;
    --danger: #b42318;
    --page: #f5f7fb;
    --panel: #ffffff;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, textarea { font: inherit; }

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(420px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 24px 70px rgba(19, 24, 35, .08);
}

.brand-mark {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--brand-dark);
    color: #fff;
    font-weight: 900;
    margin-bottom: 18px;
}

h1, h2, p { margin-top: 0; }

.login-panel h1 { margin-bottom: 22px; font-size: 30px; }

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
}

input, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 13px;
    background: #fff;
    color: var(--ink);
    outline: none;
}

textarea { resize: vertical; line-height: 1.5; }

input:focus, textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79, 111, 216, .16);
}

button {
    border: 0;
    border-radius: 8px;
    background: var(--brand-dark);
    color: #fff;
    padding: 12px 18px;
    font-weight: 850;
    cursor: pointer;
}

button:disabled { opacity: .45; cursor: not-allowed; }

.login-panel button { width: 100%; margin-top: 16px; }

.topbar {
    height: 68px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 max(22px, calc((100vw - 1180px) / 2));
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.topbar div { display: grid; gap: 2px; }
.topbar strong { font-size: 18px; }
.topbar span, .topbar a { color: var(--muted); font-size: 14px; }
.topbar a { text-decoration: none; font-weight: 800; }

.workspace {
    width: min(1180px, calc(100vw - 32px));
    margin: 24px auto 54px;
}

.alert {
    border-radius: 8px;
    padding: 13px 15px;
    margin-bottom: 16px;
    font-weight: 750;
}

.alert.ok { background: #eaf7f1; color: var(--ok); border: 1px solid #bfe8d6; }
.alert.error { background: #fff0ee; color: var(--danger); border: 1px solid #ffd1cb; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.stats-row article, .panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 55px rgba(19, 24, 35, .055);
}

.stats-row article {
    padding: 18px;
    display: grid;
    gap: 8px;
}

.stats-row span, .panel-head span, .campaign span, .campaign small, .empty {
    color: var(--muted);
}

.stats-row strong { font-size: 26px; letter-spacing: 0; }

.panel { padding: 20px; }

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

.panel-head h1 { margin-bottom: 6px; font-size: 28px; }
.panel-head h2 { margin: 0; font-size: 20px; }
.panel-head p { margin: 0; color: var(--muted); }
.panel-head.compact { align-items: center; }

.segments {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.segments a {
    color: var(--muted);
    text-decoration: none;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 850;
    border-left: 1px solid var(--line);
    background: #fff;
}

.segments a:first-child { border-left: 0; }
.segments a.active { background: #eef3ff; color: var(--brand-dark); }

.compose {
    display: grid;
    gap: 14px;
}

.confirm-line {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 14px;
    align-items: end;
}

.grid {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(340px, .92fr);
    gap: 16px;
    margin-top: 16px;
}

.table-wrap {
    max-height: 520px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

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

th, td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    position: sticky;
    top: 0;
    background: #f9fafc;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
}

.pill {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 0 9px;
    border-radius: 999px;
    background: #eef0f4;
    color: #586170;
    font-size: 12px;
    font-weight: 850;
}

.pill.approved { background: #eaf7f1; color: var(--ok); }
.pill.pending { background: #fff7db; color: #875c00; }
.pill.rejected { background: #fff0ee; color: var(--danger); }

.campaign-list { display: grid; gap: 10px; }

.campaign {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 13px;
    display: grid;
    gap: 5px;
}

.campaign strong {
    line-height: 1.25;
}

@media (max-width: 820px) {
    .topbar { padding: 0 16px; }
    .stats-row, .grid, .confirm-line { grid-template-columns: 1fr; }
    .panel-head { display: grid; }
    .segments { width: 100%; display: grid; grid-template-columns: 1fr; }
    .segments a { border-left: 0; border-top: 1px solid var(--line); }
    .segments a:first-child { border-top: 0; }
}
