/* SignalPlus components. Written with logical properties so Arabic (rtl) and English (ltr) mirror each other. */

/* ---------- Base ---------------------------------------------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--page);
  color: var(--text);
  font: 400 var(--text-md)/var(--lh-md) var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  caret-color: var(--accent);
}

::selection { background: var(--accent-soft-hover); color: var(--text); }

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
table { border-collapse: collapse; }

a { color: var(--accent-text); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-chip); }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-pill); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-4) 0; }

/* Identifiers, keys and code: always left to right, isolated inside right-to-left text. */
.mono, code, kbd, samp { font-family: var(--font-mono); font-size: 0.92em; font-feature-settings: "calt" 0; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.strong { font-weight: 600; }
.text-xs { font-size: var(--text-xs); line-height: var(--lh-xs); }
.text-sm { font-size: var(--text-sm); line-height: var(--lh-sm); }
.text-lg { font-size: var(--text-lg); line-height: var(--lh-lg); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nowrap { white-space: nowrap; }
/* Identifiers in a table never break at their hyphens and dots; the table scrolls instead. */
.table td .mono { white-space: nowrap; }
.break { overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.stack { display: flex; flex-direction: column; gap: var(--gap, var(--s-4)); }
.stack-sm { --gap: var(--s-2); }
.stack-lg { --gap: var(--s-6); }
.row { display: flex; align-items: center; gap: var(--gap, var(--s-2)); flex-wrap: wrap; }
.row-nowrap { flex-wrap: nowrap; }
.row-between { justify-content: space-between; }
.row-end { justify-content: flex-end; }
.spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.grid-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s-4); align-items: start; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-sidebar { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

.icon { flex: none; width: var(--icon-size, 18px); height: var(--icon-size, 18px); }
.icon-sm { --icon-size: 16px; }
.icon-xs { --icon-size: 14px; }
.icon-lg { --icon-size: 24px; }
[dir="rtl"] .icon-flip { transform: scaleX(-1); }
.icon-spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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

.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  z-index: var(--z-sidebar);
}
.sidebar-brand { height: var(--topbar-height); flex: none; display: flex; align-items: center; gap: var(--s-2); padding-inline: var(--s-5); border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 600; font-size: 15px; letter-spacing: -0.01em; color: var(--text); direction: ltr; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 24px; height: 24px; border-radius: var(--r-control); background: var(--accent); color: var(--text-on-accent); display: grid; place-items: center; }
.brand-tag { font-size: var(--text-xs); font-weight: 500; color: var(--text-muted); border: 1px solid var(--border); border-radius: var(--r-chip); padding: 0 6px; line-height: 18px; }

.sidebar-context { padding: var(--s-3); display: flex; flex-direction: column; gap: var(--s-2); border-bottom: 1px solid var(--border); }
.sidebar-label { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--text-muted); padding-inline: 2px; }

.picker { border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface); }
.picker-item { width: 100%; display: flex; align-items: center; gap: var(--s-2); padding: 6px 10px; background: none; border: 0; text-align: start; border-radius: 0; color: var(--text); }
.picker-item + .picker-item { border-top: 1px solid var(--border); }
.picker-item:first-child { border-radius: var(--r-card) var(--r-card) 0 0; }
.picker-item:last-child { border-radius: 0 0 var(--r-card) var(--r-card); }
.picker-item:only-child { border-radius: var(--r-card); }
.picker-item:hover { background: var(--surface-hover); }
.picker-item small { display: block; font-size: var(--text-xs); line-height: 16px; color: var(--text-muted); }
.picker-item b { display: flex; align-items: baseline; gap: 6px; font-size: var(--text-sm); font-weight: 500; min-width: 0; }
.picker-item b .mono { color: var(--text-muted); font-weight: 400; font-size: 11px; }
.picker-item > div { flex: 1; min-width: 0; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: var(--s-2) var(--s-3) var(--s-4); }
.nav-group + .nav-group { margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--divider); }
.nav-group-title { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--text-muted); padding: 0 10px var(--s-1); font-weight: 500; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding-inline: 10px; border-radius: var(--r-control);
  color: var(--text-secondary); font-size: var(--text-md);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
