*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    background: #f0f2f5;
    color: #222;
    min-height: 100vh;
}

/* ── Nav ── */
nav {
    background: #1a1a2e;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 52px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

.brand {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .5px;
    color: #e2e8f0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-links a {
    color: #94a3b8;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    transition: background .15s, color .15s;
}

.nav-links a:hover,
.nav-links a.active {
    color: #fff;
    background: rgba(255,255,255,.08);
}

.nav-links a.active { font-weight: 600; }

.nav-sep { color: #334155; }
.nav-logout { font-size: 13px; }

/* ── Container ── */
.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 28px 24px;
}

.page-header {
    margin-bottom: 20px;
}

.page-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
}

.count {
    background: #e2e8f0;
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ── Alerts ── */
.alert {
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-size: 13px;
    border-left: 4px solid;
}

.alert-ok    { background: #f0fdf4; color: #166534; border-color: #22c55e; }
.alert-error { background: #fef2f2; color: #991b1b; border-color: #ef4444; }
.alert-info  { background: #eff6ff; color: #1e40af; border-color: #3b82f6; }

/* ── Search form ── */
.search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    align-items: center;
}

.search-form input[type="text"],
.search-form select {
    padding: 7px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: #222;
    min-width: 150px;
}

.search-form input:focus,
.search-form select:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}

/* ── Table ── */
.table-wrap {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    overflow-x: auto;
    margin-bottom: 20px;
}

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

thead th {
    background: #f8fafc;
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background .1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

tbody td {
    padding: 10px 14px;
    color: #334155;
    vertical-align: middle;
}

td.fp {
    font-family: monospace;
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
    cursor: default;
}

td.cell-actions form {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
}

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3px;
    white-space: nowrap;
}

.badge-ok       { background: #dcfce7; color: #15803d; }
.badge-wait     { background: #fef9c3; color: #92400e; }
.badge-disabled { background: #fee2e2; color: #b91c1c; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 14px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s, border-color .12s, color .12s;
    white-space: nowrap;
}

.btn:hover { background: #f1f5f9; }

.btn-primary {
    background: #4361ee;
    border-color: #4361ee;
    color: #fff;
}
.btn-primary:hover { background: #3451d1; border-color: #3451d1; }

.btn-secondary { color: #64748b; }

.btn-full { width: 100%; }

/* Small action buttons */
.btn-sm {
    padding: 4px 9px;
    font-size: 12px;
    border-radius: 5px;
}

.btn-ok       { background: #f0fdf4; border-color: #86efac; color: #15803d; }
.btn-ok:hover { background: #dcfce7; }

.btn-err       { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.btn-err:hover { background: #fee2e2; }

.btn-wait       { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.btn-wait:hover { background: #fef9c3; }

.btn-danger       { background: #fff; border-color: #fca5a5; color: #b91c1c; }
.btn-danger:hover { background: #fef2f2; }

/* ── Pagination ── */
.pagination {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    text-decoration: none;
    font-size: 13px;
    transition: background .12s, border-color .12s;
}

.page-link:hover { background: #f1f5f9; }
.page-link.active { background: #4361ee; border-color: #4361ee; color: #fff; font-weight: 600; }

/* ── Empty state ── */
.empty-state {
    padding: 40px;
    text-align: center;
    color: #94a3b8;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* ── Card ── */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    padding: 24px;
    max-width: 640px;
}

.card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #1e293b;
}

.card p {
    color: #64748b;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* ── Radio group ── */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .12s, background .12s;
}

.radio-option:hover { border-color: #93c5fd; background: #f8fafc; }
.radio-option.radio-selected { border-color: #4361ee; background: #eff3ff; }

.radio-option input[type="radio"] {
    margin-top: 2px;
    accent-color: #4361ee;
    flex-shrink: 0;
}

.radio-option strong { display: block; color: #1e293b; margin-bottom: 2px; }
.radio-option span   { color: #64748b; font-size: 13px; line-height: 1.4; }

/* ── Login page ── */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-box {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0,0,0,.1);
    padding: 40px 36px;
    width: 100%;
    max-width: 360px;
}

.login-box h1 {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 24px;
    text-align: center;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    color: #222;
    background: #fff;
    transition: border-color .12s, box-shadow .12s;
}

.form-group input:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}

.login-box .btn-primary { margin-top: 8px; }
