:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #202d31;
  background: #edf2ef;
  --ink: #202d31;
  --muted: #536760;
  --sidebar: #152b31;
  --sidebar-text: #dce7e5;
  --paper: #fff;
  --line: #d9e2dd;
  --accent: #176854;
  --accent-hover: #125542;
  --soft: #f4f7f5;
  --danger: #933e35;
  --radius: .66rem;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
h1, h2, h3, p { margin: 0; }
a { color: #15604d; text-underline-offset: .17em; }
a:hover { text-decoration-thickness: .12em; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, input, select, textarea { max-width: 100%; }
code { color: #466158; font-size: .86em; }
:focus-visible { outline: 3px solid #147a62; outline-offset: 3px; }

.skip-link {
  position: absolute; z-index: 5; top: .4rem; left: .4rem; padding: .6rem .85rem;
  transform: translateY(calc(-100% - .6rem)); border-radius: .4rem; background: #fff; font-weight: 700;
}
.skip-link:focus { transform: none; }
.owner-shell { display: grid; grid-template-columns: minmax(11.9rem, 15rem) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  display: flex; flex-direction: column; align-self: start; position: sticky; top: 0;
  gap: 2.05rem; min-height: 100vh; padding: 1.55rem .85rem .85rem;
  color: var(--sidebar-text); background: var(--sidebar);
}
.brand { display: flex; align-items: center; gap: .62rem; color: inherit; text-decoration: none; }
.sidebar .brand { margin-inline: .55rem; }
.brand-mark {
  display: grid; grid-auto-flow: column; align-items: end; justify-content: center; gap: 3px;
  flex: 0 0 2.18rem; padding: .47rem .3rem; height: 2.18rem; border-radius: .42rem; background: #d9b182;
  box-shadow: inset 0 0 0 1px #f0d4ae80;
}
.brand-mark i { display: block; width: .23rem; background: #25343a; border-radius: 1px; }
.brand-mark i:nth-child(1) { height: .59rem; }
.brand-mark i:nth-child(2) { height: 1.15rem; }
.brand-mark i:nth-child(3) { height: .83rem; }
.brand strong { display: block; color: #fff9f0; font-size: 1rem; line-height: 1.1; font-weight: 750; }
.brand small { display: block; margin-top: .18rem; color: #bbcfcc; font-size: .72rem; }
.sidebar nav ul { display: grid; list-style: none; padding: 0; margin: 0; gap: .22rem; }
.sidebar nav a {
  position: relative; display: flex; align-items: center; gap: .65rem; min-height: 2.58rem;
  padding: .48rem .62rem; border: 1px solid transparent; border-radius: .38rem;
  color: var(--sidebar-text); text-decoration: none; font-size: .88rem; font-weight: 650;
}
.sidebar nav a:hover { background: #213e43; }
.sidebar nav a[aria-current='page'] { color: #fff; background: #29494c; border-color: #4c6c68; }
.sidebar nav a[aria-current='page']::before { position: absolute; inset: .45rem auto .45rem 0; width: 3px; content: ''; background: #e4bb85; border-radius: 2px; }
.nav-label { min-width: 0; overflow-wrap: anywhere; }
.sidebar :focus-visible { outline-color: #e6c795; }
.nav-icon { display: grid; place-items: center; flex: 0 0 1rem; width: 1rem; height: 1rem; color: #b8cfcb; }
.nav-icon::before { display: block; width: 100%; height: 100%; content: ''; }
.nav-grid::before { background: currentColor; clip-path: polygon(0 0, 44% 0, 44% 43%, 0 43%, 0 0, 56% 0, 100% 0, 100% 43%, 56% 43%, 56% 0, 0 56%, 44% 56%, 44% 100%, 0 100%, 0 56%, 56% 56%, 100% 56%, 100% 100%, 56% 100%, 56% 56%); }
.nav-person::before { background: radial-gradient(circle at 50% 25%, currentColor 25%, transparent 27%), radial-gradient(ellipse at 50% 100%, currentColor 53%, transparent 55%); }
.nav-battle::before { background: currentColor; clip-path: polygon(55% 0, 13% 55%, 46% 55%, 43% 100%, 87% 42%, 56% 42%); }
.nav-chat::before { border: 2px solid currentColor; border-radius: 4px 4px 4px 0; transform: scaleY(.82); }
.nav-bars::before { background: currentColor; clip-path: polygon(0 100%, 0 56%, 24% 56%, 24% 100%, 38% 100%, 38% 12%, 62% 12%, 62% 100%, 76% 100%, 76% 40%, 100% 40%, 100% 100%); }
.nav-gear::before { border: 2px solid currentColor; border-radius: 50%; outline: 1px dashed currentColor; outline-offset: -1px; transform: scale(.8); }
.sidebar-footer { display: flex; justify-content: space-between; align-items: center; gap: .35rem; margin-top: auto; padding: .65rem .4rem 0; border-top: 1px solid #365459; }
.sidebar-footer button { padding: .43rem .18rem; border: 0; color: #dfebe7; background: none; font-size: .83rem; text-decoration: underline; text-underline-offset: .15em; }

.workspace { min-width: 0; padding: 2rem clamp(1.1rem, 4.2vw, 4rem) 3.5rem; }
.workspace-inner { display: grid; gap: 1.05rem; width: 100%; max-width: 86rem; margin: 0 auto; }
.page-heading { padding-bottom: .95rem; border-bottom: 1px solid #cad6d0; }
h1 { font-size: clamp(1.85rem, 3vw, 2.7rem); line-height: 1.06; font-weight: 770; letter-spacing: -.04em; }
.page-heading p { margin-top: .38rem; color: var(--muted); font-size: .94rem; line-height: 1.45; }
.updated { color: var(--muted); font-size: .84rem; }
.updated strong { color: inherit; }
.back-link { font-size: .88rem; }
.alert { padding: .7rem .9rem; border: 1px solid; border-radius: .4rem; overflow-wrap: anywhere; font-size: .9rem; }
.alert-good { border-color: #b7d8c9; background: #e6f4eb; color: #255c41; }
.alert-error { border-color: #e4bdb6; background: #fff0ec; color: #842d25; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.metric { display: flex; flex-direction: column; align-items: flex-start; gap: .22rem; min-width: 0; min-height: 7rem; padding: .8rem .9rem; border: 1px solid var(--line); border-top: 3px solid #b8cdc5; border-radius: var(--radius); background: var(--paper); color: var(--ink); text-decoration: none; }
.metric:nth-child(4) { border-top-color: #cb9a70; }
.metric:hover { border-color: #82ad9e; }
.metric > span { color: var(--muted); font-size: .81rem; line-height: 1.23; }
.metric strong { font-variant-numeric: tabular-nums; font-size: clamp(1.6rem, 3vw, 2.35rem); line-height: 1.06; overflow-wrap: anywhere; }
.metric small { margin-top: .18rem; color: var(--muted); font-size: .72rem; }
.section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; align-items: start; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.panel-heading { display: flex; flex-wrap: wrap; gap: .55rem 1rem; align-items: center; justify-content: space-between; padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
.panel-heading h2 { font-size: 1.16rem; line-height: 1.15; font-weight: 740; overflow-wrap: anywhere; }
.panel-heading a:not(.button) { font-size: .83rem; font-weight: 650; }
.kicker { margin-bottom: .2rem; color: var(--muted); font-size: .73rem; }
.report-rows { padding: .08rem 1rem; }
.report-rows div { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: .45rem; min-height: 3.15rem; border-bottom: 1px solid var(--line); }
.report-rows div:last-child { border-bottom: 0; }
.report-rows strong { min-width: 1.75rem; color: #173f38; text-align: end; font-size: 1.22rem; }
.report-rows small { min-width: 5.4rem; color: #725337; text-align: end; font-size: .73rem; }
.report-rows span { font-size: .88rem; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr)); gap: .18rem .9rem; margin: 0; padding: .5rem 1rem .72rem; }
.facts div { min-width: 0; padding: .41rem 0; border-bottom: 1px solid var(--line); }
.facts dt { margin-bottom: .23rem; color: var(--muted); font-size: .76rem; }
.facts dd { margin: 0; font-size: .9rem; overflow-wrap: anywhere; }
.profile-status { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; padding: .7rem 1rem .16rem; }
.identifier { overflow-wrap: anywhere; }
.profile-status .identifier { color: var(--muted); }
.pill { display: inline-block; max-width: 100%; padding: .23rem .42rem; border: 1px solid #dce5e0; border-radius: .35rem; background: #eef2ef; color: #40534c; font-size: .73rem; font-weight: 680; line-height: 1.2; overflow-wrap: anywhere; }
.pill-good { border-color: #c6dfce; background: #e7f3eb; color: #235a3d; }
.pill-warn { border-color: #ebd7b8; background: #fbf1de; color: #714b1e; }
.pill-bad { border-color: #eac8c1; background: #fbebe7; color: #86342a; }
.empty { padding: .9rem 1rem; color: var(--muted); font-size: .88rem; }
.footnote { margin: .7rem 1rem; color: var(--muted); font-size: .82rem; }

.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.table-scroll:focus-visible { outline-offset: -3px; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; text-align: start; }
th, td { padding: .64rem .82rem; border-bottom: 1px solid #e0e7e3; vertical-align: top; text-align: start; }
th { color: #466058; background: #f3f7f4; font-size: .72rem; font-weight: 720; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7faf8; }
td small { display: block; margin-top: .16rem; color: var(--muted); font-size: .75rem; }
td time { white-space: nowrap; }
td .row-link { display: inline-block; font-weight: 720; }
.inventory-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem .75rem; padding: .76rem 1rem; }
.inventory-grid section { min-width: 0; padding: .45rem .45rem .55rem; border: 1px solid var(--line); border-radius: .42rem; }
.inventory-grid h3 { margin: .25rem .35rem .48rem; font-size: .88rem; }

.filters, .action-form, .catalog { display: flex; flex-wrap: wrap; gap: .62rem; align-items: end; }
.filters { padding: .78rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.field { display: grid; gap: .27rem; min-width: 0; font-size: .8rem; color: #435650; font-weight: 650; }
.filter-search { flex: 1 1 11rem; }
.field input, .field select, .field textarea {
  min-width: 0; width: 100%; min-height: 2.55rem; padding: .43rem .55rem;
  border: 1px solid #aebfb5; border-radius: .4rem; background: #fff; color: var(--ink); font-size: .88rem; font-weight: 450;
}
.field input::placeholder { color: #63756e; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #327a62; }
.button { display: inline-grid; align-content: center; justify-items: center; min-height: 2.55rem; padding: .44rem .78rem; border: 1px solid; border-radius: .43rem; font-size: .81rem; font-weight: 725; line-height: 1.2; text-align: center; text-decoration: none; white-space: normal; }
.button-primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.button-primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.button-secondary { border-color: #afc4b8; background: #f0f6f3; color: #254c3e; }
.button-secondary:hover { border-color: #87a99a; background: #e1eee7; }
.button-danger { border-color: #c38c83; background: #fbefeb; color: var(--danger); }
.button-danger:hover { border-color: #a76156; background: #f7e2dc; }
.panel > .action-form { padding: .85rem 1rem; }
.action-form .field { flex: 1 1 12rem; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr)); gap: .55rem; width: 100%; }
.action-form .short-field { flex: 0 1 8rem; }
.disclosure { padding: .45rem .55rem; border: 1px solid var(--line); border-radius: .38rem; background: #f6f9f7; }
.disclosure > summary { cursor: pointer; color: #245c4b; font-size: .83rem; font-weight: 725; }
.disclosure[open] > summary { margin-bottom: .47rem; }
.disclosure > p { margin-block: .4rem; overflow-wrap: anywhere; font-size: .83rem; }
.panel > .disclosure { margin: .77rem 1rem; }
.disclosure .action-form { margin-top: .35rem; }
.disclosure .table-scroll { margin-top: .4rem; }
.message-list { display: grid; margin: 0; padding: 0; list-style: none; }
.message { padding: .76rem 1rem; border-bottom: 1px solid var(--line); }
.message-list li:last-child .message { border-bottom: 0; }
.message header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: .38rem; }
.message header small { display: block; margin-top: .16rem; color: var(--muted); font-size: .72rem; }
.message header strong { font-size: .91rem; overflow-wrap: anywhere; }
.message p { margin-block: .52rem; font-size: .89rem; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.message .disclosure:not([open]) { display: inline-block; }
.message .disclosure[open] { min-width: min(18rem, 100%); }
.message-badges { display: flex; flex-wrap: wrap; gap: .24rem; }
.moderation-forms { display: grid; gap: .62rem; }
.moderation-forms .action-form + .action-form { padding-top: .51rem; border-top: 1px solid var(--line); }
.pagination { display: flex; flex-wrap: wrap; gap: .38rem; padding: .66rem 1rem; }
.kind-choices { display: flex; flex-wrap: wrap; gap: .36rem; }
.kind-choices a { min-height: 2.35rem; padding: .51rem .67rem; border: 1px solid #c5d3cd; border-radius: .35rem; background: #f6faf7; color: #285447; text-decoration: none; font-size: .82rem; font-weight: 700; }
.kind-choices a[aria-current='page'] { border-color: #6d9b89; background: #deede5; }
.catalog { display: grid; align-items: stretch; padding: .7rem 1rem; }
.catalog .filters { padding: 0 0 .35rem; border: 0; }
.count { margin-inline-start: .25rem; color: var(--muted); font-weight: 500; }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 1rem; background: radial-gradient(ellipse at 25% 10%, #355354 0, transparent 62%), #152b31; }
.login-panel { display: grid; gap: 1rem; width: min(100%, 27rem); padding: clamp(1.12rem, 5vw, 2rem); border: 1px solid #c4d5ca; border-top: 4px solid #d1ab78; border-radius: .72rem; background: #fff; }
.login-brand strong { color: #1d3335; }
.login-brand small { color: #506a61; }
.login-panel h1 { font-size: clamp(1.6rem, 7vw, 2.12rem); }
.login-form { display: grid; gap: .77rem; }

@media (max-width: 950px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-rows div { grid-template-columns: 1fr auto; gap: .12rem .35rem; padding-block: .38rem; }
  .report-rows small { grid-column: 1 / -1; text-align: start; }
}

@media (max-width: 710px) {
  .owner-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: relative; min-height: auto; gap: .58rem; padding: .78rem .68rem .46rem; }
  .sidebar .brand { margin: 0 .22rem; }
  .sidebar nav ul { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .2rem; }
  .sidebar nav a { min-height: 2.55rem; gap: .42rem; padding: .35rem .43rem; font-size: .8rem; }
  .sidebar-footer { justify-content: flex-start; gap: 1rem; margin: 0; padding: .13rem .21rem 0; }
  .workspace { padding: 1.2rem .68rem 2rem; }
  .workspace-inner { gap: .77rem; }
  .section-grid { grid-template-columns: minmax(0, 1fr); }
  .metric { min-height: 5.65rem; padding: .65rem .68rem; }
  .panel-heading, .panel > .action-form, .facts, .message, .catalog { padding-inline: .7rem; }
  th, td { padding-inline: .55rem; }
  .sidebar-footer button { min-height: 2.25rem; display: inline-grid; align-items: center; }
}

@media (max-width: 360px) {
  .sidebar nav a { font-size: .72rem; gap: .25rem; }
  .nav-icon { display: none; }
  .inventory-grid { grid-template-columns: minmax(0, 1fr); }
}