.nav-item .icon { --icon-size: 18px; color: var(--text-muted); }
.nav-item.active .icon { color: var(--accent-text); }
.nav-item .nav-count { margin-inline-start: auto; font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.nav-item.disabled { opacity: 0.5; pointer-events: none; }

.sidebar-account { flex: none; border-top: 1px solid var(--border); padding: var(--s-2) var(--s-3); }
.account-button { width: 100%; display: flex; align-items: center; gap: 10px; padding: var(--s-2); border: 0; background: none; border-radius: var(--r-control); text-align: start; }
.account-button:hover { background: var(--surface-hover); }
.account-button b { display: block; font-size: var(--text-sm); font-weight: 500; }
.account-button small { display: block; font-size: var(--text-xs); color: var(--text-muted); }
.account-button > div { flex: 1; min-width: 0; }

.avatar { flex: none; width: 32px; height: 32px; border-radius: var(--r-pill); display: grid; place-items: center; background: var(--surface-muted); border: 1px solid var(--border); font-weight: 600; font-size: var(--text-sm); color: var(--text-secondary); }
.avatar-sm { width: 24px; height: 24px; font-size: 11px; }

.app-main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  height: var(--topbar-height); flex: none;
  display: flex; align-items: center; gap: var(--s-4);
  padding-inline: var(--s-8);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.btn.topbar-menu { display: none; }
.topbar-end { margin-inline-start: auto; display: flex; align-items: center; gap: var(--s-2); }

.breadcrumb { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--text-sm); color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { color: var(--text-disabled); }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 500; }

.sidebar-scrim { display: none; }

@media (max-width: 1023px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(300px, 86vw); transform: translateX(-100%); transition: transform var(--dur-slow) var(--ease-out); box-shadow: var(--shadow-dialog); }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open, [dir="rtl"] .sidebar.open { transform: none; }
  .sidebar-scrim.open { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: calc(var(--z-sidebar) - 1); }
  .topbar { padding-inline: var(--s-4); }
  .btn.topbar-menu { display: inline-flex; }
}

/* On a phone with a control at the top bar's end, the breadcrumb keeps only the environment (the page title already
   names the page, and the sidebar that names the rest is off screen). */
@media (max-width: 760px) { .topbar:has(.topbar-end:not(:empty)) .breadcrumb > :not(:has(.chip-env)) { display: none; } }

/* ---------- Page --------------------------------------------------------------------------------------------- */

.page { width: 100%; max-width: var(--content-max); padding: var(--s-6) var(--s-8) var(--s-12); }
.page-narrow { max-width: 880px; }
@media (max-width: 760px) { .page { padding: var(--s-4) var(--s-4) var(--s-10); } }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-5); }
.page-header > div:first-child { min-width: 0; }
.page-title { font-size: var(--text-xl); line-height: var(--lh-xl); font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.page-description { margin-top: 2px; font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--text-muted); max-width: 75ch; }
.page-actions { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-sm); color: var(--text-muted); margin-bottom: var(--s-2); }
.back-link:hover { color: var(--text); text-decoration: none; }

.section + .section { margin-top: var(--s-6); }
.section-title { font-size: var(--text-lg); line-height: var(--lh-lg); font-weight: 600; margin-bottom: var(--s-3); }

.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--border); margin-bottom: var(--s-5); overflow-x: auto; scrollbar-width: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding-inline: var(--s-3); color: var(--text-muted); font-weight: 500; font-size: var(--text-md); white-space: nowrap; background: none; border: 0; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--accent-text); }
.tab.active::after { content: ""; position: absolute; inset-inline: var(--s-2); bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }
.tab .badge { height: 18px; }

