@font-face {
  font-family: Inter;
  src: url('/assets/InterVariable.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --surface-canvas: #000;
  --surface-card: #212121;
  --surface-raised: #292929;
  --surface-floating: #333;
  --text-primary: #fff;
  --text-secondary: #999;
  --text-body: #e5e7eb;
  --accent: #0075ff;
  --status-active: #4ade80;
  --line: rgba(229,231,235,.12);
  --line-hover: rgba(229,231,235,.24);
  --ease: cubic-bezier(.2,.8,.2,1);
  --content-width: 1560px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--surface-canvas); color: var(--text-primary); font: 14px/1.5 Inter,ui-sans-serif,system-ui,-apple-system,sans-serif; font-feature-settings: "cv11","ss01"; -webkit-font-smoothing: antialiased; }
::selection { color: var(--text-primary); background: var(--accent); }
header { height: 72px; border-bottom: 1px solid var(--line); }
.header-inner { height: 100%; max-width: var(--content-width); padding: 0 32px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; letter-spacing: -.4px; font-weight: 500; }
.brand img { display: block; border-radius: 5px; }
main { max-width: var(--content-width); margin: 0 auto; padding: 48px 32px; }
main:focus { outline: none; }
.is-login header { display: none; }
.is-login main { min-height: 100vh; display: grid; grid-template-columns: minmax(0,1fr); place-items: center; padding: 32px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 32px; line-height: 1.2; font-weight: 450; letter-spacing: -1.1px; }
h2 { font-size: 20px; line-height: 28px; font-weight: 450; letter-spacing: -.5px; }
h3 { font-size: 14px; font-weight: 500; letter-spacing: -.15px; }
.muted, .optional { color: var(--text-secondary); font-size: 12px; }
.optional { margin-left: 4px; font-weight: 400; }
.card { background: var(--surface-card); border: 1px solid var(--line); border-radius: 16px; }
button, input, textarea, select { font: inherit; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-raised); color: var(--text-primary); cursor: pointer; font-size: 13px; font-weight: 450; transition: background 140ms var(--ease),border-color 140ms var(--ease),color 140ms var(--ease); white-space: nowrap; }
button:hover { background: var(--surface-floating); border-color: var(--line-hover); }
button:disabled { opacity: .5; cursor: wait; }
.primary { background: var(--accent); border-color: var(--accent); }
.primary:hover { background: var(--accent); border-color: var(--text-body); }
.quiet { background: transparent; border-color: transparent; color: var(--text-secondary); }
.quiet:hover { color: var(--text-primary); }
.small { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.icon { width: 18px; height: 18px; flex-shrink: 0; pointer-events: none; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible { outline: 1px solid var(--text-body); outline-offset: 3px; }
input, textarea, select { width: 100%; min-width: 0; min-height: 40px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-raised); color: var(--text-body); transition: border-color 140ms var(--ease); }
select { appearance: none; -webkit-appearance: none; }
input:hover, textarea:hover, select:hover { border-color: var(--line-hover); }
.select-control { display: block; position: relative; min-width: 0; }
.select-control select { appearance: none; -webkit-appearance: none; padding-right: 48px; }
.select-chevron { position: absolute; right: 16px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--text-body); pointer-events: none; }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-secondary); }
label { display: grid; gap: 8px; font-size: 13px; color: var(--text-body); }
form { display: grid; gap: 24px; }
.login { width: 360px; max-width: 100%; padding: 28px; }
.login form { margin-top: 0; gap: 16px; }
.login input { min-height: 44px; }
.login .primary { margin-top: 8px; min-height: 44px; width: 100%; }
.titlebar { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 32px; }
.pagetitle p { margin-top: 12px; color: var(--text-secondary); font-size: 14px; }
.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); margin-bottom: 32px; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metrics > div { display: flex; align-items: center; gap: 12px; padding: 0 24px; border-right: 1px solid var(--line); }
.metrics > div:first-child { padding-left: 0; }
.metrics > div:last-child { padding-right: 0; border-right: 0; }
.metrics span { color: var(--text-secondary); font-size: 12px; }
.metrics strong { order: -1; font-size: 24px; line-height: 30px; font-weight: 450; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.tabletools { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 24px 16px; }
.listtitle { display: flex; align-items: baseline; gap: 12px; }
.listtitle h2 { font-size: 16px; line-height: 24px; letter-spacing: -.35px; }
.filters { display: flex; align-items: center; gap: 12px; padding: 0 24px 20px; }
.filters .search { position: relative; flex: 1; max-width: 480px; }
.search .icon { position: absolute; left: 12px; top: 11px; color: var(--text-secondary); }
.search input { padding-left: 38px; font-size: 13px; }
.filters select { width: 174px; font-size: 13px; }
.tablewrap { overflow: hidden; }
.table-scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; white-space: nowrap; }
th { padding: 12px 24px; font-size: 12px; color: var(--text-secondary); font-weight: 400; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
td { padding: 16px 24px; border-bottom: 1px solid var(--line); font-size: 13px; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-raised); }
td:first-child { width: 22%; min-width: 180px; }
td:last-child { text-align: right; }
td:last-child button { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.clientname { display: block; max-width: 460px; overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-weight: 450; }
.clientmeta, .deviceactivity { display: block; color: var(--text-secondary); font-size: 12px; margin-top: 4px; }
.clientmeta { max-width: 460px; overflow: hidden; text-overflow: ellipsis; }
.mobile-label { display: none; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--text-body); font-size: 12px; white-space: nowrap; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--text-secondary); }
.status[data-status="active"] { color: var(--status-active); }
.status[data-status="active"]::before { background: var(--status-active); }
.empty { padding: 48px 24px; text-align: center; color: var(--text-secondary); font-size: 13px; }
.listfooter { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; margin-top: 16px; }
.error { color: #f87171; font-size: 13px; overflow-wrap: anywhere; }
#pageError:not([hidden]) { margin-bottom: 16px; }
.form-section { display: grid; gap: 16px; }
.form-section + .form-section { padding-top: 24px; border-top: 1px solid var(--line); }
.form-section h3 { margin-bottom: 4px; }
.formgrid { display: grid; grid-template-columns: minmax(0,1fr) 152px; gap: 12px; }
.formgrid:has(#expiryLabel[hidden]) { grid-template-columns: minmax(0, 180px); }
.quickexpiry { display: flex; gap: 8px; }
.quickexpiry button { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.notes { margin-top: 0; }
.notes label { margin-top: 12px; }
dialog { color: var(--text-primary); background: var(--surface-card); border: 1px solid var(--line-hover); border-radius: 16px; padding: 0; width: 1340px; max-width: calc(100vw - 48px); max-height: calc(100vh - 48px); }
dialog[open] { display: flex; flex-direction: column; }
dialog.is-creating { width: 640px; }
dialog::backdrop { background: rgba(0,0,0,.8); }
body:has(dialog[open]) { overflow: hidden; }
.dialoghead { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 32px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.dialogtitle { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dialogtitle h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialoghead button { font-size: 24px; font-weight: 400; padding: 0; width: 32px; min-height: 32px; flex-shrink: 0; }
.dialogbody { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.1fr); gap: 32px; padding: 32px; overflow: auto; min-height: 0; }
.is-creating .dialogbody { display: block; }
#licenseForm { align-content: start; }
#issuedSection { min-width: 0; padding-left: 32px; border-left: 1px solid var(--line); }
.sectionhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 12px; }
.sectionhead:first-child, #telegramProfile + .sectionhead { margin-top: 0; }
.keyrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 16px; background: var(--surface-raised); border: 1px solid var(--line); border-radius: 7px; }
.keyrow button { min-height: 32px; padding: 5px 10px; font-size: 12px; }
#keyPreview { font: 13px/1.5 ui-monospace,monospace; letter-spacing: .02em; }
#issuedKey { margin-top: 12px; font: 12px/1.5 ui-monospace,monospace; word-break: break-all; }
.keyhint { margin-top: 8px; }
.device { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.device:last-child { border-bottom: 0; }
.deviceinfo { min-width: 0; }
.devicename { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.device p { margin-top: 4px; }
.device button { font-size: 12px; min-height: 32px; padding: 5px 10px; }
.device.is-disabled .devicename { color: var(--text-secondary); }
details { margin-top: 20px; }
summary { cursor: pointer; color: var(--text-secondary); font-size: 12px; padding: 4px 0; }
summary:hover { color: var(--text-body); }
.accessinfo p { line-height: 1.7; margin-top: 8px; }
.historyrow { font-size: 12px; color: var(--text-body); padding: 10px 0; border-bottom: 1px solid var(--line); }
.dialogerror { padding: 0 32px 20px; flex-shrink: 0; }
.dialogfooter { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 32px; border-top: 1px solid var(--line); flex-shrink: 0; }
#saveLicense { margin-left: auto; min-width: 136px; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 12px 20px; background: var(--surface-floating); border: 1px solid var(--line-hover); border-radius: 7px; max-width: calc(100vw - 48px); font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 5; padding: 10px 16px; border-radius: 7px; background: var(--surface-card); color: var(--text-primary); text-decoration: none; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
@media (max-width: 1000px) {
  main { padding: 32px 24px; }
  .header-inner { padding: 0 24px; }
  .metrics > div { padding: 0 16px; gap: 8px; }
  .metrics span { max-width: 112px; }
  .dialogbody { grid-template-columns: 1fr; }
  #issuedSection { border-left: 0; border-top: 1px solid var(--line); padding: 24px 0 0; }
  th, td { padding-left: 16px; padding-right: 16px; }
  .clientname, .clientmeta { max-width: 240px; }
}
@media (max-width: 760px) {
  header { height: 64px; }
  .header-inner { padding: 0 16px; gap: 16px; }
  .brand { gap: 8px; font-size: 14px; }
  .brand img { flex-shrink: 0; }
  main { padding: 28px 16px; }
  .is-login main { min-height: calc(100vh - 64px); min-height: calc(100dvh - 64px); padding: 24px 16px; }
  h1 { font-size: 28px; letter-spacing: -.8px; }
  button, .small, .quickexpiry button, .device button, .keyrow button, td:last-child button { min-height: 44px; }
  button { font-size: 14px; }
  input, textarea, select, .search input, .filters select, #issuedKey { font-size: 16px; min-height: 44px; }
  .login { padding: 24px; }
  .login-mark { margin-bottom: 20px; }
  .login-description { font-size: 14px; }
  .titlebar { flex-direction: column; align-items: stretch; gap: 20px; margin-bottom: 24px; }
  .pagetitle p { margin-top: 10px; line-height: 1.7; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 0; margin-bottom: 24px; }
  .metrics > div, .metrics > div:first-child, .metrics > div:last-child { padding: 14px; gap: 10px; min-height: 64px; }
  .metrics > div:nth-child(even) { border-right: 0; }
  .metrics > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .metrics span { max-width: none; }
  .tabletools { padding: 12px 16px; gap: 8px; }
  .listtitle { gap: 8px; }
  #refresh { gap: 6px; padding: 8px; font-size: 12px; }
  .filters { flex-direction: column; align-items: stretch; gap: 12px; padding: 0 16px 20px; }
  .filters .search, .filters select { width: 100%; max-width: none; }
  .search .icon { top: 14px; }
  .table-scroll { overflow: visible; }
  table, tbody { display: block; white-space: normal; }
  thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
  tbody tr { display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "client status" "expiry devices" "action action"; gap: 20px 16px; padding: 20px 16px; border-top: 1px solid var(--line); }
  td { padding: 0; border: 0; min-width: 0; }
  td:first-child { width: auto; }
  .license-client { grid-area: client; }
  .license-status { grid-area: status; align-self: start; }
  .license-expiry { grid-area: expiry; }
  .license-devices { grid-area: devices; }
  .license-action { grid-area: action; }
  .license-action button { width: 100%; font-size: 14px; }
  .clientname { font-size: 15px; line-height: 1.6; }
  .clientname, .clientmeta { max-width: none; white-space: normal; overflow: visible; overflow-wrap: anywhere; }
  .mobile-label { display: block; margin-bottom: 6px; color: var(--text-secondary); font-size: 12px; }
  .listfooter { gap: 8px; line-height: 1.7; }
  .empty { padding: 32px 20px; border-top: 1px solid var(--line); }
  .formgrid { grid-template-columns: 1fr; gap: 16px; }
  .quickexpiry { flex-wrap: wrap; }
  dialog, dialog.is-creating { width: calc(100vw - 24px); max-width: calc(100vw - 24px); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .dialoghead { padding: 16px 20px; gap: 8px; align-items: flex-start; }
  .dialogtitle { flex-wrap: wrap; gap: 8px; padding-top: 8px; }
  .dialogtitle h2 { font-size: 18px; line-height: 26px; white-space: normal; overflow-wrap: anywhere; }
  .dialoghead button { width: 44px; min-height: 44px; }
  .dialogbody { padding: 20px; gap: 24px; overscroll-behavior: contain; }
  .dialogerror { padding: 0 20px 16px; }
  .dialogfooter { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px 20px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  #saveLicense { width: 100%; margin-left: 0; }
  #revokeLicense { white-space: normal; }
  .keyrow { flex-wrap: wrap; padding: 12px; }
  #keyPreview { min-width: 0; overflow-wrap: anywhere; }
  .keyrow button { width: 100%; }
  #issuedKey { min-height: 104px; }
  .device { align-items: flex-start; gap: 12px; }
  .devicename { white-space: normal; overflow-wrap: anywhere; line-height: 1.7; }
  .device button { flex-shrink: 0; font-size: 13px; }
  summary { display: flex; align-items: center; min-height: 44px; font-size: 13px; }
  summary::before { content: "+"; margin-right: 8px; }
  details[open] > summary::before { content: "−"; }
  summary::-webkit-details-marker { display: none; }
  #toast { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 32px); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }

.telegram-panel { margin-bottom: 24px; padding: 20px 24px; }
.telegram-panel .tabletools { padding: 0 0 16px; }
.telegram-panel details { margin-top: 16px; }
.telegram-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.tg-profile, .tg-user, .tg-purchase { display: flex; gap: 16px; align-items: flex-start; }
.tg-profile img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.tg-info { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.tg-info p, .tg-controls p { margin: 0; }
.tg-info a { color: #fff; text-underline-offset: 3px; }
.tg-user, .tg-purchase { justify-content: space-between; border-top: 1px solid var(--line); padding: 16px 0; }
.tg-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; max-width: 340px; }
.tg-controls p { width: 100%; text-align: right; }
.telegram-profile { padding-bottom: 20px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.license-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.license-client-info { display: grid; gap: 4px; min-width: 0; }
.license-client-info .clientmeta { margin-top: 0; }
.client-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-initials { display: grid; place-items: center; background: var(--surface-raised); border: 1px solid var(--line); color: var(--text-secondary); font-size: 13px; }
@media (max-width: 760px) {
  .client-avatar { width: 44px; height: 44px; }
  .telegram-panel { padding: 20px 16px; }
  .telegram-filters { grid-template-columns: 1fr; }
  .tg-user, .tg-purchase { flex-direction: column; }
  .tg-controls { max-width: none; width: 100%; justify-content: flex-start; }
  .tg-controls p { text-align: left; }
  .tg-controls button { min-height: 44px; }
}

.panel-nav { display: flex; gap: 8px; margin-bottom: 28px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.panel-nav button { background: transparent; border-color: transparent; color: var(--text-secondary); }
.panel-nav button[aria-current="page"] { color: var(--text-primary); background: var(--surface-raised); border-color: var(--line); }
#botView .pagetitle a { color: var(--text-secondary); text-underline-offset: 4px; }
.bot-health { padding: 20px 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bot-health > div { display: grid; gap: 8px; }
.bot-health strong { font-size: 16px; font-weight: 500; }
.bot-health strong[data-ok="true"] { color: #4ade80; }
.bot-health p { margin: 0; grid-column: 1 / -1; overflow-wrap: anywhere; }
.bot-metrics { margin-bottom: 12px; }
.stats-note { margin: 0 0 24px; }
.message-form { margin-top: 16px; }
.message-form .telegram-filters { margin-top: 0; }
.message-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 16px 0; }
.message-history-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 0; border-top: 1px solid var(--line); }
.message-history-row > button { flex-shrink: 0; }
.history-message, .message-bubble { white-space: pre-wrap; overflow-wrap: anywhere; }
#messageDialog { width: min(840px, calc(100vw - 32px)); }
#messageDialog .dialoghead button { font-size: 13px; width: auto; padding: 8px 12px; min-height: 40px; }
.message-preview-body { padding: 20px 28px; overflow: auto; }
.message-bubble { background: var(--surface-raised); padding: 16px; border: 1px solid var(--line); border-radius: 12px; line-height: 1.7; }
.message-preview-body details { margin-top: 20px; }
@media (max-width: 760px) {
  .panel-nav { gap: 4px; }
  .panel-nav button { flex: 1; font-size: 13px; }
  .bot-health { padding: 20px 16px; grid-template-columns: 1fr; }
  #botView .titlebar { align-items: flex-start; flex-direction: column; }
  .message-history-row { flex-direction: column; }
  .message-preview-body { padding: 16px 20px; }
  #messageDialog .dialoghead button { min-height: 44px; }
}

.panel-nav button { white-space: normal; }


#connectionResult { margin-bottom: 0; overflow-wrap: anywhere; }
#connectionResult[data-status="succeeded"] { color: #4ade80; }
#connectionResult[data-status="failed"] { color: var(--danger, #f87171); }

/* Focus each bot screen on one task, using the landing's flat surfaces and rhythm. */
.bot-section-nav { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin: -8px 0 24px; }
.bot-section-nav button { border: 0; border-bottom: 1px solid transparent; border-radius: 0; background: transparent; padding: 12px 0; min-height: 44px; color: var(--text-secondary); }
.bot-section-nav button[aria-current="page"] { color: var(--text-primary); border-bottom-color: var(--text-primary); }
.nav-count { margin-left: 6px; font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.bot-health { display: block; }
.bot-health > div.connection-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.connection-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bot-health > div.connection-states { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.connection-states > div { display: flex; align-items: center; gap: 12px; }
.connection-states strong { font-size: 14px; font-weight: 450; }
.connection-states strong::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 8px; border-radius: 50%; background: currentColor; vertical-align: middle; }
.connection-details { margin-top: 12px; }
.connection-details p { padding-top: 12px; }
.bot-health > p.error, .bot-health > #connectionResult:not([hidden]) { margin-top: 16px; }
#botOverview .bot-metrics { margin-top: 24px; }
#botUsersSection .telegram-filters { margin-top: 0; }
#botUsersSection .tabletools { padding-bottom: 20px; }
.bot-health > .owner-notifications { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.owner-notifications p { margin-top: 8px; }
#ownerNotificationInvite:not([hidden]), #ownerNotificationError:not([hidden]) { margin-top: 12px; }

@media (max-width: 760px) {
  .bot-section-nav { gap: 20px; }
  .bot-section-nav button { font-size: 13px; }
  .bot-health > div.connection-heading { align-items: flex-start; flex-direction: column; gap: 12px; margin-bottom: 20px; }
  .connection-actions { width: 100%; display: grid; grid-template-columns: 1fr; gap: 4px; }
  .connection-actions button { padding: 10px 0; justify-content: flex-start; text-align: left; }
  .bot-health > div.connection-states { grid-template-columns: 1fr; gap: 12px; }
  .connection-states > div { justify-content: space-between; gap: 8px; }
  .connection-states strong { text-align: right; }
  .bot-health > .owner-notifications { align-items: flex-start; flex-direction: column; gap: 12px; }
}



.usage-filter { padding: 0 24px 20px; }
.usage-filter label { max-width: 300px; }
.usage-overview { margin-top: 28px; padding: 24px; }
.usage-overview h2 { font-size: 18px; }
.usage-overview .sectionhead { margin-top: 0; }
.usage-overview details p { margin-top: 12px; line-height: 1.7; }
.usage-metrics { display: grid; grid-template-columns: repeat(auto-fit,minmax(110px,1fr)); gap: 12px; margin: 20px 0; }
.usage-metric { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 16px; min-width: 0; }
.usage-metric strong { font-size: 26px; font-weight: 450; font-variant-numeric: tabular-nums; }
.usage-metric span { font-size: 12px; color: var(--text-secondary); }
.usage-line { display: block; }
#usageSection { grid-column: 1 / -1; min-width: 0; border-top: 1px solid var(--line); padding-top: 20px; }
#usageFreshness { line-height: 1.7; }
.usage-nav { display: flex; gap: 8px; margin: 20px 0; }
.usage-nav button { background: transparent; border-color: transparent; color: var(--text-secondary); }
.usage-nav button[aria-current="page"] { color: var(--text-primary); background: var(--surface-raised); border-color: var(--line); }
.usage-controls { display: grid; grid-template-columns: minmax(100px,180px) minmax(180px,1fr); gap: 16px; margin-bottom: 20px; }
.usage-event { padding: 16px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.usage-event p { margin: 6px 0; line-height: 1.7; }
.usage-event strong { font-size: 13px; font-weight: 500; }
.usage-error-heading { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; }
.usage-diagnostic { margin-top: 12px; min-width: 0; }
.usage-log { white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.7 ui-monospace,monospace; padding: 16px; border-radius: 8px; background: var(--surface-raised); border: 1px solid var(--line); }
#usageSection > section > .muted { margin-top: 16px; line-height: 1.7; }
.license-usage, .license-activity { white-space: nowrap; min-width: 190px; }
.license-usage .usage-line, .license-activity .usage-line { display: block; white-space: nowrap; }
.license-activity .error, .license-activity .clientmeta, .license-usage .clientmeta { display: block; margin-top: 4px; font-size: 12px; white-space: nowrap; }
@media (max-width:760px) {
  tbody tr { grid-template-areas: "client status" "expiry devices" "usage usage" "activity activity" "action action"; }
  .license-usage { grid-area: usage; }
  .license-activity { grid-area: activity; }
  .usage-filter { padding: 0 16px 20px; }
  .usage-filter label { max-width: none; }
  .usage-overview { padding: 20px 16px; }
  .usage-controls { grid-template-columns: 1fr; }
  .usage-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .usage-nav button { flex: 1; min-height: 44px; padding: 8px; }
  .license-usage,.license-activity { grid-column: 1 / -1; min-width: 0; white-space: normal; }
  .license-usage .usage-line, .license-activity .usage-line, .license-activity .error, .license-activity .clientmeta, .license-usage .clientmeta { white-space: normal; }
  .usage-error-heading { flex-direction: column; }
  .usage-diagnostic button { white-space: normal; min-height: 44px; }
}

