:root {
  color-scheme: light;
  --bg: #f3f7fb;
  --surface: #ffffff;
  --surface-strong: #f7fbff;
  --text: #101828;
  --muted: #667085;
  --line: #d6e0ec;
  --accent: #0c9488;
  --accent-strong: #0b5f75;
  --accent-soft: #e6fbf8;
  --ink-soft: #eef4ff;
  --warning: #9a5b00;
  --warning-bg: #fff3d3;
  --danger: #c73636;
  --shadow: 0 18px 44px rgba(16, 24, 40, 0.1);
  --shadow-soft: 0 10px 24px rgba(16, 24, 40, 0.07);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f141b;
  --surface: #171d26;
  --surface-strong: #1d2733;
  --text: #f4f7fb;
  --muted: #aab6c7;
  --line: #303b4a;
  --accent: #33c7b7;
  --accent-strong: #7de5d9;
  --accent-soft: #123b3a;
  --ink-soft: #202a3a;
  --warning: #ffd06e;
  --warning-bg: #3b2d12;
  --danger: #ff7878;
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.36);
  --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.28);
}

:root[data-context="web"] {
  --accent: #18cce7;
  --accent-strong: #7967f6;
  --accent-soft: #142f46;
  --line: #30394f;
}

:root[data-context="web"] body {
  background: linear-gradient(145deg, rgba(0, 222, 255, 0.08), rgba(139, 92, 246, 0.08) 58%, transparent), var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(12, 148, 136, 0.14), transparent 260px),
    linear-gradient(180deg, rgba(11, 95, 117, 0.08), transparent 320px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.web-auth-gate {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(140deg, rgba(0, 222, 255, 0.12), transparent 36%),
    linear-gradient(220deg, rgba(139, 92, 246, 0.16), transparent 42%),
    #05060a;
  color: #f8fbff;
}

.web-auth-panel {
  display: grid;
  width: min(100%, 460px);
  gap: 22px;
  padding: 28px;
  border: 1px solid rgba(123, 208, 255, 0.2);
  border-radius: 8px;
  background: rgba(15, 20, 31, 0.92);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(18px);
}

.web-auth-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.web-auth-brand img {
  width: 72px;
  height: 72px;
  border: 1px solid rgba(123, 208, 255, 0.25);
  border-radius: 8px;
  object-fit: cover;
}

.web-auth-brand p,
.web-auth-panel > p {
  margin: 0;
  color: #aebbd0;
  line-height: 1.55;
}

.web-auth-brand p {
  color: #45d9f5;
  font-size: 0.8rem;
  font-weight: 800;
}

.web-auth-brand h1 {
  margin: 4px 0 0;
  font-size: 1.55rem;
}

.telegram-login-slot {
  display: grid;
  min-height: 48px;
  place-items: center;
}

.portal-link {
  color: #45d9f5;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.portal-link:hover {
  text-decoration: underline;
}

.auth-error {
  padding: 12px;
  border: 1px solid rgba(255, 120, 120, 0.45);
  border-radius: 8px;
  background: rgba(150, 30, 50, 0.18);
  color: #ffb2bd !important;
}

button {
  font: inherit;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 14px 92px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--surface), var(--surface-strong));
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: #101827;
  box-shadow: 0 10px 22px rgba(12, 148, 136, 0.24);
  color: var(--accent-strong);
  font-weight: 900;
}

.brand-mark img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 138%;
  height: 138%;
  object-fit: cover;
  object-position: center;
  transform: translate(-50%, -50%);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.user-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.user-chip strong,
.user-chip span:last-child {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 10px;
  font-size: 20px;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.icon-button,
.language-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface), var(--surface-strong));
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.language-button {
  font-weight: 800;
}

.status-panel,
.section,
.plan-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface-strong) 72%, var(--surface)));
  box-shadow: var(--shadow);
}

.status-panel {
  display: grid;
  gap: 18px;
  padding: 20px;
  margin-bottom: 16px;
}

.status-pill {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 12px;
  font-weight: 800;
}

.primary-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(12, 148, 136, 0.22);
}

.small-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface), var(--surface-strong));
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

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

.plan-card {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.plan-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.plan-card h3 {
  margin: 0;
  font-size: 18px;
}

.plan-price {
  color: var(--accent);
  font-weight: 900;
}

.feature-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 14px;
}

.secondary-button {
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  font-weight: 800;
}

