/* RouteSeam app shell + screen layout (loads after routeseam_components.css — keep the name sorting after it).
   Mirrors ui_kits/app (shell.jsx, domains.jsx, detail.jsx, growth.jsx, settings.jsx)
   from the RouteSeam design system. Requires routeseam_tokens.css + routeseam_components.css. */

/* ---- Frame ---------------------------------------------------------- */
.rm-shell { margin: 0; min-height: 100vh; }
.rm-frame { display: flex; min-height: 100vh; }

.rm-side {
  width: 232px; flex: none;
  border-right: 1px solid var(--rm-border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.rm-side__brand {
  display: flex; align-items: center; gap: 9px;
  padding: 0 14px; height: 56px; flex: none;
  border-bottom: 1px solid var(--rm-border);
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--rm-text); text-decoration: none;
}
.rm-side__brand img { width: 22px; height: 22px; display: block; }

.rm-side__org {
  display: flex; align-items: center; gap: 9px;
  margin: 10px; padding: 7px 8px; min-width: 0;
  border-radius: var(--rm-radius-control); border: 1px solid var(--rm-border);
}
.rm-side__org-text { min-width: 0; flex: 1; }
.rm-side__org-name { display: block; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-side__org-plan { display: block; font-size: 11px; line-height: 14px; color: var(--rm-text-tertiary); }
.rm-side__org-form { flex: 1; min-width: 0; }
.rm-side__org-select {
  width: 100%; height: 28px; padding: 0 20px 0 4px;
  background: transparent; color: var(--rm-text);
  border: 0; border-radius: 4px; font: 500 13px/20px var(--rm-font-sans);
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 16 16' fill='none' stroke='%2352525b' stroke-width='1.6'%3E%3Cpath d='M4 6.5l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 4px center;
}
.rm-side__org-select:hover { background-color: var(--rm-bg-hover); }
.rm-side__org-select option { background: var(--rm-bg-elevated); color: var(--rm-text); }

.rm-avatar {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  background: var(--rm-mint-subtle-bg); border: 1px solid var(--rm-mint-subtle-border);
  color: var(--rm-mint); display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.rm-avatar--round { border-radius: 50%; }

.rm-side__nav { padding: 0 10px; display: flex; flex-direction: column; gap: 2px; }
.rm-side__label {
  padding: 16px 12px 6px;
  font: 500 10px/14px var(--rm-font-mono); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--rm-text-tertiary);
}
.rm-nav-item { text-decoration: none; }
.rm-nav-item svg { flex: none; }
.rm-nav-item__count { margin-left: auto; font: 400 11px/16px var(--rm-font-mono); color: var(--rm-text-tertiary); }

.rm-side__user {
  margin-top: auto; padding: 12px; min-width: 0;
  border-top: 1px solid var(--rm-border);
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; color: var(--rm-text-secondary);
}
.rm-side__email { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-side__user form { margin: 0; }

.rm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-x: clip; }
.rm-top {
  min-height: 56px; height: auto; flex: none; min-width: 0;
  border-bottom: 1px solid var(--rm-border);
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  padding: 12px 32px;
}
.rm-top__crumb { font: 400 13px/20px var(--rm-font-mono); color: var(--rm-text-tertiary); white-space: nowrap; }
.rm-top__crumb a { color: inherit; text-decoration: none; transition: color var(--rm-fast) var(--rm-ease); }
.rm-top__crumb a:hover { color: var(--rm-text); }
.rm-top__title { font-size: 14px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-top__actions {
  margin-left: auto; display: flex; gap: 8px; align-items: center;
  flex-wrap: wrap; justify-content: flex-end; min-width: 0;
}
.rm-top__actions form { margin: 0; }

.rm-notices { padding: 16px 32px 0; display: flex; flex-direction: column; gap: 8px; }
.rm-notices:empty { display: none; }
.rm-body { padding: var(--rm-page-pad); display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.rm-body--bare { max-width: 640px; margin: 0 auto; }

/* ---- Small primitives the kit relies on ---------------------------- */
.rm-btn--sm { height: 30px; padding: 0 12px; }
.rm-btn svg { flex: none; }
.rm-btn--primary.rm-btn--hero:hover { box-shadow: var(--rm-glow); }
a.rm-btn { text-decoration: none; }
.rm-input--sm { height: 30px; font-size: 13px; }
.rm-select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%23a1a1aa' stroke-width='1.6'%3E%3Cpath d='M4 6.5l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.rm-mono { font-family: var(--rm-font-mono); font-size: 13px; }
.rm-muted { color: var(--rm-text-secondary); }
.rm-meta { color: var(--rm-text-tertiary); font-size: 12px; line-height: 16px; }
.rm-code { color: var(--rm-mint); }
.rm-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rm-nowrap { white-space: nowrap; }
.rm-label {
  font: 500 12px/16px var(--rm-font-sans); color: var(--rm-text-tertiary);
  text-transform: uppercase; letter-spacing: 0.04em;
}

/* ---- Cards, grids, sections ---------------------------------------- */
.rm-card--flush { padding: 0; overflow: hidden; }
.rm-card--narrow { max-width: 640px; }
.rm-card--flush > .rm-section-head { padding: 16px 24px 0; }
.rm-scroll-x { overflow-x: auto; }
.rm-table--card th:first-child, .rm-table--card td:first-child { padding-left: 24px; }
.rm-table--card th:last-child, .rm-table--card td:last-child { padding-right: 24px; }
.rm-table--card tbody tr:last-child td { border-bottom: 0; }
.rm-table--static tbody tr:hover { background: transparent; cursor: default; }
.rm-table td.rm-mono { color: var(--rm-text); }
.rm-table td.rm-mono.rm-muted { color: var(--rm-text-secondary); }
.rm-table td.rm-mono.rm-code { color: var(--rm-mint); }

.rm-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.rm-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.rm-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.rm-stat__value--mint { color: var(--rm-mint); }
.rm-stat__value--red { color: var(--rm-red); }
.rm-stat__value .rm-skeleton { display: inline-block; vertical-align: middle; }

.rm-section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; min-width: 0; }
.rm-section-head h2 { font-size: 16px; line-height: 24px; font-weight: 600; margin: 0; min-width: 0; }
.rm-section-head__right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.rm-section-head__right form { margin: 0; }

.rm-stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rm-stack > * { margin: 0; }
.rm-card > p { margin: 0; }
.rm-section-lede { color: var(--rm-text-secondary); font-size: 13px; line-height: 20px; margin: 0 0 16px; max-width: 60ch; }

.rm-tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--rm-border); min-width: 0; }
.rm-tab {
  padding: 0 12px; height: 36px; display: inline-flex; align-items: center;
  font: 500 13px/20px var(--rm-font-sans); color: var(--rm-text-tertiary);
  border-bottom: 1.5px solid transparent; margin-bottom: -1px; text-decoration: none;
  transition: color var(--rm-fast) var(--rm-ease);
}
.rm-tab:hover { color: var(--rm-text); }
.rm-tab--current { color: var(--rm-text); border-bottom-color: var(--rm-mint); }

.rm-kv { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rm-border); font-size: 13px; line-height: 20px; }
.rm-kv:last-of-type { border-bottom: 0; }
.rm-kv__k { color: var(--rm-text-tertiary); width: 132px; flex: none; }
.rm-kv__v { min-width: 0; overflow-wrap: anywhere; }

