:root {
  --navy: #22344a; --navy-2: #2f4763; --ink: #1b2430; --muted: #66707d; --line: #dde2e8; --bg: #f4f6f8; --card: #fff;
  --ok: #1f7a4d; --ok-bg: #e5f4ec; --warn: #9a6500; --warn-bg: #fdf3dc; --bad: #b2342b; --bad-bg: #fbe7e5; --info-bg: #e7eef7;
  --r: 10px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.45; }
h1 { font-size: 26px; margin: 4px 0; color: var(--navy); }
h2 { font-size: 18px; margin: 0 0 12px; color: var(--navy); }
h3 { font-size: 15px; margin: 18px 0 8px; color: var(--navy); }
button { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 9px 14px; cursor: pointer; min-height: 40px; }
button:hover:not(:disabled) { border-color: var(--navy-2); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--navy-2); }
button.ghost { background: transparent; }
button.small { padding: 4px 10px; min-height: 30px; font-size: 13px; }
button.danger { color: var(--bad); }
button.wide { width: 100%; }
button.linkbtn { border: 0; background: none; color: var(--navy-2); text-decoration: underline; padding: 6px 0; min-height: 0; }
input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; background: #fff; width: 100%; min-height: 40px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid #7aa2d6; outline-offset: 1px; }
input[type=checkbox] { width: auto; min-height: 0; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: #f8fafb; }
td.r, th.r { text-align: right; white-space: nowrap; }
tr.sum td { font-weight: 700; background: #f3f6f9; }
tr.struck td { color: #9aa1aa; text-decoration: line-through; }
.tablewrap { overflow-x: auto; margin: 8px 0; }
.small { font-size: 12.5px; } .muted { color: var(--muted); } .center { text-align: center; } .pad { padding: 16px 0; }
.neg { color: var(--bad); } .pos { color: var(--ok); } .warn { color: var(--warn); }
.app header { background: var(--navy); color: #fff; padding: 10px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.app header .brand { font-weight: 700; margin-right: 12px; } .app header .case { opacity: .85; }
.app header select { width: auto; min-height: 32px; padding: 4px 8px; }
.app header .who { opacity: .9; font-size: 13px; margin-right: 8px; }
.app header button { color: #fff; border-color: rgba(255,255,255,.35); }
.testbanner { background: var(--warn-bg); color: var(--warn); text-align: center; font-size: 12.5px; padding: 4px; font-weight: 600; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 14px 0; background: #fff; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; white-space: nowrap; padding: 10px 12px; color: var(--muted); }
.tabs button.active { color: var(--navy); border-bottom-color: var(--navy); font-weight: 600; }
main { max-width: 1180px; margin: 0 auto; padding: 18px 14px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 16px; }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.cardhead h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 16px; align-items: start; }
.stack > * + * { margin-top: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fbfcfd; }
.stat-label { font-size: 12px; color: var(--muted); } .stat-value { font-size: 20px; font-weight: 700; color: var(--navy); } .stat-sub { font-size: 12px; color: var(--muted); }
.stat.warn { background: var(--warn-bg); border-color: #f1d9a6; } .stat.bad { background: var(--bad-bg); border-color: #efc2bd; } .stat.ok { background: var(--ok-bg); border-color: #bfe3cf; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #eef1f4; color: #3c4652; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); color: var(--navy-2); }
.form { display: flex; flex-direction: column; gap: 12px; } .form.narrow { max-width: 380px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); flex: 1; }
.field > span { font-weight: 600; color: #46505c; }
.row { display: flex; gap: 10px; flex-wrap: wrap; } .row > * { min-width: 130px; } .row.three > * { min-width: 90px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.hint { background: var(--info-bg); padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.warnbox { background: var(--warn-bg); color: var(--warn); padding: 8px 12px; border-radius: 8px; font-size: 13.5px; margin: 6px 0; }
.okbox { background: var(--ok-bg); color: var(--ok); padding: 10px 12px; border-radius: 8px; margin: 6px 0; }
.error { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: 8px; margin: 8px 0; }
.callout { display: flex; gap: 14px; align-items: center; justify-content: space-between; background: #f1f5fa; border: 1px solid #d2deec; border-radius: 10px; padding: 12px 14px; margin: 12px 0; flex-wrap: wrap; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; } .quick .primary { flex: 1; }
.netline { display: flex; gap: 10px; align-items: center; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; } .btnlist { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
td.actions { white-space: nowrap; text-align: right; }
.monthpicker { display: flex; align-items: center; gap: 6px; } .monthpicker strong { min-width: 130px; text-align: center; }
.monthpicker button { min-height: 34px; padding: 2px 12px; font-size: 18px; }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; } .subtabs button.active { background: var(--navy); color: #fff; }
.checks { list-style: none; padding: 0; margin: 8px 0; } .checks li { padding: 6px 0; border-bottom: 1px dashed var(--line); } .checks li.bad { color: var(--bad); } .checks li.warn { color: var(--warn); }
.plain { list-style: none; padding: 0; margin: 6px 0; } .plain li { padding: 6px 0; border-bottom: 1px solid #eef1f4; }
.objection { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 10px 0; }
.objhead { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.events { margin: 8px 0; padding-left: 18px; font-size: 13.5px; }
.planver { margin-bottom: 14px; }
.statement { background: #f7f8fa; border-left: 3px solid var(--navy); padding: 8px 12px; font-size: 14px; }
.sigwrap { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 10px 0; }
.sigpad { width: 100%; height: 180px; display: block; touch-action: none; background: #fff; cursor: crosshair; }
.sigfoot { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; background: #f8fafb; border-top: 1px dashed var(--line); font-size: 12.5px; }
.modal-bg { position: fixed; inset: 0; background: rgba(20,30,45,.45); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 10px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 900px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; } .modal-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.modal-body .card { border: 0; padding: 0; }
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; width: min(92vw, 520px); }
.toast { background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.err { background: var(--bad); }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, #22344a 0%, #2f4763 45%, #f4f6f8 45%); }
.login-card { background: #fff; border-radius: 14px; padding: 28px; width: 100%; max-width: 420px; box-shadow: 0 16px 50px rgba(0,0,0,.18); display: flex; flex-direction: column; gap: 10px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login .brand { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { flex: 1; border: 0; border-radius: 0; font-size: 13px; padding: 8px 4px; }
.seg button.active { background: var(--navy); color: #fff; }
@media (max-width: 820px) {
  .grid2 { grid-template-columns: 1fr; }
  main { padding: 12px 8px 60px; } .card { padding: 14px; }
  .app header .who { display: none; }
  th, td { padding: 7px 5px; }
  table.resp thead { display: none; }
  table.resp, table.resp tbody { display: block; }
  table.resp tr { display: block; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; background: #fff; }
  table.resp td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 3px 0; text-align: right; }
  table.resp td > * { text-align: right; }
  table.resp td[data-l]::before { content: attr(data-l); color: var(--muted); font-size: 12.5px; text-align: left; flex: 0 0 auto; }
  table.resp td.actions { justify-content: flex-end; padding-top: 6px; }
  table.resp td.actions:empty { display: none; }
  .app header .case { display: none; }
}
@media print { header, nav, .testbanner, button { display: none !important; } .card { border: 0; } }
.card.duecard { border-left: 4px solid var(--warn); background: var(--warn-bg); }