.danger-button {
  min-height: 44px;
  border: 1px solid var(--danger);
  border-radius: 8px;
  background: transparent;
  color: var(--danger);
  font-weight: 800;
}

.primary-button:disabled,
.secondary-button:disabled,
.small-button:disabled,
.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.section {
  padding: 16px;
  margin-bottom: 16px;
}

.hidden {
  display: none;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.action-grid {
  display: grid;
  gap: 10px;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.summary-grid > div {
  display: grid;
  gap: 4px;
  min-height: 70px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface), var(--surface-strong));
  box-shadow: var(--shadow-soft);
}

.summary-grid span {
  color: var(--muted);
  font-size: 13px;
}

.summary-grid strong {
  font-size: 20px;
}

.action-card {
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface), var(--surface-strong));
  box-shadow: var(--shadow-soft);
  color: var(--text);
  text-align: left;
}

.action-card span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.membership-alert {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--accent-soft);
}

.membership-alert.hidden {
  display: none;
}

.membership-alert strong {
  font-size: 14px;
}

.membership-alert span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.membership-alert.warning {
  border-color: color-mix(in srgb, var(--warning) 38%, var(--line));
  background: var(--warning-bg);
}

.membership-alert.warning strong {
  color: var(--warning);
}

.membership-alert.danger {
  border-color: color-mix(in srgb, var(--danger) 42%, var(--line));
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}

.membership-alert.danger strong {
  color: var(--danger);
}

.plan-notice {
  margin-bottom: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.empty-state,
.info-stack,
.account-list,
.payment-panel {
  display: grid;
  gap: 12px;
}

.payment-panel > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface), var(--surface-strong));
}

.payment-panel span {
  color: var(--muted);
}

.empty-state {
  min-height: 160px;
  align-content: center;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface), var(--surface-strong));
  text-align: center;
}

.empty-state p {
  margin-bottom: 0;
}

.info-row,
.account-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface), var(--surface-strong));
}

.account-list span,
.info-row span {
  color: var(--muted);
}

.account-list strong {
  text-align: right;
}

.account-actions {
  display: grid !important;
  gap: 10px !important;
  align-items: stretch !important;
}

.account-actions > span {
  color: var(--muted);
}

.account-actions p {
  margin-bottom: 0;
}

.account-metrics {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.compact-header h3 {
  margin: 0;
  font-size: 17px;
}

.theme-choice {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.theme-choice .active-theme {
  background: var(--accent);
  color: #ffffff;
}

.admin-tabs,
.admin-list {
  display: grid;
  gap: 10px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.admin-tabs .small-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.admin-tabs .small-button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #ffffff;
}

.admin-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface), var(--surface-strong));
  box-shadow: var(--shadow-soft);
}

.metrics-grid {
  display: grid;
  gap: 12px;
}

.metric-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface), var(--surface-strong));
  box-shadow: var(--shadow-soft);
}

.metric-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.metric-card dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  margin: 0;
}

.metric-card dt {
  color: var(--muted);
}

.metric-card dd {
  margin: 0;
  font-weight: 900;
  text-align: right;
}

.metric-list-card {
  min-width: 0;
}

.metric-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.metric-list li {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric-list strong,
.metric-list span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-list span {
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.admin-card dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  margin: 0;
}

.admin-card dt {
  color: var(--muted);
}

.admin-card dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

.owner-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.admin-section {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.owner-panel.hidden {
  display: none;
}

.admin-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.admin-card input,
.admin-card select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  padding: 0 10px;
}

.admin-card p {
  margin-bottom: 0;
}

.route-wizard,
.routes-list {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.route-wizard {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface), var(--surface-strong));
}

.route-wizard.hidden {
  display: none;
}

.route-wizard h3 {
  margin: 0;
}

.route-wizard label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.route-wizard input,
.route-wizard select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  padding: 0 12px;
}

.route-wizard input[type="search"] {
  min-height: 40px;
  background: color-mix(in srgb, var(--surface) 82%, var(--ink-soft));
}

.route-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface), var(--surface-strong));
  box-shadow: var(--shadow-soft);
}

.route-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.route-card-header::-webkit-details-marker {
  display: none;
}

.route-card-header::after {
  content: "+";
  flex: 0 0 auto;
  align-self: center;
  color: var(--accent-strong);
  font-weight: 900;
}

.route-card[open] > .route-card-header::after {
  content: "-";
}

.route-card-header > div {
  min-width: 0;
}

