:root {
  --blue: #25abe2; --blue-dark: #0f6f99; --blue-tint: #e6f5fc; --blue-tint-2: #cdebf8;
  --green: #8bc53e; --green-dark: #4d7a17; --green-tint: #eef7e3;
  --ink: #1b2329; --ink-2: #4a5761; --ink-3: #74828c; --line: #dfe6ea; --bg: #f5f8fa; --card: #ffffff;
  --red: #c0392b; --red-tint: #fdecea; --amber: #a86400; --amber-tint: #fff4e0;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 38, 51, .06), 0 2px 8px rgba(16, 38, 51, .05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.45; }
a { color: var(--blue-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--ink-3); } .small { font-size: .875rem; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* top bar */
.topbar { background: #fff; border-bottom: 3px solid var(--blue); position: sticky; top: 0; z-index: 10; }
.topbar .inner { max-width: 1200px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topbar img { height: 44px; width: auto; }
.topbar .title { font-weight: 700; font-size: 1.05rem; }
.topbar .title span { display: block; font-weight: 400; color: var(--ink-3); font-size: .8rem; }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.topbar nav a { text-decoration: none; color: var(--ink-2); padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: .92rem; }
.topbar nav a.active, .topbar nav a:hover { background: var(--blue-tint); color: var(--blue-dark); }
.userbox { font-size: .85rem; color: var(--ink-3); display: flex; gap: 8px; align-items: center; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
.wrap.narrow { max-width: 760px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card > h2:first-child { display: flex; align-items: center; gap: 8px; }
.card .step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; font-size: .85rem; font-weight: 700; flex: none; }

/* forms */
label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: .95rem; }
label .opt { font-weight: 400; color: var(--ink-3); }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=datetime-local], input[type=number], select, textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #c5d0d6; border-radius: 8px; background: #fff; color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid var(--blue-tint-2); border-color: var(--blue); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
.checks { display: grid; gap: 6px; margin-top: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 400; margin: 0; cursor: pointer; }
.check:hover { border-color: var(--blue); }
.check input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--blue-dark); }
.check.on { border-color: var(--blue); background: var(--blue-tint); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pills label { margin: 0; font-weight: 400; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: #fff; cursor: pointer; }
.pills input { accent-color: var(--blue-dark); }
.followq { margin: 8px 0 4px 28px; padding: 10px 12px; border-left: 3px solid var(--blue); background: #fbfdfe; border-radius: 0 8px 8px 0; }
.followq > label:first-child { margin-top: 0; }

button, .btn { font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; cursor: pointer; background: var(--blue-dark); color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { filter: brightness(1.08); }
button.secondary, .btn.secondary { background: #fff; color: var(--blue-dark); border-color: #b9dcea; }
button.ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
button.danger { background: #fff; color: var(--red); border-color: #efc4be; }
button.big { padding: 13px 22px; font-size: 1.05rem; width: 100%; justify-content: center; }
button:disabled { opacity: .55; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

.alert { padding: 12px 14px; border-radius: 8px; margin: 10px 0; border: 1px solid; }
.alert.info { background: var(--blue-tint); border-color: var(--blue-tint-2); }
.alert.warn { background: var(--amber-tint); border-color: #f2d39a; color: #5d3a00; }
.alert.error { background: var(--red-tint); border-color: #f1b8b1; color: #7a1d12; }
.alert.ok { background: var(--green-tint); border-color: #cfe6b2; color: #2d4a0c; }
.alert ul { margin: 6px 0 0 18px; padding: 0; }

.files { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.files li { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: .9rem; }
.files li .st { color: var(--ink-3); font-size: .8rem; }

/* badges */
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.tier-file { background: #eef1f3; color: #4a5761; }
.tier-review { background: var(--amber-tint); color: var(--amber); border-color: #f2d39a; }
.tier-investigation { background: var(--red-tint); color: var(--red); border-color: #f1b8b1; }
.st-closed, .st-filed { background: #eef1f3; color: #4a5761; }
.st-new { background: var(--blue-tint); color: var(--blue-dark); }
.st-in_review, .st-investigation { background: #fff; color: var(--ink); border-color: var(--line); }
.st-waiting { background: #f3eefc; color: #5b3c99; }
.overdue { background: var(--red); color: #fff; }
.chip { display: inline-block; font-size: .75rem; padding: 1px 7px; border-radius: 6px; background: #eef1f3; color: var(--ink-2); margin: 1px 2px 1px 0; }
.chip.done { background: var(--green-tint); color: var(--green-dark); }
.chip.open { background: var(--amber-tint); color: var(--amber); }
.chip.late { background: var(--red-tint); color: var(--red); }

/* tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--blue-tint); color: #12465e; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; position: sticky; top: 0; }
tbody tr.click { cursor: pointer; } tbody tr.click:hover { background: #f7fbfd; }
tbody tr:last-child td { border-bottom: 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.kpi .n { font-size: 1.8rem; font-weight: 800; line-height: 1.1; }
.kpi .l { color: var(--ink-3); font-size: .85rem; }
.kpi.alertk .n { color: var(--red); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: end; }
.filters > * { flex: 1 1 150px; } .filters label { margin: 0 0 3px; font-size: .8rem; color: var(--ink-3); }
.filters input, .filters select { padding: 8px 10px; }

.grid2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: .92rem; }
.dl dt { color: var(--ink-3); } .dl dd { margin: 0; white-space: pre-wrap; }
@media (max-width: 560px) { .dl { grid-template-columns: 1fr; } .dl dt { margin-top: 6px; } }
.story { white-space: pre-wrap; background: #fbfcfd; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 3px solid var(--blue-tint-2); padding: 0 0 14px 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 11px; height: 11px; border-radius: 50%; background: var(--blue); }
.timeline li.sys::before { background: #b3c1c9; }
.timeline .meta { font-size: .8rem; color: var(--ink-3); }
.timeline .txt { white-space: pre-wrap; margin-top: 2px; }
.req { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 10px; background: #fff; }
.req.done { border-color: #cfe6b2; background: #fbfef7; }
.req.open.late { border-color: #f1b8b1; background: #fffafa; }
.req h3 { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
details summary { cursor: pointer; font-weight: 600; color: var(--blue-dark); }

.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--ink-2); margin: 4px 0 8px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 50; font-size: .92rem; box-shadow: var(--shadow); }
.center { text-align: center; }
.done-card { text-align: center; padding: 30px 18px; }
.done-card .num { font-size: 1.6rem; font-weight: 800; color: var(--blue-dark); margin: 6px 0 12px; }

@media print {
  .topbar, .noprint, .actions, button, details:not([open]) { display: none !important; }
  body { background: #fff; } .card { box-shadow: none; break-inside: avoid; }
  .grid2 { grid-template-columns: 1fr; } .printonly { display: block !important; }
}
.printonly { display: none; }
