:root {
    --bg: #f4f6fb;
    --ink: #172033;
    --muted: #687387;
    --dark: #151927;
    --card: #ffffff;
    --line: #dfe5ef;
    --purple: #6b3df4;
    --green: #00a878;
    --yellow: #ffbf3c;
    --red: #e84a5f;
    --blue: #2574f5;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

.auth-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 20%, rgba(107, 61, 244, .16), transparent 28%),
        radial-gradient(circle at 85% 30%, rgba(0, 168, 120, .14), transparent 25%),
        var(--bg);
}

.auth-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 420px;
    gap: 48px;
    align-items: center;
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.auth-brand strong,
.logo {
    display: inline-block;
    font-size: 28px;
    font-weight: 900;
}

.auth-brand h1 {
    max-width: 680px;
    margin: 24px 0 16px;
    font-size: clamp(36px, 5vw, 64px);
    line-height: .95;
}

.auth-brand p {
    max-width: 560px;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.5;
}

.auth-card,
.card,
.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(23, 32, 51, .08);
}

.auth-card {
    padding: 28px;
}

.auth-card h2 {
    margin: 0 0 22px;
    font-size: 24px;
}

label {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--muted);
    font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="number"],
select,
textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 14px;
    color: var(--ink);
    background: white;
    font: inherit;
    outline: none;
}

textarea {
    min-height: 96px;
    padding-top: 12px;
    resize: vertical;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(107, 61, 244, .14);
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--purple);
}

fieldset {
    margin: 0 0 16px;
    padding: 0;
    border: 0;
}

legend {
    margin-bottom: 8px;
    color: var(--muted);
    font-weight: 700;
}

fieldset label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--ink);
    font-weight: 700;
}

button {
    font: inherit;
}

button,
.primary-link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    padding: 0 18px;
    background: var(--purple);
    color: white;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
.primary-link:hover {
    filter: brightness(.96);
}

.alert,
.notice {
    margin-bottom: 16px;
    border-radius: 8px;
    padding: 12px;
    font-weight: 700;
}

.alert,
.notice.error {
    border: 1px solid rgba(232, 74, 95, .35);
    background: rgba(232, 74, 95, .08);
    color: #9d2033;
}

.notice.success {
    border: 1px solid rgba(0, 168, 120, .35);
    background: rgba(0, 168, 120, .08);
    color: #08775a;
}

.app-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

.sidebar {
    min-height: 100vh;
    padding: 24px;
    background: var(--dark);
    color: white;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.sidebar .logo {
    font-size: 32px;
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar a,
.sidebar span,
.ghost {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-radius: 8px;
    padding: 12px 14px;
    background: transparent;
    color: rgba(255, 255, 255, .78);
    text-decoration: none;
    font-weight: 800;
}

.sidebar a.active,
.sidebar a:hover,
.ghost:hover {
    background: rgba(255, 255, 255, .1);
    color: white;
}

.sidebar form {
    margin-top: auto;
}

.ghost {
    border: 0;
    cursor: pointer;
}

.content {
    padding: 32px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.kicker {
    color: var(--muted);
    font-weight: 900;
    text-transform: uppercase;
    font-size: 12px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.topbar h1 {
    margin-bottom: 0;
    font-size: 34px;
}

.grid {
    display: grid;
    gap: 16px;
    margin-bottom: 18px;
}

.dashboard-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
    padding: 20px;
    border-top: 5px solid var(--purple);
}

.card span {
    color: var(--muted);
    font-weight: 800;
}

.card strong {
    display: block;
    margin-top: 12px;
    font-size: 44px;
    line-height: 1;
}

.accent-green {
    border-top-color: var(--green);
}

.accent-yellow {
    border-top-color: var(--yellow);
}

.accent-blue {
    border-top-color: var(--blue);
}

.panel {
    padding: 24px;
    margin-bottom: 18px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
}

.panel-header h2 {
    margin-bottom: 0;
}

.empty-state {
    min-height: 180px;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    gap: 8px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: #fafbfe;
}

.empty-state h3 {
    margin-bottom: 0;
    font-size: 22px;
}

.empty-state p {
    max-width: 520px;
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.5;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

.status-badge {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    border-radius: 999px;
    padding: 0 10px;
    background: rgba(37, 116, 245, .1);
    color: var(--blue);
    font-weight: 800;
    text-transform: capitalize;
}

.button-secondary {
    background: #e8edf6;
    color: var(--ink);
}

.question-picker {
    margin-top: 8px;
}

.question-toolbar {
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr) minmax(180px, 240px) minmax(160px, 220px) auto auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 12px;
}

.question-toolbar button {
    min-height: 46px;
    white-space: nowrap;
}

.question-filter-field {
    display: grid;
    gap: 8px;
    margin-bottom: 0;
    color: var(--muted);
    font-weight: 700;
}

.question-picker-meta {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.question-empty-filter {
    margin: 0 0 12px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 14px;
    color: var(--muted);
    font-weight: 700;
    text-align: center;
}

.question-empty-filter[hidden] {
    display: none;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .question-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .question-toolbar button {
        width: 100%;
    }
}

@media (max-width: 820px) {
    .auth-wrap,
    .app-page,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .auth-wrap {
        padding: 32px 0;
    }

    .sidebar {
        min-height: auto;
    }

    .content {
        padding: 24px 16px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .question-toolbar {
        grid-template-columns: 1fr;
    }
}
