:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --panel: #ffffff;
  --ink: #17211b;
  --muted: #66756c;
  --line: #dfe8e2;
  --green: #0f7a49;
  --amber: #b66b00;
  --red: #b42318;
  --blue: #235a97;
  --shadow: 0 10px 28px rgba(26, 48, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 9px 13px;
  color: #fff;
  background: var(--green);
  cursor: pointer;
}

button.secondary {
  color: var(--ink);
  background: #e8efe9;
}

button.danger {
  background: var(--red);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  display: grid;
  grid-template-columns: 228px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 22px 18px;
  color: #eef8f0;
  background: #10291c;
}

.brand {
  display: grid;
  gap: 5px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.brand strong {
  font-size: 20px;
}

.brand span {
  color: #a8c7b5;
  font-size: 13px;
}

nav {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

nav a {
  color: #cde2d3;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
}

nav a.active,
nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

main {
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.token-box {
  display: grid;
  grid-template-columns: 120px 160px auto auto auto;
  gap: 8px;
}

.auth-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.auth-strip > div:first-child {
  display: grid;
  gap: 4px;
}

.password-box {
  display: grid;
  grid-template-columns: 130px 150px auto;
  gap: 8px;
  align-items: center;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 17px;
}

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

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.operations-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.8fr) minmax(520px, 1.2fr);
  gap: 16px;
  margin-bottom: 16px;
}

.summary-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.summary-row {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.summary-row b {
  color: var(--green);
  font-size: 24px;
}

.summary-row small,
.quality-item p {
  color: var(--muted);
}

.quality-list {
  display: grid;
  gap: 9px;
  max-height: 360px;
  overflow: auto;
  min-width: 0;
}

.quality-item {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid #d59b36;
  border-radius: 8px;
  background: #fffdf7;
}

.quality-item p {
  margin: 6px 0;
  line-height: 1.5;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.quality-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.quality-source {
  margin: -6px 0 12px;
  font-size: 12px;
  line-height: 1.5;
}

.quality-filters {
  display: grid;
  grid-template-columns: 104px 92px 104px minmax(150px, 1fr) 76px auto auto;
  align-items: end;
  gap: 8px;
  min-width: 0;
  margin-bottom: 12px;
}

.quality-filters label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.quality-filters label > span {
  color: #405348;
  font-size: 12px;
  font-weight: 700;
}

.quality-filters input,
.quality-filters select {
  min-width: 0;
}

.quality-filters button {
  min-height: 39px;
  white-space: nowrap;
}

.quality-state {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: 132px;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.quality-state.error {
  color: #942f24;
  border-color: #edb1a5;
  background: #fff7f5;
}

.quality-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  font-size: 12px;
}

.button-link {
  padding: 0;
  color: var(--green);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 15px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.workspace {
  display: grid;
  grid-template-columns: 430px 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  padding: 16px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  cursor: pointer;
}

.task-card.active {
  border-color: var(--green);
  outline: 2px solid rgba(15, 122, 73, 0.15);
}

.task-card h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 7px 0;
}

.badge,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #edf3ee;
  color: #2e4a39;
}

.risk-high {
  color: #fff;
  background: var(--red);
}

.risk-medium {
  color: #5a3200;
  background: #ffdf9b;
}

.risk-low {
  color: #0b5f38;
  background: #ccebd9;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.field {
  padding: 10px;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.risk-box,
.phone-box,
.language-box {
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

textarea,
select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  background: #fff;
}

textarea {
  min-height: 78px;
  resize: vertical;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.expiry-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid #d9e4dc;
  border-radius: 14px;
  background: #f5faf6;
}

.expiry-box h3, .expiry-box p { margin: 0; }
.expiry-box p { color: #52705d; font-size: 13px; margin-top: 4px; }
.expiry-box.expired { border-color: #edb1a5; background: #fff5f2; }
.expiry-box.expired p { color: #a44131; }

.lifecycle-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.lifecycle-box h3, .lifecycle-box p { margin: 0; }
.lifecycle-box p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.lifecycle-box.suspended { border-color: #edb1a5; background: #fff5f2; }
.lifecycle-box.suspended p { color: #a44131; }
.lifecycle-actions { display: flex; align-items: center; gap: 8px; }
.lifecycle-actions select { min-width: 180px; }

.provider-list,
.unlock-list,
.complaint-list,
.appeal-list,
.order-list {
  display: grid;
  gap: 8px;
}

.provider-item,
.order-item,
.unlock-item,
.complaint-item,
.appeal-item,
.audit-item {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfb;
}

.appeal-item {
  grid-template-columns: 1.2fr 1.8fr 0.6fr 0.8fr auto;
  align-items: center;
}

.appeal-item > div:not(.actions) {
  display: grid;
  gap: 4px;
}

.appeal-item span, .appeal-item small { color: var(--muted); font-size: 13px; }

.provider-item {
  grid-template-columns: 1.5fr 1fr 0.7fr 0.6fr auto;
  align-items: center;
}

.provider-item div:first-child {
  display: grid;
  gap: 4px;
}

.provider-item div:first-child span {
  color: var(--muted);
  font-size: 13px;
}

.complaint-item {
  grid-template-columns: 1.7fr 0.9fr 0.8fr 1fr auto;
  align-items: center;
}

.order-item {
  grid-template-columns: 1.8fr 1fr 0.7fr 0.7fr 0.6fr auto;
  align-items: center;
}

.complaint-item div:first-child {
  display: grid;
  gap: 4px;
}

.complaint-item div:first-child span,
.order-item div:first-child span {
  color: var(--muted);
  font-size: 13px;
}

.actions.compact {
  margin-top: 0;
}

.actions.compact button {
  white-space: nowrap;
}

.audit-list {
  display: grid;
  gap: 8px;
}

.empty {
  min-height: 320px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

:focus-visible {
  outline: 3px solid rgba(35, 90, 151, 0.42);
  outline-offset: 2px;
}

.navigation-target,
.restriction-workbench {
  margin-bottom: 16px;
  scroll-margin-top: 18px;
}

.core-module-state {
  display: grid;
  gap: 8px;
  justify-items: start;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid #d6e1da;
  border-radius: 10px;
  color: var(--muted);
  background: #f7faf8;
}

.core-module-state.compact {
  padding: 8px 12px;
  font-size: 12px;
}

.core-module-state.error {
  border-color: #e6b8ae;
  color: #813f34;
  background: #fff4f1;
}

.core-module-state button {
  width: auto;
}

.restriction-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.restriction-heading > div {
  min-width: 0;
}

.restriction-heading h2 {
  margin-top: 4px;
  font-size: 21px;
}

.restriction-heading p {
  max-width: 760px;
  margin-top: 7px;
  line-height: 1.6;
}

.section-kicker {
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.restriction-summary,
.danger-label {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #0b5f38;
  background: #e3f2e8;
  font-size: 12px;
  font-weight: 700;
}

.danger-label {
  color: #8d2f24;
  background: #fff0ed;
}

.restriction-notice {
  min-height: 0;
  margin-bottom: 0;
  padding: 0;
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.5;
}

.restriction-notice:not(:empty) {
  min-height: 38px;
  margin-bottom: 14px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: #f7faf8;
}

.restriction-notice.success {
  color: #0b5f38;
  border-color: #a9d5b9;
  background: #eef9f1;
}

.restriction-notice.error {
  color: #942f24;
  border-color: #efb7af;
  background: #fff4f1;
}

.restriction-notice.pending {
  color: #654100;
  border-color: #e8cf95;
  background: #fff9e9;
}

.restriction-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.45fr);
  align-items: start;
  gap: 16px;
}

.restriction-create,
.restriction-records {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfdfb;
}

.form-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.form-heading h3 {
  font-size: 16px;
}

.form-heading p {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.45;
}

.restriction-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.restriction-span-2 {
  grid-column: 1 / -1;
}

.form-control,
.restriction-filters label {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
}

.form-control > span,
.restriction-filters label > span,
.restriction-revoke > label {
  color: #405348;
  font-size: 12px;
  font-weight: 700;
}

.form-control > span small {
  margin-left: 5px;
  color: var(--muted);
  font-weight: 500;
}

.form-control > small,
.restriction-form-actions p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.form-control textarea {
  min-height: 82px;
}

.internal-field {
  padding: 10px;
  border: 1px dashed #d3b86d;
  border-radius: 7px;
  background: #fffdf5;
}

.restriction-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.restriction-form-actions p {
  max-width: 230px;
}

.restriction-form-actions button {
  flex: none;
}

.restriction-filters {
  display: grid;
  grid-template-columns: 104px 104px minmax(150px, 1fr) 82px auto;
  align-items: end;
  gap: 8px;
  margin-bottom: 14px;
}

.restriction-filters input,
.restriction-filters select {
  min-width: 0;
}

.restriction-list {
  display: grid;
  gap: 11px;
  min-width: 0;
}

.restriction-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 8px;
  background: #fff;
}

.restriction-card.revoked {
  border-left-color: #93a198;
  background: #fafbfa;
}

.restriction-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.restriction-card-head > div {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.restriction-card h3,
.restriction-card code {
  min-width: 0;
  max-width: 100%;
}

.restriction-card code {
  display: block;
  color: #24352b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.scope-badge,
.restriction-status {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  color: #2b513d;
  background: #e8f2eb;
  font-size: 11px;
  font-weight: 700;
}

.scope-badge.listing {
  color: #344e73;
  background: #eaf0f8;
}

.restriction-status {
  flex: none;
  color: #942f24;
  background: #fff0ed;
}

.restriction-status.revoked {
  color: #536158;
  background: #edf0ee;
}

.restriction-copy {
  display: grid;
  gap: 5px;
  margin-top: 11px;
  padding: 10px;
  border-radius: 7px;
}

.restriction-copy span,
.restriction-revoked-detail span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.restriction-copy p {
  color: var(--ink);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.public-reason {
  border: 1px solid #edc3bc;
  background: #fff7f5;
}

.internal-notes {
  border: 1px dashed #d7c17c;
  background: #fffdf5;
}

.restriction-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

.restriction-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.restriction-revoked-detail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 11px;
}

.restriction-revoked-detail > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.restriction-revoked-detail strong {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.restriction-revoke {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.restriction-revoke > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
}

.restriction-revoke textarea {
  min-height: 62px;
}

.restriction-state {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: 120px;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.restriction-state.error {
  color: #942f24;
  border-color: #edb1a5;
  background: #fff7f5;
}

.restriction-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1100px) {
  .restriction-layout,
  .operations-grid,
  .workspace {
    grid-template-columns: 1fr;
  }

  .restriction-create {
    max-width: none;
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    padding: 16px;
  }

  .brand {
    padding-bottom: 14px;
  }

  nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 14px;
  }

  nav a {
    min-width: 0;
    padding: 8px;
    overflow-wrap: anywhere;
    text-align: center;
  }

  main {
    min-width: 0;
    padding: 18px;
  }

  .topbar,
  .auth-strip {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .token-box,
  .password-box {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .token-box input,
  .password-box input {
    min-width: 0;
  }

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

  .provider-item,
  .order-item,
  .unlock-item,
  .complaint-item,
  .appeal-item,
  .audit-item {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 700px) {
  .quality-filters,
  .restriction-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quality-query,
  .restriction-query {
    grid-column: 1 / -1;
  }

  .quality-filters button,
  .restriction-filters button {
    min-height: 39px;
  }
}

@media (max-width: 600px) {
  .sidebar,
  main {
    padding: 12px;
  }

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

  .topbar h1 {
    font-size: 22px;
  }

  .token-box,
  .password-box,
  .field-grid,
  .restriction-form-grid,
  .quality-filters,
  .restriction-filters,
  .restriction-revoked-detail {
    grid-template-columns: 1fr;
  }

  .restriction-span-2,
  .quality-query,
  .restriction-query {
    grid-column: auto;
  }

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

  .panel,
  .restriction-create,
  .restriction-records {
    padding: 12px;
  }

  .panel-header,
  .restriction-heading,
  .restriction-form-actions,
  .expiry-box,
  .lifecycle-box {
    align-items: stretch;
    flex-direction: column;
  }

  .restriction-form-actions p {
    max-width: none;
  }

  .restriction-form-actions button,
  .quality-filters button,
  .restriction-filters button {
    width: 100%;
  }

  .restriction-revoke > div {
    grid-template-columns: 1fr;
  }

  .restriction-revoke button {
    width: 100%;
  }

  .restriction-pagination {
    justify-content: space-between;
  }

  .quality-pagination {
    justify-content: space-between;
  }

  .lifecycle-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .lifecycle-actions select {
    min-width: 0;
  }
}

.expiry-workbench { scroll-margin-top: 24px; }
.expiry-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.expiry-heading h2, .expiry-card h3 { margin: 0; }
.expiry-heading p { max-width: 780px; margin: 8px 0 0; color: var(--muted); line-height: 1.65; }
.expiry-heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.expiry-heading-actions button { white-space: nowrap; }
.expiry-filters {
  display: grid;
  grid-template-columns: minmax(140px, .8fr) minmax(150px, .9fr) minmax(240px, 1.5fr) minmax(100px, .65fr) auto;
  align-items: end;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #dce8e1;
  border-radius: 16px;
  background: #f8fbf9;
}
.expiry-filters label { display: grid; gap: 7px; min-width: 0; color: #405348; font-size: 13px; font-weight: 700; }
.expiry-filters select, .expiry-filters input, .expiry-filters button { width: 100%; min-width: 0; min-height: 42px; }
.expiry-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.expiry-card { min-width: 0; padding: 18px; border: 1px solid #dfe8e2; border-left: 5px solid #789386; border-radius: 16px; background: #fff; }
.expiry-card.state-expired { border-left-color: #a6503d; background: #fff9f7; }
.expiry-card.state-expiring_soon { border-left-color: #b47b1e; background: #fffbf2; }
.expiry-card.state-unknown { border-left-color: #7b6f85; }
.expiry-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.expiry-card-head > div { display: grid; gap: 8px; min-width: 0; }
.expiry-card h3, .expiry-meta dd, .expiry-documents, .expiry-owner-note { overflow-wrap: anywhere; }
.expiry-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin: 16px 0 0; }
.expiry-meta div { min-width: 0; }
.expiry-meta dt { color: var(--muted); font-size: 12px; }
.expiry-meta dd { margin: 4px 0 0; font-size: 13px; line-height: 1.5; }
.expiry-documents, .expiry-owner-note { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; color: #6f4c13; background: #fff3d8; font-size: 13px; line-height: 1.55; }
.expiry-owner-note { color: #743b31; background: #f8e8e4; }
.expiry-state { grid-column: 1 / -1; display: grid; justify-items: center; gap: 10px; min-height: 130px; place-content: center; padding: 24px; color: var(--muted); text-align: center; }
.expiry-state.error { color: #8d3b2f; }

@media (max-width: 900px) {
  .expiry-heading { display: grid; }
  .expiry-heading-actions { justify-content: space-between; }
  .expiry-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .expiry-query { grid-column: 1 / -1; }
  .expiry-list { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .expiry-heading-actions, .expiry-filters { display: grid; grid-template-columns: minmax(0, 1fr); }
  .expiry-query { grid-column: auto; }
  .expiry-heading-actions button, .expiry-heading-actions .restriction-summary { width: 100%; text-align: center; }
  .expiry-meta { grid-template-columns: minmax(0, 1fr); }
}

.search-analytics-workbench {
  min-width: 0;
  scroll-margin-top: 24px;
}

.search-analytics-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.search-analytics-heading > div:first-child {
  min-width: 0;
}

.search-analytics-heading h2 {
  margin-top: 4px;
  font-size: 21px;
}

.search-analytics-heading p {
  max-width: 720px;
  margin-top: 7px;
  line-height: 1.6;
}

.search-analytics-toolbar {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.analytics-period-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f2f6f3;
}

.analytics-period-switch button {
  min-height: 34px;
  padding: 7px 11px;
  color: #526158;
  white-space: nowrap;
  background: transparent;
}

.analytics-period-switch button.active {
  color: #fff;
  background: var(--green);
  box-shadow: 0 3px 10px rgba(15, 122, 73, 0.18);
}

.analytics-privacy {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(360px, 1.1fr);
  gap: 20px;
  margin-top: 16px;
  padding: 15px 16px;
  border: 1px solid #b9dbc5;
  border-radius: 10px;
  color: #174e31;
  background: #eff8f2;
}

.analytics-privacy > div {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
}

.analytics-privacy-mark {
  display: grid;
  flex: none;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-weight: 800;
}

.analytics-privacy h3 {
  font-size: 14px;
}

.analytics-privacy p {
  margin-top: 4px;
  color: #476a55;
  font-size: 12px;
  line-height: 1.55;
}

.analytics-privacy ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 16px;
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.45;
}

.search-analytics-content {
  min-width: 0;
  margin-top: 16px;
}

.search-analytics-state {
  display: grid;
  min-height: 170px;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  color: var(--muted);
  text-align: center;
}

.search-analytics-state strong {
  color: var(--ink);
}

.search-analytics-state span,
.search-analytics-state small {
  max-width: 620px;
  line-height: 1.55;
}

.search-analytics-state.error {
  color: #942f24;
  border-color: #edb1a5;
  background: #fff7f5;
}

.search-analytics-state.error strong {
  color: #7d2b22;
}

.analytics-loader {
  width: 26px;
  height: 26px;
  border: 3px solid #c7ded0;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: analytics-spin 0.8s linear infinite;
}

@keyframes analytics-spin {
  to { transform: rotate(360deg); }
}

.analytics-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.analytics-summary-card {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfdfb;
}

.analytics-summary-card > span,
.analytics-summary-card small {
  color: var(--muted);
  font-size: 12px;
}

.analytics-summary-card strong {
  color: var(--green);
  font-size: 25px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.analytics-report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

.analytics-report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.analytics-report-block {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.analytics-report-block.analytics-daily {
  grid-column: 1 / -1;
}

.analytics-block-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.analytics-block-heading h3 {
  font-size: 15px;
}

.analytics-block-heading p,
.analytics-block-heading > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.analytics-daily-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px 14px;
}

.analytics-daily-row {
  min-width: 0;
  padding: 9px 0;
  border-top: 1px solid #edf1ee;
}

.analytics-daily-row > div:first-child,
.analytics-breakdown-row > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.analytics-daily-row strong,
.analytics-breakdown-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.analytics-daily-row span,
.analytics-breakdown-row span {
  flex: none;
  color: #4c5c52;
  font-size: 12px;
}

.analytics-bar {
  height: 6px;
  margin: 8px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eee9;
}

.analytics-bar span {
  display: block;
  width: var(--analytics-bar);
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.analytics-daily-row p,
.analytics-breakdown-row p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.analytics-breakdown-list {
  display: grid;
}

.analytics-breakdown-row {
  min-width: 0;
  padding: 10px 0;
  border-top: 1px solid #edf1ee;
}

.analytics-breakdown-row:first-child,
.analytics-daily-row:first-child {
  border-top: 0;
}

.analytics-breakdown-row p {
  margin-top: 5px;
}

.analytics-inline-empty {
  padding: 18px 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

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

@media (max-width: 900px) {
  .search-analytics-heading {
    display: grid;
  }

  .search-analytics-toolbar {
    justify-content: space-between;
  }

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

@media (max-width: 680px) {
  .analytics-summary-grid,
  .analytics-report-grid {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .analytics-report-block.analytics-daily {
    grid-column: auto;
  }
}

@media (max-width: 480px) {
  .search-analytics-toolbar {
    display: grid;
    justify-content: stretch;
  }

  .analytics-period-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-period-switch button,
  .search-analytics-toolbar .restriction-summary {
    width: 100%;
    min-width: 0;
    justify-content: center;
    text-align: center;
  }

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

@media (prefers-reduced-motion: reduce) {
  .analytics-loader {
    animation: none;
  }
}

.users-workbench { display: grid; gap: 16px; }
.users-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.users-heading h2 { margin-top: 4px; font-size: 20px; }
.users-heading p { margin-top: 6px; max-width: 760px; line-height: 1.55; font-size: 13px; }
.users-heading-actions { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.users-filterbar { display: grid; grid-template-columns: minmax(220px, 1fr) 130px 130px 90px auto auto; align-items: end; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fbfdfb; }
.users-filterbar label { display: grid; gap: 6px; min-width: 0; }
.users-filterbar label > span { color: #405348; font-size: 12px; font-weight: 700; }
.users-filterbar input, .users-filterbar select { min-width: 0; width: 100%; }
.users-filterbar button { min-height: 39px; white-space: nowrap; }
.users-notice { min-height: 0; color: var(--muted); font-size: 13px; }
.users-notice.error { padding: 10px 12px; border: 1px solid #edb1a5; border-radius: 6px; color: #942f24; background: #fff7f5; }
.users-list { min-width: 0; }
.users-table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.users-table { width: 100%; min-width: 880px; border-collapse: collapse; font-size: 13px; }
.users-table th, .users-table td { padding: 12px 14px; border-bottom: 1px solid #edf1ee; text-align: left; vertical-align: middle; }
.users-table th { color: #53655a; background: #f6f9f6; font-size: 11px; letter-spacing: .02em; }
.users-table tbody tr:hover { background: #fbfdfb; }
.users-table tbody tr:last-child td { border-bottom: 0; }
.user-primary { display: grid; gap: 3px; min-width: 180px; }
.user-primary strong { color: var(--ink); }
.user-primary code { color: #537061; font-size: 11px; }
.user-primary small { color: var(--muted); font-size: 11px; }
.user-role { color: #315642; font-weight: 700; }
.user-status { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: #e8efe9; color: #315642; font-size: 11px; font-weight: 700; }
.user-status.status-suspended { background: #fff4da; color: #875a0d; }
.user-status.status-disabled { background: #fdebed; color: #a33c46; }
.users-pagination { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 2px; }
.users-state { display: grid; justify-items: center; gap: 7px; padding: 44px 20px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); text-align: center; }
.users-state strong { color: var(--ink); }
.users-state.error { border-color: #edb1a5; background: #fff7f5; color: #942f24; }
.users-state.permission { background: #f8faf9; }
.users-state p { max-width: 420px; font-size: 13px; line-height: 1.5; }
.users-stale { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 9px 12px; border: 1px solid #edcf91; border-radius: 6px; color: #875a0d; background: #fffaf0; font-size: 12px; }
.users-stale button { margin-left: auto; }
.user-detail-dialog { width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 10px; box-shadow: 0 20px 60px rgba(15, 38, 26, .22); }
.user-detail-dialog::backdrop { background: rgba(15, 26, 20, .45); }
.user-detail-dialog form { display: grid; gap: 0; max-height: inherit; overflow: auto; }
.user-detail-header { display: flex; justify-content: space-between; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.user-detail-header h2 { margin-top: 4px; font-size: 19px; }
.user-detail-header p { margin-top: 5px; font-size: 12px; }
.user-detail-content { padding: 18px 22px; }
.user-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.user-detail-grid > div { padding: 12px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.user-detail-grid > div:nth-child(2n) { border-right: 0; }
.user-detail-grid > div:nth-last-child(-n + 2) { border-bottom: 0; }
.user-detail-grid dt { color: var(--muted); font-size: 11px; }
.user-detail-grid dd { margin: 4px 0 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 700; }
.user-detail-notice { min-height: 0; margin: 0 22px; font-size: 12px; }
.user-detail-notice.success, .user-detail-notice.error { margin-bottom: 2px; padding: 9px 11px; border-radius: 6px; }
.user-detail-notice.success { color: #176751; background: #edf8f4; }
.user-detail-notice.error { color: #942f24; background: #fff3f0; }
.user-detail-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; border-top: 1px solid var(--line); }

@media (max-width: 900px) {
  .users-filterbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .users-query { grid-column: 1 / -1; }
  .users-heading { flex-direction: column; }
  .users-heading-actions { width: 100%; justify-content: space-between; }
}
@media (max-width: 560px) {
  .users-filterbar { grid-template-columns: 1fr; }
  .users-query { grid-column: auto; }
  .users-heading-actions { align-items: flex-start; flex-direction: column; }
  .users-heading-actions button { width: 100%; }
  .user-detail-grid { grid-template-columns: 1fr; }
  .user-detail-grid > div, .user-detail-grid > div:nth-child(2n) { border-right: 0; }
  .user-detail-grid > div:nth-last-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .user-detail-grid > div:last-child { border-bottom: 0; }
  .user-detail-actions { display: grid; grid-template-columns: 1fr; }
  .user-detail-actions button { width: 100%; }
}

/* Reference-aligned admin shell: dark fixed navigation, two-level utility header,
   dense operational cards and table workspaces. */
@font-face {
  font-family: "UKIJ Ekran";
  src: url("/assets/fonts/UKIJEkran.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "UKIJ Ekran";
  src: url("/assets/fonts/UKIJEkran-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #252b3a;
  --muted: #7a8495;
  --line: #e7ecf2;
  --green: #557cf6;
  --amber: #ff9f2d;
  --red: #ff5c64;
  --blue: #4098ff;
  --sidebar: #31465f;
  --sidebar-active: #263b54;
  --brand-soft: #eef2ff;
  --shadow: 0 8px 24px rgba(35, 55, 80, 0.06);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 126px;
}

body {
  min-width: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

.ug,
[lang="ug-Arab"],
[lang|="ug"] {
  font-family: "UKIJ Ekran", sans-serif;
  font-size: 0.9em;
  direction: rtl;
}

button,
input,
textarea,
select {
  border-radius: 4px;
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease, transform 180ms ease;
}

button {
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid var(--green);
  border-radius: 4px;
  color: #fff;
  background: var(--green);
  font-weight: 600;
  box-shadow: none;
}

button:hover:not(:disabled) {
  border-color: #416bea;
  background: #416bea;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button.secondary {
  border-color: #dce3ed;
  color: #566174;
  background: #fff;
}

button.secondary:hover:not(:disabled) {
  border-color: #8fb3ff;
  color: #416bea;
  background: #f7f9ff;
}

button.danger {
  border-color: #ff9fa4;
  color: #fff;
  background: var(--red);
}

button.danger:hover:not(:disabled) {
  border-color: #ee4852;
  background: #ee4852;
}

button:disabled {
  border-color: #d9dee7;
  color: #a6adba;
  background: #eef1f5;
  opacity: 1;
}

input,
textarea,
select {
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid #dce3ed;
  color: var(--ink);
  background: #fff;
}

input::placeholder,
textarea::placeholder {
  color: #adb5c2;
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: var(--green);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(85, 124, 246, 0.12);
}

:focus-visible {
  outline: 3px solid rgba(85, 124, 246, 0.38);
  outline-offset: 2px;
}

.app-shell {
  display: block;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: 244px;
  min-width: 244px;
  height: 100vh;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  color: #d8e0eb;
  background: var(--sidebar);
  box-shadow: 8px 0 24px rgba(28, 46, 68, 0.08);
}

.brand {
  display: flex;
  height: 70px;
  flex: 0 0 70px;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  border: 0;
  background: rgba(19, 38, 59, 0.14);
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: var(--green);
  font-size: 18px;
  font-weight: 800;
}

.brand-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.brand-copy strong {
  overflow: hidden;
  color: #fff;
  font-size: 17px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.brand-copy small {
  color: #aebdce;
  font-size: 11px;
  letter-spacing: 0.12em;
}

.sidebar nav {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  margin: 0;
  padding: 16px 12px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar nav a {
  position: relative;
  display: grid;
  min-height: 48px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 4px;
  color: #c7d2df;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}

.sidebar nav a::before {
  position: absolute;
  inset: 8px auto 8px -12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
  content: "";
}

.sidebar nav a:hover,
.sidebar nav a.active {
  color: #fff;
  background: var(--sidebar-active);
}

.sidebar nav a.active::before {
  background: #75a0ff;
}

.nav-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid rgba(210, 224, 239, 0.34);
  border-radius: 5px;
  color: #b9c8d8;
  font-size: 13px;
  font-weight: 700;
}

.sidebar nav a.active .nav-icon,
.sidebar nav a:hover .nav-icon {
  border-color: rgba(255, 255, 255, 0.56);
  color: #fff;
}

.nav-badge {
  display: grid;
  min-width: 24px;
  height: 20px;
  place-items: center;
  padding: 0 6px;
  border-radius: 10px;
  color: #fff;
  background: var(--red);
  font-size: 11px;
  font-weight: 700;
}

.sidebar-foot {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 9px;
  padding: 0 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #aebdce;
  font-size: 12px;
}

.system-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16c76a;
  box-shadow: 0 0 0 4px rgba(22, 199, 106, 0.13);
}

main {
  min-width: 0;
  margin-left: 244px;
  padding: 0 28px 44px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 -28px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 2px 8px rgba(35, 55, 80, 0.04);
  backdrop-filter: blur(10px);
}

.topbar-title,
.utility-user {
  display: flex;
  min-width: 0;
  align-items: center;
}

.topbar-title {
  gap: 14px;
}

.menu-glyph {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #7d8794;
  font-size: 17px;
}

.topbar h1 {
  font-size: 18px;
  font-weight: 650;
  line-height: 1.3;
}

.topbar p {
  margin-top: 3px;
  color: #929aa7;
  font-size: 11px;
}

.utility-user {
  flex: 0 0 auto;
  gap: 14px;
  color: #5f6877;
  font-size: 13px;
}

.notification {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #7d8794;
  font-size: 21px;
}

.notification > span {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--red);
}

.admin-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-weight: 700;
}

.workspace-tabs {
  position: sticky;
  top: 70px;
  z-index: 25;
  display: flex;
  min-width: 0;
  gap: 4px;
  margin: 0 -28px 20px;
  padding: 0 20px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: #fff;
  scrollbar-width: thin;
}

.workspace-tabs a {
  position: relative;
  display: inline-flex;
  min-width: max-content;
  min-height: 50px;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  color: #3f4856;
  font-weight: 600;
  text-decoration: none;
}

.workspace-tabs a::after {
  position: absolute;
  inset: auto 12px -1px;
  height: 2px;
  background: transparent;
  content: "";
}

.workspace-tabs a.active {
  color: var(--green);
}

.workspace-tabs a.active::after {
  background: var(--green);
}

.workspace-tabs a span {
  color: #9ba3af;
  font-size: 13px;
}

.panel,
.metric {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow);
}

.panel {
  min-width: 0;
  padding: 18px 20px;
}

.auth-strip {
  display: grid;
  grid-template-columns: auto minmax(420px, 1fr) minmax(360px, 0.8fr);
  align-items: end;
  gap: 14px;
  margin-bottom: 16px;
  padding: 12px 16px;
  box-shadow: none;
}

.auth-caption {
  display: grid;
  gap: 3px;
  min-width: max-content;
}

.auth-caption strong {
  font-size: 13px;
}

.auth-caption .hint {
  font-size: 10px;
}

.token-box {
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) minmax(130px, 1fr) auto auto auto;
  gap: 7px;
}

.password-box {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(130px, 1fr) auto;
  gap: 7px;
}

.auth-strip input,
.auth-strip button {
  min-height: 34px;
  padding-block: 6px;
  font-size: 12px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric {
  position: relative;
  display: flex;
  min-height: 126px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  overflow: hidden;
  box-shadow: none;
}

.metric::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--metric-color, var(--green));
  content: "";
}

.metric-copy {
  display: grid;
  gap: 6px;
}

.metric-copy > span {
  color: #667085;
  font-size: 13px;
}

.metric-copy strong {
  margin: 0;
  color: #2f3745;
  font-size: 29px;
  font-weight: 600;
  line-height: 1.1;
}

.metric-copy small {
  color: #a0a8b5;
  font-size: 10px;
}

.metric-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border-radius: 50%;
  color: var(--metric-color, var(--green));
  background: var(--metric-soft, var(--brand-soft));
  font-size: 19px;
  font-weight: 700;
}

.metric-blue { --metric-color: #557cf6; --metric-soft: #eef2ff; }
.metric-red { --metric-color: #ff5c64; --metric-soft: #fff0f1; }
.metric-green { --metric-color: #16c76a; --metric-soft: #eafaf1; }
.metric-orange { --metric-color: #ff9f2d; --metric-soft: #fff5e8; }

.operations-grid {
  grid-template-columns: minmax(320px, 0.78fr) minmax(0, 1.42fr);
  gap: 16px;
}

.panel-header {
  min-height: 36px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  font-size: 16px;
  font-weight: 650;
}

.summary-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
}

.summary-row {
  min-height: 105px;
  padding: 16px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
}

.summary-row:nth-child(2n) { border-right: 0; }
.summary-row:nth-last-child(-n + 2) { border-bottom: 0; }
.summary-row strong { color: #667085; font-size: 12px; font-weight: 500; }
.summary-row b { color: #4098ff; font-size: 24px; font-weight: 500; }
.summary-row small { font-size: 10px; }

.quality-source {
  margin-top: -6px;
}

.quality-filters,
.restriction-filters,
.expiry-filters {
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fafbfd;
}

.quality-filters {
  grid-template-columns: 96px 84px 96px minmax(120px, 1fr) 70px auto auto;
}

.quality-filters button {
  padding-inline: 11px;
}

.quality-filters label > span,
.restriction-filters label > span,
.expiry-filters label {
  color: #737d8c;
  font-size: 11px;
}

.quality-list {
  max-height: 390px;
  gap: 0;
  border: 1px solid var(--line);
}

.quality-item {
  padding: 13px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid #ffb85c;
  border-radius: 0;
  background: #fff;
}

.quality-item:last-child { border-bottom: 0; }
.quality-item:hover { background: #fbfcff; }

.button-link {
  min-height: auto;
  border: 0;
  color: var(--green);
  background: transparent;
  box-shadow: none;
}

.button-link:hover:not(:disabled) {
  border: 0;
  color: #416bea;
  background: transparent;
}

.quality-pagination,
.restriction-pagination {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.workspace {
  grid-template-columns: minmax(320px, 0.72fr) minmax(0, 1.28fr);
  gap: 16px;
}

.task-list {
  gap: 0;
  border: 1px solid var(--line);
}

.task-card {
  padding: 14px 15px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
}

.task-card:last-child { border-bottom: 0; }
.task-card:hover { background: #f8faff; }
.task-card.active { position: relative; border-color: var(--line); background: #f2f6ff; outline: 0; }
.task-card.active::before { position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--green); content: ""; }
.task-card h3 { font-size: 14px; }

.badge,
.status,
.scope-badge,
.restriction-status {
  min-height: 23px;
  border: 1px solid #dfe6f2;
  border-radius: 3px;
  color: #55729f;
  background: #f2f6fc;
  font-size: 11px;
}

.risk-high,
.restriction-status {
  border-color: #ffc7ca;
  color: #d8434b;
  background: #fff0f1;
}

.risk-medium {
  border-color: #ffd9a8;
  color: #bc6b08;
  background: #fff6e9;
}

.risk-low {
  border-color: #b9e9cc;
  color: #0d9750;
  background: #ebfaf1;
}

.field-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { border-radius: 4px; background: #fafbfd; }
.risk-box,
.phone-box,
.language-box,
.expiry-box,
.lifecycle-box { border-radius: 5px; background: #fafbfd; }
.expiry-box { border-left: 3px solid #ff9f2d; }
.expiry-box.expired,
.lifecycle-box.suspended { border-color: #ffc5c8; background: #fff7f7; }

.actions {
  flex-wrap: wrap;
}

.actions.compact {
  justify-content: flex-end;
  gap: 7px;
}

.actions.compact button {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 12px;
}

.provider-list,
.order-list,
.unlock-list,
.complaint-list,
.appeal-list,
.audit-list {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  scrollbar-width: thin;
}

.data-table-head,
.provider-item,
.order-item,
.unlock-item,
.complaint-item,
.appeal-item,
.audit-item {
  width: 100%;
  min-width: 880px;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
}

.data-table-head {
  display: grid;
  min-height: 46px;
  color: #929aa8;
  background: #fafbfd;
  font-size: 12px;
  font-weight: 650;
}

.data-table-head span {
  min-width: 0;
}

.provider-item:last-child,
.order-item:last-child,
.unlock-item:last-child,
.complaint-item:last-child,
.appeal-item:last-child,
.audit-item:last-child { border-bottom: 0; }

.provider-item:hover,
.order-item:hover,
.unlock-item:hover,
.complaint-item:hover,
.appeal-item:hover,
.audit-item:hover { background: #fbfcff; }

.provider-item,
.data-table-head.provider-head { grid-template-columns: 1.5fr 0.8fr 0.7fr 1fr minmax(245px, auto); }
.order-item,
.data-table-head.order-head { min-width: 1050px; grid-template-columns: 1.8fr 1fr 0.7fr 0.7fr 0.6fr minmax(310px, auto); }
.unlock-item,
.data-table-head.unlock-head { grid-template-columns: 1.2fr 1fr 1fr 1fr; }
.complaint-item,
.data-table-head.complaint-head { min-width: 980px; grid-template-columns: 1.7fr 0.9fr 0.8fr 1fr minmax(220px, auto); }
.appeal-item,
.data-table-head.appeal-head { min-width: 1050px; grid-template-columns: 1.2fr 1.8fr 0.6fr 0.8fr minmax(200px, auto); }
.audit-item,
.data-table-head.audit-head { grid-template-columns: 1.2fr 1fr 1fr 1fr; }

.navigation-target,
.restriction-workbench,
.expiry-workbench,
.search-analytics-workbench {
  margin-bottom: 16px;
  scroll-margin-top: 138px;
}

.section-kicker {
  color: var(--green);
  letter-spacing: 0.12em;
}

.restriction-heading,
.expiry-heading,
.search-analytics-heading {
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.restriction-heading h2,
.expiry-heading h2,
.search-analytics-heading h2 {
  font-size: 18px;
}

.restriction-summary,
.danger-label {
  border: 1px solid #c9dafc;
  border-radius: 3px;
  color: #4873d2;
  background: #f1f5ff;
}

.danger-label {
  border-color: #ffc7ca;
  color: #d8434b;
  background: #fff0f1;
}

.restriction-layout { grid-template-columns: minmax(300px, 0.7fr) minmax(0, 1.4fr); }
.restriction-create,
.restriction-records { border-radius: 5px; background: #fafbfd; }
.restriction-card { border-left-color: var(--red); border-radius: 4px; }
.restriction-card.revoked { border-left-color: #a4adba; }
.public-reason { border-color: #ffd2d5; background: #fff8f8; }
.internal-notes { border-color: #ead59d; background: #fffdf5; }

.expiry-filters {
  grid-template-columns: minmax(120px, 0.8fr) minmax(130px, 0.9fr) minmax(220px, 1.5fr) minmax(90px, 0.65fr) auto;
  margin-top: 14px;
  padding: 12px;
}

.expiry-list {
  gap: 12px;
  margin-top: 14px;
}

.expiry-card {
  padding: 15px;
  border-radius: 5px;
  background: #fff;
}

.expiry-card.state-expired { background: #fffafa; }
.expiry-card.state-expiring_soon { background: #fffdf8; }
.expiry-documents,
.expiry-owner-note { border-radius: 4px; }

.analytics-period-switch {
  border-radius: 4px;
  background: #f5f7fa;
}

.analytics-period-switch button { border-radius: 3px; }
.analytics-period-switch button.active { background: var(--green); }

.analytics-privacy {
  border-color: #c9dafc;
  border-radius: 5px;
  color: #355eaa;
  background: #f4f7ff;
}

.analytics-privacy-mark { background: var(--green); }
.analytics-privacy p { color: #6680ad; }
.analytics-summary-grid { gap: 12px; }
.analytics-summary-card { border-radius: 4px; background: #fff; }
.analytics-summary-card strong { color: var(--green); }
.analytics-report-block { border-radius: 4px; }
.analytics-bar { background: #e9edf4; }
.analytics-bar span { background: var(--green); }

.core-module-state,
.quality-state,
.restriction-state,
.search-analytics-state {
  border-radius: 4px;
  background: #fafbfd;
}

.core-module-state.error,
.quality-state.error,
.restriction-state.error,
.search-analytics-state.error {
  border-color: #ffc6c9;
  color: #c33e46;
  background: #fff7f7;
}

.empty {
  min-height: 240px;
}

@media (max-width: 1199px) {
  .auth-strip {
    grid-template-columns: auto 1fr;
  }

  .password-box {
    grid-column: 1 / -1;
  }

  .operations-grid,
  .workspace,
  .restriction-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .quality-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quality-query {
    grid-column: span 2;
  }
}

@media (min-width: 1200px) and (max-width: 1320px) {
  .quality-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quality-query {
    grid-column: span 2;
  }
}

@media (max-width: 980px) {
  .sidebar { width: 210px; min-width: 210px; }
  main { margin-left: 210px; padding-inline: 20px; }
  .topbar { flex-direction: row; align-items: center; }
  .topbar,
  .workspace-tabs { margin-inline: -20px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-strip { grid-template-columns: minmax(0, 1fr); }
  .password-box { grid-column: auto; }
  .token-box { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .token-box button { min-width: 0; }
  .restriction-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .restriction-query { grid-column: 1 / -1; }
  .expiry-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .expiry-query { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  html { scroll-padding-top: 162px; }
  .app-shell { display: block; }
  .sidebar {
    position: relative;
    inset: auto;
    width: 100%;
    min-width: 0;
    height: auto;
    box-shadow: none;
  }

  .brand {
    height: 60px;
    flex-basis: 60px;
    padding-inline: 16px;
  }

  .brand-mark { width: 32px; height: 32px; flex-basis: 32px; }

  .sidebar nav {
    display: flex;
    flex-direction: row;
    gap: 5px;
    padding: 8px 10px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .sidebar nav a {
    min-width: max-content;
    min-height: 44px;
    grid-template-columns: 24px auto auto;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
  }

  .sidebar nav a::before { display: none; }
  .nav-icon { width: 22px; height: 22px; }
  .sidebar-foot { display: none; }

  main {
    width: 100%;
    min-width: 0;
    margin-left: 0;
    padding: 0 12px 32px;
  }

  .topbar {
    min-height: 62px;
    margin-inline: -12px;
    padding-inline: 14px;
  }

  .topbar p,
  .notification { display: none; }
  .menu-glyph { width: 24px; }
  .topbar h1 { font-size: 16px; }
  .utility-user { gap: 9px; font-size: 11px; }
  .admin-avatar { width: 32px; height: 32px; }

  .workspace-tabs {
    top: 62px;
    min-height: 46px;
    margin: 0 -12px 14px;
    padding-inline: 8px;
  }

  .workspace-tabs a { min-height: 46px; padding-inline: 10px; font-size: 12px; }

  .auth-strip,
  .panel {
    padding: 14px;
  }

  .token-box,
  .password-box {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .token-box input:first-child,
  .password-box input:first-child { grid-column: 1; }

  .metrics { gap: 10px; }
  .metric { min-height: 110px; padding: 15px; }
  .metric-copy strong { font-size: 25px; }
  .metric-icon { width: 38px; height: 38px; flex-basis: 38px; }

  .quality-filters,
  .restriction-filters,
  .expiry-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quality-query,
  .restriction-query,
  .expiry-query { grid-column: 1 / -1; }
  .search-analytics-toolbar,
  .restriction-heading,
  .expiry-heading,
  .search-analytics-heading { display: grid; }
  .search-analytics-toolbar { justify-content: stretch; }
  .restriction-form-grid,
  .expiry-list,
  .analytics-summary-grid,
  .analytics-report-grid { grid-template-columns: minmax(0, 1fr); }
  .restriction-span-2 { grid-column: auto; }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .navigation-target,
  .restriction-workbench,
  .expiry-workbench,
  .search-analytics-workbench { scroll-margin-top: 120px; }
}

@media (max-width: 460px) {
  .brand-copy small { display: none; }
  .utility-user #authStatus {
    max-width: 124px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .auth-strip,
  .panel { padding: 12px; }
  .auth-caption { min-width: 0; }
  .token-box,
  .password-box,
  .metrics,
  .summary-list,
  .quality-filters,
  .restriction-filters,
  .expiry-filters,
  .field-grid,
  .expiry-meta { grid-template-columns: minmax(0, 1fr); }

  .metric {
    min-height: 92px;
  }

  .summary-row,
  .summary-row:nth-child(2n),
  .summary-row:nth-last-child(-n + 2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .summary-row:last-child { border-bottom: 0; }
  .quality-query,
  .restriction-query,
  .expiry-query { grid-column: auto; }
  .expiry-heading-actions,
  .lifecycle-box,
  .expiry-box { display: grid; }
  .expiry-heading-actions { justify-content: stretch; }
  .expiry-heading-actions button,
  .expiry-heading-actions .restriction-summary { width: 100%; justify-content: center; text-align: center; }
  .lifecycle-actions { display: grid; min-width: 0; }
  .lifecycle-actions select { min-width: 0; }
  .restriction-form-actions { display: grid; }
  .restriction-form-actions button { width: 100%; }
  .analytics-period-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-privacy ul { grid-template-columns: minmax(0, 1fr); }
}

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

/* Platform configuration workbenches */
.platform-workbench {
  padding: 0;
  overflow: hidden;
}

.workbench-heading {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.workbench-heading > div:first-child {
  min-width: 0;
}

.workbench-heading h2 {
  margin-top: 4px;
  font-size: 18px;
}

.workbench-heading p {
  max-width: 720px;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.55;
}

.workbench-heading-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.button-file {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid #dce3ed;
  border-radius: 4px;
  color: #566174;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
}

.button-file:hover {
  border-color: #8fb3ff;
  color: #416bea;
  background: #f7f9ff;
}

.button-file input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
  white-space: nowrap;
}

.platform-filterbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 140px 140px auto auto;
  align-items: end;
  gap: 8px;
  margin: 16px 20px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fafbfd;
}

.platform-filterbar label,
.location-editor-grid label,
.preview-controls > label:not(.control-check),
.template-form-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.platform-filterbar label > span,
.location-editor-grid label > span,
.preview-controls label > span,
.template-form-grid label > span {
  color: #737d8c;
  font-size: 11px;
  font-weight: 700;
}

.location-editor {
  margin: 12px 20px 0;
  padding: 16px;
  border: 1px solid #cbd9f8;
  border-radius: 5px;
  background: #f7f9ff;
}

.location-editor[hidden] {
  display: none;
}

.location-editor .form-heading {
  margin-bottom: 12px;
}

.icon-close {
  width: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 20px;
}

.location-editor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.location-span-2 {
  grid-column: span 2;
}

.editor-actions {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
}

.editor-actions .hint {
  flex: 1;
}

.location-contract-note {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr);
  gap: 12px 24px;
  margin-top: 12px;
  padding: 14px 20px;
  border-block: 1px solid #dce5f5;
  color: #5c6879;
  background: #f7f9fd;
  font-size: 12px;
  line-height: 1.6;
}

.location-contract-note > div {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
}

.location-contract-note strong {
  color: #344054;
  font-size: 12px;
}

.location-contract-note p {
  grid-column: 1 / -1;
  color: #7c8797;
  font-size: 11px;
}

.location-contract-note .control-check {
  align-items: start;
}

.location-import-source {
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.location-import-source > strong {
  grid-column: 1 / -1;
}

.location-import-source label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.location-import-source label > span {
  color: #707b8c;
  font-size: 11px;
  font-weight: 700;
}

.location-pagination {
  margin: 0 20px 18px;
  border-top: 1px solid var(--line);
}

.location-pagination label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #7b8594;
  font-size: 11px;
}

.location-pagination select {
  width: 88px;
  min-height: 34px;
  padding-block: 5px;
}

.platform-data-region {
  min-width: 0;
  padding: 16px 20px 20px;
}

.platform-empty {
  display: grid;
  min-height: 210px;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  border: 1px dashed #d6deea;
  border-radius: 5px;
  color: #7f8998;
  background: #fafbfd;
  text-align: center;
}

.platform-empty.compact {
  min-height: 280px;
}

.platform-empty strong {
  color: #485365;
}

.platform-empty p {
  max-width: 540px;
  font-size: 12px;
  line-height: 1.55;
}

.platform-empty.api-unavailable {
  border-color: #f1d8a9;
  color: #876127;
  background: #fffdf7;
}

.state-symbol {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: var(--brand-soft);
  font-size: 20px;
}

.inline-api-warning {
  margin-bottom: 10px;
  padding: 9px 12px;
  border: 1px solid #f1d8a9;
  border-radius: 4px;
  color: #876127;
  background: #fffdf7;
  font-size: 12px;
}

.location-table {
  width: 100%;
  min-width: 840px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.platform-data-region:has(.location-table) {
  overflow-x: auto;
}

.location-table-row {
  display: grid;
  min-height: 62px;
  grid-template-columns: 1.35fr 1fr 0.9fr 0.9fr 0.9fr minmax(165px, auto);
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.location-table-row:last-child {
  border-bottom: 0;
}

.location-table-row:not(.location-table-head):hover {
  background: #fbfcff;
}

.location-table-head {
  min-height: 44px;
  color: #8b94a3;
  background: #fafbfd;
  font-size: 11px;
  font-weight: 700;
}

.location-name,
.location-table-row > div:not(.actions) {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.location-name strong,
.location-name span,
.location-table-row code {
  overflow-wrap: anywhere;
}

.location-name .ug {
  color: #78869a;
  font-size: 12px;
}

.location-table-row small {
  color: #98a2b3;
  font-size: 10px;
}

.location-table-row code {
  color: #536177;
  font-size: 11px;
}

.status.state-active,
.status.state-published {
  border-color: #b9e9cc;
  color: #0d9750;
  background: #ebfaf1;
}

.status.state-disabled,
.status.state-archived {
  border-color: #dfe3e9;
  color: #7d8795;
  background: #f2f4f7;
}

.status.state-draft {
  border-color: #ffd9a8;
  color: #bc6b08;
  background: #fff6e9;
}

button.danger-soft,
.danger-soft {
  border-color: #ffcdd0;
  color: #d64a52;
  background: #fff3f4;
}

button.danger-soft:hover:not(:disabled) {
  border-color: #ff9fa4;
  color: #c83942;
  background: #ffecef;
}

.preview-truth-label {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid #f1d8a9;
  border-radius: 3px;
  color: #876127;
  background: #fffaf0;
  font-size: 11px;
  font-weight: 700;
}

.preview-workspace {
  display: grid;
  grid-template-columns: 250px minmax(460px, 1fr);
  min-height: 760px;
}

.preview-controls {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: #fafbfd;
}

.control-check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: #5f6a7b;
  font-size: 12px;
}

.control-check input,
.module-visible input {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
}

.preview-data-note {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #cbd9f8;
  border-radius: 4px;
  color: #5c7098;
  background: #f4f7ff;
  font-size: 11px;
}

.preview-data-note p {
  color: #7080a1;
  font-size: 10px;
  line-height: 1.55;
}

.device-stage {
  display: grid;
  min-width: 0;
  place-items: start center;
  padding: 24px;
  overflow: auto;
  background-color: #eef1f5;
  background-image: linear-gradient(#e3e7ed 1px, transparent 1px), linear-gradient(90deg, #e3e7ed 1px, transparent 1px);
  background-size: 24px 24px;
}

.miniapp-device {
  --device-width: 390;
  --device-height: 844;
  position: relative;
  width: min(calc(var(--device-width) * 1px), 100%);
  aspect-ratio: var(--device-width) / var(--device-height);
  max-height: 704px;
  padding: 12px 8px 10px;
  overflow: hidden;
  border: 1px solid #1d2530;
  border-radius: 38px;
  background: #151c25;
  box-shadow: 0 24px 50px rgba(28, 42, 61, 0.22);
}

.miniapp-device.viewport-wechat { --device-width: 375; --device-height: 812; }
.miniapp-device.viewport-android { --device-width: 412; --device-height: 915; border-radius: 27px; }

.device-speaker {
  position: absolute;
  z-index: 3;
  top: 6px;
  left: 50%;
  width: 58px;
  height: 5px;
  border-radius: 3px;
  background: #404956;
  transform: translateX(-50%);
}

.miniapp-preview-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 29px;
  color: #252b3a;
  background: #f5f7fa;
  font-size: 11px;
}

.viewport-android .miniapp-preview-canvas { border-radius: 20px; }

.preview-statusbar {
  display: flex;
  height: 27px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: #fff;
  background: var(--preview-primary, #557cf6);
  font-size: 9px;
  font-weight: 700;
}

.variant-blue { --preview-primary: #557cf6; --preview-soft: #eef2ff; --preview-accent: #ff9f2d; }
.variant-fresh { --preview-primary: #149b68; --preview-soft: #eaf8f2; --preview-accent: #f49a35; }
.variant-contrast { --preview-primary: #1f2937; --preview-soft: #eef0f2; --preview-accent: #e65437; }

.template-compact .preview-page { font-size: 0.94em; }
.template-compact .preview-body { gap: 8px; }
.template-trust .preview-notice { border-color: #7cc9a0; background: #eaf8f1; }

.preview-page {
  height: calc(100% - 27px);
  overflow: hidden;
  padding-bottom: 52px;
}

.preview-hero {
  padding: 11px 12px 25px;
  color: #fff;
  background: var(--preview-primary);
}

.preview-location {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
}

.preview-location span,
.preview-banner p,
.preview-simple-head span,
.preview-profile-head span,
.miniapp-preview-canvas [lang="ug-Arab"] {
  font-family: "UKIJ Ekran", sans-serif;
  direction: rtl;
}

.preview-location span,
.preview-banner p {
  font-size: 8px;
}

.preview-search {
  display: grid;
  min-height: 38px;
  grid-template-columns: 24px 1fr;
  align-items: center;
  margin-top: 8px;
  padding: 5px 9px;
  border-radius: 20px;
  color: #7e8898;
  background: #fff;
}

.preview-search div {
  display: grid;
  gap: 1px;
}

.preview-search b {
  font-size: 7px;
  font-weight: 400;
}

.preview-banner {
  min-height: 96px;
  margin-top: 10px;
  padding: 17px 16px;
  border-radius: 12px;
  background: linear-gradient(125deg, rgba(17, 84, 198, 0.9), rgba(62, 153, 245, 0.92));
}

.variant-fresh .preview-banner { background: linear-gradient(125deg, #087c56, #31b987); }
.variant-contrast .preview-banner { background: linear-gradient(125deg, #111827, #4b5563); }

.preview-banner small {
  color: #dceaff;
  font-size: 8px;
}

.preview-banner h3 {
  margin-top: 7px;
  font-size: 16px;
  line-height: 1.2;
}

.preview-banner p {
  margin-top: 5px;
  color: #eaf2ff;
}

.preview-body {
  display: grid;
  align-content: start;
  gap: 10px;
  width: auto;
  margin-top: -17px;
  margin-left: 0;
  padding: 0 10px 14px;
}

.preview-categories {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 12px 7px;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 7px 18px rgba(35, 55, 80, 0.08);
}

.preview-categories > span {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-width: 0;
  text-align: center;
}

.preview-categories i,
.preview-choice-grid i {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: var(--preview-primary);
  font-style: normal;
  font-weight: 800;
}
.preview-categories i img,
.preview-choice-grid i img,
.preview-category-layout article i img,
.preview-service > i img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.preview-categories i,
.preview-choice-grid i,
.preview-category-layout article i {
  overflow: hidden;
  padding: 3px;
  border: 1px solid rgba(85, 124, 246, .12);
  background: linear-gradient(145deg, #fff, #f4f7ff);
  box-shadow: 0 3px 8px rgba(42, 64, 110, .12);
}

.preview-categories small { font-size: 8px; }
.preview-categories b { color: #7b8492; font-size: 6px; font-weight: 400; }

.preview-notice {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid #c9d9ff;
  border-radius: 7px;
  color: #4065b9;
  background: #f1f5ff;
  font-size: 8px;
}

.preview-notice span { font-size: 7px; }

.preview-section {
  padding: 10px;
  border-radius: 10px;
  background: #fff;
}

.preview-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.preview-section-title strong { font-size: 11px; }
.preview-section-title span { color: var(--preview-primary); font-size: 7px; }

.preview-service {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 7px 0;
  border-top: 1px solid #edf0f4;
}

.preview-service > i,
.preview-profile-head > i {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 50%;
  color: var(--preview-primary);
  background: var(--preview-soft);
  font-style: normal;
  font-weight: 800;
}

.preview-service > div { display: grid; gap: 2px; }
.preview-service strong { font-size: 9px; }
.preview-service span { color: #7b8492; font-size: 7px; }
.preview-service b { color: #8994a3; font-size: 6px; font-weight: 400; }
.preview-service em { color: var(--preview-accent); font-size: 8px; font-style: normal; font-weight: 800; }

.preview-simple-head {
  display: grid;
  gap: 2px;
  min-height: 82px;
  place-content: center;
  color: #fff;
  background: var(--preview-primary);
  text-align: center;
}

.preview-simple-head strong { font-size: 15px; }
.preview-simple-head span { font-size: 9px; }

.preview-category-layout {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 0;
  margin-top: 0;
  padding: 0;
}

.preview-category-layout aside {
  min-height: 460px;
  background: #f0f2f5;
}

.preview-category-layout aside span {
  display: grid;
  min-height: 44px;
  place-items: center;
  color: #6f7887;
  font-size: 8px;
}

.preview-category-layout aside span.active {
  border-left: 3px solid var(--preview-primary);
  color: var(--preview-primary);
  background: #fff;
  font-weight: 700;
}

.preview-category-layout section { padding: 9px; background: #fff; }
.preview-filter { margin-bottom: 7px; padding: 8px; border-radius: 5px; color: #7a8493; background: #f5f7fa; font-size: 8px; }
.preview-category-layout article { display: grid; grid-template-columns: 31px minmax(0, 1fr) auto; align-items: center; gap: 7px; padding: 9px 0; border-bottom: 1px solid #edf0f4; }
.preview-category-layout article i { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 8px; color: var(--preview-primary); background: var(--preview-soft); font-style: normal; font-weight: 800; }
.preview-category-layout article div { display: grid; gap: 2px; }
.preview-category-layout article strong { font-size: 9px; }
.preview-category-layout article span { color: #8993a1; font-size: 7px; }

.preview-form-title { display: grid; gap: 2px; margin-top: 28px; }
.preview-form-title strong { font-size: 11px; }
.preview-form-title span { color: #8993a1; font-size: 8px; }
.preview-choice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.preview-choice-grid > span { display: grid; justify-items: center; gap: 4px; padding: 8px 4px; border: 1px solid #e2e7ee; border-radius: 7px; background: #fff; }
.preview-choice-grid > span.active { border-color: var(--preview-primary); background: var(--preview-soft); }
.preview-choice-grid strong { font-size: 8px; }
.preview-choice-grid b { color: #8993a1; font-size: 6px; font-weight: 400; }
.preview-field { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; padding: 8px 10px; border: 1px solid #e1e6ed; border-radius: 6px; background: #fff; }
.preview-field strong { font-size: 8px; }
.preview-field b { color: #8993a1; font-size: 7px; font-weight: 400; text-align: right; }
.preview-field span { grid-column: 1 / -1; padding: 7px; border-radius: 4px; color: #adb4bf; background: #f7f8fa; font-size: 8px; }
.preview-submit { display: grid; min-height: 43px; place-content: center; border: 0; border-radius: 7px; color: #fff; background: var(--preview-primary); font-size: 9px; }
.preview-submit small { margin-top: 2px; font-size: 7px; }

.preview-profile-head {
  display: grid;
  min-height: 118px;
  grid-template-columns: 44px 1fr;
  align-content: center;
  gap: 10px;
  padding: 18px;
  color: #fff;
  background: var(--preview-primary);
}

.preview-profile-head > i { width: 42px; height: 42px; color: var(--preview-primary); background: #fff; }
.preview-profile-head > div { display: grid; gap: 2px; }
.preview-profile-head strong { font-size: 13px; }
.preview-profile-head span { font-size: 8px; }
.preview-profile-head small { color: rgba(255,255,255,.75); font-size: 7px; }
.preview-profile-head + .preview-body { margin-top: -14px; }
.preview-stats { display: grid; grid-template-columns: repeat(3, 1fr); padding: 11px; border-radius: 9px; background: #fff; box-shadow: 0 6px 18px rgba(35,55,80,.08); }
.preview-stats span { display: grid; justify-items: center; gap: 2px; border-right: 1px solid #edf0f4; }
.preview-stats span:last-child { border: 0; }
.preview-stats b { color: var(--preview-primary); font-size: 13px; }
.preview-stats small { color: #7e8794; font-size: 7px; }
.preview-menu-row { display: grid; grid-template-columns: 25px 1fr auto; align-items: center; gap: 7px; padding: 8px 0; border-top: 1px solid #edf0f4; }
.preview-menu-row > span { color: var(--preview-primary); }
.preview-menu-row > div { display: grid; gap: 1px; }
.preview-menu-row strong { font-size: 8px; }
.preview-menu-row b { color: #8993a1; font-size: 7px; font-weight: 400; }
.preview-menu-row em { color: #a4acb7; font-size: 13px; font-style: normal; }

.preview-tabbar {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  display: grid;
  height: 52px;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  border-top: 1px solid #e5e9ef;
  background: rgba(255,255,255,.98);
}

.preview-tabbar > span {
  display: grid;
  justify-items: center;
  gap: 0;
  color: #98a2b3;
  font-size: 12px;
}

.preview-tabbar > span.active { color: var(--preview-primary); }
.preview-tabbar > span.primary { transform: translateY(-7px); }
.preview-tabbar > span.primary::first-line { color: #fff; background: var(--preview-primary); }
.preview-tabbar small { margin-top: 1px; font-size: 7px; }
.preview-tabbar b { font-size: 6px; font-weight: 400; }

.template-workspace {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-height: 590px;
}

.template-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: #fafbfd;
}

.template-list-item {
  display: grid;
  min-height: 86px;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  color: #465164;
  background: #fff;
  text-align: left;
}

.template-list-item:hover:not(:disabled) {
  border-color: #aac1fa;
  color: #465164;
  background: #f8faff;
}

.template-list-item.active {
  border-color: var(--green);
  color: #465164;
  background: #f2f6ff;
  box-shadow: inset 3px 0 0 var(--green);
}

.template-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.template-item-top strong { color: #303949; font-size: 13px; }
.template-item-top em { font-style: normal; }
.template-list-item > span:not(.template-item-top),
.template-list-item small { color: #8490a1; font-size: 10px; }

.template-editor {
  min-width: 0;
  padding: 18px 20px;
}

.template-editor fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.template-editor fieldset:disabled {
  opacity: 0.72;
}

.template-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.template-span-2 { grid-column: span 2; }

.module-editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.module-editor-heading span {
  color: #8993a1;
  font-size: 11px;
}

.template-module-editor {
  border: 1px solid var(--line);
  border-top: 0;
}

.template-module-row {
  display: grid;
  min-height: 54px;
  grid-template-columns: 28px minmax(170px, 1fr) 120px auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.template-module-row:last-child { border-bottom: 0; }
.module-grip { color: #a9b1bc; letter-spacing: -2px; }
.module-visible { display: grid; grid-template-columns: 18px 1fr; align-items: center; gap: 8px; font-weight: 600; }
.template-module-row code { color: #8190a3; font-size: 11px; }
.module-order-actions { display: flex; gap: 5px; }
.module-order-actions button { width: 32px; min-height: 30px; padding: 0; }
.template-editor-empty { display: grid; min-height: 180px; place-items: center; color: #8c96a5; background: #fafbfd; }

.template-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.template-editor-notice {
  min-height: 18px;
  margin-top: 8px;
  color: #8a5b19;
  font-size: 11px;
  text-align: right;
}

@media (max-width: 1199px) {
  .preview-workspace { grid-template-columns: 220px minmax(400px, 1fr); }
  .template-workspace { grid-template-columns: 280px minmax(0, 1fr); }
  .template-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .workbench-heading { align-items: flex-start; }
  .workbench-heading-actions { flex-wrap: wrap; }
  .platform-filterbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .platform-filterbar label:first-child { grid-column: 1 / -1; }
  .location-editor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-workspace,
  .template-workspace { grid-template-columns: minmax(0, 1fr); }
  .preview-controls,
  .template-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .preview-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-data-note { grid-column: 1 / -1; }
  .template-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .workbench-heading { display: grid; padding: 14px; }
  .workbench-heading-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-content: stretch; }
  .workbench-heading-actions .restriction-summary { grid-column: 1 / -1; justify-content: center; }
  .workbench-heading-actions > button,
  .workbench-heading-actions > .button-file { width: 100%; }
  .platform-filterbar,
  .location-editor-grid,
  .preview-controls,
  .template-list,
  .template-form-grid { grid-template-columns: minmax(0, 1fr); }
  .platform-filterbar { margin-inline: 12px; }
  .platform-filterbar label:first-child,
  .preview-data-note,
  .template-span-2 { grid-column: auto; }
  .location-editor { margin-inline: 12px; }
  .location-contract-note { grid-template-columns: minmax(0, 1fr); padding-inline: 14px; }
  .location-contract-note p { grid-column: auto; }
  .location-import-source { grid-column: auto; grid-template-columns: minmax(0, 1fr); }
  .location-import-source > strong { grid-column: auto; }
  .location-pagination { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-inline: 12px; }
  .location-pagination #locationPageInfo { grid-column: 1 / -1; grid-row: 1; text-align: center; }
  .location-pagination #locationPrevBtn { grid-column: 1; grid-row: 2; }
  .location-pagination #locationNextBtn { grid-column: 2; grid-row: 2; }
  .location-pagination label { grid-column: 1 / -1; grid-row: 3; justify-content: center; }
  .platform-data-region { padding-inline: 12px; }
  .device-stage { padding: 18px 8px; }
  .miniapp-device { max-width: 340px; }
  .template-list { max-height: 320px; overflow-y: auto; }
  .template-editor { padding: 14px 12px; }
  .module-editor-heading { display: grid; }
  .template-module-row { grid-template-columns: 20px minmax(0, 1fr) auto; }
  .template-module-row code { display: none; }
  .template-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Regional operations workspace: dense desktop governance console with
   contained small-screen table scrolling. */
.region-workbench {
  --region-success: #19745b;
  --region-success-soft: #edf8f4;
  --region-warning: #9a620a;
  --region-warning-soft: #fff8e8;
  --region-danger: #c23f49;
  --region-danger-soft: #fff2f3;
  --region-neutral: #647083;
  --region-neutral-soft: #f4f6f9;
  padding: 0;
  overflow: hidden;
}

.region-workbench-heading {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 19px 20px;
  border-bottom: 1px solid var(--line);
}

.region-workbench-heading > div:first-child {
  min-width: 0;
}

.region-workbench-heading h2 {
  margin-top: 4px;
  font-size: 18px;
}

.region-workbench-heading p {
  max-width: 800px;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.6;
}

.region-heading-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.region-heading-actions [hidden] {
  display: none !important;
}

.region-summary {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid #cddaf8;
  border-radius: 4px;
  color: #4665aa;
  background: #f3f6ff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.icon-text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.region-governance-note {
  display: grid;
  grid-template-columns: 40px minmax(260px, 1.2fr) minmax(500px, 1fr);
  align-items: center;
  gap: 14px;
  margin: 16px 20px 0;
  padding: 14px 16px;
  border: 1px solid #cfdaf0;
  border-radius: 5px;
  color: #425675;
  background: #f6f8fd;
}

.region-note-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 5px;
  color: #fff;
  background: #557cf6;
  font-size: 12px;
  font-weight: 800;
}

.region-governance-note h3 {
  color: #344259;
  font-size: 13px;
}

.region-governance-note p {
  max-width: 720px;
  margin-top: 4px;
  color: #69778b;
  font-size: 11px;
  line-height: 1.55;
}

.region-governance-note ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.region-governance-note li {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding-left: 9px;
  border-left: 3px solid #8aa5ee;
}

.region-governance-note li:nth-child(2) { border-left-color: #e9ac4e; }
.region-governance-note li:nth-child(3) { border-left-color: #e07279; }
.region-governance-note li strong { color: #39475c; font-size: 11px; }
.region-governance-note li span { color: #7b8798; font-size: 10px; line-height: 1.4; }

.region-filterbar {
  display: grid;
  grid-template-columns: 138px 150px minmax(220px, 1fr) 108px auto auto;
  align-items: end;
  gap: 8px;
  margin: 14px 20px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fafbfd;
}

.region-filterbar label {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.region-filterbar label > span {
  color: #697487;
  font-size: 11px;
  font-weight: 700;
}

.region-filterbar input,
.region-filterbar select {
  width: 100%;
}

.region-notice {
  min-height: 0;
  margin: 0 20px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
}

.region-notice:not(:empty) {
  min-height: 38px;
  margin-top: 12px;
  padding: 9px 12px;
  border: 1px solid #d5ddea;
  color: #536176;
  background: #f7f9fc;
}

.region-notice.success {
  border-color: #b9ddcf;
  color: #17634f;
  background: var(--region-success-soft);
}

.region-notice.warning {
  border-color: #eed39c;
  color: #80520b;
  background: var(--region-warning-soft);
}

.region-notice.error {
  border-color: #efbec2;
  color: #a52f39;
  background: var(--region-danger-soft);
}

.region-data-region {
  min-width: 0;
  padding: 14px 20px 0;
}

.region-state {
  display: grid;
  min-height: 220px;
  grid-template-columns: 42px minmax(0, 520px) auto;
  place-content: center;
  align-items: center;
  gap: 14px;
  padding: 26px;
  border: 1px dashed #d4dce8;
  border-radius: 5px;
  color: #687488;
  background: #fafbfd;
}

.region-state-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid #d7e0ef;
  border-radius: 50%;
  color: #5871a6;
  background: #fff;
  font-size: 16px;
  font-weight: 800;
}

.region-state strong {
  display: block;
  color: #3e495b;
  font-size: 14px;
}

.region-state p {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.55;
}

.region-state.error {
  border-color: #efc1c5;
  color: #a03740;
  background: var(--region-danger-soft);
}

.region-state.error .region-state-icon {
  border-color: #efc1c5;
  color: var(--region-danger);
}

.region-state.permission {
  border-color: #d5dce7;
  color: #5f6a7b;
  background: var(--region-neutral-soft);
}

.region-state.loading .region-state-icon {
  animation: region-spin 1s linear infinite;
}

@keyframes region-spin {
  to { transform: rotate(360deg); }
}

.region-stale-warning {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  padding: 9px 10px;
  border: 1px solid #edd39f;
  border-radius: 4px;
  color: #7e540d;
  background: var(--region-warning-soft);
  font-size: 11px;
}

.region-stale-warning > span:nth-child(2) { flex: 1; }
.region-stale-warning button { min-height: 30px; padding-block: 4px; }

.region-table-scroll {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  scrollbar-width: thin;
}
.region-metric-row td { padding: 0 16px 14px; background: #f7faf8; border-bottom: 1px solid var(--line); }
.region-metrics-inline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.region-metrics-inline > div { display: grid; gap: 3px; min-width: 0; }
.region-metrics-inline strong { color: var(--ink); font-size: 12px; }
.region-metrics-inline span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.region-metrics-inline.error { display: flex; align-items: center; gap: 12px; color: #a33c36; }
@media (max-width: 900px) { .region-metrics-inline { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.region-table-scroll:focus-visible {
  outline-offset: 3px;
}

.region-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.region-table th,
.region-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.region-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #596579;
  background: #f7f9fc;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.region-table th:nth-child(1) { width: 195px; }
.region-table th:nth-child(2) { width: 175px; }
.region-table th:nth-child(3) { width: 175px; }
.region-table th:nth-child(4) { width: 255px; }
.region-table th:nth-child(5) { width: 150px; }
.region-table th:nth-child(6) { width: 255px; }
.region-table tbody tr:last-child td { border-bottom: 0; }
.region-table tbody tr:hover { background: #fbfcff; }

.region-identity,
.region-stage-cell,
.region-owner-cell,
.region-version,
.region-row-actions {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 5px;
}

.region-identity strong,
.region-owner-cell strong,
.region-version strong {
  color: #303b4d;
  font-size: 12px;
}

.region-identity [lang="ug-Arab"] {
  display: block;
  overflow-wrap: anywhere;
  color: #505f73;
  font-size: 11px;
  line-height: 1.55;
  text-align: left;
}

.region-identity small,
.region-stage-cell small,
.region-owner-cell small,
.region-version small,
.region-version span {
  color: #8993a2;
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.region-owner-cell > span { color: #536176; font-size: 11px; font-weight: 650; }

.region-stage-token,
.region-status-token {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  min-height: 24px;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid #cbd8f8;
  border-radius: 999px;
  color: #4167c4;
  background: #f1f5ff;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.region-status-token { border-color: #d7dee8; color: var(--region-neutral); background: var(--region-neutral-soft); }
.region-status-token.status-active { border-color: #b8ddcf; color: var(--region-success); background: var(--region-success-soft); }
.region-status-token.status-hold,
.region-status-token.status-paused { border-color: #edd39c; color: var(--region-warning); background: var(--region-warning-soft); }
.region-status-token.status-exiting,
.region-status-token.status-exited { border-color: #efbec2; color: var(--region-danger); background: var(--region-danger-soft); }

.region-gates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.region-gate {
  display: inline-flex;
  min-width: 0;
  min-height: 24px;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  border: 1px solid #dce2ea;
  border-radius: 4px;
  color: #6f7989;
  background: #f7f8fa;
  font-size: 10px;
  white-space: nowrap;
}

.region-gate > span {
  display: inline-grid;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  place-items: center;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 800;
}

.region-gate.passed { border-color: #c2dfd4; color: #246b58; background: #f2faf7; }
.region-gate.passed > span { color: #fff; background: var(--region-success); }
.region-gate.missing { border-color: #ead9b4; color: #815b1a; background: #fffaf0; }
.region-gate.missing > span { color: #845f20; background: #f3dfb3; }

.region-row-actions { gap: 7px; }
.region-row-actions > button { width: max-content; min-height: 30px; padding: 4px 9px; font-size: 10px; }
.region-action-permission {
  display: inline-flex;
  width: max-content;
  min-height: 28px;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid #dce2ea;
  border-radius: 4px;
  color: #7c8796;
  background: #f6f7f9;
  font-size: 10px;
  font-weight: 700;
}
.region-decision-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.region-decision-actions button { min-height: 30px; padding: 4px 8px; font-size: 10px; }
.region-decision-actions .decision-go { border-color: #a9d5c5; color: #176751; background: #eef9f5; }
.region-decision-actions .decision-hold { border-color: #e8cf98; color: #86590d; background: #fff8e8; }
.region-decision-actions .decision-rollback { border-color: #edbec2; color: #ad3741; background: #fff2f3; }
.region-decision-actions .decision-go:hover:not(:disabled) { border-color: #79b9a1; color: #0f5945; background: #e3f5ef; }
.region-decision-actions .decision-hold:hover:not(:disabled) { border-color: #dab463; color: #744900; background: #fff1d2; }
.region-decision-actions .decision-rollback:hover:not(:disabled) { border-color: #dc9097; color: #922a33; background: #ffe6e8; }

.region-table tbody tr.is-expanded > td {
  border-bottom-color: #cbd8f5;
  background: #f8faff;
}

.region-category-expansion[hidden] { display: none; }

.region-category-expansion > td {
  padding: 0;
  background: #f4f7fc;
}

.region-category-panel {
  padding: 15px;
  border-bottom: 1px solid var(--line);
}

.region-category-panel > header,
.region-assignment-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.region-category-panel > header h3,
.region-assignment-heading h3 {
  margin-top: 3px;
  color: #344259;
  font-size: 13px;
}

.region-category-panel > header p,
.region-assignment-heading p {
  max-width: 760px;
  margin-top: 4px;
  color: #738095;
  font-size: 10px;
  line-height: 1.55;
}

.region-category-panel > header button { min-height: 32px; flex: 0 0 auto; padding-block: 5px; }

.region-category-state {
  display: grid;
  min-height: 116px;
  grid-template-columns: 34px minmax(0, 520px) auto;
  place-content: center;
  align-items: center;
  gap: 12px;
  padding: 18px;
  color: #687488;
}

.region-category-state > span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid #d5deec;
  border-radius: 50%;
  background: #fff;
  font-size: 11px;
  font-weight: 800;
}

.region-category-state strong { display: block; color: #455166; font-size: 12px; }
.region-category-state p { margin-top: 3px; font-size: 10px; line-height: 1.5; }
.region-category-state.error { color: #a03740; background: var(--region-danger-soft); }
.region-category-state.permission { background: var(--region-neutral-soft); }
.region-category-state.loading > span { animation: region-spin 1s linear infinite; }

.region-category-stale {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #e8cf98;
  border-radius: 4px;
  color: #7f550c;
  background: var(--region-warning-soft);
  font-size: 10px;
}

.region-category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.region-category-card {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dce3ed;
  border-top: 3px solid #aab4c3;
  border-radius: 5px;
  background: #fff;
}

.region-category-card.status-prepared { border-top-color: #e2aa4e; }
.region-category-card.status-enabled { border-top-color: var(--region-success); }
.region-category-card.status-paused { border-top-color: var(--region-warning); }

.region-category-card-heading {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.region-category-card-heading > div { min-width: 0; }
.region-category-card-heading h4 { margin-top: 5px; color: #364257; font-size: 12px; overflow-wrap: anywhere; }
.region-category-card-heading p { margin-top: 2px; color: #69788d; font-family: "UKIJ Ekran", sans-serif; font-size: 10px; line-height: 1.45; text-align: left; overflow-wrap: anywhere; }

.region-wave-token,
.region-entity-token {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  padding: 2px 6px;
  border: 1px solid #cdd9f5;
  border-radius: 3px;
  color: #4d69ad;
  background: #f3f6ff;
  font-size: 9px;
  font-weight: 800;
}

.region-category-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid #d8dfe8;
  border-radius: 999px;
  color: #647083;
  background: #f7f8fa;
  font-size: 9px;
  font-weight: 750;
  white-space: nowrap;
}

.region-category-card.status-enabled .region-category-status { border-color: #b9ddcf; color: #17634f; background: var(--region-success-soft); }
.region-category-card.status-prepared .region-category-status,
.region-category-card.status-paused .region-category-status { border-color: #eed39c; color: #80520b; background: var(--region-warning-soft); }

.region-category-card dl,
.region-category-dialog-summary dl,
.region-assignment-dialog-summary dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border: 1px solid #e5e9ef;
  border-radius: 4px;
  overflow: hidden;
}

.region-category-card dl > div,
.region-category-dialog-summary dl > div,
.region-assignment-dialog-summary dl > div {
  min-width: 0;
  padding: 6px 7px;
  border-right: 1px solid #e5e9ef;
  background: #fafbfd;
}

.region-category-card dl > div:last-child,
.region-category-dialog-summary dl > div:last-child,
.region-assignment-dialog-summary dl > div:last-child { border-right: 0; }
.region-category-card dt,
.region-category-dialog-summary dt,
.region-assignment-dialog-summary dt { color: #9099a7; font-size: 8px; }
.region-category-card dd,
.region-category-dialog-summary dd,
.region-assignment-dialog-summary dd { margin: 3px 0 0; color: #495569; font-size: 9px; font-weight: 700; overflow-wrap: anywhere; }

.region-category-subcategory-list { display: grid; gap: 6px; }
.region-category-subcategory-list > strong { color: #59667a; font-size: 9px; }
.region-category-subcategory-list > div { display: flex; flex-wrap: wrap; gap: 4px; }
.region-category-subcategory-list span { padding: 3px 6px; border: 1px solid #dce3ed; border-radius: 3px; color: #59677b; background: #f7f9fc; font-size: 9px; }
.region-category-subcategory-list em { color: #8b95a4; font-size: 9px; font-style: normal; }

.region-category-blockers {
  padding: 8px 9px;
  border: 1px solid #ebd09a;
  border-radius: 4px;
  color: #78500d;
  background: #fffaf0;
}

.region-category-blockers strong { font-size: 9px; }
.region-category-blockers ul { display: grid; gap: 3px; margin: 5px 0 0; padding-left: 16px; }
.region-category-blockers li { font-size: 9px; line-height: 1.45; }

.region-category-card footer { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: auto; }
.region-category-card footer button { min-height: 28px; padding: 4px 7px; font-size: 9px; }
.region-category-card footer .action-prepare,
.region-category-card footer .action-enable,
.region-category-card footer .action-resume { border: 1px solid #add7c7; color: #17634f; background: var(--region-success-soft); }
.region-category-card footer .action-pause,
.region-category-card footer .action-disable { border: 1px solid #efbec2; color: #a52f39; background: var(--region-danger-soft); }

.region-category-dialog-summary,
.region-assignment-dialog-summary {
  display: grid;
  gap: 11px;
  margin: 16px 20px 0;
  padding: 13px;
  border: 1px solid #dfe5ee;
  border-radius: 5px;
  background: #fafbfd;
}

.region-category-dialog-route {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.region-category-dialog-route > span:first-child { padding: 4px 7px; border: 1px solid #cdd9f5; border-radius: 3px; color: #4d69ad; background: #f3f6ff; font-size: 9px; font-weight: 800; }
.region-category-dialog-route > strong { flex: 1; color: #3f4c60; font-size: 11px; overflow-wrap: anywhere; }
.region-category-no-blocker { color: #376c5d; font-size: 10px; line-height: 1.5; }

.region-category-subcategories {
  min-width: 0;
  margin: 14px 20px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fafbfd;
}

.region-category-subcategories[hidden],
.region-category-reason[hidden],
.region-decision-confirm[hidden] { display: none; }
.region-category-subcategories legend { padding: 0 6px; color: #485468; font-size: 11px; font-weight: 750; }
.region-category-subcategories > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.region-category-subcategories label { display: grid; min-width: 0; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; padding: 9px; border: 1px solid #dfe5ed; border-radius: 4px; background: #fff; cursor: pointer; }
.region-category-subcategories input { width: 16px; min-height: 16px; margin: 2px 0 0; accent-color: var(--green); }
.region-category-subcategories label > span { display: grid; min-width: 0; gap: 2px; }
.region-category-subcategories strong { color: #3d495c; font-size: 10px; }
.region-category-subcategories small { color: #69788d; font-family: "UKIJ Ekran", sans-serif; font-size: 9px; line-height: 1.4; text-align: left; overflow-wrap: anywhere; }
.region-category-subcategories code { color: #939baa; font-size: 8px; overflow-wrap: anywhere; }
.region-category-no-subcategories { grid-column: 1 / -1; color: #7f8998; font-size: 10px; }

.region-assignment-workbench {
  margin: 0 20px 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.region-assignment-filter {
  display: grid;
  grid-template-columns: 180px 100px auto auto;
  align-items: end;
  gap: 8px;
  margin-top: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fafbfd;
}

.region-assignment-filter label { display: grid; gap: 5px; }
.region-assignment-filter label > span { color: #697487; font-size: 10px; font-weight: 700; }
.region-assignment-list { min-width: 0; margin-top: 12px; }
.region-assignment-table { width: 100%; min-width: 1080px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.region-assignment-table th,
.region-assignment-table td { padding: 10px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.region-assignment-table th { color: #596579; background: #f7f9fc; font-size: 10px; font-weight: 750; white-space: nowrap; }
.region-assignment-table th:nth-child(1) { width: 210px; }
.region-assignment-table th:nth-child(2) { width: 210px; }
.region-assignment-table th:nth-child(3) { width: 150px; }
.region-assignment-table th:nth-child(4) { width: 200px; }
.region-assignment-table th:nth-child(5) { width: 145px; }
.region-assignment-table th:nth-child(6) { width: 140px; }
.region-assignment-table tbody tr:last-child td { border-bottom: 0; }

.region-assignment-identity,
.region-assignment-location,
.region-assignment-eligibility,
.region-assignment-suggestion { display: grid; min-width: 0; gap: 4px; }
.region-assignment-identity strong,
.region-assignment-location strong,
.region-assignment-suggestion strong { color: #3b475a; font-size: 11px; overflow-wrap: anywhere; }
.region-assignment-identity code,
.region-assignment-location span,
.region-assignment-suggestion small,
.region-assignment-eligibility span { color: #7b8798; font-size: 9px; overflow-wrap: anywhere; }
.region-assignment-location small { color: #9a7431; font-size: 8px; line-height: 1.45; }
.region-assignment-suggestion [lang="ug-Arab"] { color: #657388; font-family: "UKIJ Ekran", sans-serif; font-size: 9px; line-height: 1.4; text-align: left; }
.region-assignment-eligibility strong { display: flex; align-items: center; gap: 5px; color: #855d18; font-size: 10px; }
.region-assignment-eligibility.eligible strong { color: #17634f; }
.region-assignment-none { color: #8b95a4; font-size: 10px; }
.region-assignment-pagination { margin-inline: 0; }

.region-assignment-route {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: #8993a2;
}

.region-assignment-route > div { display: grid; min-width: 0; gap: 3px; padding: 9px; border: 1px solid #dfe5ed; border-radius: 4px; background: #fff; }
.region-assignment-route > div > span { color: #929ba9; font-size: 8px; }
.region-assignment-route strong { color: #445166; font-size: 10px; overflow-wrap: anywhere; }
.region-assignment-route small { color: #68768a; font-family: "UKIJ Ekran", sans-serif; font-size: 9px; line-height: 1.4; text-align: left; }
.region-assignment-dialog-summary dl { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.region-pagination {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin: 0 20px;
  border-top: 0;
  color: #7c8797;
  font-size: 11px;
}

.region-pagination button { min-height: 32px; padding-block: 5px; }

.region-dialog {
  width: min(820px, calc(100vw - 40px));
  max-height: min(820px, calc(100vh - 40px));
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid #d9e0ea;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 24px 70px rgba(22, 35, 55, 0.25);
}

.region-dialog::backdrop {
  background: rgba(27, 39, 57, 0.55);
  backdrop-filter: blur(2px);
}

.region-dialog-form {
  min-width: 0;
}

.region-dialog-form[aria-busy="true"] {
  cursor: progress;
}

.region-dialog-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
}

.region-dialog-header > div { min-width: 0; }
.region-dialog-header h2 { margin-top: 4px; font-size: 18px; }
.region-dialog-header p { margin-top: 5px; font-size: 11px; line-height: 1.5; }
.dialog-close { width: 36px; min-height: 36px; flex: 0 0 36px; padding: 0; font-size: 20px; }

.region-dialog-notice {
  min-height: 0;
  margin: 0 20px;
  color: #aa303a;
  font-size: 12px;
  line-height: 1.55;
}

.region-dialog-notice:not(:empty) {
  min-height: 40px;
  margin-top: 14px;
  padding: 9px 11px;
  border: 1px solid #efbec2;
  border-radius: 4px;
  background: var(--region-danger-soft);
}

.region-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  padding: 16px 20px 0;
}

.region-form-grid [name="nameUg"] {
  font-family: "UKIJ Ekran", sans-serif;
  font-size: 13px;
}

.region-category-fieldset,
.region-gate-fieldset {
  min-width: 0;
  margin: 16px 20px 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fafbfd;
}

.region-category-fieldset legend,
.region-gate-fieldset legend {
  padding: 0 6px;
  color: #485468;
  font-size: 12px;
  font-weight: 750;
}

.region-category-fieldset label,
.region-gate-grid label,
.region-decision-confirm {
  display: grid;
  min-width: 0;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  cursor: pointer;
}

.region-category-fieldset input,
.region-gate-grid input,
.region-decision-confirm input {
  width: 16px;
  min-height: 16px;
  margin: 2px 0 0;
  accent-color: var(--green);
}

.region-category-fieldset label > span,
.region-gate-grid label > span,
.region-decision-confirm > span {
  display: grid;
  gap: 3px;
}

.region-category-fieldset strong,
.region-gate-grid strong,
.region-decision-confirm strong { color: #3c485b; font-size: 11px; }
.region-category-fieldset small,
.region-gate-grid small,
.region-decision-confirm small { color: #818c9c; font-size: 10px; line-height: 1.45; }
.region-gate-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.region-gate-grid label { min-height: 58px; padding: 9px; border: 1px solid #dfe5ed; border-radius: 4px; background: #fff; }
.region-gate-grid .derived-gate { border-style: dashed; background: #f5f7fa; }

.region-dialog-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
}

.region-dialog-actions p {
  flex: 1;
  margin-right: 8px;
  font-size: 10px;
  line-height: 1.45;
}

.region-decision-dialog { width: min(660px, calc(100vw - 40px)); }
.region-decision-dialog > form > .form-control { margin: 14px 20px 0; }

.region-decision-summary {
  display: grid;
  gap: 12px;
  margin: 16px 20px 0;
  padding: 14px;
  border: 1px solid #dfe5ee;
  border-radius: 5px;
  background: #fafbfd;
}

.region-decision-route {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  color: #7e8998;
  text-align: center;
}

.region-decision-route span:first-child,
.region-decision-route strong {
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid #d9e0e9;
  border-radius: 4px;
  color: #465267;
  background: #fff;
}

.region-decision-dialog[data-decision="go"] .region-decision-route strong { border-color: #b3dccd; color: #176751; background: #edf8f4; }
.region-decision-dialog[data-decision="hold"] .region-decision-route strong { border-color: #e9cf96; color: #875a0d; background: #fff8e8; }
.region-decision-dialog[data-decision="rollback"] .region-decision-route strong { border-color: #edb8bd; color: #ab333d; background: #fff2f3; }

.region-decision-summary dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  border: 1px solid #e3e8ef;
  border-radius: 4px;
  overflow: hidden;
}

.region-decision-summary dl > div { min-width: 0; padding: 8px 9px; border-right: 1px solid #e3e8ef; background: #fff; }
.region-decision-summary dl > div:last-child { border-right: 0; }
.region-decision-summary dt { color: #8a94a2; font-size: 9px; }
.region-decision-summary dd { margin: 4px 0 0; overflow-wrap: anywhere; color: #3f4a5b; font-size: 10px; font-weight: 700; }
.region-decision-gates { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.region-decision-gates > strong { margin-right: 5px; color: #475367; font-size: 11px; }

.region-decision-confirm {
  margin: 14px 20px 0;
  padding: 11px;
  border: 1px solid #e4cf9f;
  border-radius: 4px;
  background: #fffaf0;
}

@media (max-width: 1279px) {
  .region-governance-note { grid-template-columns: 40px minmax(0, 1fr); }
  .region-governance-note ul { grid-column: 2; }
  .region-filterbar { grid-template-columns: 125px 140px minmax(190px, 1fr) 100px; }
  .region-filterbar > button { width: 100%; }
  .region-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .region-workbench-heading { align-items: flex-start; }
  .region-heading-actions { flex-wrap: wrap; }
  .region-summary { width: 100%; justify-content: center; }
  .region-governance-note { grid-template-columns: 36px minmax(0, 1fr); }
  .region-governance-note ul { grid-column: 1 / -1; }
  .region-filterbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .region-filter-query { grid-column: 1 / -1; }
  .region-state { grid-template-columns: 42px minmax(0, 1fr); }
  .region-state button { grid-column: 2; width: max-content; }
  .region-gate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .region-assignment-heading { display: grid; }
  .region-assignment-heading .region-summary { width: max-content; }
  .region-assignment-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .region-workbench { margin-inline: 0; }
  .region-workbench-heading { display: grid; gap: 14px; padding: 15px 12px; }
  .region-workbench-heading p { font-size: 11px; }
  .region-heading-actions { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .region-summary { grid-column: 1 / -1; white-space: normal; text-align: center; }
  .region-heading-actions button { width: 100%; min-width: 0; }
  .region-governance-note { margin: 12px 12px 0; padding: 12px; }
  .region-governance-note ul { grid-template-columns: minmax(0, 1fr); }
  .region-filterbar { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 12px 12px 0; padding: 10px; }
  .region-filter-query { grid-column: 1 / -1; }
  .region-filterbar button { min-width: 0; padding-inline: 8px; }
  .region-notice { margin-inline: 12px; }
  .region-data-region { padding: 12px 12px 0; }
  .region-table { min-width: 1080px; }
  .region-state { min-height: 230px; grid-template-columns: minmax(0, 1fr); justify-items: center; padding: 22px 15px; text-align: center; }
  .region-state button { grid-column: auto; width: 100%; }
  .region-stale-warning { display: grid; grid-template-columns: auto 1fr; }
  .region-stale-warning button { grid-column: 1 / -1; width: 100%; }
  .region-pagination { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: 92px; margin-inline: 12px; padding-block: 12px; }
  .region-pagination span { grid-column: 1 / -1; grid-row: 1; text-align: center; }
  .region-pagination button { width: 100%; }
  .region-dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  .region-dialog-header { padding: 14px 12px; }
  .region-dialog-header h2 { font-size: 16px; }
  .region-dialog-notice { margin-inline: 12px; }
  .region-form-grid { grid-template-columns: minmax(0, 1fr); padding: 14px 12px 0; }
  .region-category-fieldset,
  .region-gate-fieldset { margin: 14px 12px 0; padding: 11px; }
  .region-gate-grid { grid-template-columns: minmax(0, 1fr); }
  .region-dialog-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; }
  .region-dialog-actions p { grid-column: 1 / -1; margin: 0; text-align: left; }
  .region-dialog-actions button { width: 100%; min-width: 0; padding-inline: 8px; }
  .region-decision-dialog > form > .form-control,
  .region-decision-summary,
  .region-decision-confirm { margin-inline: 12px; }
  .region-decision-summary dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .region-decision-summary dl > div:nth-child(2) { border-right: 0; }
  .region-decision-summary dl > div:nth-child(-n + 2) { border-bottom: 1px solid #e3e8ef; }
  .region-category-panel { padding: 12px; }
  .region-category-panel > header { display: grid; }
  .region-category-panel > header button { width: 100%; }
  .region-category-grid { grid-template-columns: minmax(0, 1fr); }
  .region-category-state { min-height: 150px; grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .region-category-state button { width: 100%; }
  .region-category-subcategories,
  .region-category-dialog-summary,
  .region-assignment-dialog-summary { margin-inline: 12px; }
  .region-category-subcategories > div { grid-template-columns: minmax(0, 1fr); }
  .region-category-card dl,
  .region-category-dialog-summary dl { grid-template-columns: minmax(0, 1fr); }
  .region-category-card dl > div,
  .region-category-dialog-summary dl > div { border-right: 0; border-bottom: 1px solid #e5e9ef; }
  .region-category-card dl > div:last-child,
  .region-category-dialog-summary dl > div:last-child { border-bottom: 0; }
  .region-assignment-workbench { margin-inline: 12px; }
  .region-assignment-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .region-assignment-filter button { width: 100%; min-width: 0; padding-inline: 7px; }
  .region-assignment-dialog-summary dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .region-assignment-dialog-summary dl > div:nth-child(2) { border-right: 0; }
  .region-assignment-dialog-summary dl > div:nth-child(-n + 2) { border-bottom: 1px solid #e5e9ef; }
}

@media (prefers-reduced-motion: reduce) {
  .region-state.loading .region-state-icon,
  .region-category-state.loading > span { animation: none; }
}

/* Desktop workspace routing: only the selected module participates in layout. */
@media (min-width: 561px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    height: 100vh;
    min-height: 0;
  }

  main {
    height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
}

.navigation-target {
  display: none !important;
  margin-bottom: 0;
  scroll-margin-top: 0;
}

.navigation-target.is-active {
  display: block !important;
  animation: admin-view-enter 160ms ease-out;
}

/* The section itself is a routed landmark, not an actionable control. Keep
   focus available for assistive technology without drawing a panel-sized ring. */
.navigation-target:focus {
  outline: none;
}

.operations-grid.is-active,
.workspace.is-active {
  display: grid !important;
}

.metrics {
  display: none !important;
}

.metrics.is-view-active {
  display: grid !important;
}

@keyframes admin-view-enter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .navigation-target.is-active { animation: none; }
}

@media (max-width: 560px) {
  html,
  body {
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .navigation-target.is-active {
    animation: none;
  }
}

/* The workspace bar identifies one routed view; it is not a second tab system. */
.workspace-tabs {
  min-height: 46px;
  align-items: center;
  gap: 10px;
}

.workspace-context {
  flex: 0 0 auto;
  padding-left: 8px;
  color: #98a2b3;
  font-size: 11px;
  font-weight: 600;
}

.workspace-tabs a {
  min-height: 46px;
  gap: 7px;
  padding-inline: 10px;
}

.workspace-tabs a span,
.workspace-tabs a.active span {
  color: inherit;
}

.workspace-tab-mark {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid #c9d8fc;
  border-radius: 4px;
  background: #f4f7ff;
  font-size: 10px !important;
}

@media (min-width: 561px) and (max-width: 1320px) {
  .auth-strip {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .password-box {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .workspace-tabs {
    justify-content: space-between;
    padding-inline: 12px;
  }

  .workspace-context {
    padding-left: 0;
  }
}

/* Compact admin session toolbar. Authentication remains available without
   taking a full workspace row; password editing is opt-in. */
.auth-strip [hidden] {
  display: none !important;
}

.auth-strip {
  display: grid;
  grid-template-columns: minmax(176px, auto) minmax(320px, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  margin-bottom: 16px;
  padding: 10px 16px;
  box-shadow: none;
}

.auth-caption {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.auth-caption strong {
  color: #334155;
  font-size: 13px;
  line-height: 1.25;
}

.auth-caption .hint {
  overflow: hidden;
  color: #8a96a8;
  font-size: 10px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-login-form,
.auth-session-tools {
  min-width: 0;
}

.auth-login-form {
  display: grid;
  grid-template-columns: minmax(130px, 0.75fr) minmax(160px, 1fr) auto;
  align-items: center;
  gap: 7px;
}

.auth-login-form input,
.auth-login-form button,
.auth-session-tools button {
  min-height: 36px;
  font-size: 12px;
}

.auth-session-tools:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.auth-session-state {
  max-width: 360px;
  overflow: hidden;
  color: #516174;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.password-panel {
  grid-column: 1 / -1;
  padding-top: 10px;
  border-top: 1px solid #e7ecf2;
}

.password-box {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.password-box label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.password-box label > span {
  color: #78869a;
  font-size: 11px;
  font-weight: 600;
}

.password-box input,
.password-box button {
  min-height: 36px;
  font-size: 12px;
}

@media (min-width: 561px) and (max-width: 900px) {
  .auth-strip {
    grid-template-columns: minmax(150px, auto) minmax(0, 1fr);
  }

  .auth-login-form,
  .auth-session-tools {
    grid-column: 2;
  }

  .auth-session-tools:not([hidden]) {
    justify-content: flex-start;
  }

  .auth-session-state {
    max-width: 240px;
  }
}

@media (max-width: 560px) {
  .auth-strip {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
    min-height: 0;
    padding: 12px;
  }

  .auth-caption .hint {
    white-space: normal;
  }

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

  .auth-session-tools:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    justify-content: stretch;
  }

  .auth-session-state {
    max-width: none;
    align-self: center;
  }

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

  .password-box button {
    width: 100%;
  }
}
