/* Meridian console — screen layout: sign-in, the shell, lists, cards, and the diff.
 * Logical properties throughout (inline-start/end), so Farsi mirrors without overrides. */

/* -- sign-in -------------------------------------------------------------------------------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 32px 16px; background:
    radial-gradient(1100px 500px at 50% -10%, var(--ac3), transparent 70%), var(--bg); }
.auth-card { width: min(420px, 100%); background: var(--s1); border: 1px solid var(--b1); border-radius: var(--r3);
  box-shadow: var(--shadow-md); padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.auth-card h1 { font-size: 1.5rem; }
.auth-foot { font-size: .8125rem; color: var(--t3); text-align: center; max-width: 420px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; }
.brand-name { font-family: var(--heading); font-size: 1.125rem; font-weight: 600; }
.cli-box { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: var(--r); background: var(--s2);
  border: 1px solid var(--b1); color: var(--t2); }
.offer-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--ac2);
  color: var(--ac-text); }
.offer-icon .icon { width: 26px; height: 26px; }
.forgot > summary { list-style: none; cursor: pointer; color: var(--ac-text); font-size: .875rem; font-weight: 600; }
.forgot > summary::-webkit-details-marker { display: none; }
.forgot > summary::marker { content: none; }
.forgot[open] { display: flex; flex-direction: column; gap: 8px; }
.steps { padding-inline-start: 20px; color: var(--t2); font-size: .9rem; display: flex; flex-direction: column; gap: 4px; }
.totp-grid { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }

/* -- shell ---------------------------------------------------------------------------------- */
.top { position: sticky; top: 0; z-index: 100; background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--b1); }
.top-inner { max-width: 1040px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; }
.top-inner:first-child { min-height: 56px; }
.top-brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: var(--t1); }
.top-brand .brand-mark { width: 28px; height: 28px; flex-shrink: 0; }
.top-title { font-family: var(--heading); font-weight: 600; font-size: 1.0625rem; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.tabs { display: flex; flex: 1; min-inline-size: 0; flex-wrap: nowrap; gap: var(--space-2);
  overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: none; margin-bottom: -1px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; display: flex; align-items: center; padding: 10px 12px; color: var(--t2); text-decoration: none; font-weight: 600; font-size: .9375rem;
  border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--t1); }
.tab.active { color: var(--t1); border-bottom-color: var(--ac-text); }
.view { display: block; max-width: 1040px; margin: 0 auto; padding: 24px 20px 64px; outline: none; }
.view:focus-visible { outline: 2px solid var(--ac-text); outline-offset: -2px; }
.view > * + * { margin-top: 16px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.section-title { margin-top: 32px !important; font-size: 1.25rem; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--t2); text-decoration: none; font-weight: 600;
  font-size: .9rem; }
.back:hover { color: var(--t1); }

/* -- lists ---------------------------------------------------------------------------------- */
.search { max-width: 360px; }
.list { background: var(--s1); border: 1px solid var(--b1); border-radius: var(--r2); overflow: hidden;
  box-shadow: var(--shadow-sm); }
.list-plain { border: 0; box-shadow: none; background: none; border-radius: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px;
  border-top: 1px solid var(--b1); color: inherit; text-decoration: none; }
.row:first-child { border-top: 0; }
.list-plain .row { padding-inline: 0; }
.row-link:hover { background: var(--band); }
.row-dim { opacity: .6; }
.row-compact { padding-block: 10px; }
.row-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-title .name { font-weight: 600; overflow-wrap: anywhere; }
.row-sub { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--t2); font-size: .8125rem; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; text-align: end; }
.empty { padding: 40px 16px; text-align: center; color: var(--t2); display: grid; place-items: center; }
.usage { display: flex; flex-direction: column; gap: 4px; min-width: 150px; align-items: stretch; }
.row-side .usage { align-items: flex-end; }
.usage-text { font-size: .8125rem; font-variant-numeric: tabular-nums; color: var(--t1); }
.bar { display: block; height: 6px; border-radius: 99px; background: var(--b1); overflow: hidden; width: 100%;
  min-width: 120px; }
.bar-fill { display: block; height: 100%; border-radius: 99px; background: var(--ok); }
.bar-high { background: var(--ac-ui); }
.bar-full { background: var(--err); }