/* ---------- Cards -------------------------------------------------------------------------------------------- */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-xs); min-width: 0; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5) 0; }
.card-header.ruled { padding-bottom: var(--s-4); border-bottom: 1px solid var(--border); }
.card-title { font-size: var(--text-md); line-height: var(--lh-md); font-weight: 600; }
.card-description { font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--text-muted); margin-top: 2px; }
.card-body { padding: var(--s-4) var(--s-5) var(--s-5); }
.card-footer { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-2); padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); background: var(--surface-header); border-radius: 0 0 var(--r-card) var(--r-card); }
.card-footer.between { justify-content: space-between; }
.card > .table-wrap:last-child { border-radius: 0 0 var(--r-card) var(--r-card); }

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

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding-inline: 14px; border-radius: var(--r-control);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: var(--text-sm); font-weight: 500; line-height: 1; white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  user-select: none;
}
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn .icon { --icon-size: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:active { background: var(--accent-pressed); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #FFFFFF; }
:root[data-theme="dark"] .btn-danger { color: #1A0B0A; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] .btn-danger { color: #1A0B0A; } }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-danger-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--danger-text); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-link { height: auto; padding: 0; border: 0; background: none; box-shadow: none; color: var(--accent-text); }
.btn-link:hover { background: none; text-decoration: underline; }
.btn-sm { height: 28px; padding-inline: 10px; font-size: var(--text-xs); }
.btn-lg { height: 40px; padding-inline: 18px; font-size: var(--text-md); }
.btn-block { width: 100%; }
.btn-icon { width: 34px; padding: 0; }
.btn-icon.btn-sm { width: 28px; }
.btn.loading > :not(.btn-spinner) { visibility: hidden; }
.btn-spinner { position: absolute; inset: 0; display: grid; place-items: center; }

.button-group { display: inline-flex; }
.button-group .btn { border-radius: 0; }
.button-group .btn:first-child { border-start-start-radius: var(--r-control); border-end-start-radius: var(--r-control); }
.button-group .btn:last-child { border-start-end-radius: var(--r-control); border-end-end-radius: var(--r-control); }
.button-group .btn + .btn { margin-inline-start: -1px; }

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

.form { display: flex; flex-direction: column; gap: var(--s-4); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
@media (max-width: 760px) { .form-row { grid-template-columns: minmax(0, 1fr); } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: var(--text-sm); line-height: var(--lh-sm); font-weight: 500; color: var(--text); display: flex; align-items: baseline; gap: 6px; }
.label .optional { font-weight: 400; color: var(--text-muted); font-size: var(--text-xs); }
.hint { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--text-muted); }
.field-error { display: flex; align-items: flex-start; gap: 4px; font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--danger-text); }
.field-error .icon { --icon-size: 14px; margin-top: 2px; }

.input, .select, .textarea {
  width: 100%; min-width: 0;
  height: 36px; padding-inline: 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-control);
  font-size: var(--text-md);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-disabled); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-muted); color: var(--text-muted); cursor: not-allowed; }
.input[readonly] { background: var(--surface-muted); }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--danger); }
.input.invalid:focus, .textarea.invalid:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }
.input-sm { height: 30px; font-size: var(--text-sm); }
.textarea { height: auto; min-height: 88px; padding-block: 8px; line-height: var(--lh-md); resize: vertical; }
.input.mono, .textarea.mono { font-size: 13px; }
.select { appearance: none; padding-inline-end: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%236B7280'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: 14px; background-position: right 12px center; }
[dir="rtl"] .select { background-position: left 12px center; }

.input-group { position: relative; display: flex; align-items: stretch; }
.input-group .input { flex: 1; }
.input-group .input-addon { display: inline-flex; align-items: center; padding-inline: 10px; border: 1px solid var(--border-strong); background: var(--surface-muted); color: var(--text-muted); font-size: var(--text-sm); white-space: nowrap; }
.input-group .input-addon:first-child { border-inline-end: 0; border-start-start-radius: var(--r-control); border-end-start-radius: var(--r-control); }
.input-group .input-addon:last-child { border-inline-start: 0; border-start-end-radius: var(--r-control); border-end-end-radius: var(--r-control); }
.input-group .input:not(:first-child) { border-start-start-radius: 0; border-end-start-radius: 0; }
.input-group .input:not(:last-child) { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; --icon-size: 16px; }
.input-icon > .input { padding-inline-start: 34px; }
.input-icon > .input-end { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); }

.check { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: var(--text-md); line-height: var(--lh-md); }
.check input { flex: none; margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.check small { display: block; color: var(--text-muted); font-size: var(--text-xs); line-height: var(--lh-xs); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; flex: none; position: relative; width: 34px; height: 20px; margin: 0; border-radius: var(--r-pill); background: var(--border-strong); transition: background var(--dur) var(--ease-out); cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); transition: inset-inline-start var(--dur) var(--ease-out); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { inset-inline-start: 16px; }
.switch input:disabled { opacity: 0.5; cursor: not-allowed; }

.segmented { display: inline-flex; padding: 2px; gap: 2px; background: var(--surface-muted); border-radius: var(--r-control); }
.segmented button { height: 28px; padding-inline: 12px; border: 0; border-radius: 5px; background: transparent; color: var(--text-muted); font-size: var(--text-sm); white-space: nowrap; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: 0 0 0 1px var(--border), var(--shadow-xs); }
.segmented.block { display: flex; }
.segmented.block button { flex: 1; padding-inline: 4px; }

.radio-cards { display: grid; gap: var(--s-2); }
.radio-card { display: flex; align-items: flex-start; gap: 10px; padding: var(--s-3) var(--s-4); border: 1px solid var(--border-strong); border-radius: var(--r-card); cursor: pointer; background: var(--surface); }
.radio-card:hover { border-color: var(--text-disabled); }
.radio-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.radio-card input { margin: 3px 0 0; accent-color: var(--accent); }
.radio-card b { display: block; font-weight: 500; }
.radio-card small { display: block; color: var(--text-muted); font-size: var(--text-xs); line-height: var(--lh-xs); }

.code-input { display: flex; gap: var(--s-2); direction: ltr; justify-content: center; }
.code-input input { width: 46px; height: 52px; text-align: center; font: 500 22px/1 var(--font-mono); border: 1px solid var(--border-strong); border-radius: var(--r-card); background: var(--surface); }
.code-input input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.code-input.invalid input { border-color: var(--danger); }
.code-input .gap { width: 8px; }

.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-2); padding: var(--s-6); border: 1.5px dashed var(--border-strong); border-radius: var(--r-card); background: var(--surface-header); text-align: center; color: var(--text-muted); position: relative; transition: border-color var(--dur) var(--ease-out), background var(--dur) var(--ease-out); }
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone b { color: var(--text); font-weight: 500; }

