:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #111;
  background: #f5f5f5;
  --blue: #0058a3;
  --blue-dark: #003b70;
  --yellow: #ffdb00;
  --border: #d6d6d6;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 14px max(18px, env(safe-area-inset-left));
  color: #fff;
  background: var(--blue);
}
.topbar h1 { margin: 0; font-size: 1.25rem; }
.topbar p { margin: 3px 0 0; opacity: .85; }
.brand {
  display: grid;
  place-items: center;
  width: 64px;
  height: 38px;
  color: var(--blue);
  background: var(--yellow);
  border-radius: 50%;
  font-weight: 800;
  letter-spacing: -.04em;
}
.topbar .link-button { margin-left: auto; color: #fff; }
main { width: min(1180px, 100%); margin: 0 auto; padding: 18px; }
.card {
  margin-bottom: 18px;
  padding: 22px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgb(0 0 0 / 9%);
}
.narrow { width: min(460px, 100%); margin: 34px auto; }
h2 { margin: 0 0 20px; color: var(--blue-dark); font-size: 1.2rem; }
label, legend { display: block; margin-bottom: 7px; font-weight: 650; }
input, select, button, .button-link {
  min-height: 48px;
  font: inherit;
  border-radius: 4px;
}
input, select {
  width: 100%;
  margin-bottom: 18px;
  padding: 10px 12px;
  color: #111;
  background: #fff;
  border: 2px solid var(--border);
}
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
  border-color: var(--blue);
}
button, .button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: 2px solid var(--blue);
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}
button:disabled { cursor: wait; opacity: .65; }
.primary { color: #fff; background: var(--blue); }
.primary:hover { background: var(--blue-dark); }
.secondary, .button-link { color: var(--blue-dark); background: #fff; }
.compact { min-height: 42px; padding: 7px 14px; }
.link-button { min-height: 40px; padding: 5px 8px; background: transparent; border-color: transparent; }
.role-picker { display: flex; gap: 20px; margin: 0 0 18px; padding: 0; border: 0; }
.role-picker legend { width: 100%; }
.role-picker label { font-weight: 500; }
.role-picker input { width: auto; min-height: auto; margin: 0 5px 0 0; }
.field-grid, .filters { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
.derived { margin: -4px 0 18px; padding: 12px; background: #edf5fb; border-left: 4px solid var(--blue); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hint { color: #555; font-size: .9rem; }
.message, .network { margin-bottom: 16px; padding: 13px 16px; border-radius: 4px; }
.message.success { color: #075b28; background: #daf5e4; border: 1px solid #57a978; }
.message.error, .network { color: #741515; background: #ffebeb; border: 1px solid #d88484; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.record-list { display: grid; gap: 10px; }
.record-item { padding: 13px; border: 1px solid var(--border); border-radius: 4px; }
.record-item p { margin: 3px 0; }
.record-item button { margin-top: 8px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 10px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: #fff; background: var(--blue); }
.hidden { display: none !important; }

@media (min-width: 720px) {
  .layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); gap: 18px; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .field-grid .wide { grid-column: 1 / -1; }
  .filters { grid-template-columns: repeat(4, minmax(140px, 1fr)); align-items: end; }
  .filters button { margin-bottom: 18px; }
}