/* -- cards ---------------------------------------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.card, .view > .mode-disclosure { background: var(--s1); border: 1px solid var(--b1); border-radius: var(--r2); padding: var(--space-4);
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head .field { flex-direction: row; align-items: center; }
.card-head .field select { width: auto; min-height: 36px; }
.card-danger { border-color: color-mix(in srgb, var(--err) 30%, var(--b1)); }
.danger-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 12px;
  border-top: 1px solid var(--b1); }
.danger-row:first-of-type { border-top: 0; padding-top: 0; }
.danger-row > div { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .9rem; }
.facts dt { color: var(--t2); }
/* A server's own facts and its host facts are separate lists; one label column keeps their values aligned. */
.server .facts { grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); }
.facts dd { min-width: 0; overflow-wrap: anywhere; }
.share { display: flex; gap: 20px; align-items: flex-start; }
.share-links { flex: 1; }
.share-qr { flex: 0 0 auto; inline-size: 220px; max-inline-size: 100%; }
.share-qr .qr { margin-inline: auto; }
.qr-export-actions { justify-content: center; }
.qr { display: block; border-radius: var(--r); background: #fff; border: 1px solid var(--b1); flex-shrink: 0; }
.individual-connections { border-top: 1px solid var(--b1); margin-top: 20px; padding-top: 12px; }
.individual-connections > summary { cursor: pointer; font-weight: 600; padding-block: 8px; }
.individual-connections > div { padding-top: 12px; }
.connection-entry { border-bottom: 1px solid var(--b1); padding-bottom: 16px; margin-bottom: 8px; }
.connection-remark { font-size: 1rem; overflow-wrap: anywhere; }
.connection-qr { max-width: 100%; height: auto; margin-inline: auto; }
.expiry-fields { border: 0; min-width: 0; }
.expiry-fields legend { font-size: .875rem; font-weight: 600; margin-bottom: 8px; }
.expiry-never { display: flex; align-items: center; gap: 8px; font-size: .875rem; }
.expiry-never input { width: 18px; height: 18px; padding: 0; }
.expiry-utc { overflow-wrap: anywhere; }
.card-slot { min-width: 0; }
.card-slot > .card { height: 100%; }
.server-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.server-name h2 { font-size: 1rem; overflow-wrap: anywhere; }
.cli-hint { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; padding: var(--space-2) var(--space-3); border-radius: var(--r2);
  background: var(--band); border: 1px dashed var(--b2); color: var(--t2); }
.cli-hint > span:not(.cmd) { flex: 1; min-inline-size: 0; overflow-wrap: anywhere; }

/* -- revision diff -------------------------------------------------------------------------- */
.diff-list { list-style: none; display: flex; flex-direction: column; gap: 2px; font-family: var(--mono); font-size: .8125rem;
  text-align: left; }
.diff-list li { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 6px 10px; border-radius: 6px; align-items: baseline; }
.diff-add { background: var(--ok2); }
.diff-del { background: var(--err2); }
.diff-mod { background: var(--warn2); }
.diff-mark { font-weight: 700; width: 1ch; }
.diff-add .diff-mark { color: var(--ok); }
.diff-del .diff-mark { color: var(--err); }
.diff-mod .diff-mark { color: var(--ac-text); }
.diff-path { color: var(--t1); font-weight: 600; overflow-wrap: anywhere; }
.diff-before { color: var(--t2); text-decoration: line-through; overflow-wrap: anywhere; }
.diff-after { color: var(--t1); overflow-wrap: anywhere; }
.diff-arrow { color: var(--t3); }

/* -- privacy and UTC history ---------------------------------------------------------------- */
.privacy-options { border: 1px solid var(--b1); min-inline-size: 0; }
.privacy-options legend { font-family: var(--heading); font-size: 1.0625rem; font-weight: 600; padding-inline: 6px; }
.privacy-choice { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: var(--r);
  background: var(--s2); border: 1px solid var(--b1); cursor: pointer; }
.privacy-choice:has(input:checked) { border-color: var(--ac-text); background: var(--band); }
.privacy-choice input { margin-block-start: 4px; width: auto; min-height: 0; flex-shrink: 0; }
.privacy-change { padding-block: 12px; border-top: 1px solid var(--b1); }
.privacy-change:first-child { border-top: 0; }
.privacy-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 8px; font-size: .8125rem; }
.usage-plot > * + * { margin-top: 6px; }
.usage-chart { display: block; width: 100%; height: auto; }
.usage-grid { stroke: var(--b1); stroke-width: 1; }
.usage-bar { fill: var(--ac-ui); }
.usage-bar:focus { outline: none; fill: var(--ac-text); stroke: var(--t1); stroke-width: 1; }
.usage-zero { opacity: .25; }
.usage-dates { display: flex; justify-content: space-between; gap: 10px; }
.usage-data summary { cursor: pointer; color: var(--t2); font-size: .875rem; }
.usage-table-scroll { overflow-x: auto; margin-top: 10px; }
.usage-table { width: 100%; border-collapse: collapse; font-size: .8125rem; font-variant-numeric: tabular-nums; }
.usage-table th, .usage-table td { padding: 8px 12px; text-align: end; border-bottom: 1px solid var(--b1); }
.usage-table th:first-child { text-align: start; font-weight: 500; }
.usage-table thead { color: var(--t2); }