.tag-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 36px; padding: 4px 6px; border: 1px solid var(--border-strong); border-radius: var(--r-control); background: var(--surface); }
.tag-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.tag-input input { flex: 1; min-width: 120px; border: 0; background: none; height: 26px; padding-inline: 4px; }
.tag-input input:focus { outline: none; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding-inline: 8px 4px; border-radius: var(--r-chip); background: var(--surface-muted); border: 1px solid var(--border); font-size: var(--text-xs); }
.tag button { display: grid; place-items: center; width: 18px; height: 18px; border: 0; border-radius: 3px; background: none; color: var(--text-muted); padding: 0; }
.tag button:hover { background: var(--border); color: var(--text); }

.form-actions { display: flex; align-items: center; gap: var(--s-2); justify-content: flex-end; }

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

.table-wrap { overflow-x: auto; }
.table { width: 100%; font-size: var(--text-sm); line-height: var(--lh-sm); }
.table th {
  height: 38px; padding: 0 var(--s-4); text-align: start; white-space: nowrap;
  font-size: var(--text-xs); font-weight: 500; color: var(--text-muted);
  background: var(--surface-header); border-block: 1px solid var(--border);
}
.card > .table-wrap:first-child .table th, .card > .table:first-child th { border-top: 0; }
.card > .table-wrap:first-child .table thead tr:first-child th:first-child { border-start-start-radius: var(--r-card); }
.card > .table-wrap:first-child .table thead tr:first-child th:last-child { border-start-end-radius: var(--r-card); }
.table td { height: 46px; padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--divider); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-fast) var(--ease-out); }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-hover) 60%, transparent); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.selected { background: var(--accent-soft); }
.table .num, .table th.num { text-align: end; font-variant-numeric: tabular-nums; }
.table .actions { width: 1%; white-space: nowrap; text-align: end; }
.table .cell-main { font-weight: 500; color: var(--text); }
.cell-sub { display: block; font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--text-muted); }
.table .shrink { width: 1%; white-space: nowrap; }
.table-compact td { height: 38px; padding-block: 6px; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; color: inherit; font: inherit; }
.th-sort:hover { color: var(--text); }
.th-sort[aria-sort] { color: var(--text); }

.toolbar { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; padding: var(--s-3) var(--s-4); }
.toolbar .input-icon { width: min(320px, 100%); }
.toolbar .select { width: auto; min-width: 150px; }
.toolbar-filters { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.input-filter { width: var(--w, 200px); }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--border); font-size: var(--text-sm); color: var(--text-muted); }
.pagination .row { gap: var(--s-1); }

/* ---------- Badges and chips --------------------------------------------------------------------------------- */

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding-inline: 8px; border-radius: var(--r-pill); font-size: var(--text-xs); font-weight: 500; line-height: 1; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral-text); }
.badge .icon { --icon-size: 13px; }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-warning { background: var(--warning-soft); color: var(--warning-text); }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); }
.badge-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }

.chip { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding-inline: 6px; border-radius: var(--r-chip); border: 1px solid var(--border); font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); background: var(--surface); direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.chip-env { font-weight: 500; color: var(--text); }
.chip-env.prod { border-color: var(--danger-border); color: var(--danger-text); background: var(--danger-soft); }

kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding-inline: 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: var(--r-chip); background: var(--surface); color: var(--text-muted); font-size: 11px; }

/* ---------- Alerts and banners ------------------------------------------------------------------------------- */