.route-card-header strong {
  display: block;
  overflow-wrap: anywhere;
}

.route-card p {
  margin: 0;
}

.route-card-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.route-status {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.route-message {
  min-height: 22px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

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

.route-settings {
  display: grid;
  gap: 8px;
}

.route-settings label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.route-settings input,
.route-settings select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 82%, var(--ink-soft));
  color: var(--text);
  font: inherit;
  padding: 0 10px;
}

.route-details,
.route-submenu {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 88%, var(--ink-soft));
}

.route-details {
  padding: 0;
}

.route-submenu {
  margin-top: 8px;
  background: var(--surface);
}

.route-details > summary,
.route-submenu > summary {
  cursor: pointer;
  list-style: none;
  min-height: 44px;
  padding: 12px;
  color: var(--text);
  font-weight: 900;
}

.route-details > summary::-webkit-details-marker,
.route-submenu > summary::-webkit-details-marker {
  display: none;
}

.route-details > summary::after,
.route-submenu > summary::after {
  content: "+";
  float: right;
  color: var(--accent-strong);
  font-weight: 900;
}

.route-details[open] > summary::after,
.route-submenu[open] > summary::after {
  content: "-";
}

.route-details > :not(summary),
.route-submenu > :not(summary) {
  margin: 0 12px 12px;
}

.route-save-button {
  width: 100%;
}

.deduplication-box,
.plan-option-box {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 82%, var(--ink-soft));
}

.extension-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.extension-box p {
  margin-bottom: 0;
  font-size: 13px;
}

.extension-group {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.extension-group legend {
  padding: 0 6px;
  color: var(--text);
  font-weight: 800;
}

.deduplication-box legend,
.plan-option-box legend {
  padding: 0 6px;
  color: var(--text);
  font-weight: 800;
}

.deduplication-box p {
  margin-bottom: 0;
  font-size: 13px;
}

.check-grid {
  display: grid;
  gap: 8px;
}

.check-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px !important;
  color: var(--text) !important;
  font-weight: 700;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

@media (min-width: 520px) {
  .check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.copy-control {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.copy-control select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  padding: 0 12px;
}

.copy-readiness {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface), var(--surface-strong));
}

.copy-readiness.is-ready {
  border-color: color-mix(in srgb, #22c55e 58%, var(--line));
}

.copy-readiness.is-warning {
  border-color: color-mix(in srgb, #f59e0b 66%, var(--line));
}

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

.copy-readiness-header strong {
  color: var(--text);
  font-size: 0.96rem;
}

.copy-readiness-header span,
.copy-readiness p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.copy-readiness-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.copy-readiness-row {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-strong) 82%, var(--accent));
}

.copy-readiness-row span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.copy-readiness-row strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-readiness-row.is-good {
  border-color: color-mix(in srgb, #22c55e 52%, var(--line));
}

.copy-readiness-row.is-warning {
  border-color: color-mix(in srgb, #f59e0b 62%, var(--line));
}

.progress-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface), var(--surface-strong));
}

.progress-panel > div:not(.progress-bar) {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.progress-panel .copy-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.copy-stats span {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.copy-stats b {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.copy-stats strong {
  color: var(--text);
  font-size: 1rem;
}

.active-copy-summary {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 88%, var(--accent));
}

.active-copy-summary.hidden {
  display: none;
}

.copy-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.copy-summary-header strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-summary-header span {
  display: inline-grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--button-text);
  font-weight: 900;
}

.active-copy-list {
  display: grid;
  gap: 7px;
  max-height: 250px;
  min-width: 0;
  overflow: auto;
}

.active-copy-card {
  display: grid;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text);
  text-align: left;
}

.active-copy-card.is-selected {
  border-color: color-mix(in srgb, var(--accent) 82%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
}

.active-copy-title,
.active-copy-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-copy-title {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 900;
}

.active-copy-meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.active-copy-mini-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.active-copy-mini-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.copy-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.progress-panel > div.copy-metric-grid:not(.progress-bar) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-content: initial;
  gap: 8px;
}

.copy-metric-card {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 58px;
  align-content: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-strong) 86%, var(--accent));
}

.copy-metric-card.hidden {
  display: none;
}

.copy-metric-card.is-wide {
  grid-column: 1 / -1;
}

