:root {
  color-scheme: dark;
  --background: #09111f;
  --surface: #132033;
  --field: #0d1829;
  --line: #2c465f;
  --text: #edf7f5;
  --muted: #afc2d0;
  --accent: #4be5b1;
  font-family: Arial, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  line-height: 1.45;
}

.page {
  width: min(100%, 65rem);
  margin-inline: auto;
  padding: clamp(1rem, 3.5vw, 2.5rem);
}

.page-header { margin-bottom: 1.1rem; }

h1, h2, p, dl, dd { margin: 0; }

h1 {
  color: var(--accent);
  font-size: clamp(1.55rem, 5vw, 2.4rem);
  letter-spacing: -.025em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

h2 { font-size: 1.08rem; }

.version {
  color: var(--muted);
  font-size: .62em;
  letter-spacing: normal;
  white-space: nowrap;
}

.muted, .empty { color: var(--muted); }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .55rem;
  margin-bottom: 1rem;
}

.metric, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .8rem;
  min-width: 0;
}

.metric {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: .65rem .55rem;
}

.metric dt {
  color: var(--muted);
  font-size: clamp(.72rem, 2.4vw, .91rem);
  line-height: 1.2;
}

.metric dd {
  color: var(--accent);
  font-size: clamp(1.25rem, 5.5vw, 2rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.panel { padding: clamp(.85rem, 3vw, 1.35rem); }

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .2rem .8rem;
  margin-bottom: .8rem;
}

.section-heading p { font-size: .83rem; }

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: .65rem;
}

.field { min-width: 0; }

label {
  display: block;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 600;
  margin-bottom: .25rem;
}

input, select, button {
  min-height: 2.75rem;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: .55rem;
  font: inherit;
  padding: .5rem .65rem;
}

input, select { width: 100%; }
input::placeholder { color: var(--muted); }

button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .7; }

a { color: var(--accent); }

a:focus-visible, input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.text-button {
  color: var(--accent);
  background: transparent;
  border: 0;
  padding-inline: 0;
  text-decoration: underline;
}

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .55rem .8rem;
  margin-top: .8rem;
  padding: .65rem .75rem;
  border: 1px solid #80623e;
  border-radius: .55rem;
  background: #27231d;
  color: #f4ddad;
}

.notice button { border-color: #80623e; }
.empty { margin-top: .8rem; }

.event-list, .role-list {
  list-style: none;
  padding: 0;
  margin: .65rem 0 0;
}

.event-list:empty, .role-list:empty { margin: 0; }

.event, .role-item {
  padding: .65rem 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.event-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .15rem .75rem;
}

.event-heading a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-weight: 700;
}

.event time, .role-meta, #total { color: var(--muted); font-size: .84rem; }
.event-type { font-weight: 600; }
.event-detail { margin-top: .25rem; white-space: pre-line; }

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-bottom: .55rem;
}

.profile-layout { display: grid; gap: .75rem; }

.role-item {
  padding-left: .55rem;
  border-left: .2rem solid var(--role-color, var(--line));
}

.role-item + .role-item { margin-top: .35rem; }
.role-name { font-weight: 700; }

.profile-id {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.profile-id summary { cursor: pointer; padding-block: .55rem; }

@media (max-width: 540px) {
  .filters { grid-template-columns: 1fr; }
}

@media (min-width: 760px) {
  .metrics { gap: .8rem; }
  .metric { padding: .8rem 1rem; }
  .profile-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-history, .profile-id { grid-column: 1 / -1; }
}

form { display: flex; flex-wrap: wrap; align-items: end; gap: .8rem; margin: 1rem 0; }
form label { display: grid; gap: .3rem; font-size: .9rem; }
form input, form select { max-width: 100%; }
details summary { cursor: pointer; font-weight: 600; }
#case-detail ul, #findings, #watch, #rules, #import-rows { overflow-wrap: anywhere; }
#workspace nav { margin: 1rem 0; gap: .65rem; }
#message:empty { display: none; }
.supervision-page .page-header { flex-wrap: wrap; }
.supervision-page .language-picker { display: grid; gap: .25rem; }
.supervision-page code { unicode-bidi: isolate; overflow-wrap: anywhere; }
.supervision-page form label { min-inline-size: 0; max-inline-size: 100%; }
.supervision-page :is(button, select) { max-inline-size: 100%; }
:lang(ar) .supervision-page { font-family: "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif; }
:lang(zh-CN) .supervision-page { font-family: "Noto Sans CJK SC", "Microsoft YaHei UI", sans-serif; }
:lang(ko) .supervision-page { font-family: "Noto Sans CJK KR", "Malgun Gothic", sans-serif; }
:lang(ja) .supervision-page { font-family: "Noto Sans CJK JP", "Yu Gothic UI", sans-serif; }