.alert { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3) var(--s-4); border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface); font-size: var(--text-sm); line-height: var(--lh-sm); }
.alert > .icon { margin-top: 1px; --icon-size: 18px; }
.alert-content { flex: 1; min-width: 0; }
.alert-title { font-weight: 600; color: var(--text); }
.alert-text { color: var(--text-secondary); }
.alert-meta { margin-top: 4px; font-size: var(--text-xs); color: var(--text-muted); }
.alert-actions { display: flex; align-items: center; gap: var(--s-2); flex: none; }
.alert-info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.alert-info > .icon { color: var(--accent-text); }
.alert-success { background: var(--success-soft); border-color: var(--success-border); }
.alert-success > .icon { color: var(--success-text); }
.alert-warning { background: var(--warning-soft); border-color: var(--warning-border); }
.alert-warning > .icon { color: var(--warning-text); }
.alert-danger { background: var(--danger-soft); border-color: var(--danger-border); }
.alert-danger > .icon { color: var(--danger-text); }
.alert .btn { box-shadow: none; }
@media (max-width: 760px) { .alert { flex-wrap: wrap; } .alert-actions { width: 100%; justify-content: flex-end; } }

.banner { display: flex; align-items: center; gap: var(--s-3); padding: 10px var(--s-8); font-size: var(--text-sm); border-bottom: 1px solid var(--border); }
.banner-warning { background: var(--warning-soft); border-color: var(--warning-border); color: var(--text); }
.banner-warning .icon { color: var(--warning-text); }
.banner-danger { background: var(--danger-soft); border-color: var(--danger-border); }
.banner-danger .icon { color: var(--danger-text); }

/* ---------- Empty, error, loading ---------------------------------------------------------------------------- */

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-2); padding: var(--s-12) var(--s-6); }
.empty-icon { width: 48px; height: 48px; border-radius: var(--r-pill); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-bottom: var(--s-2); }
.empty-icon .icon { --icon-size: 24px; }
.empty-title { font-size: var(--text-lg); line-height: var(--lh-lg); font-weight: 600; }
.empty-text { max-width: 52ch; color: var(--text-muted); font-size: var(--text-sm); line-height: var(--lh-sm); }
.empty-actions { display: flex; gap: var(--s-2); margin-top: var(--s-3); flex-wrap: wrap; justify-content: center; }
.empty-compact { padding: var(--s-8) var(--s-4); }

.skeleton { display: block; border-radius: var(--r-chip); background: linear-gradient(90deg, var(--surface-muted) 0%, var(--surface-hover) 40%, var(--surface-muted) 80%); background-size: 300% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.skeleton-text { height: 12px; }
.skeleton-title { height: 20px; width: 40%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.loading-frame { transition: opacity var(--dur) var(--ease-out); }
.loading-frame.refreshing { opacity: 0.55; pointer-events: none; }

.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot-mark { display: flex; flex-direction: column; align-items: center; gap: var(--s-4); color: var(--text-muted); font-size: var(--text-sm); }

/* ---------- Dialogs and sheets ------------------------------------------------------------------------------- */

.scrim { position: fixed; inset: 0; z-index: var(--z-dialog); background: var(--scrim); display: grid; place-items: center; padding: var(--s-4); animation: fade-in var(--dur) var(--ease-out); }
.dialog { width: min(520px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--r-dialog); box-shadow: var(--shadow-dialog); animation: dialog-in var(--dur-slow) var(--ease-out); }
.dialog-sm { width: min(420px, 100%); }
.dialog-lg { width: min(720px, 100%); }
.dialog-xl { width: min(960px, 100%); }
.dialog-header { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-5) var(--s-6) 0; }
.dialog-header > div { flex: 1; min-width: 0; }
.dialog-title { font-size: var(--text-lg); line-height: var(--lh-lg); font-weight: 600; }
.dialog-description { margin-top: 4px; color: var(--text-muted); font-size: var(--text-sm); line-height: var(--lh-sm); }
.dialog-body { padding: var(--s-4) var(--s-6); overflow-y: auto; }
.dialog-footer { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-4) var(--s-6) var(--s-5); }
.dialog-danger .dialog-title { color: var(--danger-text); }

.sheet-scrim { position: fixed; inset: 0; z-index: var(--z-dialog); background: var(--scrim); animation: fade-in var(--dur) var(--ease-out); }
.sheet { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(560px, 100%); z-index: calc(var(--z-dialog) + 1); background: var(--surface-raised); border-inline-start: 1px solid var(--border); box-shadow: var(--shadow-dialog); display: flex; flex-direction: column; animation: sheet-in var(--dur-slow) var(--ease-out); }
.sheet-wide { width: min(760px, 100%); }
.sheet-header { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); }
.sheet-header > div { flex: 1; min-width: 0; }
.sheet-body { flex: 1; overflow-y: auto; padding: var(--s-5); }
.sheet-footer { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); }