.copy-metric-card span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.copy-metric-card strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-metric-card.is-good {
  border-color: color-mix(in srgb, #22c55e 62%, var(--line));
  background: color-mix(in srgb, #22c55e 18%, var(--surface-strong));
}

.copy-metric-card.is-warning {
  border-color: color-mix(in srgb, #f59e0b 68%, var(--line));
  background: color-mix(in srgb, #f59e0b 18%, var(--surface-strong));
}

.copy-metric-card.is-bad {
  border-color: color-mix(in srgb, #ef4444 68%, var(--line));
  background: color-mix(in srgb, #ef4444 16%, var(--surface-strong));
}

.copy-metric-card.is-good strong,
.copy-metric-card.is-warning strong,
.copy-metric-card.is-bad strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.copy-metric-card.is-good strong::before,
.copy-metric-card.is-warning strong::before,
.copy-metric-card.is-bad strong::before {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  content: "";
}

.copy-metric-card.is-good strong::before {
  background: #22c55e;
}

.copy-metric-card.is-warning strong::before {
  background: #f59e0b;
}

.copy-metric-card.is-bad strong::before {
  background: #ef4444;
}

.copy-reasons {
  display: grid;
  gap: 10px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.copy-reasons.hidden {
  display: none;
}

.copy-issue-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.copy-issue-group {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.copy-issue-review {
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-strong));
}

.copy-recovery-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.copy-recovery-list li {
  position: relative;
  min-width: 0;
  padding-left: 14px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.copy-recovery-list li::before {
  position: absolute;
  top: 0.58em;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
}

.copy-issue-group h4 {
  margin: 0;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
}

.copy-issue-list {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.copy-issue-list.is-compact {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.copy-issue-item {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-strong);
}

.copy-issue-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-issue-meta {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-warning {
  margin: 8px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(245, 158, 11, 0.42);
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.12);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.35;
}

.progress-panel span {
  color: var(--muted);
}

.progress-panel p {
  max-width: 100%;
  min-width: 0;
  margin-bottom: 0;
}

#copyMessage {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#copyMessage.copy-current-item {
  display: grid;
  gap: 8px;
  overflow: hidden;
  white-space: normal;
}

.copy-current-label {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-current-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-current-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}

.copy-current-chip {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 84%, var(--accent));
}

.copy-current-chip b {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.copy-current-chip strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-current-chip.is-eta {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--line));
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
}

.copy-current-chip.is-eta strong {
  color: var(--accent-strong);
}

.copy-current-chip.is-overall {
  background: color-mix(in srgb, var(--surface-strong) 78%, var(--accent));
}

.copy-current-chip.is-overall b {
  color: var(--accent-strong);
}

.copy-current-chip.is-warning {
  border-color: color-mix(in srgb, var(--warning) 72%, var(--line));
  background: color-mix(in srgb, var(--warning) 16%, var(--surface));
}

.copy-current-chip.is-warning b,
.copy-current-chip.is-warning strong {
  color: var(--warning);
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 180ms ease;
}

.progress-bar span.is-active {
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 42%, transparent);
}

.progress-bar span.is-indeterminate {
  min-width: 34%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong), var(--accent));
  background-size: 220% 100%;
  animation: copy-progress-pulse 1.1s linear infinite;
}

@keyframes copy-progress-pulse {
  from {
    background-position: 0% 50%;
    transform: translateX(-8%);
  }

  to {
    background-position: 220% 50%;
    transform: translateX(190%);
  }
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 10px 10px 14px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px);
  box-shadow: 0 -10px 28px rgba(16, 24, 40, 0.08);
  z-index: 20;
}

.nav-item {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.nav-item.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #ffffff;
}

.help-content {
  display: grid;
  gap: 16px;
}

.help-section {
  display: grid;
  gap: 10px;
}

.help-section h3 {
  margin: 0;
  font-size: 17px;
}

.help-section-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.help-list details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface), var(--surface-strong));
  overflow: hidden;
}

.help-list summary {
  cursor: pointer;
  padding: 14px;
  font-weight: 800;
}

.help-list p {
  margin: 0;
  padding: 0 14px 14px;
  color: var(--muted);
  line-height: 1.55;
}

.help-list ul {
  margin: 0;
  padding: 0 14px 14px 30px;
  color: var(--muted);
  line-height: 1.55;
}

.help-list li + li {
  margin-top: 6px;
}

@media (max-width: 380px) {
  .nav-item {
    font-size: 11px;
  }

  .copy-readiness-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 680px) {
  .app-shell {
    padding: 28px 22px 100px;
  }

  .status-panel {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .plan-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .button-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