/* ---- Domain hero + lifecycle -------------------------------------- */
.rm-hero { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.rm-hero__host { font: 400 20px/28px var(--rm-font-mono); letter-spacing: -0.01em; color: var(--rm-text); overflow-wrap: anywhere; }
.rm-hero__route { font: 400 13px/20px var(--rm-font-mono); color: var(--rm-text-secondary); margin-top: 6px; overflow-wrap: anywhere; }
.rm-hero__right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex: none; }
.rm-hero__steps { margin-top: 24px; overflow-x: auto; }
.rm-steps { list-style: none; margin: 0; padding: 0; }
.rm-step--failed { color: var(--rm-red); }
.rm-step--failed .rm-step__bar { background: var(--rm-red-subtle-border); }
.rm-step__dot {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 11px;
  border: 1px solid var(--rm-border-strong); background: var(--rm-bg-elevated); color: var(--rm-text-tertiary);
  transition: all var(--rm-slow) var(--rm-ease);
}
.rm-step--current .rm-step__dot { border-color: var(--rm-amber-subtle-border); color: var(--rm-amber); }
.rm-step--done .rm-step__dot { border-color: var(--rm-mint); background: var(--rm-mint-subtle-bg); color: var(--rm-mint); }
.rm-step--failed .rm-step__dot { border-color: var(--rm-red-subtle-border); background: var(--rm-red-subtle-bg); color: var(--rm-red); }
.rm-step--final.rm-step--done .rm-step__dot { background: var(--rm-mint); color: var(--rm-on-accent); box-shadow: var(--rm-glow); }

.rm-waiting { display: flex; align-items: center; gap: 10px; font: 400 12px/16px var(--rm-font-mono); color: var(--rm-text-tertiary); }
.rm-waiting__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--rm-amber); animation: rm-pulse 1.6s var(--rm-ease) infinite; }
.rm-actions-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.rm-actions-row__right { margin-left: auto; display: flex; gap: 8px; }
.rm-actions-row form { margin: 0; }