@keyframes fade-in { from { opacity: 0; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes sheet-in { from { transform: translateX(24px); opacity: 0; } }
[dir="rtl"] .sheet { animation-name: sheet-in-rtl; }
@keyframes sheet-in-rtl { from { transform: translateX(-24px); opacity: 0; } }

/* ---------- Menus and popovers ------------------------------------------------------------------------------- */

.menu-anchor { position: relative; display: inline-flex; }
.menu { position: fixed; z-index: var(--z-popover); min-width: 200px; max-width: 320px; max-height: min(420px, 70dvh); overflow-y: auto; padding: 4px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-popover); animation: menu-in var(--dur-fast) var(--ease-out); }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 6px 10px; border: 0; border-radius: var(--r-control); background: none; color: var(--text); font-size: var(--text-sm); text-align: start; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-hover); outline: none; text-decoration: none; }
.menu-item .icon { --icon-size: 16px; color: var(--text-muted); }
.menu-item.danger { color: var(--danger-text); }
.menu-item.danger .icon { color: var(--danger-text); }
.menu-item.selected { font-weight: 500; }
.menu-item.selected .check-mark { margin-inline-start: auto; color: var(--accent-text); }
.menu-item:disabled { opacity: 0.5; cursor: not-allowed; }
.menu-item small { display: block; color: var(--text-muted); font-size: var(--text-xs); }
.menu-item > div { flex: 1; min-width: 0; }
.menu-separator { height: 1px; margin: 4px; background: var(--border); }
.menu-label { padding: 6px 10px 4px; font-size: var(--text-xs); color: var(--text-muted); font-weight: 500; }
.menu-search { padding: 4px 4px 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-catcher { position: fixed; inset: 0; z-index: calc(var(--z-popover) - 1); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }

.tooltip { position: relative; }
.tooltip[data-tip]:hover::after, .tooltip[data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); inset-inline-start: 50%; transform: translateX(-50%); padding: 4px 8px; border-radius: var(--r-chip); background: var(--text); color: var(--page); font-size: var(--text-xs); line-height: var(--lh-xs); white-space: nowrap; z-index: var(--z-popover); pointer-events: none; }
[dir="rtl"] .tooltip[data-tip]:hover::after, [dir="rtl"] .tooltip[data-tip]:focus-visible::after { transform: translateX(50%); }

/* ---------- Toasts ------------------------------------------------------------------------------------------- */

.toasts { position: fixed; inset-block-end: var(--s-5); inset-inline-end: var(--s-5); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--s-2); width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3) var(--s-4); background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-popover); font-size: var(--text-sm); line-height: var(--lh-sm); animation: toast-in var(--dur-slow) var(--ease-out); }
.toast > .icon { margin-top: 1px; }
.toast-success > .icon { color: var(--success); }
.toast-danger > .icon { color: var(--danger); }
.toast-info > .icon { color: var(--accent); }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; }
.toast-text { color: var(--text-secondary); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Figures (KPI row) and details -------------------------------------------------------------------- */

.kpis { display: grid; grid-template-columns: repeat(var(--kpi-cols, 5), minmax(0, 1fr)); gap: var(--s-4); }
@media (max-width: 1280px) { .kpis { --kpi-cols: 3 !important; } }
@media (max-width: 760px) {
  .kpis { --kpi-cols: 2 !important; }
  .kpis > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .toolbar { align-items: stretch; }
  .toolbar > *, .toolbar .input-icon, .toolbar .select, .toolbar .toolbar-filters, .toolbar .toolbar-filters > * { width: 100%; min-width: 0; }
  .toolbar .segmented { display: flex; overflow-x: auto; }
}
.kpi { padding: 14px var(--s-4); }
.card.kpi > .card-body { padding: 0; }
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--text-muted); }
.kpi-value { display: flex; align-items: baseline; gap: var(--s-2); margin: 4px 0 6px; font-size: var(--text-2xl); line-height: var(--lh-2xl); font-weight: 600; letter-spacing: -0.02em; }
.kpi-value small { font-size: var(--text-sm); font-weight: 500; letter-spacing: 0; color: var(--text-muted); }
.kpi-meta { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--text-muted); }
.kpi.danger .kpi-value { color: var(--danger-text); }
.delta { display: inline-flex; padding: 0 6px; margin-inline-end: 6px; border-radius: var(--r-chip); background: var(--neutral-soft); color: var(--neutral-text); font-weight: 500; direction: ltr; }
.delta.good { background: var(--success-soft); color: var(--success-text); }
.delta.bad { background: var(--danger-soft); color: var(--danger-text); }

