:root {
    --blue: #174a9c;
    --blue-2: #2f68bd;
    --blue-soft: #eaf1fb;
    --navy: #0d2d62;
    --text: #1d2a3a;
    --muted: #6b7788;
    --line: #dfe5ec;
    --bg: #f4f7fb;
    --white: #ffffff;
    --success: #18794e;
    --danger: #b42318;
    --shadow: 0 10px 30px rgba(26, 59, 108, .09);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 250px; position: fixed; inset: 0 auto 0 0; background: linear-gradient(180deg, #133f84, #0b2f68); color: white; padding: 22px 16px; display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; color: white; font-weight: 800; font-size: 18px; padding: 0 8px 24px; }
.brand img { width: 54px; height: 54px; object-fit: contain; border-radius: 12px; background: white; padding: 4px; }
.nav { display: grid; gap: 7px; }
.nav a { color: rgba(255,255,255,.82); padding: 12px 14px; border-radius: 10px; font-weight: 650; }
.nav a:hover, .nav a.active { color: white; background: rgba(255,255,255,.14); }
.sidebar-user { margin-top: 14px; padding: 16px 12px 0; border-top: 1px solid rgba(255,255,255,.18); display: grid; gap: 4px; }
.sidebar-user span { color: rgba(255,255,255,.7); font-size: 13px; }
.sidebar-user a { color: white; margin-top: 8px; font-size: 14px; }
.main { margin-left: 250px; min-width: 0; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { background: white; min-height: 92px; display: flex; align-items: center; gap: 16px; padding: 20px 30px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar h1 { margin: 0; font-size: 25px; color: var(--navy); }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.menu-button { display: none; border: 0; background: var(--blue-soft); color: var(--blue); width: 42px; height: 42px; border-radius: 9px; font-size: 20px; }
.content { padding: 28px 30px; flex: 1; }
.app-footer { padding: 20px 30px; color: var(--muted); font-size: 13px; text-align: center; border-top: 1px solid var(--line); background: white; }
.hero-stat { background: linear-gradient(120deg, var(--blue), var(--blue-2)); color: white; padding: 28px 32px; border-radius: 18px; box-shadow: var(--shadow); display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.hero-stat span { font-weight: 700; font-size: 18px; }
.hero-stat strong { font-size: clamp(44px, 7vw, 78px); line-height: 1; }
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.stat-card span { color: var(--muted); font-size: 14px; display: block; min-height: 38px; }
.stat-card strong { display: block; font-size: 34px; color: var(--navy); margin-top: 6px; }
.quick-actions { display: flex; gap: 10px; margin-bottom: 22px; }
.panel, .form-card { background: white; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.form-card { padding: 24px; max-width: 920px; }
.form-card.narrow { max-width: 560px; }
.panel-header { padding: 22px 24px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; color: var(--navy); font-size: 20px; }
.panel-header p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.actions-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.button-row, .form-actions { display: flex; gap: 9px; align-items: center; }
.btn { display: inline-flex; justify-content: center; align-items: center; border-radius: 9px; padding: 10px 16px; border: 1px solid transparent; font-weight: 700; line-height: 1.2; }
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--navy); }
.btn-outline { border-color: #aac0df; background: white; color: var(--blue); }
.btn-ghost { color: var(--muted); background: transparent; }
.btn-small { padding: 8px 11px; font-size: 13px; }
.btn-block { width: 100%; }
.filter-bar { padding: 14px 24px; display: flex; gap: 10px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.filter-bar input { min-width: 280px; flex: 1; }
input, textarea, select { width: 100%; border: 1px solid #cbd5e1; border-radius: 9px; padding: 11px 12px; background: white; color: var(--text); outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--blue-2); box-shadow: 0 0 0 3px rgba(47,104,189,.12); }
textarea { resize: vertical; }
.field { display: grid; gap: 7px; }
.field label { font-weight: 700; font-size: 14px; }
.field label b { color: var(--danger); }
.field small { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field-full { grid-column: 1 / -1; }
.check-row { display: flex; flex-wrap: wrap; gap: 12px; }
.check-row label { display: inline-flex; align-items: center; gap: 8px; background: var(--blue-soft); padding: 10px 14px; border-radius: 9px; }
.check-row input { width: auto; }
.note-box { background: #f8fafc; border: 1px dashed #b8c5d4; border-radius: 10px; padding: 13px; color: var(--muted); }
.section-label { color: var(--navy); font-weight: 800; border-top: 1px solid var(--line); padding-top: 15px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 920px; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f7f9fc; color: #506077; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td { font-size: 14px; }
td strong { display: block; color: #152c4b; }
td small { display: block; color: var(--muted); margin-top: 4px; max-width: 300px; }
.empty { text-align: center; color: var(--muted); padding: 32px; }
.badge { display: inline-flex; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 800; }
.badge-success { background: #e7f7ef; color: var(--success); }
.badge-muted { background: #edf1f5; color: #64748b; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-list span { background: var(--blue-soft); color: var(--blue); padding: 4px 7px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.row-actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.inline-form { display: inline; margin: 0; }
.inline-form button { border: 0; background: none; padding: 0; color: var(--blue); font-weight: 700; }
.inline-form .danger-link { color: var(--danger); }
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 650; }
.alert-success { background: #e8f7ef; color: #176b47; border: 1px solid #b7e4cc; }
.alert-error { background: #fff0ef; color: #9f211b; border: 1px solid #f4c1bd; }
.alert-info { background: #eaf2fd; color: #174a9c; border: 1px solid #bed2ef; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at top, #eaf2ff, #f7f9fc 55%, #eef2f7); }
.auth-card, .install-card { width: min(440px, 100%); background: white; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 22px 60px rgba(20,52,99,.16); padding: 28px; text-align: center; }
.install-card { width: min(720px, 100%); }
.auth-logo { width: 118px; height: 148px; object-fit: contain; margin: 0 auto 8px; }
.auth-card h1, .install-card h1 { color: var(--navy); font-size: 23px; margin: 8px 0; }
.muted { color: var(--muted); }
.auth-card form { text-align: left; display: grid; gap: 16px; margin-top: 22px; }
.auth-footer { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
@media (max-width: 1050px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 12px 0 30px rgba(0,0,0,.2); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-button { display: inline-grid; place-items: center; }
    .topbar { padding: 16px; }
    .content { padding: 18px 14px; }
    .hero-stat { align-items: flex-start; flex-direction: column; gap: 14px; padding: 23px; }
    .stats-grid { grid-template-columns: 1fr; }
    .actions-header, .filter-bar { align-items: stretch; flex-direction: column; }
    .button-row { flex-wrap: wrap; }
    .filter-bar input { min-width: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .field-full { grid-column: auto; }
    .quick-actions { flex-direction: column; }
}

/* Registry update: persistent user ranking and expanded classifications */
.sidebar { overflow-y: auto; }
.sidebar-performance {
    margin: auto 0 0;
    padding: 12px;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 16px;
    background: linear-gradient(155deg, rgba(255,255,255,.18), rgba(255,255,255,.08));
    box-shadow: 0 12px 28px rgba(2,20,55,.28), inset 0 1px 0 rgba(255,255,255,.18);
    backdrop-filter: blur(8px);
}
.performance-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.performance-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 4px 9px;
    border-radius: 999px;
    background: white;
    color: var(--navy);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
    box-shadow: 0 5px 14px rgba(0,0,0,.14);
}
.performance-live {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: rgba(255,255,255,.76);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.performance-live i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #67e8a5;
    box-shadow: 0 0 0 4px rgba(103,232,165,.14);
}
.performance-rank {
    padding: 10px 8px 12px;
    border-radius: 12px;
    background: rgba(5,31,75,.28);
    text-align: center;
}
.performance-label {
    display: block;
    color: rgba(255,255,255,.92);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: .025em;
}
.rank-number {
    margin: 7px 0 0;
    color: white;
    font-size: 72px;
    font-weight: 950;
    line-height: .86;
    letter-spacing: -.075em;
    text-shadow: 0 5px 18px rgba(0,0,0,.3);
}
.rank-number small {
    color: #a9ccff;
    font-size: 24px;
    font-weight: 900;
    vertical-align: top;
    margin-right: 3px;
    letter-spacing: 0;
}
.rank-context {
    color: rgba(255,255,255,.7);
    font-size: 10px;
    margin-top: 9px;
}
.performance-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-top: 8px;
}
.performance-metric {
    min-width: 0;
    padding: 10px 7px;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 11px;
    background: rgba(255,255,255,.09);
    text-align: center;
}
.performance-metric strong {
    display: block;
    color: white;
    font-size: 25px;
    line-height: 1;
    font-weight: 900;
}
.performance-metric span {
    display: block;
    margin-top: 5px;
    color: rgba(255,255,255,.82);
    font-size: 9px;
    line-height: 1.2;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .035em;
}
.performance-metric small {
    display: block;
    margin-top: 3px;
    color: rgba(255,255,255,.55);
    font-size: 8px;
    line-height: 1.15;
}
.performance-rate strong { color: #a9d5ff; }
.input-breakdown {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px 9px;
    color: rgba(255,255,255,.68);
    font-size: 10px;
    margin-top: 9px;
}
.form-card { max-width: 1080px; }
.wide-table { min-width: 1420px; }
.remarks-cell { max-width: 280px; min-width: 180px; color: #4f5f73; line-height: 1.45; }
.tag-list span.tag-success,
.check-row label.tag-success { background: #e7f7ef; color: #18794e; }
.tag-list span.tag-warning,
.check-row label.tag-warning { background: #fff5db; color: #8a5b00; }
.tag-list span.tag-danger,
.check-row label.tag-danger { background: #fff0ef; color: #b42318; }
.check-row label.tag-success,
.check-row label.tag-warning,
.check-row label.tag-danger { border: 1px solid currentColor; }

@media (max-height: 760px) and (min-width: 761px) {
    .sidebar { padding-top: 16px; padding-bottom: 14px; }
    .brand { padding-bottom: 14px; }
    .nav { gap: 4px; }
    .nav a { padding-top: 9px; padding-bottom: 9px; }
    .sidebar-performance { padding: 9px; }
    .performance-heading { margin-bottom: 7px; }
    .performance-rank { padding: 8px 6px 9px; }
    .rank-number { font-size: 54px; }
    .rank-context { margin-top: 6px; }
    .performance-metric { padding: 8px 5px; }
    .performance-metric strong { font-size: 21px; }
    .input-breakdown { margin-top: 6px; }
    .sidebar-user { margin-top: 9px; padding-top: 10px; }
}
