:root {
  --bg: #f6f5f2; --surface: #ffffff; --surface-2: #f0eee9; --text: #1d1c1a; --muted: #6d6a64; --line: #e2dfd8;
  --accent: #2f5d50; --accent-text: #ffffff; --danger: #b3261e; --warn: #b06a00; --ok: #2e7d32; --info: #285a9e;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161615; --surface: #1f1f1d; --surface-2: #2a2a27; --text: #ecebe7; --muted: #a09d96; --line: #34332f;
    --accent: #7fb8a6; --accent-text: #10201b; --danger: #ef8a83; --warn: #f0b35a; --ok: #8ccf8f; --info: #8fb6ef;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #161615; --surface: #1f1f1d; --surface-2: #2a2a27; --text: #ecebe7; --muted: #a09d96; --line: #34332f;
  --accent: #7fb8a6; --accent-text: #10201b; --danger: #ef8a83; --warn: #f0b35a; --ok: #8ccf8f; --info: #8fb6ef;
  --shadow: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
header.top { background: var(--surface); border-bottom: 1px solid var(--line); }
header.top .wrap { display: flex; align-items: center; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .02em; color: var(--text); }
.brand span { color: var(--muted); font-weight: 400; }
.objsel { flex: 1; min-width: 180px; }
.me { color: var(--muted); font-size: 13px; display: flex; gap: 10px; align-items: center; }
main { padding: 20px 0 48px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 24px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
select, input[type=text], input[type=date], input[type=search], textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; max-width: 100%;
}
textarea { width: 100%; min-height: 70px; resize: vertical; }
button, .btn {
  font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; display: inline-block; text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { filter: brightness(.97); text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn-danger { color: var(--danger); }
.btn-link { background: none; border: none; padding: 0; color: var(--accent); font-weight: 400; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0 12px; }
.tab { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 14px; }
.tab.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.tab b { font-weight: 600; margin-left: 4px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input[type=search] { flex: 1; min-width: 180px; }
table.reg { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.reg th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); padding: 8px 10px; }
table.reg td { padding: 10px; border-top: 1px solid var(--line); vertical-align: top; }
table.reg tr.click { cursor: pointer; }
table.reg tr.click:hover td { background: var(--surface-2); }
.num { font-weight: 700; white-space: nowrap; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--surface-2); }
.st-open { color: var(--info); } .st-sent { color: var(--warn); } .st-claimed { color: var(--accent); } .st-accepted { color: var(--ok); }
.sev { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.sev-critical { background: var(--danger); } .sev-normal { background: var(--warn); } .sev-minor { background: var(--ok); }
.late { color: var(--danger); font-weight: 600; }
.el { color: var(--muted); font-size: 13px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; }
dl.meta { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 0; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; }
.desc { font-size: 18px; font-weight: 600; margin: 14px 0 6px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.photos a { display: block; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0 8px 14px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.actions form { margin: 0 0 12px; }
.actions .card + .card { margin-top: 12px; }
details summary { cursor: pointer; color: var(--accent); }
.flash { background: var(--surface); border-left: 4px solid var(--ok); padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.flash.err { border-left-color: var(--danger); }
.login { max-width: 440px; margin: 10vh auto; }
.docs-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.docs-forms form { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.docs-forms form .spacer { flex: 1; }
tr.new td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
  dl.meta { grid-template-columns: 1fr; gap: 0 0; }
  dl.meta dd { margin-bottom: 8px; }
  table.reg, table.reg tbody, table.reg tr, table.reg td { display: block; width: 100%; }
  table.reg thead { display: none; }
  table.reg { border: none; background: none; }
  table.reg tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; padding: 8px 10px; }
  table.reg td { border: none; padding: 2px 0; }
  table.reg td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 13px; }
  .hide-m { display: none; }
}
.in-tg header.top .brand span { display: none; }
.in-tg main { padding-top: 12px; }