.rm-active-moment { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.rm-active-moment__title { font-size: 16px; line-height: 24px; font-weight: 600; margin-bottom: 4px; overflow-wrap: anywhere; }
.rm-active-moment__right { margin-left: auto; display: flex; gap: 8px; }

/* DNS record rows: TYPE NAME / value / copy — the copy-paste artifact */
.rm-dns .rm-dns__row--record { grid-template-columns: 110px minmax(0, 1fr) auto; }
.rm-dns__name { color: var(--rm-text-secondary); margin-left: 6px; text-transform: none; }
.rm-dns__value { overflow-wrap: anywhere; }
.rm-dns-stack { display: flex; flex-direction: column; gap: 10px; }
.rm-dns-stack__caption { font-size: 12px; line-height: 16px; color: var(--rm-text-tertiary); }
.rm-dns-stack__caption--red { color: var(--rm-red); }

.rm-copy {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; border-radius: var(--rm-radius-control);
  background: transparent; border: 1px solid var(--rm-border);
  color: var(--rm-text-secondary); font: 500 12px/16px var(--rm-font-sans); cursor: pointer;
  transition: color var(--rm-fast) var(--rm-ease), border-color var(--rm-fast) var(--rm-ease);
}
.rm-copy:hover { border-color: var(--rm-border-strong); color: var(--rm-text); }
.rm-copy--copied, .rm-copy--copied:hover { color: var(--rm-mint); border-color: var(--rm-mint-subtle-border); }

/* ---- Forms ---------------------------------------------------------- */
.rm-form { display: flex; flex-direction: column; gap: 18px; max-width: 560px; }
.rm-form > .rm-field-hint { margin: 0; }
.rm-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rm-field .rm-field-label, .rm-field .rm-field-hint, .rm-field .rm-field-error { margin: 0; }
.rm-field legend.rm-field-label { padding: 0; margin-bottom: 4px; }
fieldset.rm-field { border: 0; padding: 0; margin: 0; }
.rm-form__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
  gap: 12px;
  align-items: start;
}
@media (max-width: 640px) {
  .rm-form__row { grid-template-columns: 1fr; }
}
.rm-form__actions { display: flex; gap: 8px; padding-top: 4px; }
.rm-form__actions form { margin: 0; }
.rm-inline-form { display: flex; gap: 8px; align-items: center; }
.rm-inline-form .rm-select { width: auto; min-width: 7.5rem; flex: none; }

.rm-options { display: flex; flex-direction: column; gap: 10px; }
.rm-option { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 13px; line-height: 20px; }
.rm-option input[type="checkbox"], .rm-option input[type="radio"] {
  appearance: none; width: 16px; height: 16px; margin: 2px 0 0; flex: none;
  border-radius: 4px; border: 1px solid var(--rm-border-strong); background: transparent;
  display: grid; place-items: center; cursor: pointer;
  transition: background var(--rm-fast) var(--rm-ease), border-color var(--rm-fast) var(--rm-ease);
}
.rm-option input[type="radio"] { border-radius: 50%; }
.rm-option input:hover { border-color: var(--rm-text-tertiary); }
.rm-option input:checked { background: var(--rm-mint); border-color: var(--rm-mint); }
.rm-option input[type="checkbox"]:checked::after {
  content: ""; width: 8px; height: 4px; margin-top: -2px;
  border-left: 1.8px solid var(--rm-on-accent); border-bottom: 1.8px solid var(--rm-on-accent);
  transform: rotate(-45deg);
}
.rm-option input[type="radio"]:checked::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--rm-on-accent); }
.rm-option__text { min-width: 0; }
.rm-option__label { color: var(--rm-text); }
.rm-option__desc { display: block; font-size: 12px; line-height: 16px; color: var(--rm-text-tertiary); }

/* ---- Banners / flashes -------------------------------------------- */
.rm-banner__body { flex: 1; color: var(--rm-text-secondary); line-height: 20px; }
.rm-banner__body a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.rm-banner__body strong { color: var(--rm-text); font-weight: 500; }
.rm-banner__action { margin-left: auto; flex: none; }
.rm-banner--info .rm-banner__body { color: var(--rm-text-secondary); }
.rm-banner--success { color: var(--rm-mint); background: var(--rm-mint-subtle-bg); border-color: var(--rm-mint-subtle-border); }

/* ---- Empty state (dashed frame, like the kit) --------------------- */
.rm-empty { border: 1px dashed var(--rm-border-strong); border-radius: var(--rm-radius-card); }
.rm-empty--inset { border: 0; padding: 40px 24px; }
.rm-empty__body { max-width: 44ch; margin-left: auto; margin-right: auto; }
.rm-empty__body:last-child { margin-bottom: 0; }

