[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.module-rows { display: contents; }
.modules-panel { margin-top: 20px; }
.quiet-button, .action-dialog button { border: 1px solid #443234; border-radius: 8px; background: #241c1f; color: var(--text); padding: 9px 13px; font-size: 12px; }
.permissions-panel { max-width: 1600px; margin-top: 20px; padding: 20px 28px; border: 1px solid var(--border); border-radius: 14px; background: #171618; }
.permissions-panel summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.permissions-panel p { color: var(--muted); font-size: 12px; line-height: 1.8; max-width: 900px; }
.actor-row { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding: 15px 0; border-top: 1px solid var(--border); font-size: 12px; }
.actor-row small { color: var(--muted); overflow-wrap: anywhere; min-width: 0; }
.permission-option { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.permission-option input { accent-color: var(--accent); width: 16px; height: 16px; }
.action-dialog { width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 16px; padding: 26px; }
.action-dialog::backdrop { background: #0009; }
.action-dialog h2 { margin: 0 0 16px; font-size: 18px; }
.action-dialog p { font-size: 13px; line-height: 1.8; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
#agent-key-label, #agent-key-value { display: block; width: 100%; min-width: 0; margin: 8px 0 12px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); box-sizing: border-box; }
#agent-key-value { font-family: monospace; }
#bridge-force-stop { border-color: #b82a40; background: #8f172d; }
@media (max-width: 600px) { .permissions-panel { padding: 20px; } }
.services-panel { border: 1px solid var(--border); border-radius: 16px; background: #171618; overflow: hidden; max-width: 1600px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 25px 28px; border-bottom: 1px solid var(--border); }
.panel-header h2 { font-size: 18px; font-weight: 600; letter-spacing: -.35px; margin: 0 0 7px; }
.panel-header p { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 0; }
.component-count { font-size: 10px; color: var(--muted); white-space: nowrap; border: 1px solid var(--border); border-radius: 20px; padding: 7px 10px; }
.service-list { display: block; }
.service-row { min-width: 0; }
.service-row + .service-row { border-top: 1px solid var(--border); }
.service-summary { display: grid; grid-template-columns: minmax(150px, 1fr) 100px 300px 10px; align-items: center; gap: 14px; padding: 10px 20px; list-style: none; cursor: pointer; overflow-x: auto; scrollbar-width: thin; }
.service-summary::-webkit-details-marker { display: none; }
.service-summary::after { content: '›'; font-size: 20px; color: var(--muted); text-align: center; }
.service-row[open] > .service-summary::after { transform: rotate(90deg); color: var(--accent); }
.service-summary:hover { background: #ffffff03; }
.service-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.service-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.service-identity > div:last-child { min-width: 0; }
.service-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border: 1px solid #ec163539; border-radius: 8px; background: #ec16350c; color: #f35a70; }
.service-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.service-identity h3 { margin: 0; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.service-body { padding: 12px 20px 22px 60px; display: grid; gap: 18px; }
.service-description { margin: 0; max-width: 900px; color: var(--muted); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.module-details-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 28px; }
.module-detail-section { min-width: 0; }
.module-detail-section + .module-detail-section { border-left: 1px solid var(--border); padding-left: 28px; }
.module-detail-section h4 { margin: 0 0 16px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); }
.detail-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin: 0; }
.detail-field { min-width: 0; }
.detail-field-wide { grid-column: 1 / -1; }
.detail-field dt { margin-bottom: 5px; font-size: 11px; line-height: 1.4; color: var(--muted); }
.detail-field dd { margin: 0; font-size: 12px; line-height: 1.6; color: var(--text); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.detail-field .detail-action { font-family: Consolas, monospace; font-size: 11px; }
.detail-field .detail-reason { padding: 10px 12px; border-left: 2px solid #6c3640; border-radius: 0 6px 6px 0; background: #ffffff03; }
.detail-empty { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.module-notice { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.module-notice strong { font-size: 11px; font-weight: 600; }
.module-notice > div { white-space: pre-line; }
.module-notice-error { border-color: #f3a34e40; color: #f3bd85; background: #f3a34e06; }
.component-state { font-size: 11px; font-weight: 600; display: flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--muted); }
.component-state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex: none; background: currentColor; }
.component-state[data-tone="online"] { color: #e9b4a9; }
.component-state[data-tone="online"]::before { background: #69ce9a; box-shadow: 0 0 0 4px #69ce9a10; }
.component-state[data-tone="offline"]::before { background: var(--accent); box-shadow: 0 0 0 4px #ec163510; }
.component-state[data-tone="waiting"], .component-state[data-tone="warning"] { color: #d9b778; }
.module-row .component-state[data-tone="off"] { color: #f35a70; }
.module-row .component-state[data-tone="on"], .module-row .component-state[data-tone="in_use"] { color: #69ce9a; }
.module-row .component-state[data-tone="standby"] { color: #68a9f5; }
.module-row .component-state[data-tone="starting"] { color: #bd8cff; }
.module-row .component-state[data-tone="error"] { color: #f3a34e; }
.module-row .component-state[data-tone="in_use"]::before { animation: module-blink .4s steps(2, jump-none) infinite; }
.module-row .component-state[data-tone="error"]::before { animation: module-blink 2s steps(2, jump-none) infinite; }
@keyframes module-blink { from { opacity: 1; } to { opacity: .15; } }
@media (prefers-reduced-motion: reduce) { .module-row .component-state::before { animation: none; } }
.service-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.service-actions button, .service-actions a { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; padding: 6px 9px; border: 1px solid #443234; border-radius: 7px; color: var(--text); background: #241c1f; font-size: 11px; white-space: nowrap; text-decoration: none; }
.service-actions button:hover:not(:disabled), .service-actions a:hover { border-color: #9b3444; background: #3c2027; }
.service-actions button[data-action="connect"], .service-actions button[data-action="start"] { background: #8f172d; border-color: #b82a40; }
.component-error { font-size: 12px; color: #f0909e; line-height: 1.7; }
.action-message { min-height: 20px; font-size: 12px; color: var(--muted); }
@media (max-width: 950px) { .panel-header { align-items: flex-start; } }
@media (max-width: 1000px) { .module-details-grid { grid-template-columns: minmax(0, 1fr); gap: 22px; }.module-detail-section + .module-detail-section { border-left: 0; border-top: 1px solid var(--border); padding: 20px 0 0; } }
@media (max-width: 600px) { .panel-header { padding: 18px 16px; }.panel-header h2 { font-size: 16px; }.panel-header p { font-size: 11px; }.component-count { display: none; }.service-summary { grid-template-columns: minmax(130px, 1fr) 85px max-content 10px; gap: 10px; padding: 8px 16px; }.service-body { padding: 2px 16px 14px; }.component-state { font-size: 10px; } }

/* The actions must be visible, not hidden in a sideways-scrolling module row. */
@media (max-width: 1050px) {
  .service-summary { grid-template-columns: minmax(0, 1fr) auto 18px; gap: 10px; overflow-x: visible; padding: 14px 16px; }
  .service-identity { grid-column: 1; grid-row: 1; }
  .service-identity h3 { white-space: normal; overflow: visible; overflow-wrap: anywhere; font-size: 14px; }
  .component-state { grid-column: 2; grid-row: 1; justify-self: end; font-size: 12px; }
  .service-summary::after { grid-column: 3; grid-row: 1; }
  .service-actions { grid-column: 1 / -1; grid-row: 2; flex-wrap: wrap; justify-content: flex-start; min-width: 0; gap: 8px; }
  .service-actions button, .service-actions a { min-height: 44px; padding: 9px 12px; font-size: 13px; }
  .service-body { padding: 8px 16px 18px; }
  .detail-fields { grid-template-columns: minmax(0,1fr); }
  .detail-field { grid-column: 1 / -1; }
  .detail-field dt { font-size: 12px; }
  .detail-field dd { font-size: 13px; }
  .module-detail-section h4 { font-size: 12px; }
}
@media (max-width: 370px) {
  .component-state { max-width: 110px; white-space: normal; text-align: right; }
  .service-actions button, .service-actions a { flex: 1 1 auto; }
}
