:root {
  --bg: #eeeeec;
  --surface: #fafaf9;
  --text: #131741;
  --muted: #5b5e70;
  --border: #d4d4d1;
  --primary: #ff4c01;
  --primary-dark: #d93f00;
  --ink: #131741;
  --link: #c23a00;
  --accent: #fbe6dd;
  --danger: #b3261e;
  --success: #1e7b4a;
  --warning: #8a5a00;
  --radius: 8px;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--link); }
a:hover { color: var(--ink); }

h1 { font-size: 1.7rem; margin: 0 0 .5rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .35rem; color: var(--muted); }
p { margin: 0 0 .75rem; }
code { background: #e1e1de; padding: .1rem .35rem; border-radius: 4px; font-size: .9em; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 1.25rem; }
main.wrap { flex: 1; padding-top: 1.5rem; padding-bottom: 2.5rem; }
.narrow { max-width: 480px; margin: 0 auto; }
.narrow.wide { max-width: 780px; }

.site-header { background: #fff; color: var(--ink); border-bottom: 3px solid var(--primary); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: .7rem; padding-bottom: .7rem; }
.brand { color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: .55rem; }
.brand:hover { color: var(--primary); }
.brand-logo { background: #fff; border-radius: 8px; width: 36px; height: 36px; display: block; }
.hero-logo { display: block; width: 96px; height: 96px; margin: 0 0 1rem; }
.nav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.nav a, .nav .link-button { color: var(--ink); text-decoration: none; padding: .35rem .65rem; border-radius: 6px; font-size: .95rem; }
.nav a:hover, .nav .link-button:hover, .nav a.active { background: var(--accent); color: var(--ink); }
.nav a.button { background: var(--ink); color: var(--bg); }
.nav a.button:hover { background: var(--primary); color: var(--bg); }
.count { background: var(--primary); color: var(--bg); border-radius: 999px; padding: 0 .45rem; font-size: .8rem; font-weight: 700; }

.site-footer { border-top: 3px solid var(--primary); color: var(--ink); font-size: .85rem; padding: 1rem 0; background: #fff; }
.site-footer a { color: var(--ink); }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.crumb { margin-bottom: .25rem; font-size: .9rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 46rem; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.report { background: var(--accent); border-radius: var(--radius); padding: 1rem; }
.empty { color: var(--muted); font-style: italic; margin: .25rem 0; }

.hero { padding: 2rem 0 1.5rem; }
.hero h1 { font-size: 2.1rem; max-width: 44rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.card.highlight { border-color: var(--primary); box-shadow: 0 0 0 2px var(--accent); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; text-decoration: none; color: var(--text); display: flex; flex-direction: column; }
.stat:hover { border-color: var(--primary); color: var(--text); }
.stat.attention { border-color: var(--primary); background: var(--accent); }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--link); }
.stat-label { color: var(--muted); font-size: .9rem; }

.button { display: inline-block; background: var(--ink); color: var(--bg); border: 1px solid var(--ink); border-radius: 6px; padding: .55rem 1rem; font-size: 1rem; font-weight: 600; text-decoration: none; cursor: pointer; font-family: inherit; }
.button:hover { background: var(--primary); border-color: var(--primary); color: var(--bg); }
.button.small { padding: .35rem .75rem; font-size: .9rem; }
.button.secondary { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.button.secondary:hover { background: var(--primary); border-color: var(--primary); color: var(--bg); }
.button.danger { background: var(--danger); border-color: var(--danger); }
.link-button { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; font: inherit; text-align: left; }
.link-button:hover { text-decoration: underline; }
.link-button.danger { color: var(--danger); }
.inline { display: inline; }

.form { display: flex; flex-direction: column; gap: .9rem; }
.form + .form { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
.grid > .form + .form { margin-top: 0; padding-top: 0; border-top: 0; }
.form.row { flex-direction: row; flex-wrap: wrap; align-items: flex-end; margin-top: 1rem; }
.form.row.card { margin-top: 0; }
.form .button { align-self: flex-start; }
.form.row .button { align-self: flex-end; }
.grow { flex: 1; min-width: 200px; }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .95rem; }
label.check { flex-direction: row; align-items: flex-start; gap: .5rem; font-weight: 400; }
label.check input { margin-top: .3rem; }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
.grid > label > .hint { order: 1; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="date"],
input[type="number"], input[type="search"], input[type="file"], select, textarea {
  font: inherit; font-weight: 400; color: var(--text); background: var(--surface); border: 1px solid #b4b4b0; border-radius: 6px; padding: .5rem .6rem; width: 100%;
}
input.short { width: 5.5rem; }
input:focus, select:focus, textarea:focus, .button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
textarea { resize: vertical; }
fieldset { border: 1px solid var(--border); border-radius: 6px; padding: .6rem .9rem .8rem; margin: 0; }
legend { font-weight: 600; font-size: .95rem; padding: 0 .3rem; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .25rem .75rem; }

.filters { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters a { padding: .3rem .75rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); text-decoration: none; font-size: .9rem; }
.filters a.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.filter-form { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filter-form label { min-width: 160px; }
.filter-form label.check { align-items: center; padding-bottom: .45rem; }
.filter-form label.check input { margin-top: 0; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: .85rem; white-space: nowrap; }
.table tbody tr:hover { background: #f4f4f2; }
.table .num { text-align: right; white-space: nowrap; }
.table tfoot th { border-bottom: 0; color: var(--text); font-size: .93rem; }

.badge { display: inline-block; border-radius: 999px; padding: .1rem .6rem; font-size: .8rem; font-weight: 600; background: #e0e0dd; color: #33365a; white-space: nowrap; }
.badge-open { background: var(--ink); color: var(--bg); }
.badge-in_progress { background: #fff1d6; color: #7a4d00; }
.badge-reported { background: #ece5fb; color: #4c2f99; }
.badge-closed, .badge-verify-verified, .badge-user-active { background: #dff3e7; color: #17603a; }
.badge-cancelled { background: #eceff2; color: #58636e; }
.badge-overdue, .badge-verify-rejected, .badge-user-suspended { background: #fbe3e1; color: #8f1d17; }
.badge-verify-pending { background: #fff1d6; color: #7a4d00; }
.badge-invoice-submitted { background: #fff1d6; color: #7a4d00; }
.badge-invoice-approved { background: #ece5fb; color: #4c2f99; }
.badge-invoice-paid { background: #dff3e7; color: #17603a; }
.badge-invoice-rejected { background: #fbe3e1; color: #8f1d17; }
.badge-invoice-cancelled { background: #eceff2; color: #58636e; }
.table.invoice td, .table.invoice th { color: var(--text); font-size: .95rem; }
.table.invoice tr.subtotal th, .table.invoice tr.total th { border-top: 2px solid var(--ink); }
.table.invoice tr.total th { font-size: 1.05rem; }
.badge-actor-mcp { background: #ece5fb; color: #4c2f99; }
.badge-actor-system { background: #eceff2; color: #58636e; }

.flash { border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 1rem; border: 1px solid transparent; }
.flash-success { background: #dff3e7; border-color: #a9d9bd; color: #124d2f; }
.flash-error { background: #fbe3e1; border-color: #efb3ae; color: #7d1812; }
.flash-warning { background: #fff4dc; border-color: #ecd08f; color: #6b4600; }
.flash-info { background: var(--accent); border-color: #f2b9a1; color: var(--ink); }

.facts { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: .35rem .9rem; margin: 0; font-size: .93rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts.columns { grid-template-columns: minmax(150px, auto) 1fr minmax(150px, auto) 1fr; }
@media (max-width: 700px) { .facts.columns { grid-template-columns: minmax(110px, auto) 1fr; } }

.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.tags li { background: var(--accent); color: var(--ink); border-radius: 999px; padding: .2rem .75rem; font-size: .9rem; }

.notice-list { list-style: none; margin: 0; padding: 0; }
.notice-list li { padding: .65rem 0; border-bottom: 1px solid var(--border); }
.notice-list li:last-child { border-bottom: 0; }
.notice-list li.read { opacity: .7; }

.thread { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.message { background: #e4e4e1; border-radius: var(--radius); padding: .6rem .8rem; max-width: 88%; }
.message.own { background: var(--accent); align-self: flex-end; }
.message.system { background: var(--accent); border: 1px dashed var(--primary); max-width: 100%; }
.message-meta { font-size: .82rem; color: var(--muted); margin-bottom: .2rem; }

.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; font-size: .9rem; }