/* ---- Analytics ------------------------------------------------------ */
.rm-chart__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.rm-chart__total { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.rm-bars { display: flex; align-items: flex-end; gap: 4px; height: 130px; }
.rm-bar {
  flex: 1; min-height: 3px; border-radius: 3px 3px 0 0;
  background: linear-gradient(to top, rgba(62, 207, 142, 0.22), rgba(62, 207, 142, 0.72));
}
.rm-bar--zero { background: var(--rm-bg-elevated); }
.rm-axis { display: flex; justify-content: space-between; padding-top: 10px; font: 400 10px/14px var(--rm-font-mono); color: var(--rm-text-tertiary); }

.rm-rank { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rm-border); font-size: 13px; white-space: nowrap; }
.rm-rank:last-child { border-bottom: 0; }
.rm-rank__key { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-family: var(--rm-font-mono); font-size: 13px; color: var(--rm-text-secondary); }
.rm-rank__meter { height: 3px; border-radius: 2px; background: var(--rm-mint); opacity: 0.5; flex: none; }
.rm-rank__n { margin-left: auto; flex: none; font: 400 12px/16px var(--rm-font-mono); color: var(--rm-text-tertiary); }

.rm-codes { display: flex; gap: 24px; flex-wrap: wrap; }
.rm-code-stat { display: flex; flex-direction: column; gap: 4px; }
.rm-code-stat__code { font: 400 20px/28px var(--rm-font-mono); }
.rm-code-stat__code--ok { color: var(--rm-mint); }
.rm-code-stat__code--warn { color: var(--rm-amber); }
.rm-code-stat__code--bad { color: var(--rm-red); }

/* ---- Settings ------------------------------------------------------- */
.rm-reveal {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--rm-radius-control);
  border: 1px solid var(--rm-mint-subtle-border); background: var(--rm-mint-subtle-bg);
  font: 400 13px/20px var(--rm-font-mono); color: var(--rm-text); word-break: break-all;
}
.rm-reveal > .rm-copy { margin-left: auto; flex: none; }

.rm-usage { display: flex; flex-direction: column; gap: 18px; max-width: 620px; }
.rm-usage__row { display: flex; flex-direction: column; gap: 7px; }
.rm-usage__top { display: flex; gap: 12px; font-size: 13px; line-height: 20px; }
.rm-usage__top .rm-muted { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-usage__count { margin-left: auto; flex: none; white-space: nowrap; font-family: var(--rm-font-mono); font-size: 12px; color: var(--rm-text-tertiary); }

.rm-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.rm-plan {
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 20px; border-radius: var(--rm-radius-card);
  border: 1px solid var(--rm-border); background: var(--rm-bg-raised);
}
.rm-plan--current { border-color: var(--rm-mint-subtle-border); }
.rm-plan__name { font-size: 13px; line-height: 20px; font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.rm-plan__price { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em; }
.rm-plan__cta { margin-top: 8px; }
.rm-plan__cta form { margin: 0; }

/* ---- Danger zone ---------------------------------------------------- */
.rm-danger-zone { border: 1px solid var(--rm-red-subtle-border); border-radius: var(--rm-radius-card); padding: var(--rm-card-pad); }
.rm-danger-zone__title { font-size: 14px; line-height: 22px; font-weight: 600; color: var(--rm-red); margin: 0 0 4px; }
.rm-danger-zone__desc { font-size: 13px; line-height: 20px; color: var(--rm-text-secondary); margin: 0 0 14px; max-width: 64ch; }
.rm-danger-zone form { margin: 0; }

/* ---- Responsive ----------------------------------------------------- */
@media (max-width: 1100px) {
  .rm-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rm-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .rm-frame { flex-direction: column; }
  .rm-side { width: auto; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--rm-border); }
  .rm-side__nav { flex-direction: row; flex-wrap: wrap; padding: 0 10px 10px; }
  .rm-side__label { padding: 8px 12px 4px; }
  .rm-side__user { margin-top: 0; }
  .rm-top, .rm-notices { padding-left: 20px; padding-right: 20px; }
  .rm-body { padding: 20px; }
  .rm-grid-2, .rm-grid-3 { grid-template-columns: 1fr; }
  .rm-kv__k { width: 104px; }
}
@media (max-width: 560px) {
  .rm-stat-grid { grid-template-columns: 1fr; }
  .rm-dns .rm-dns__row--record { grid-template-columns: 1fr; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .rm-waiting__dot, .rm-pill__dot--pulse, .rm-skeleton { animation: none; }
}