/* -- small screens -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  h1 { font-size: 1.5rem; }
  .top-inner, .view { padding-inline: 14px; }
  .view { padding-top: 18px; }
  .cards { grid-template-columns: 1fr; }
  .card-head .field select { min-block-size: 44px; }
  .grid-2 { grid-template-columns: 1fr; }
  .row { align-items: flex-start; }
  .row-side .usage, .usage { min-width: 110px; }
  .bar { min-width: 90px; }
  .share { flex-direction: column; align-items: center; }
  .share-links { width: 100%; }
  .totp-grid { grid-template-columns: 1fr; justify-items: center; }
  .hide-sm { display: none; }
  .privacy-diff { grid-template-columns: 1fr; gap: 10px; }
  .danger-row { flex-direction: column; align-items: stretch; }
  .search { max-width: none; }
}
/* Keep the three independent server verdicts readable in compact cards. */
.server-badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-block-end: 1rem; }
.health-checks { padding-inline-start: 1.8rem; overflow-wrap: anywhere; }
.field-error { color: var(--err); font-size: .85rem; margin-block: .25rem 0; }
.server-capacity { border-block-start: 1px solid var(--b1); padding-block-start: 1rem; margin-block: 1rem; }
.server-capacity > .card-head { margin-block-end: .25rem; }
.capacity-history > summary { cursor: pointer; font-weight: 600; padding-block: .5rem; }
.capacity-history[open] > div { margin-block: .5rem; }
.capacity-chart { display: block; width: 100%; height: auto; }
.capacity-legend { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.capacity-legend h4 { font-size: .85rem; }
.capacity-receive { fill: var(--ac-ui); }
.capacity-send { fill: var(--t2); }
.capacity-gap { fill: var(--b1); opacity: .55; }
.capacity-peak { stroke: var(--t1); stroke-width: 1.5; }
.capacity-bar:focus { outline: 2px solid var(--ac-text); }
.capacity-key::before { content: ""; display: inline-block; width: .7rem; height: .7rem; margin-inline-end: .4rem; border-radius: 2px; }
.capacity-key-receive::before { background: var(--ac-ui); }
.capacity-key-send::before { background: var(--t2); }
.field-error:empty { display: none; }
.live-status { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; margin-block: 0; }
.live-trouble:empty { display: none; }
.live-retry[hidden] { display: none; }
/* Dynamic browser chrome and notches leave the sign-in controls in the usable viewport. */
.auth { min-height: 100dvh; padding-block: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-bottom)); }

/* The shared shell keeps the display choice and account preferences within reach. */
.shell-top { flex-wrap: nowrap; padding-block: var(--space-2); }
.shell-top .top-brand { flex: 1 1 260px; gap: var(--space-2); }
.shell-top .top-title { max-inline-size: 24rem; }
.shell-controls { display: flex; align-items: center; gap: var(--space-3); flex: 0 0 auto; }
.mode-switch { flex-wrap: nowrap; }
.mode-switch button { min-block-size: 44px; flex: 0 0 auto; white-space: nowrap; }
.account-menu { position: relative; flex: 0 0 auto; }
.account-toggle { display: flex; align-items: center; gap: var(--space-2); list-style: none; cursor: pointer;
  min-block-size: 44px; padding-inline: var(--space-3); border: 1px solid var(--b1); border-radius: var(--r); font-size: .875rem; font-weight: 600; }
.account-toggle::-webkit-details-marker { display: none; }
.account-toggle:hover, .account-menu[open] .account-toggle { background: var(--s2); }
.account-panel { position: absolute; inset-inline-end: 0; inset-block-start: calc(100% + var(--space-2));
  inline-size: min(320px, calc(100vw - 28px)); box-shadow: var(--shadow-lg); }
