:root {
  color-scheme: light;
  --bg: #f2f5f8;
  --chrome: #ffffff;
  --panel: #ffffff;
  --surface: #f6f8fb;
  --surface-strong: #edf2f7;
  --text: #101722;
  --muted: #65748a;
  --line: #d8e0e9;
  --brand: #168ed0;
  --brand-strong: #0878b8;
  --brand-soft: #e6f5fd;
  --green: #168d62;
  --green-soft: #e3f6ed;
  --red: #d83a58;
  --red-soft: #ffedf1;
  --amber: #a96508;
  --amber-soft: #fff3de;
  --shadow: 0 10px 28px rgba(20, 35, 55, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d11;
  --chrome: #161a20;
  --panel: #181c23;
  --surface: #101319;
  --surface-strong: #20252d;
  --text: #f4f8fd;
  --muted: #91a4bd;
  --line: #303741;
  --brand: #2fb5ef;
  --brand-strong: #149bd6;
  --brand-soft: #102b3d;
  --green: #2ac783;
  --green-soft: #0f3226;
  --red: #ff5370;
  --red-soft: #341522;
  --amber: #ffb84b;
  --amber-soft: #332512;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
h1, h2, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.2; }
h2 { font-size: 18px; line-height: 1.3; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 21px; height: 21px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.trial-offer { margin-bottom: 20px; }
.trial-button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 86px; padding: 14px; border: 1px solid var(--green); border-radius: 8px; background: var(--green-soft); text-align: left; cursor: pointer; }
.trial-button > .icon, .trial-price { color: var(--green); }
.trial-button > span { flex: 1; min-width: 0; }
.trial-button strong { display: block; font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.trial-button small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.trial-price { flex: 0 0 auto; font-size: 19px; white-space: nowrap; }
.trial-button:hover:not(:disabled) { border-color: var(--brand); }
.trial-button:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.trial-button:disabled { cursor: wait; opacity: .75; }
.trial-message, .trial-channel-gate p { margin-top: 12px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.trial-message.error { color: var(--red); }
.trial-channel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.trial-channel-actions > * { flex: 1 1 125px; }
.pill.neutral { color: var(--muted); background: var(--surface-strong); }
.plan-overview.no-plan .plan-status-row { color: var(--muted); }
.plan-overview.no-plan .status-dot { background: var(--muted); box-shadow: none; }

.app-shell {
  width: min(100%, 620px);
  min-height: var(--tg-viewport-stable-height, 100vh);
  margin: 0 auto;
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

.app-chrome {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--chrome) 94%, transparent);
  backdrop-filter: blur(16px);
}
.title-bar,
.account-bar { display: flex; min-height: 62px; align-items: center; padding: 0 18px; }
.title-bar { justify-content: space-between; background: var(--surface-strong); }
.title-bar > strong { font-size: 20px; }
.title-actions { display: flex; gap: 5px; }
.chrome-button,
.icon-button {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.chrome-button:hover,
.chrome-button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible { border-color: var(--line); background: var(--surface); color: var(--brand); outline: none; }
.account-bar { gap: 11px; min-height: 68px; }
.profile-avatar { display: block; width: 42px; height: 42px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; background: #080b10; object-fit: cover; }
.account-copy { min-width: 0; flex: 1; }
.account-copy strong,
.account-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: 16px; }
.account-copy span { margin-top: 3px; color: var(--muted); font-size: 13px; }

.pill,
.outline-badge,
.count-badge,
.timer {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.pill { background: var(--surface); color: var(--muted); }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.pill.bad { background: var(--red-soft); color: var(--red); }
.outline-badge { border: 1px solid var(--line); color: var(--muted); }
.outline-badge.bad { border-color: color-mix(in srgb, var(--red) 48%, var(--line)); color: var(--red); }
.count-badge { min-width: 30px; padding-inline: 8px; background: var(--surface); color: var(--muted); }

.drawer-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(0, 0, 0, .5); backdrop-filter: blur(2px); }
.app-drawer {
  position: fixed;
  visibility: hidden;
  pointer-events: none;
  top: 0;
  right: max(0px, calc((100vw - 620px) / 2));
  z-index: 40;
  width: min(88vw, 390px);
  height: 100dvh;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  padding: max(18px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom));
  background: var(--chrome);
  box-shadow: -18px 0 50px rgba(0, 0, 0, .22);
  transform: translateX(105%);
  transition: transform 180ms ease, visibility 0s linear 180ms;
}
.app-drawer.open { visibility: visible; pointer-events: auto; transform: translateX(0); transition-delay: 0s; }
.drawer-head { display: grid; grid-template-columns: 44px minmax(0, 1fr) 40px; align-items: center; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.drawer-nav { display: grid; gap: 5px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.drawer-link,
.drawer-secondary a,
.drawer-secondary button {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 13px;
  border: 0;
  border-radius: 8px;
  padding: 0 13px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.drawer-link.active,
.drawer-link:hover,
.drawer-link:focus-visible { background: var(--brand-soft); color: var(--brand); outline: none; }
.theme-control { padding: 16px 0; border-bottom: 1px solid var(--line); }
.theme-control > span { display: block; margin-bottom: 9px; color: var(--muted); font-size: 13px; font-weight: 700; }
.theme-segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.theme-option { display: flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 750; cursor: pointer; }
.theme-option .icon { width: 18px; height: 18px; }
.theme-option.active { background: var(--panel); color: var(--brand); box-shadow: 0 2px 8px rgba(0, 0, 0, .1); }
.drawer-secondary { display: grid; gap: 2px; padding-top: 14px; }
.drawer-secondary a:hover,
.drawer-secondary button:hover { color: var(--brand); }

.view-stack { padding: 18px 14px 0; }
.app-view { animation: view-in 150ms ease; }
@keyframes view-in { from { opacity: .55; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.view-heading { margin: 2px 2px 16px; }
.subview-heading { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 10px; margin: 0 0 16px; }
.label,
.metric-label,
.empty-state,
.field-label { color: var(--muted); }
.label { margin-bottom: 4px; font-size: 12px; font-weight: 800; text-transform: uppercase; }

.panel,
.feature-link,
.notice {
  margin-bottom: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.panel { padding: 16px; }
.notice { padding: 13px 15px; border-color: color-mix(in srgb, var(--red) 48%, var(--line)); background: var(--red-soft); color: var(--red); }
.notice.pending { border-color: var(--line); background: var(--brand-soft); color: var(--text); }
.notice strong { display: block; font-size: 14px; }
.notice p { margin-top: 4px; font-size: 13px; line-height: 1.45; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.plan-overview { overflow: hidden; }
.plan-status-row { display: flex; align-items: center; gap: 7px; margin-bottom: 14px; color: var(--brand); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent); }
.plan-overview.inactive .status-dot { background: var(--red); box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 14%, transparent); }
.plan-overview.inactive .plan-status-row { color: var(--red); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 16px 0; border-block: 1px solid var(--line); }
.metric-block { min-width: 0; padding: 13px 8px 13px 0; }
.metric-block + .metric-block { padding-left: 10px; border-left: 1px solid var(--line); }
.metric { display: block; min-height: 24px; font-size: 20px; font-weight: 850; line-height: 1.2; white-space: nowrap; }
.metric-label { display: block; margin-top: 4px; font-size: 12px; }
.quota-exhausted { color: var(--bad, #ff5577); }
.quota-notice { color: var(--bad, #ff5577); font-size: 13px; line-height: 1.5; margin: 0 0 14px; }

.connect-action,
.row-action {
  display: grid;
  width: 100%;
  min-height: 66px;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.connect-action { grid-template-columns: 42px minmax(0, 1fr) auto; }
.connect-action:hover,
.connect-action:focus-visible,
.row-action:hover,
.row-action:focus-visible { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent); outline: none; }
.action-icon,
.step-icon { display: inline-flex; width: 42px; height: 42px; align-items: center; justify-content: center; border-radius: 8px; background: var(--brand-soft); color: var(--brand); }
.action-copy { min-width: 0; }
.action-copy strong,
.action-copy small,
.row-action strong,
.row-action small,
.feature-link strong,
.feature-link small { display: block; }
.action-copy strong,
.row-action strong,
.feature-link strong { font-size: 14px; }
.action-copy small,
.row-action small,
.feature-link small { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.device-dots { display: flex; max-width: 72px; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.device-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.device-dot.connected { background: var(--green); animation: device-pulse 1.8s ease-in-out infinite; }
.device-dot.online { box-shadow: 0 0 8px color-mix(in srgb, var(--green) 60%, transparent); }
@keyframes device-pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; transform: scale(1.18); } }
.copy-link-button { display: flex; width: 100%; min-height: 44px; align-items: center; justify-content: center; gap: 9px; margin-top: 10px; border: 1px solid transparent; border-radius: 8px; background: var(--brand); color: white; font-weight: 800; cursor: pointer; }
.copy-link-button:hover { background: var(--brand-strong); }
.copy-link-button:disabled { cursor: default; opacity: .5; }
.expiry-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 13px; font-size: 13px; }
.expiry-row > span { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.expiry-row .icon { width: 17px; height: 17px; }
.expiry-row strong { text-align: right; }

.feature-link { display: grid; grid-template-columns: 42px minmax(0, 1fr) 22px; width: 100%; min-height: 72px; align-items: center; gap: 11px; padding: 12px 14px; color: var(--text); text-align: left; cursor: pointer; }
.feature-link:hover { border-color: var(--brand); }
.chevron { color: var(--muted); }
.text-button { border: 0; padding: 5px; background: transparent; color: var(--brand); font-size: 13px; font-weight: 750; cursor: pointer; }

.subscription-actions { display: grid; grid-template-columns: 1.2fr 1fr; gap: 8px; margin-top: 16px; }
.btn { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 8px; padding: 0 13px; font-size: 14px; font-weight: 800; cursor: pointer; }
.btn .icon { width: 18px; height: 18px; }
.btn:disabled { cursor: default; opacity: .5; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--brand-strong); }
.btn.secondary { border-color: var(--line); background: var(--surface); color: var(--brand); }
.btn.outline { border-color: var(--brand); background: transparent; color: var(--brand); }
.btn.wide { width: 100%; }
.row-action { grid-template-columns: 24px minmax(0, 1fr) 20px; margin-top: 10px; border-inline: 0; border-bottom: 0; border-radius: 0; padding-inline: 2px; background: transparent; }
.row-action > .icon:first-child { color: var(--brand); }

.devices-list { margin-top: 11px; }
.device-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; min-height: 60px; align-items: center; border-top: 1px solid var(--line); }
.device-row:first-child { border-top: 0; }
.device-copy { min-width: 0; }
.device-name { display: block; overflow: hidden; font-size: 14px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.device-last-seen { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.device-light { width: 9px; height: 9px; border-radius: 50%; background: #91a0b4; }
.device-light.online { background: var(--green); animation: device-pulse 1.6s ease-in-out infinite; }
.device-controls { display: flex; gap: 3px; }
.device-controls .icon-button { width: 34px; height: 34px; }
.icon-button.danger { color: var(--red); }
.icon-button:disabled { cursor: wait; opacity: .5; }
.device-editor { display: grid; grid-column: 2 / 4; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; padding-bottom: 11px; }
.device-editor[hidden] { display: none; }
.devices-list.compact .device-row { grid-template-columns: 10px minmax(0, 1fr); }
.devices-list.compact .device-row:nth-child(n+4) { display: none; }

.connect-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; padding: 0 2px; color: var(--muted); font-size: 13px; font-weight: 700; }
.client-choice { display: grid; gap: 8px; margin-bottom: 18px; }
.client-segmented { display: grid; grid-template-columns: minmax(0, 1fr); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.client-segmented button { min-width: 0; height: 58px; padding: 2px 6px; line-height: 1.15; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 750; cursor: pointer; }
.client-segmented button + button { border-left: 1px solid var(--line); }
.client-segmented button.active { background: var(--brand); color: white; }
.client-segmented button.client-auto { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: var(--green-soft); box-shadow: inset 0 0 0 1px var(--green); color: var(--text); }
.client-segmented button.client-auto.active { background: var(--surface-strong); box-shadow: inset 0 0 0 2px var(--green); }
.client-auto-badge { color: var(--green); font-size: 10px; line-height: 1.2; white-space: nowrap; }
.client-auto-name { font-size: 13px; line-height: 1.2; white-space: nowrap; }
.client-segmented button:focus-visible { outline: 2px solid var(--text); outline-offset: -4px; }
.select-control { position: relative; display: flex; align-items: center; }
.select-control select { min-height: 42px; appearance: none; border: 1px solid var(--line); border-radius: 8px; padding: 0 38px 0 13px; background: var(--panel); color: var(--text); font-weight: 750; outline: none; }
.select-control .icon { position: absolute; right: 10px; width: 17px; height: 17px; pointer-events: none; transform: rotate(90deg); }
.setup-step { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; }
.step-copy p { margin: 5px 0 14px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.step-copy .btn { min-width: min(100%, 225px); }
.setup-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.karing-handoff .btn { text-decoration: none; }
.home-promo { padding: 8px 2px 18px; border-bottom: 1px solid var(--line); }
.home-promo > label { display: block; font-weight: 700; margin-bottom: 10px; }
.home-promo .inline-form { margin: 0; }
.complete-step .step-icon { background: var(--green-soft); color: var(--green); }

.device-picker { margin-bottom: 18px; }
.tariff-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; color: var(--muted); font-size: 13px; font-weight: 700; }
.device-stepper { display: grid; grid-template-columns: 44px 52px 44px; flex-shrink: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.device-stepper button { height: 44px; padding: 0; border: 0; background: transparent; color: var(--brand); font-size: 24px; cursor: pointer; }
.device-stepper input { width: 100%; min-width: 0; height: 44px; padding: 0 2px; border: 0; border-inline: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--text); font: inherit; font-size: 16px; font-weight: 850; text-align: center; font-variant-numeric: tabular-nums; appearance: textfield; -moz-appearance: textfield; }
.device-stepper input::-webkit-inner-spin-button, .device-stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.device-stepper button:disabled, .seg:disabled { opacity: .4; cursor: default; }
.device-stepper :focus-visible, .seg:focus-visible { outline: 2px solid var(--brand); outline-offset: -3px; }
.device-stepper input[aria-invalid="true"] { box-shadow: inset 0 -2px var(--red); }
.segmented { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.seg { min-width: 0; height: 40px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--text); font-weight: 850; cursor: pointer; }
.seg:last-child { border-right: 0; }
.seg.active { background: var(--brand); color: white; }
.device-input-error { color: var(--red); }
.device-plan-warning { margin-top: 12px; padding: 10px 0 0 12px; border-left: 3px solid var(--brand); font-size: 13px; line-height: 1.5; }
.device-plan-warning p { margin: 0 0 8px; }
.field-label { margin-bottom: 9px; font-size: 13px; font-weight: 700; }
.plans-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.plan-button { position: relative; display: grid; min-height: 104px; align-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 13px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.plan-button:hover,
.plan-button:focus-visible,
.plan-button.selected { border-color: var(--brand); background: var(--brand-soft); outline: none; }
.plan-button.selected { box-shadow: inset 0 0 0 1px var(--brand); }
.plan-title { display: block; font-size: 16px; font-weight: 850; }
.plan-meta { display: block; color: var(--muted); font-size: 12px; }
.price { color: var(--brand); font-size: 17px; font-weight: 900; white-space: nowrap; }
.price-wrap { display: flex; align-items: baseline; gap: 6px; }
.price-wrap s { color: var(--muted); font-size: 11px; }
.discount-badge { position: absolute; top: 8px; right: 8px; border-radius: 999px; padding: 3px 6px; background: var(--green-soft); color: var(--green); font-size: 10px; font-weight: 850; }
.selected-plan-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 9px; border-top: 1px solid var(--line); padding-top: 14px; }
.selected-plan-summary span { color: var(--muted); font-size: 13px; }
.selected-plan-summary strong { color: var(--brand); font-size: 21px; }
.payment-note { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.4; text-align: center; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }

.text-input,
.text-area,
.device-name-input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; background: var(--surface); color: var(--text); outline: none; resize: vertical; }
.text-input,
.device-name-input { min-height: 42px; }
.text-input:focus,
.text-area:focus,
.device-name-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 11%, transparent); }
.small-button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); border-radius: 8px; padding: 0 11px; background: var(--surface); color: var(--text); font-size: 12px; font-weight: 800; cursor: pointer; }
.small-button .icon { width: 17px; height: 17px; }
.small-button.primary { border-color: transparent; background: var(--brand); color: #fff; }
.stack-form { display: grid; gap: 9px; margin-top: 12px; }
.form-note { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.form-actions,
.reply-actions { display: flex; justify-content: flex-end; gap: 8px; }
.file-control { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 10px; border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; color: var(--brand); font-size: 13px; font-weight: 750; cursor: pointer; }
.file-control input { width: min(190px, 52%); color: var(--muted); font-size: 11px; }

.order-active { border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }
.timer { min-width: 67px; border-radius: 8px; background: var(--amber-soft); color: var(--amber); }
.order-details { display: grid; gap: 6px; margin: 13px 0; font-size: 14px; line-height: 1.45; }
.order-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.order-actions .btn:first-child { grid-column: 1 / -1; }
.record-list { margin-top: 10px; border-top: 1px solid var(--line); }
.record-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; min-height: 60px; align-items: center; border-bottom: 1px solid var(--line); padding: 8px 0; }
.record-row:last-child { border-bottom: 0; }
.record-row strong,
.record-row span { display: block; }
.record-row strong { overflow-wrap: anywhere; font-size: 13px; }
.record-row div > span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.record-button { width: 100%; border-inline: 0; border-top: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.ticket-item { border-bottom: 1px solid var(--line); }
.ticket-item:last-child { border-bottom: 0; }
.ticket-item > .record-button { border-bottom: 0; }
.ticket-item > .record-button[aria-expanded="true"] > .icon { transform: rotate(90deg); color: var(--brand); }
.ticket-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 4px 0 12px; }
.ticket-actions .small-button { min-width: 0; min-height: 44px; padding: 8px; white-space: normal; }
.ticket-actions .small-button > span { min-width: 0; overflow-wrap: anywhere; }
.ticket-actions .danger { color: var(--red); }
.closed-ticket-notice { display: grid; justify-items: start; gap: 10px; padding-top: 14px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.status-text { font-size: 11px; font-weight: 800; text-align: right; }
.status-text.pending { color: var(--amber); }
.status-text.paid,
.status-text.completed { color: var(--green); }
.status-text.failed,
.status-text.expired,
.status-text.cancelled { color: var(--red); }
.empty-state { padding: 13px 0 3px; font-size: 13px; line-height: 1.45; }

.support-tabs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; margin-top: 13px; padding: 4px; border-radius: 8px; background: var(--surface); }
.support-tab { min-height: 37px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 800; cursor: pointer; }
.support-tab.active { background: var(--panel); color: var(--brand); box-shadow: 0 2px 7px rgba(0, 0, 0, .1); }
.thread-head { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 10px; margin: 13px 0 8px; }
.thread-head strong { display: block; overflow-wrap: anywhere; font-size: 14px; }
.thread-messages { display: grid; gap: 8px; max-height: 390px; overflow-y: auto; border-block: 1px solid var(--line); padding: 12px 0; }
.message-bubble { max-width: 88%; border-radius: 8px; padding: 9px 10px; background: var(--surface); font-size: 13px; line-height: 1.42; }
.message-bubble.user { justify-self: end; background: var(--brand-soft); }
.message-bubble.admin { justify-self: start; }
.message-bubble.system { max-width: 100%; justify-self: center; background: transparent; color: var(--muted); text-align: center; }
.message-bubble > span { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; text-align: right; }
.message-image { display: block; width: min(100%, 320px); max-height: 280px; margin-top: 6px; border-radius: 6px; object-fit: contain; }
.file-icon { position: relative; overflow: hidden; }
.file-icon input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(calc(100% - 20px), 600px);
  min-height: 68px;
  margin: 0 auto max(10px, env(safe-area-inset-bottom));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: color-mix(in srgb, var(--chrome) 96%, transparent);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .2);
  backdrop-filter: blur(16px);
}
.bottom-link { display: grid; min-width: 0; place-items: center; align-content: center; gap: 4px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.bottom-link .icon { width: 20px; height: 20px; }
.bottom-link span { font-size: 11px; }
.bottom-link.active { background: var(--brand-soft); color: var(--brand); }

.toast { position: fixed; right: 14px; bottom: calc(92px + env(safe-area-inset-bottom)); left: 14px; z-index: 50; max-width: 592px; margin: 0 auto; border-radius: 8px; padding: 12px 14px; background: #101722; color: #fff; font-size: 13px; font-weight: 750; box-shadow: 0 12px 32px rgba(0, 0, 0, .28); }
.copy-link-dialog { width: min(420px, calc(100% - 24px)); max-height: calc(100dvh - 32px); margin: auto; border: 1px solid var(--line); border-radius: 8px; padding: 18px; background: var(--panel); color: var(--text); overflow: auto; }
.copy-link-dialog[open] { display: grid; gap: 14px; }
.copy-link-dialog::backdrop { background: rgba(0, 0, 0, .65); }
.copy-link-dialog h2 { font-size: 18px; }
.copy-link-dialog p { color: var(--muted); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.copy-link-dialog textarea { min-height: 96px; font-size: 14px; line-height: 1.5; resize: none; }

@media (max-width: 410px) {
  .view-stack { padding-inline: 10px; }
  .title-bar,
  .account-bar { padding-inline: 13px; }
  .account-bar .pill { max-width: 86px; overflow: hidden; text-overflow: ellipsis; }
  .subscription-actions { grid-template-columns: 1fr; }
  .plans-list { gap: 7px; }
  .plan-button { min-height: 98px; padding: 11px; }
  .device-editor { grid-template-columns: 1fr 1fr; }
  .device-name-input { grid-column: 1 / -1; }
  .inline-form { grid-template-columns: 1fr; }
  .bottom-nav { width: calc(100% - 12px); }
}

@media (max-width: 340px) {
  #statusPill { display: none; }
  .plans-list { grid-template-columns: 1fr; }
  .order-actions { grid-template-columns: 1fr; }
  .order-actions .btn:first-child { grid-column: auto; }
  .connect-action { grid-template-columns: 42px minmax(0, 1fr); }
  .device-dots { grid-column: 2; }
  .bottom-link span { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.paid-promo-offer { padding: 16px 0; margin-top: 12px; border-top: 1px solid var(--border, #353a42); line-height: 1.5; overflow-wrap: anywhere; scroll-margin-top: 150px; scroll-margin-bottom: 90px; }
.paid-promo-offer strong { display: block; font-size: 16px; }
.paid-promo-offer p { font-size: 13px; margin: 8px 0 12px; color: var(--muted, #9eafc0); }
.paid-promo-offer button { max-width: 100%; min-height: 42px; white-space: normal; }
