:root {
  --navy: #263C63; --navy-2: #34508a; --gold: #EFB033; --gold-soft: #fdf3dc;
  --bg: #f5f6f9; --card: #fff; --ink: #1d2433; --muted: #667085; --line: #e3e7ee;
  --ok: #1e7f4f; --ok-soft: #e3f4ea; --warn: #b54708; --warn-soft: #fdf0e3; --bad: #b42318; --bad-soft: #fde8e7;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--navy-2); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; color: var(--navy); }
h2 { font-size: 1.15rem; margin: 1.75rem 0 .75rem; color: var(--navy); }
h3 { font-size: 1rem; margin: 0 0 .25rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.top { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 1rem; padding: .5rem 1rem; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 600; }
.brand img { height: 34px; background: #fff; border-radius: 6px; padding: 3px 6px; }
.brand span { color: var(--gold); letter-spacing: .02em; }
#nav { display: flex; gap: .25rem; flex-wrap: wrap; margin-left: auto; }
#nav a, #nav button { color: #dfe6f3; text-decoration: none; padding: .35rem .65rem; border-radius: 6px; font-size: .9rem; background: none; border: 0; cursor: pointer; font-family: inherit; }
#nav a:hover, #nav button:hover { background: rgba(255,255,255,.1); }
#nav a.on { background: var(--gold); color: var(--navy); font-weight: 600; }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 16px 4rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: .9rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem; }

label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin: .6rem 0 .2rem; }
input, select, textarea { width: 100%; font: inherit; padding: .5rem .6rem; border: 1px solid #cdd3dd; border-radius: 7px; background: #fff; color: var(--ink); }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
input[disabled], select[disabled], textarea[disabled] { background: #f2f4f7; color: #475467; }
input[type=checkbox], input[type=radio] { width: auto; margin: 0; }

.btn { font: inherit; font-weight: 600; border: 0; border-radius: 7px; padding: .5rem .9rem; cursor: pointer; background: var(--navy); color: #fff; }
.btn:hover { background: var(--navy-2); }
.btn.gold { background: var(--gold); color: var(--navy); }
.btn.ghost { background: transparent; color: var(--navy); border: 1px solid #cdd3dd; }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid #f3c1bd; }
.btn.sm { padding: .25rem .55rem; font-size: .82rem; }
.btn[disabled] { opacity: .5; cursor: default; }

.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--line); margin: 1rem 0; flex-wrap: wrap; }
.tabs a { padding: .5rem .9rem; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a.on { color: var(--navy); border-color: var(--gold); }

.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: .12rem .5rem; border-radius: 99px; background: #eef1f6; color: #475467; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.gold { background: var(--gold-soft); color: #8a5a00; }

.bar { height: 8px; background: #eceff4; border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--navy); border-radius: 99px; }
.bar.ok > i { background: var(--ok); }

.obj { border-left: 4px solid var(--navy); }
.obj.poste { border-left-color: var(--gold); }
.obj-head { display: flex; gap: .75rem; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.obj-meta { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .87rem; color: var(--muted); margin-top: .3rem; }
.obj-meta b { color: var(--ink); font-weight: 600; }
details > summary { cursor: pointer; font-weight: 600; color: var(--navy-2); margin-top: .6rem; font-size: .9rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; background: #fafbfc; }
td.num, th.num { text-align: center; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin: 1rem 0; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.stat b { display: block; font-size: 1.6rem; color: var(--navy); line-height: 1.2; }
.stat span { font-size: .82rem; color: var(--muted); }

.cal { display: grid; grid-template-columns: repeat(12, minmax(22px, 1fr)); gap: 3px; }
.cal i { display: block; height: 22px; border-radius: 4px; background: #eceff4; font-style: normal; font-size: .7rem; text-align: center; line-height: 22px; color: #475467; }
.cal i.ok { background: #b7e1c8; color: #0f5132; } .cal i.part { background: #fbd9a8; color: #7a4100; } .cal i.none { background: #f7c6c2; color: #7a1a12; }

.steps { display: flex; gap: .4rem; flex-wrap: wrap; margin: .75rem 0 1rem; }
.steps span { font-size: .8rem; padding: .3rem .65rem; border-radius: 99px; background: #eceff4; color: var(--muted); font-weight: 600; }
.steps span.done { background: var(--ok-soft); color: var(--ok); }
.steps span.now { background: var(--gold); color: var(--navy); }

.rv-item { display: grid; grid-template-columns: 1fr; gap: .4rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.rv-cols { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.rv-side { background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .65rem; }
.rv-side.me { background: #fffaf0; border-color: #f4dfae; }
.rv-side h4 { margin: 0 0 .3rem; font-size: .78rem; text-transform: uppercase; color: var(--muted); letter-spacing: .03em; }
.scores { display: flex; gap: .3rem; }
.scores button { width: 2.1rem; height: 2.1rem; border-radius: 7px; border: 1px solid #cdd3dd; background: #fff; font-weight: 700; cursor: pointer; color: var(--navy); }
.scores button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.scores button[disabled] { cursor: default; }
.gap { color: var(--warn); font-weight: 700; font-size: .8rem; }
.readonly { white-space: pre-wrap; min-height: 1.2em; }
.empty { color: var(--muted); font-style: italic; }

.notice { background: var(--gold-soft); border: 1px solid #f4dfae; border-radius: 8px; padding: .65rem .85rem; margin: .75rem 0; font-size: .92rem; }
.notice.bad { background: var(--bad-soft); border-color: #f3c1bd; }
.linkbox { font-family: ui-monospace, Menlo, monospace; font-size: .82rem; word-break: break-all; background: #f2f4f7; padding: .5rem; border-radius: 6px; }

.login { max-width: 400px; margin: 8vh auto; }
.login img { display: block; height: 70px; margin: 0 auto 1rem; }
.login h1 { text-align: center; }

#toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100% - 32px); z-index: 10; }
#toast.show { opacity: 1; }
#toast.err { background: var(--bad); }

dialog { border: 0; border-radius: 12px; padding: 1.25rem; width: min(560px, calc(100% - 32px)); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20,30,50,.45); }

@media (max-width: 640px) {
  .rv-cols { grid-template-columns: 1fr; }
  h1 { font-size: 1.3rem; }
  .brand img { height: 28px; }
}
@media print {
  .top, .tabs, .btn, #toast { display: none !important; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
}