.account-panel .segmented button { min-block-size: 44px; flex: 1; }
.account-panel .btn { min-block-size: 44px; }
.mode-note { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-4);
  max-inline-size: 1040px; margin-inline: auto; padding: var(--space-3) 20px 0; }
.mode-note .btn { min-block-size: 44px; white-space: normal; }
.server-focused { border-color: var(--ac-text); }
.server-focused, .server-focused > .mode-disclosure { scroll-margin-block-start: 12rem; }

/* Overview uses the same cards, read rows, chips, and spacing as the shell. */
.overview-page { display: flex; flex-direction: column; gap: var(--space-4); }
.overview-page > .live-status { margin-block: 0; }
.overview-page .page-head { align-items: center; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.overview-health { display: flex; gap: var(--space-3); align-items: baseline; font-size: 1.0625rem; font-weight: 600; }
.overview-number { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.overview-ratio { display: inline-flex; align-items: baseline; gap: .25em; white-space: nowrap; }
.overview-facts .kv-row { padding-block: var(--space-4); }
.attention-list { display: flex; flex-direction: column; }
.attention-row { display: flex; align-items: center; gap: var(--space-3); justify-content: space-between;
  min-block-size: 44px; padding-block: var(--space-3); border-block-start: 1px solid var(--b1); color: var(--t1); text-decoration: none; }
.attention-row:first-child { border-block-start: 0; }
.attention-row:hover .attention-label { color: var(--ac-text); }
.attention-label { min-inline-size: 0; overflow-wrap: anywhere; }
.attention-row .icon { transform: scaleX(-1); color: var(--t2); }
[dir="rtl"] .attention-row .icon { transform: none; }
.traffic-sparkline { display: block; inline-size: 100%; block-size: auto; margin-block: var(--space-3); }
.sparkline-line { fill: none; stroke: var(--ac-text); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.sparkline-point { fill: var(--ac-text); }
.recent-list { display: flex; flex-direction: column; }
.recent-row { display: flex; flex-direction: column; gap: var(--space-1); padding-block: var(--space-3);
  border-block-start: 1px solid var(--b1); color: var(--t1); text-decoration: none; overflow-wrap: anywhere; }
.recent-row:first-child { border-block-start: 0; }
.recent-row:hover { color: var(--ac-text); }
.overview-actions { position: static; inline-size: fit-content; }
.overview-actions .btn { min-block-size: 44px; white-space: nowrap; }
.share-picker-list { display: flex; flex-direction: column; gap: var(--space-1); }
.share-picker-person { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3);
  min-block-size: 44px; padding: var(--space-3); border: 1px solid var(--b1); border-radius: var(--r);
  background: var(--s1); text-align: start; cursor: pointer; }
.share-picker-person:hover { background: var(--s2); border-color: var(--ac); }
.share-picker-person bdi { min-inline-size: 0; overflow-wrap: anywhere; }
.share-picker-pages { justify-content: space-between; }
.share-dialog-body .share { flex-direction: column; align-items: center; }
.share-dialog-body .share-qr { inline-size: 100%; }
.share-dialog-body .share-links { inline-size: 100%; }
@media (max-width: 640px) {
  .shell-top .top-brand { flex: 1 1 0; }
  .shell-top .brand-name { font-size: 1rem; }
  .shell-top .top-brand.has-fleet-title .brand-name, .shell-top .brand-separator { display: none; }
  .shell-controls { inline-size: auto; justify-content: flex-end; gap: var(--space-1); }
  .shell-top .top-title { max-inline-size: none; min-inline-size: 0; }
  .mode-switch { gap: 2px; padding: 2px; }
  .mode-switch button { padding-inline: 6px; font-size: .8125rem; }
  .account-toggle { inline-size: 44px; justify-content: center; padding-inline: 0; }
  .account-toggle > span { display: none; }
  .mode-note { padding-inline: 14px; }
  .overview-page { padding-block-end: calc(44px + var(--space-3) + var(--space-3) + var(--space-4) + env(safe-area-inset-bottom)); }
  .overview-page .page-head { display: contents; }
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
  .overview-actions { position: sticky; inset-block-end: 0; z-index: 10; order: 1;
    inline-size: calc(100% + 28px); margin-inline: -14px; padding: var(--space-3) 14px;
    padding-block-end: calc(var(--space-3) + env(safe-area-inset-bottom)); background: var(--s1);
    border-block-start: 1px solid var(--b1); box-shadow: var(--shadow-md); }
  .overview-actions .btn { flex: 1 0 auto; padding-inline: var(--space-2); gap: var(--space-1); font-size: .875rem; }
}