.details { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); gap: 0; font-size: var(--text-sm); }
.details > dt { padding: 10px 0; color: var(--text-muted); border-bottom: 1px solid var(--divider); }
.details > dd { padding: 10px 0; border-bottom: 1px solid var(--divider); min-width: 0; overflow-wrap: anywhere; }
.details > dt:last-of-type, .details > dd:last-of-type { border-bottom: 0; }
@media (max-width: 600px) { .details { grid-template-columns: minmax(0, 1fr); } .details > dt { border-bottom: 0; padding-bottom: 0; } }

.id-text { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); direction: ltr; unicode-bidi: isolate; }
.id-text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-button { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: var(--r-chip); background: none; color: var(--text-muted); padding: 0; }
.copy-button:hover { background: var(--surface-hover); color: var(--text); }
.copy-button.copied { color: var(--success); }

.secret { border: 1px solid var(--warning-border); background: var(--warning-soft); border-radius: var(--r-card); padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); }
.secret-value { display: flex; align-items: center; gap: var(--s-2); padding: 10px 12px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-control); font-family: var(--font-mono); font-size: 13px; direction: ltr; overflow-wrap: anywhere; }
.secret-value > span { flex: 1; min-width: 0; }
.secret-note { display: flex; gap: var(--s-2); font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--text); }
.secret-note .icon { color: var(--warning-text); margin-top: 1px; }

.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px var(--s-4); padding: var(--s-4); border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface-header); font-family: var(--font-mono); font-size: 14px; direction: ltr; }

.code-block { margin: 0; padding: var(--s-3) var(--s-4); border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface-header); font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; direction: ltr; text-align: left; overflow-x: auto; white-space: pre; }

.steps { display: flex; flex-direction: column; }
.step { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: var(--s-3); align-items: start; padding: var(--s-3) 0; }
.step + .step { border-top: 1px solid var(--divider); }
.step-mark { width: 24px; height: 24px; border-radius: var(--r-pill); display: grid; place-items: center; border: 1.5px solid var(--border-strong); color: var(--text-muted); background: var(--surface); }
.step-mark .icon { --icon-size: 14px; }
.step.done .step-mark { background: var(--success); border-color: var(--success); color: var(--surface); }
.step.current .step-mark { border-color: var(--accent); color: var(--accent-text); }
.step-title { font-weight: 500; }
.step-done-icon { color: var(--success); }
.step-text { font-size: var(--text-sm); color: var(--text-muted); }

.progress { height: 6px; border-radius: var(--r-pill); background: var(--accent-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: var(--r-pill); background: var(--accent); }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-5); }
.list-item + .list-item { border-top: 1px solid var(--divider); }
.list-item > .grow { flex: 1; min-width: 0; }

.timeline { display: flex; flex-direction: column; }
.timeline-item { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: var(--s-3); padding-bottom: var(--s-4); }
.timeline-item::before { content: ""; position: absolute; inset-inline-start: 9px; top: 20px; bottom: 0; width: 2px; background: var(--border); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { width: 20px; height: 20px; border-radius: var(--r-pill); display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border-strong); }
.timeline-dot.success { border-color: var(--success); }
.timeline-dot.danger { border-color: var(--danger); }
.timeline-dot.warning { border-color: var(--warning); }
.timeline-dot.accent { border-color: var(--accent); }

/* ---------- Charts ------------------------------------------------------------------------------------------- */

.chart { position: relative; width: 100%; }
.chart > svg { width: 100%; height: auto; overflow: visible; direction: ltr; }
.chart text { font-family: var(--font-sans); font-size: 11px; fill: var(--text-muted); }
.chart .grid line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .baseline { stroke: var(--chart-axis); stroke-width: 1; }
.chart .value-label { fill: var(--text); font-weight: 500; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .crosshair { stroke: var(--border-strong); stroke-width: 1; }
.chart-tooltip { position: absolute; top: 0; z-index: 2; pointer-events: none; min-width: 140px; padding: 8px 10px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--r-control); box-shadow: var(--shadow-popover); font-size: var(--text-xs); line-height: var(--lh-xs); }
.chart-tooltip-title { color: var(--text-muted); margin-bottom: 4px; }
.chart-tooltip-row { display: flex; align-items: center; gap: 8px; }
.chart-tooltip-row b { font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.chart-tooltip-row span { color: var(--text-muted); }
.last-updated { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; vertical-align: middle; margin-inline-start: 4px; }
.chart-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 1px dashed var(--border); border-radius: var(--r-card); background: var(--surface-header); color: var(--text-muted); font-size: var(--text-sm); text-align: center; padding: var(--s-4); }
.chart-empty .icon { --icon-size: 22px; }

