:root {
  --bg: #f4f6f8; --card: #fff; --ink: #1d232b; --muted: #5b6573; --line: #dfe4ea;
  --navy: #0f2a44; --red: #c8102e; --ok: #1a7f4b; --warn: #a15c00; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--navy); }
.muted { color: var(--muted); }
.top { display: flex; align-items: center; gap: 24px; padding: 10px 24px; background: var(--navy); color: #fff; flex-wrap: wrap; }
.top a { color: #fff; text-decoration: none; opacity: .8; }
.top nav { display: flex; gap: 18px; flex: 1; }
.top nav a.active { opacity: 1; border-bottom: 2px solid var(--red); padding-bottom: 2px; }
.brand { font-weight: 700; font-size: 17px; }
.brand span { font-weight: 400; opacity: .7; font-size: 13px; margin-left: 6px; }
.who { font-size: 12px; opacity: .85; }
.banner { background: #fff4d6; color: var(--warn); padding: 6px 24px; font-size: 12px; }
main { max-width: 1320px; margin: 0 auto; padding: 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 16px; color: var(--navy); }
.card h3 { margin: 14px 0 6px; font-size: 14px; color: var(--navy); }
label { display: block; font-weight: 600; font-size: 13px; margin: 10px 0 4px; }
label input, label textarea, label select { margin-top: 4px; }
input, textarea, select { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); }
textarea { resize: vertical; min-height: 70px; }
input:focus, textarea:focus, select:focus { outline: 2px solid #9cc0e6; border-color: #9cc0e6; }
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 7px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { background: #f0f3f6; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: #a90d26; }
.btn.navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: progress; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }
.grid-editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.side { position: sticky; top: 12px; }
@media (max-width: 980px) { .grid-editor { grid-template-columns: 1fr; } .side { position: static; } }

.ac { position: relative; }
.ac-list { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 8px 24px rgba(0,0,0,.08); max-height: 300px; overflow: auto; }
.ac-item { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid #f0f2f5; }
.ac-item:hover, .ac-item.sel { background: #eef4fb; }
.ac-item small { color: var(--muted); }
.ac-item.create { color: var(--red); font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; background: #eef1f4; color: var(--ink); margin: 2px 4px 2px 0; }
.chip.ok { background: #e3f4ea; color: var(--ok); }
.chip.warn { background: #fff1dc; color: var(--warn); }
.chip.red { background: #fde7ea; color: var(--red); }
.chip button { border: 0; background: none; cursor: pointer; color: inherit; padding: 0; font-size: 14px; line-height: 1; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); }
table.t td { padding: 5px 6px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
table.t td input { padding: 5px 7px; }
table.t .num { width: 90px; text-align: right; }
table.t .r { text-align: right; white-space: nowrap; }
table.t tr.clickable { cursor: pointer; }
table.t tr.clickable:hover { background: #f7f9fb; }
.totals { text-align: right; margin-top: 10px; }
.totals b { font-size: 18px; color: var(--navy); }
.crit { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 14px; }
.crit label { margin: 0; font-size: 12px; color: var(--muted); }
.stars { display: inline-flex; gap: 2px; }
.stars button { border: 0; background: none; font-size: 20px; cursor: pointer; color: #cfd6de; padding: 0 1px; }
.stars button.on { color: #f0a500; }
.compet { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-top: 10px; }
.compet h4 { margin: 0 0 4px; }
.compet ul { margin: 4px 0 6px 18px; padding: 0; }
.loading { display: flex; gap: 12px; align-items: center; padding: 30px; justify-content: center; color: var(--muted); }
.spin { width: 20px; height: 20px; border: 3px solid #d9e0e7; border-top-color: var(--red); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 420px; z-index: 20; }
.toast.err { background: var(--red); }
.dirty { color: var(--warn); font-size: 12px; }
.lib-item { border-bottom: 1px solid var(--line); padding: 12px 0; }
.lib-item p { white-space: pre-wrap; margin: 6px 0 0; }
.alert { background: #fde7ea; color: var(--red); padding: 8px 10px; border-radius: 7px; margin: 8px 0; }
.login { display: grid; place-items: center; min-height: 100vh; }
.login-card { width: min(380px, calc(100vw - 32px)); }
.login-card h1 { margin: 0; color: var(--navy); }
.login-card .btn { width: 100%; justify-content: center; margin-top: 16px; }
.option-box { border-left: 3px solid var(--red); padding-left: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
table[data-lines] { table-layout: fixed; }
table[data-lines] th:nth-child(1) { width: 62px; }
table[data-lines] th.num { width: 68px; }
table[data-lines] th:nth-child(6) { width: 88px; }
table[data-lines] .hint { font-size: 11px; }
table[data-lines] th:nth-child(7) { width: 40px; }
