:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --text: #172033;
    --muted: #667085;
    --line: #d9e0ea;
    --line-soft: #e8edf3;
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --danger: #b42318;
    --success: #067647;
    --warning: #b54708;
    --radius: 8px;
    --shadow: 0 10px 24px rgba(20, 31, 52, 0.06);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

.topbar {
    background: #101827;
    color: #fff;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand strong { font-size: 16px; letter-spacing: 0; }
.brand span { color: #aab4c2; font-size: 12px; }
.topbar nav { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.topbar a {
    color: #dce5f2;
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 14px;
}
.topbar a:hover,
.topbar a.is-active {
    color: #fff;
    background: rgba(255,255,255,0.11);
}
.logout-form { display: inline; }

main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 40px; }
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.page-header h1 { margin: 0; font-size: 30px; line-height: 1.15; }
.page-header p { margin: 6px 0 0; color: var(--muted); max-width: 720px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.card,
.table-card,
.form-section,
.metric-card,
.empty-state {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.auth-card { max-width: 420px; margin: 42px auto; }
.card { padding: 18px; margin-bottom: 16px; }
.card h2, .card h3 { margin-top: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

.metric-card {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 156px;
}
.metric-card h3 { margin: 0; font-size: 14px; color: var(--muted); font-weight: 700; }
.metric-value { font-size: 34px; line-height: 1; font-weight: 800; }
.metric-card p { margin: 0; color: var(--muted); min-height: 42px; }
.metric-card .button, .metric-card button { align-self: flex-start; margin-top: auto; }

.form-section { padding: 18px; margin-bottom: 16px; }
.form-section h3 { margin: 0 0 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
label { display: block; font-weight: 700; margin-bottom: 4px; }
.hint { color: var(--muted); font-size: 13px; margin: -6px 0 12px; }
input, select, textarea {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid #c8d1dd;
    border-radius: 7px;
    margin: 0 0 12px;
    background: #fff;
    color: var(--text);
}
textarea { min-height: 108px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(37, 99, 235, 0.18);
    border-color: var(--brand);
}
.check-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 8px;
}
.check-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: var(--panel-soft);
    border: 1px solid var(--line-soft);
    border-radius: 7px;
    padding: 10px;
    font-weight: 600;
}
.check-item input { width: auto; margin: 3px 0 0; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line-soft); }

button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand);
    color: #fff;
    border: 0;
    border-radius: 7px;
    padding: 10px 14px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 700;
    min-height: 38px;
}
button:hover, .button:hover { background: var(--brand-dark); color: #fff; }
.button-secondary { background: #eef2f7; color: #263242; }
.button-secondary:hover { background: #dde5ef; color: #172033; }
.button-danger { background: #b42318; color: #fff; }
.button-danger:hover { background: #912018; color: #fff; }

.table-card { overflow: hidden; margin-bottom: 16px; }
.table-card h2, .table-card h3 { margin: 0; padding: 16px 18px 10px; }
.table-card table, table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
th { color: #475467; font-size: 13px; background: #f8fafc; }
tr:last-child td { border-bottom: 0; }
.truncate { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.muted { color: var(--muted); }
.danger { color: var(--danger); }
.ok { color: var(--success); }
.status, .pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    background: #eef2f7;
    color: #344054;
    white-space: nowrap;
}
.status--success { background: #dcfae6; color: #067647; }
.status--warning { background: #fff3d6; color: #b54708; }
.status--danger { background: #fee4e2; color: #b42318; }
.status--neutral { background: #eef2f7; color: #344054; }
.status--info { background: #dbeafe; color: #1d4ed8; }

.empty-state {
    padding: 22px;
    color: var(--muted);
    text-align: center;
}
.next-step {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
    border-radius: var(--radius);
    padding: 12px 14px;
    margin: 14px 0;
}
.mobile-list { display: none; }
details { color: var(--muted); }
summary { cursor: pointer; color: var(--brand); font-weight: 700; }
pre { overflow: auto; background: #0f172a; color: #e5e7eb; padding: 14px; border-radius: 7px; }

@media (max-width: 760px) {
    .topbar { align-items: flex-start; padding: 12px 16px; }
    .topbar nav { justify-content: flex-start; gap: 6px; }
    .topbar nav form { margin-top: 4px; }
    main { padding: 18px 14px 32px; }
    .page-header { align-items: flex-start; flex-direction: column; }
    .page-header h1 { font-size: 26px; }
    .card, .form-section, .metric-card { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    table { display: block; overflow-x: auto; white-space: nowrap; }
    th, td { padding: 9px 10px; }
    .status, .pill { white-space: normal; }
    .desktop-table { display: none; }
    .mobile-list { display: block; }
    .mobile-list .card { margin-bottom: 10px; }
    .mobile-list p { margin: 8px 0; }
}