details.disclosure > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; color: var(--text-muted); border-radius: var(--r-chip); }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary:hover { color: var(--text); }
.disclosure-caret { transition: transform var(--dur) var(--ease-out); transform: rotate(-90deg); }
[dir="rtl"] .disclosure-caret { transform: rotate(90deg); }
details.disclosure[open] .disclosure-caret { transform: none; }

.legend { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); font-size: var(--text-xs); color: var(--text-muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.key-line { width: 14px; height: 0; border-top: 2px solid var(--key, var(--series-1)); border-radius: 1px; }
.key-line.dashed { border-top-style: dashed; }
.key-box { width: 10px; height: 10px; border-radius: 2px; background: var(--key, var(--series-1)); }
.bar-row { display: grid; grid-template-columns: minmax(90px, 200px) minmax(0, 1fr) 72px; gap: var(--s-3); align-items: center; font-size: var(--text-sm); padding: 6px 0; }
.bar-track { position: relative; height: 12px; }
.bar-fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 0 4px 4px 0; background: var(--key, var(--series-1)); min-width: 2px; }
[dir="rtl"] .bar-fill { border-radius: 4px 0 0 4px; }
.bar-row .num { text-align: end; }
/* A code reads left to right but sits at the row's start; its note keeps the page's language and font. */
.bar-label { display: flex; flex-direction: column; min-width: 0; }
.stack-bar { display: flex; height: 12px; gap: 2px; }
.stack-bar > span { height: 100%; background: var(--key); }
.stack-bar > span:first-child { border-start-start-radius: 4px; border-end-start-radius: 4px; }
.stack-bar > span:last-child { border-start-end-radius: 4px; border-end-end-radius: 4px; }

/* ---------- Signed-out pages --------------------------------------------------------------------------------- */

.auth { min-height: 100dvh; display: flex; flex-direction: column; }
.auth-top { display: flex; align-items: center; justify-content: space-between; padding: var(--s-5) var(--s-8); }
.auth-main { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: var(--s-6) var(--s-4) var(--s-16); }
.auth-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-dialog); box-shadow: var(--shadow-sm); padding: var(--s-8); margin-top: 6dvh; }
.auth-card-wide { width: min(560px, 100%); }
.auth-title { font-size: var(--text-xl); line-height: var(--lh-xl); font-weight: 600; letter-spacing: -0.01em; }
.auth-text { margin-top: 6px; color: var(--text-muted); font-size: var(--text-sm); line-height: var(--lh-sm); }
.auth-footer { margin-top: var(--s-6); padding-top: var(--s-5); border-top: 1px solid var(--border); font-size: var(--text-sm); color: var(--text-muted); text-align: center; }
.auth-icon { width: 44px; height: 44px; border-radius: var(--r-pill); display: grid; place-items: center; margin-bottom: var(--s-4); background: var(--accent-soft); color: var(--accent-text); }
.auth-icon.success { background: var(--success-soft); color: var(--success-text); }
.auth-icon.danger { background: var(--danger-soft); color: var(--danger-text); }
.auth-icon.warning { background: var(--warning-soft); color: var(--warning-text); }
.qr { display: grid; place-items: center; padding: var(--s-3); border: 1px solid var(--border); border-radius: var(--r-card); background: #FFFFFF; width: fit-content; margin-inline: auto; }
.qr svg { width: 176px; height: 176px; }
@media (max-width: 600px) { .auth-card { padding: var(--s-6) var(--s-5); margin-top: 0; } .auth-top { padding: var(--s-4); } }

/* ---------- Motion preferences ------------------------------------------------------------------------------- */

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

@media (forced-colors: active) {
  .btn, .input, .select, .textarea, .card { border: 1px solid CanvasText; }
  .nav-item.active { outline: 2px solid Highlight; }
}

.input-otp { height: 52px; text-align: center; font: 500 24px/1 var(--font-mono); letter-spacing: 0.35em; padding-inline: 12px 4px; }
.input-otp::placeholder { letter-spacing: 0.35em; color: var(--text-disabled); }

/* ---------- Unhandled error bar (Blazor) --------------------------------------------------------------------- */

#blazor-error-ui { display: none; position: fixed; inset-inline: 0; bottom: 0; z-index: 1000; align-items: center; gap: 12px; padding: 12px 20px; background: var(--danger-soft); color: var(--text); border-top: 1px solid var(--danger-border); font: 500 14px/1.4 var(--font-sans); }
#blazor-error-ui .reload { margin-inline-start: auto; }
:root[lang="en"] #blazor-error-ui .unhandled-ar, :root[lang="ar"] #blazor-error-ui .unhandled-en { display: none; }
