:root {
  color-scheme: light;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans Ethiopic", "Nyala", "Abyssinica SIL", sans-serif;
  --font-ethiopic: "Noto Sans Ethiopic", "Nyala", "Abyssinica SIL", "Ebrima", system-ui,
    -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono",
    "Noto Sans Ethiopic", monospace;

  --ink: #14232b;
  --ink-soft: #33424a;
  --muted: #4a5a63;
  --line: #dde3e1;
  --line-strong: #c3ceca;
  --surface: #ffffff;
  --surface-2: #f7faf8;
  --surface-3: #edf2f0;
  --bg: #f3f5f4;

  --brand-950: #062728;
  --brand-900: #0a3536;
  --brand-800: #0b3b3c;
  --brand-700: #0b5f59;
  --brand-600: #0f766e;
  --brand-100: #d9ece9;

  --gold-500: #c9a24a;
  --gold-400: #dcbb72;
  --gold-200: #f0dfb5;

  --ok: #05603a;
  --ok-bg: #e8f7ef;
  --ok-line: #b2e3c8;
  --warn: #8a4b00;
  --warn-bg: #fff5e5;
  --warn-line: #f2d19a;
  --bad: #a8221a;
  --bad-bg: #fdecea;
  --bad-line: #f3bdb8;
  --info: #0b4a9e;
  --info-bg: #eaf2fd;
  --info-line: #b9d3f6;

  --focus: #0b5f59;
  --focus-on-dark: #ffd166;

  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius: 11px;
  --radius-sm: 8px;

  --shadow-sm: 0 1px 2px rgba(10, 53, 54, 0.06);
  --shadow-md: 0 2px 4px rgba(10, 53, 54, 0.05), 0 16px 36px -22px rgba(10, 53, 54, 0.28);
  --shadow-lg: 0 32px 70px -34px rgba(4, 26, 27, 0.55);

  --container: 1320px;
  --tap: 44px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(1100px 520px at 92% -12%, rgba(11, 95, 89, 0.08), transparent 62%);
  background-repeat: no-repeat;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.55rem, 1.16rem + 1.5vw, 2.05rem);
  letter-spacing: -0.016em;
  margin-bottom: 0.35rem;
}

h2 {
  font-size: 1.1rem;
  letter-spacing: -0.006em;
  margin-bottom: 0.85rem;
}

h3 {
  font-size: 1rem;
  margin-bottom: 0.6rem;
}

p {
  margin: 0 0 0.8rem;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--brand-700);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

a:hover {
  color: var(--brand-900);
  text-decoration-thickness: 0.13em;
}

img,
svg {
  max-width: 100%;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
}

/* ------------------------------------------------------------------ */
/* Accessibility helpers                                               */
/* ------------------------------------------------------------------ */

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 0.7rem;
  left: 0.7rem;
  z-index: 300;
  transform: translateY(-250%);
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0.6rem 1.1rem;
  border: 2px solid var(--brand-900);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--brand-900);
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  box-shadow: 0 18px 40px -18px rgba(4, 26, 27, 0.6);
  transition: transform 0.15s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 3px solid var(--focus-on-dark);
  outline-offset: 2px;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.site-header :where(a, button):focus-visible,
.auth-body :where(a, button):focus-visible {
  outline: 3px solid var(--focus-on-dark);
  outline-offset: 2px;
}

#main:focus,
#main:focus-visible {
  outline: none;
}

@supports not selector(:focus-visible) {
  :where(a, button, input, select, textarea, [tabindex]):focus {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
  }
}

/* ------------------------------------------------------------------ */
/* Application shell                                                   */
/* ------------------------------------------------------------------ */

.app-body {
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  color: #eaf2f1;
  background: linear-gradient(118deg, var(--brand-950) 0%, var(--brand-800) 52%, #0e4748 100%);
  border-bottom: 3px solid var(--gold-500);
  box-shadow: 0 14px 34px -24px rgba(4, 26, 27, 0.9);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  width: 100%;
  max-width: var(--container);
  min-height: 68px;
  margin: 0 auto;
  padding: 0.65rem 1.4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  padding: 0.2rem;
  margin-left: -0.2rem;
  border-radius: var(--radius);
  color: #ffffff;
  text-decoration: none;
}

.brand:hover,
.brand:focus {
  color: #ffffff;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(145deg, #f3e4bd 0%, var(--gold-500) 62%, #b98c33 100%);
  color: #172b2e;
  font-size: 1.05rem;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.brand-mark-lg {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  font-size: 1.5rem;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.16;
}

.brand-text strong {
  color: #ffffff;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.brand-text small {
  color: #c8dad8;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  overflow-wrap: anywhere;
}

.primary-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
  margin-left: auto;
}

.primary-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0.5rem 0.8rem;
  border-radius: 9px;
  color: #d4e4e2;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.primary-nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.primary-nav a.active {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.primary-nav a.active::after {
  content: "";
  position: absolute;
  right: 0.8rem;
  bottom: 0.3rem;
  left: 0.8rem;
  height: 2px;
  border-radius: 2px;
  background: var(--gold-400);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.2rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
}

.lang-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  color: #e3eeec;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
}

.lang-switch a:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.lang-switch a.active {
  background: #ffffff;
  color: var(--brand-800);
}

.user-chip {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: var(--tap);
  max-width: 190px;
  padding: 0.35rem 0.75rem;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0 10px 10px 0;
  color: #ffffff;
  line-height: 1.16;
  text-decoration: none;
}

.user-chip-name {
  overflow: hidden;
  font-size: 0.88rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip small {
  color: #c8dad8;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

.user-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.55rem;
  min-height: var(--tap);
  margin-left: auto;
  padding: 0.5rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.16);
}

.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.nav-toggle-bars {
  position: relative;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle-bars::before {
  top: -6px;
}

.nav-toggle-bars::after {
  top: 6px;
}

.site-header .btn-ghost {
  border-color: rgba(255, 255, 255, 0.45);
  background: transparent;
  color: #eaf2f1;
}

.site-header .btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.container {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(1.15rem, 2.4vw, 2rem) 1.4rem clamp(2rem, 4vw, 3rem);
}

.site-footer {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem 1.5rem;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 1.1rem 1.4rem 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

.site-footer p {
  margin: 0;
}

.footer-meta {
  text-align: right;
}

/* ------------------------------------------------------------------ */
/* Page heading and shared text                                        */
/* ------------------------------------------------------------------ */

.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem 1.5rem;
  margin: 0 0 1.4rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
}

.page-head h1 {
  margin-bottom: 0.2rem;
}

.page-head h1::before {
  content: "";
  display: block;
  width: 36px;
  height: 3px;
  margin-bottom: 0.6rem;
  border-radius: 2px;
  background: var(--gold-500);
}

.page-head .subtle {
  max-width: 72ch;
  font-size: 0.95rem;
}

.page-head > .btn,
.page-head > .inline-form {
  flex-shrink: 0;
}

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

.subtle {
  margin: 0;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.notice-inline {
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.center {
  text-align: center;
}

.nowrap {
  white-space: nowrap;
}

.break {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.truncate {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.select-all {
  user-select: all;
}

.js-copy-fallback {
  position: fixed;
  top: 0;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* ------------------------------------------------------------------ */
/* Alerts and notices                                                  */
/* ------------------------------------------------------------------ */

.alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.7rem;
  margin: 0 0 1.15rem;
  padding: 0.8rem 1rem;
  border: 1px solid;
  border-left-width: 4px;
  border-radius: 12px;
  font-size: 0.94rem;
}

.alert p {
  flex-basis: 100%;
  margin: 0.2rem 0 0;
}

.alert a {
  color: inherit;
  text-decoration: underline;
}

.alert-success {
  border-color: var(--ok-line);
  background: var(--ok-bg);
  color: var(--ok);
}

.alert-error {
  border-color: var(--bad-line);
  background: var(--bad-bg);
  color: var(--bad);
}

.alert-info {
  border-color: var(--info-line);
  background: var(--info-bg);
  color: var(--info);
}

.alert-warn {
  border-color: var(--warn-line);
  background: var(--warn-bg);
  color: var(--warn);
}

.notice {
  margin-top: 1.15rem;
  padding: 0.95rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.notice p {
  margin: 0.3rem 0;
}

.notice p:last-child {
  margin-bottom: 0;
}

/* ------------------------------------------------------------------ */
/* Panels, grids and stat cards                                        */
/* ------------------------------------------------------------------ */

.panel {
  margin: 0 0 1.15rem;
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel.narrow {
  max-width: 660px;
}

.panel > h2:first-child {
  margin-bottom: 0.95rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--line);
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
}

.panel-head a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font-size: 0.88rem;
  font-weight: 600;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 1.15rem;
  margin-bottom: 1.15rem;
}

.panel-grid > .panel {
  margin-bottom: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  overflow: hidden;
  padding: 1.05rem 1.15rem 1.1rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--brand-600), var(--brand-900));
}

.stat-card.warn {
  border-color: var(--warn-line);
  background: var(--warn-bg);
}

.stat-card.warn::before {
  background: var(--warn);
}

.stat-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-value {
  color: var(--ink);
  font-size: 1.95rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.1;
}

.stat-value.small {
  font-size: 1.02rem;
  overflow-wrap: anywhere;
}

.stat-value small {
  color: var(--muted);
  font-size: 0.6em;
  font-weight: 600;
}

.stat-meta {
  min-height: 1.2em;
  color: var(--muted);
  font-size: 0.82rem;
}

.kv {
  display: grid;
  grid-template-columns: minmax(120px, 38%) 1fr;
  gap: 0.45rem 0.9rem;
  margin: 0;
}

.kv dt {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.kv dd {
  margin: 0;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.capability-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.85rem;
}

.capability {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.capability strong {
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* ------------------------------------------------------------------ */
/* Badges                                                              */
/* ------------------------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  background: #eef2f0;
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.badge::before {
  content: "";
  flex: 0 0 auto;
  width: 0.4em;
  height: 0.4em;
  border-radius: 50%;
  background: currentColor;
}

.badge.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge.bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.badge.muted {
  background: #eef2f0;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: var(--tap);
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-primary {
  border-color: var(--brand-700);
  background: var(--brand-700);
  color: #ffffff;
}

.btn-primary:hover {
  border-color: #0a4f4a;
  background: #0a4f4a;
  color: #ffffff;
}

.btn-ghost {
  border-color: #7f918c;
  background: var(--surface);
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: #5f7a74;
  background: var(--surface-2);
  color: var(--ink);
}

.btn-danger {
  border-color: var(--bad-line);
  background: var(--bad-bg);
  color: var(--bad);
}

.btn-danger:hover {
  border-color: #e39a92;
  background: #fbdad6;
  color: #8e1a13;
}

.btn-small {
  min-height: var(--tap);
  padding: 0.4rem 0.8rem;
  border-radius: 9px;
  font-size: 0.84rem;
}

.btn-block {
  width: 100%;
}

.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
}

.inline-form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}

/* ------------------------------------------------------------------ */
/* Forms                                                               */
/* ------------------------------------------------------------------ */

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.field > label,
.field label {
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.6rem 0.8rem;
  border: 1px solid #7f918c;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #5f7a74;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--brand-700);
  box-shadow: 0 0 0 3px rgba(11, 95, 89, 0.18);
}

textarea {
  min-height: 5.5rem;
  line-height: 1.55;
  resize: vertical;
}

select {
  padding-right: 2.3rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234a5a63' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 12px 8px;
  appearance: none;
  cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
  width: 1.15rem;
  height: 1.15rem;
  min-height: 0;
  padding: 0;
  accent-color: var(--brand-700);
}

input[type="date"] {
  min-width: 0;
}

::placeholder {
  color: #5f6f77;
  opacity: 1;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  min-width: 0;
  margin: 0 0 0.9rem;
  padding: 0;
  border: 0;
}

.filter-row .field {
  flex: 1 1 160px;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  min-height: var(--tap);
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 400;
}

.check-row:hover {
  border-color: var(--line-strong);
  background: #f2f7f5;
}

.check-row input {
  flex: 0 0 auto;
  margin-top: 0.18rem;
}

.check-row span {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.check-row small {
  color: var(--muted);
  font-size: 0.8rem;
}

/* ------------------------------------------------------------------ */
/* Code, mono and notices                                              */
/* ------------------------------------------------------------------ */

code,
.mono {
  font-family: var(--font-mono);
  font-size: 0.86em;
}

code {
  padding: 0.08em 0.35em;
  border-radius: 6px;
  background: var(--surface-3);
  overflow-wrap: anywhere;
}

.mono {
  overflow-wrap: anywhere;
}

.code-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.code-list li {
  min-width: 0;
}

.code-list code {
  display: block;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-align: center;
  user-select: all;
}

/* ------------------------------------------------------------------ */
/* Tables                                                              */
/* ------------------------------------------------------------------ */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.table-wrap:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

caption {
  caption-side: top;
  text-align: left;
}

th,
td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

thead th {
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-3);
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:hover {
  background: #f7faf8;
}

tbody tr:last-child td,
tbody tr:last-child th {
  border-bottom: 0;
}

tbody th[scope="row"] {
  font-weight: 600;
}

td small,
th small,
td .muted {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

td code {
  background: var(--surface-3);
}

.actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.matrix {
  min-width: 700px;
}

.matrix code {
  display: block;
  padding: 0;
  background: transparent;
}

.matrix th[scope="row"] {
  font-weight: 600;
}

.check {
  color: var(--ok);
  font-weight: 800;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
  margin-top: 1rem;
}

.pagination-status {
  color: var(--muted);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ */
/* Registry and roles                                                  */
/* ------------------------------------------------------------------ */

.registry-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.registry-item {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

.registry-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
}

.registry-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.02rem;
}

.registry-head p {
  margin: 0;
  font-size: 0.82rem;
}

.registry-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 0.95rem;
}

.registry-form .wide,
.registry-form .filter-actions {
  grid-column: 1 / -1;
}

.registry-form .filter-actions {
  margin: 0;
}

.role-edit {
  margin: 0 0 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

.role-edit h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.permission-fieldset {
  min-width: 0;
  margin: 0 0 0.9rem;
  padding: 0;
  border: 0;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 0.8rem;
}

/* ------------------------------------------------------------------ */
/* Error pages                                                         */
/* ------------------------------------------------------------------ */

.error-panel {
  max-width: 620px;
  margin: 2rem auto;
  padding: 2.4rem 1.6rem;
  text-align: center;
}

.error-panel .error-code {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.24em;
}

.error-panel h1 {
  margin-bottom: 1.15rem;
  font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.6rem);
}

/* ------------------------------------------------------------------ */
/* Authentication layout                                               */
/* ------------------------------------------------------------------ */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(1rem, 4vw, 2.5rem);
  color: #eaf2f1;
  background-color: #08201f;
  background-image:
    radial-gradient(900px 520px at 12% -10%, rgba(28, 106, 106, 0.85) 0%, transparent 58%),
    radial-gradient(760px 520px at 104% 112%, rgba(14, 63, 66, 0.9) 0%, transparent 62%),
    linear-gradient(160deg, #0a2b2c 0%, #061a1b 100%);
  background-attachment: fixed;
}

.auth-shell {
  display: grid;
  grid-template-areas:
    "brand card"
    "brand footer";
  grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
  gap: 1.25rem 2.4rem;
  align-items: start;
  width: min(980px, 100%);
}

.auth-brand {
  display: flex;
  grid-area: brand;
  flex-direction: column;
  align-items: flex-start;
  align-self: center;
  gap: 0.9rem;
  padding: 0.5rem 0;
}

.auth-brand::after {
  content: "";
  display: block;
  width: 64px;
  height: 3px;
  margin-top: 0.6rem;
  border-radius: 2px;
  background: var(--gold-500);
}

.auth-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.auth-brand-text strong {
  color: #ffffff;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.auth-brand-text small {
  color: #c8dad8;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.auth-card {
  grid-area: card;
  padding: clamp(1.4rem, 3vw, 2.1rem);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 20px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}

.auth-card h1 {
  font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.7rem);
}

.auth-card h2 {
  margin-top: 0.4rem;
  font-size: 1.05rem;
}

.auth-footer {
  grid-area: footer;
  padding: 0 0.2rem;
  color: #b9cecb;
  font-size: 0.78rem;
  text-align: center;
}

.auth-footer p {
  margin: 0 0 0.6rem;
}

.auth-footer .lang-switch {
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
}

.auth-body .skip-link {
  top: 0.7rem;
  left: 0.7rem;
}

.auth-body #main:focus {
  outline: none;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 1100px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .registry-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  html {
    scroll-padding-top: 0;
  }

  .site-header {
    position: static;
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 0.55rem 0.8rem;
    padding: 0.6rem 1rem;
  }

  .brand {
    flex: 1 1 auto;
  }

  .nav-toggle {
    display: inline-flex;
    order: 1;
  }

  .header-actions {
    order: 2;
    flex: 1 1 100%;
    justify-content: space-between;
    gap: 0.5rem;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .primary-nav {
    order: 3;
    flex: 1 1 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    margin: 0;
    display: none;
  }

  .primary-nav.open {
    display: flex;
  }

  .primary-nav a {
    justify-content: flex-start;
    min-height: 48px;
    padding: 0.65rem 0.85rem;
    font-size: 0.95rem;
  }

  .primary-nav a.active::after {
    display: none;
  }

  .header-actions .user-chip {
    max-width: 42vw;
  }

  .no-js .primary-nav {
    display: flex;
    flex-wrap: wrap;
    margin-top: 0.2rem;
  }

  .no-js .nav-toggle {
    display: none;
  }
}

@media (max-width: 760px) {
  .stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .page-head > .btn,
  .page-head > .inline-form {
    align-self: flex-start;
  }

  .registry-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .permission-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .code-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .filter-row .field {
    flex-basis: 100%;
  }

  .filter-actions {
    width: 100%;
  }

  .truncate {
    max-width: 45vw;
  }

  .site-footer {
    flex-direction: column;
    gap: 0.3rem;
  }

  .footer-meta {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .container {
    padding: 1rem 0.9rem 2rem;
  }

  .site-footer {
    padding: 1rem 0.9rem 1.6rem;
  }

  .panel {
    padding: 1rem;
    border-radius: var(--radius-lg);
  }

  .header-inner {
    padding: 0.55rem 0.9rem;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .brand-text small {
    display: none;
  }

  .user-chip {
    max-width: 52vw;
    border-left: 0;
    padding: 0.35rem 0.45rem 0.35rem 0;
  }

  .user-chip small {
    display: none;
  }

  .stat-value {
    font-size: 1.7rem;
  }

  .kv {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.1rem 0;
  }

  .kv dd {
    margin-bottom: 0.45rem;
  }

  .inline-form {
    width: auto;
  }
}

@media (max-width: 860px) {
  .auth-shell {
    grid-template-areas:
      "brand"
      "card"
      "footer";
    grid-template-columns: minmax(0, 1fr);
    gap: 1.1rem;
    width: min(520px, 100%);
  }

  .auth-brand {
    flex-direction: row;
    align-items: center;
    gap: 0.85rem;
    padding: 0;
  }

  .auth-brand::after {
    display: none;
  }

  .auth-brand .brand-mark-lg {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 1.2rem;
  }

  .auth-brand-text strong {
    font-size: 1.05rem;
  }
}

/* ------------------------------------------------------------------ */
/* Preference and output modes                                         */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .skip-link {
    transition: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --muted: #33424a;
    --line: #98a6a3;
    --line-strong: #6b7a82;
  }

  .badge,
  .btn-ghost {
    border: 1px solid var(--line-strong);
  }
}

@media (forced-colors: active) {
  .panel,
  .stat-card,
  .registry-item,
  .role-edit,
  .table-wrap,
  .badge,
  .btn,
  input,
  select,
  textarea {
    border: 1px solid CanvasText;
  }

  :where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid CanvasText;
  }

  .stat-card.warn,
  .alert {
    border-left-width: 4px;
  }
}

@media print {
  .site-header,
  .site-footer,
  .skip-link,
  .nav-toggle,
  .header-actions,
  .page-head .btn,
  .filter-row,
  .pagination,
  .actions {
    display: none !important;
  }

  body {
    background: #ffffff;
  }

  .panel,
  .stat-card,
  .table-wrap {
    border: 1px solid #444444;
    box-shadow: none;
  }
}

/* ------------------------------------------------------------------ */
/* Amharic (Ethiopic) typography                                       */
/* ------------------------------------------------------------------ */

html[lang="am"],
html[lang="am"] body {
  font-family: var(--font-ethiopic);
}

html[lang="am"] body {
  line-height: 1.75;
}

html[lang="am"] h1,
html[lang="am"] h2,
html[lang="am"] h3 {
  letter-spacing: 0;
  line-height: 1.45;
}

html[lang="am"] .page-head h1::before {
  width: 42px;
}

html[lang="am"] .stat-label,
html[lang="am"] thead th {
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.78rem;
}

html[lang="am"] .stat-value,
html[lang="am"] .capability strong {
  letter-spacing: 0;
}

html[lang="am"] .badge {
  font-size: 0.78rem;
}

html[lang="am"] .btn,
html[lang="am"] input,
html[lang="am"] select,
html[lang="am"] textarea,
html[lang="am"] .primary-nav a,
html[lang="am"] .lang-switch a {
  letter-spacing: 0;
  line-height: 1.5;
}

html[lang="am"] .filter-row .field,
html[lang="am"] .registry-form .field {
  min-width: 0;
}
