.phone-log-share { border-top: 1px solid #e5e5e5; border-bottom: 1px solid #e5e5e5; padding: 18px 0; grid-column: 1 / -1; }
.phone-log-share label { display: block; margin-top: 12px; }
.phone-log-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.phone-log-actions svg { width: 15px; height: 15px; }
.phone-log-note, .phone-log-feedback { margin: 10px 0 0; font-size: 12px; color: #737373; }
.phone-log-feedback:empty { display: none; }
@font-face {
  font-family: "DM Sans";
  src: url("/assets/fonts/dm-sans/DMSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("/assets/fonts/dm-sans/DMSans-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("/assets/fonts/dm-sans/DMSans-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("/assets/fonts/dm-sans/DMSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --background: #ffffff;
  --foreground: #171717;
  --card: #ffffff;
  --card-foreground: #171717;
  --popover: #ffffff;
  --popover-foreground: #171717;
  --primary: #c8101a;
  --primary-foreground: #ffffff;
  --primary-soft: #fff1f2;
  --secondary: #f5f5f5;
  --secondary-foreground: #262626;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --accent: #f5f5f5;
  --accent-foreground: #262626;
  --destructive: #b42318;
  --destructive-soft: #fee4e2;
  --success: #067647;
  --success-soft: #dcfae6;
  --warning: #a15c07;
  --warning-soft: #fff4e5;
  --info: #155eef;
  --border: #e5e5e5;
  --input: #d4d4d4;
  --ring: rgba(200, 16, 26, 0.24);
  --radius: 8px;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.08), 0 8px 18px -14px rgba(0, 0, 0, 0.22);
  --font-sans: "DM Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(245, 245, 245, 0.96), rgba(255, 255, 255, 0.98) 260px),
    var(--background);
  color: var(--foreground);
  font: 14px/1.5 var(--font-sans);
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(255, 241, 242, 0.48), rgba(250, 250, 250, 0.9) 38%, #ffffff),
    var(--background);
}

.login-card {
  display: grid;
  gap: 22px;
  width: min(100%, 390px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--shadow-sm);
}

.login-brand {
  display: grid;
  justify-items: center;
  gap: 9px;
  text-align: center;
}

.login-logo {
  width: 74px;
  height: 74px;
  border: 1px solid var(--border);
  border-radius: 50%;
  padding: 4px;
  background: #fff;
  object-fit: contain;
  box-shadow: var(--shadow-xs);
}

.login-brand h1 {
  max-width: 330px;
  margin: 8px 0 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.08;
  text-wrap: balance;
}

.login-brand p {
  max-width: 310px;
  margin: 0;
  color: var(--muted-foreground);
  text-wrap: pretty;
}

.login-form {
  display: grid;
  gap: 14px;
}

.workspace {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 16px;
  min-height: 100vh;
  padding: 16px;
}

.app-sidebar {
  position: sticky;
  top: 16px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  height: calc(100vh - 32px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.sidebar-brand {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px;
  background: var(--card);
}

.brand-logo {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  padding: 3px;
  background: #fff;
  object-fit: contain;
}

.sidebar-brand strong {
  display: block;
  margin-top: 3px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
}

.sidebar-nav {
  display: grid;
  align-content: start;
  gap: 4px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  min-height: 38px;
  border-radius: calc(var(--radius) - 2px);
  padding: 9px 10px;
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition-property: background-color, color, box-shadow, scale;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.sidebar-nav a:hover {
  background: var(--accent);
  color: var(--foreground);
}

.sidebar-nav a.active {
  background: var(--foreground);
  color: #fff;
  box-shadow: var(--shadow-xs);
}

.sidebar-status {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--muted);
}

.app-main {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

.app-page {
  display: none;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

.app-page.active {
  display: grid;
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
}

.topbar h1 {
  margin: 3px 0 2px;
  font-size: clamp(26px, 2.4vw, 34px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.05;
  text-wrap: balance;
}

.topbar p,
.note,
.route-card small,
.login-brand p {
  color: var(--muted-foreground);
}

.topbar p,
.note,
.route-card small {
  margin: 0;
  text-wrap: pretty;
}

.connection-alert {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.connection-alert.error {
  border-color: #f5b7b1;
  background: #fffafa;
}

.connection-alert.connecting {
  border-color: #f0d4a8;
  background: #fffdf8;
}

.connection-alert-marker {
  background: var(--destructive);
}

.connection-alert.connecting .connection-alert-marker {
  background: var(--warning);
}

.connection-alert-content {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px 16px;
}

.connection-alert-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.connection-alert-heading strong {
  font-size: 15px;
  line-height: 1.3;
}

.connection-alert-heading span {
  color: var(--destructive);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.connection-alert.connecting .connection-alert-heading span {
  color: var(--warning);
}

.connection-alert p {
  margin: 0;
}

.connection-technical {
  overflow-wrap: anywhere;
  color: var(--muted-foreground);
  font: 12px/1.5 var(--font-mono);
}

.connection-alert-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 18px;
  padding-top: 4px;
}

.connection-alert-meta > span {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: var(--muted-foreground);
  font-size: 12px;
}

.connection-alert-meta b {
  color: var(--foreground);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.connection-alert-meta code {
  overflow-wrap: anywhere;
  color: var(--foreground);
  font: 12px/1.5 var(--font-mono);
}

.connection-action {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  color: var(--foreground);
  font-size: 12px;
  font-weight: 600;
}

.topbar-actions,
.action-row,
.status-cluster,
.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.summary-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.summary-card,
.route-card,
.panel,
.deployment-detail {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--shadow-sm);
}

.summary-card {
  display: grid;
  gap: 7px;
  min-height: 116px;
  padding: 16px;
}

.summary-card span {
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.summary-card strong {
  color: var(--foreground);
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.summary-card small {
  color: var(--muted-foreground);
  font-size: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.route-card {
  display: grid;
  gap: 10px;
  min-height: 150px;
  padding: 16px;
  text-decoration: none;
  transition-property: border-color, box-shadow, transform, scale;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.route-card:hover,
.panel:hover,
.summary-card:hover {
  border-color: #d4d4d4;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.route-card strong {
  font-size: 18px;
  line-height: 1.15;
  text-wrap: balance;
}

.phones-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(480px, 1.28fr);
  gap: 16px;
  align-items: start;
}

.work-grid,
.data-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

[data-page="configs"] .config-panel {
  max-width: 1120px;
}

.panel {
  min-width: 0;
  padding: 16px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-heading h2 {
  margin: 3px 0 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  text-wrap: balance;
}

.status-pill,
.count,
.badge,
.version-badge,
.connection-status,
.state-text,
.version-text,
.slot-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.status-pill,
.count,
.version-badge,
.version-text,
.connection-status {
  min-height: 24px;
  padding: 0;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 12px;
}

.version-badge,
.version-text {
  min-height: 24px;
  color: var(--muted-foreground);
  font-weight: 600;
}

.connection-status {
  justify-content: flex-start;
  color: var(--muted-foreground);
}

.connection-status::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border: 1px solid currentColor;
  background: currentColor;
  transform: rotate(45deg);
}

.badge {
  min-height: 20px;
  padding: 0;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 11px;
  text-transform: uppercase;
}

.status-pill::before,
.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 2px;
  background: currentColor;
}

.count {
  font-size: 13px;
  color: var(--foreground);
}

.state-text {
  min-height: 20px;
  color: var(--muted-foreground);
  font-size: 11px;
  text-transform: uppercase;
}

.state-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border: 1px solid currentColor;
  background: currentColor;
  transform: rotate(45deg);
}

.slot-type {
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 600;
}

.status-pill.online,
.connection-status.online,
.state-text.online,
.state-text.enabled,
.badge.online,
.badge.enabled {
  color: var(--success);
}

.connection-status.connecting {
  color: var(--warning);
}

.status-pill.offline,
.connection-status.offline,
.state-text.offline,
.badge.offline {
  color: var(--destructive);
}

.state-text.disabled,
.badge.disabled {
  color: var(--warning);
}

.state-text.deleted {
  color: #9a3412;
}

.stack {
  display: grid;
  gap: 14px;
}

.stack > *,
.config-builder > *,
.builder-section > *,
.builder-grid > *,
.slot-list > *,
.slot-row > *,
.detail-grid > *,
.work-grid > *,
.data-grid > *,
.dashboard-grid > *,
.phones-workspace > * {
  min-width: 0;
}

label {
  display: grid;
  gap: 7px;
  color: var(--foreground);
  font-size: 12px;
  font-weight: 600;
}

label > span {
  color: var(--muted-foreground);
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 38px;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  padding: 8px 10px;
  background: var(--background);
  color: var(--foreground);
  box-shadow: var(--shadow-xs);
  transition-property: border-color, box-shadow, background-color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

input::placeholder,
textarea::placeholder {
  color: #a3a3a3;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(200, 16, 26, 0.56);
  box-shadow: 0 0 0 4px var(--ring);
  outline: none;
}

.password-input {
  position: relative;
  width: 100%;
  min-width: 0;
}

.password-input input {
  min-height: 40px;
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  place-items: center;
  border: 0;
  border-radius: 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0;
  padding: 0;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition-property: background-color, color, scale;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.password-toggle:hover {
  background: var(--accent);
  color: var(--foreground);
}

.password-toggle:focus-visible {
  box-shadow: inset 0 0 0 2px var(--primary);
  outline: none;
}

.password-toggle:active {
  scale: 0.96;
}

.password-toggle-icon {
  position: absolute;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  transition-property: opacity, scale, filter;
  transition-duration: 180ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.password-toggle-icon svg {
  width: 18px;
  height: 18px;
}

.password-toggle-hide,
.password-toggle.is-visible .password-toggle-show {
  opacity: 0;
  scale: 0.25;
  filter: blur(4px);
}

.password-toggle-show,
.password-toggle.is-visible .password-toggle-hide {
  opacity: 1;
  scale: 1;
  filter: blur(0);
}

textarea {
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
}

input[type="checkbox"] {
  width: 17px;
  height: 17px;
  min-height: 17px;
  padding: 0;
  accent-color: var(--primary);
  box-shadow: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 8px 13px;
  background: var(--background);
  color: var(--foreground);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition-property: background-color, border-color, color, box-shadow, scale, opacity;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.button:hover {
  border-color: #d4d4d4;
  background: var(--accent);
}

.button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 1px 3px rgba(200, 16, 26, 0.22);
}

.button.primary:hover {
  border-color: #a80e17;
  background: #a80e17;
}

.button.primary.subtle {
  border-color: var(--foreground);
  background: var(--foreground);
  color: #fff;
}

.button.ghost {
  background: var(--background);
  color: var(--foreground);
}

.button.danger {
  border-color: rgba(180, 35, 24, 0.18);
  background: #fff;
  color: var(--destructive);
}

.button.danger:hover {
  background: var(--destructive-soft);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  scale: 1;
}

.sidebar-nav a:active,
.button:active,
.list-item:active,
.route-card:active,
.slot-heading:active,
.table-action:active {
  scale: 0.98;
}

.list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  overflow: auto;
}

.phones-panel .list {
  padding-right: 2px;
}

.manual-device-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.manual-device-form .button {
  white-space: nowrap;
}

.trash-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.trash-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.list.empty,
.detail-empty,
.log-list.empty,
.configured-list.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--muted);
  color: var(--muted-foreground);
  text-align: center;
  text-wrap: pretty;
}

.list-item {
  display: grid;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--card);
  color: var(--foreground);
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-xs);
  transition-property: background-color, border-color, box-shadow, scale;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.list-item:hover {
  border-color: #d4d4d4;
  box-shadow: var(--shadow-sm);
}

.list-item.selected {
  border-color: rgba(200, 16, 26, 0.38);
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary), var(--shadow-xs);
}

.trash-item {
  border-color: #fed7aa;
  background: #fff7ed;
  cursor: default;
}

.trash-item .restore-device-button {
  width: 100%;
  margin-top: 10px;
}

.item-title,
.detail-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  font-weight: 700;
}

.item-title span:first-child,
.detail-title span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta,
.detail-meta {
  margin-top: 4px;
  color: var(--muted-foreground);
  font-size: 12px;
  word-break: break-all;
}

.item-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted-foreground);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.detail-grid {
  display: grid;
  gap: 14px;
}

.detail-hero {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: linear-gradient(180deg, #fff, #fafafa);
}

.detail-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.detail-kpis span {
  display: grid;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.detail-kpis strong {
  color: var(--foreground);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.detail-actions {
  flex-wrap: wrap;
}

.detail-actions .button {
  flex: 1 1 auto;
}

.detail-subsection {
  display: grid;
  gap: 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--muted);
}

.detail-subtitle {
  color: var(--foreground);
  font-size: 13px;
  font-weight: 700;
}

.check-line {
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 36px;
}

.check-line span {
  color: var(--foreground);
}

.command-status {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 4px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 12px;
}

.command-status.success {
  border-color: rgba(6, 118, 71, 0.18);
  box-shadow: inset 3px 0 0 var(--success);
}

.command-status.pending {
  border-color: rgba(161, 92, 7, 0.18);
  box-shadow: inset 3px 0 0 var(--warning);
}

.command-status.danger {
  border-color: rgba(180, 35, 24, 0.18);
  box-shadow: inset 3px 0 0 var(--destructive);
}

.command-status strong {
  color: var(--foreground);
  word-break: break-all;
}

.command-status small {
  grid-column: 2;
  color: var(--muted-foreground);
}

.config-builder {
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--muted);
}

.builder-section {
  display: grid;
  gap: 12px;
}

.builder-section + .builder-section {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.builder-section h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  text-wrap: balance;
}

.builder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.builder-check {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 10px;
  background: var(--card);
}

.slot-list {
  display: grid;
  gap: 9px;
}

.slot-row {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-xs);
}

.slot-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 12px;
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
  font-weight: 700;
  text-align: left;
  transition-property: background-color, scale;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.slot-heading:hover {
  background: var(--accent);
}

.slot-row.open .slot-heading {
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.slot-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.slot-chevron {
  width: 14px;
  color: var(--primary);
  font-weight: 700;
}

.slot-summary {
  min-width: 0;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-body {
  padding: 0 12px 12px;
}

.builder-alert {
  color: var(--destructive);
  font-weight: 700;
}

.input-with-suffix {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.input-with-suffix span {
  color: var(--muted-foreground);
  font-weight: 700;
}

.compact-list .list-item {
  cursor: default;
}

.config-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.config-actions .button {
  min-height: 34px;
  padding-block: 6px;
}

.configured-list,
.log-list {
  display: grid;
  gap: 7px;
  overflow-x: auto;
}

.history-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--muted);
}

.history-export-button {
  min-height: 40px;
  white-space: nowrap;
}

.history-export-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.history-export-button svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.configured-section-title {
  margin-top: 10px;
  color: var(--foreground);
  font-size: 13px;
  font-weight: 700;
}

.history-pagination,
.history-page-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.history-pagination {
  justify-content: space-between;
  padding-block: 8px;
  color: var(--muted-foreground);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.history-page-controls > span {
  margin-right: 8px;
}

.history-page-button {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.configured-row {
  display: grid;
  grid-template-columns: minmax(132px, 1fr) 84px minmax(112px, 0.9fr) minmax(150px, 1fr) minmax(112px, 0.8fr) minmax(180px, 1.2fr) 168px 70px;
  gap: 10px;
  align-items: center;
  min-width: 1160px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.configured-row.selected {
  border-radius: var(--radius);
  padding-inline: 10px;
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

.log-row {
  display: grid;
  grid-template-columns: 146px 122px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 520px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.configured-header,
.log-header {
  min-height: 34px;
  border: 0;
  border-radius: var(--radius);
  padding: 9px 10px;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.configured-row span,
.log-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.configured-row a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.table-action {
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 5px 9px;
  background: var(--background);
  color: var(--foreground);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition-property: background-color, border-color, scale, opacity;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.table-action:hover {
  border-color: #d4d4d4;
  background: var(--accent);
}

.table-action:disabled {
  color: var(--muted-foreground);
  cursor: default;
  opacity: 0.65;
}

.deployment-detail {
  display: grid;
  gap: 14px;
  margin-top: 12px;
  min-width: min(100%, 920px);
  padding: 16px;
}

.deployment-detail-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.deployment-detail-header h3 {
  margin: 2px 0 4px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}

.deployment-detail-header p {
  margin: 0;
  color: var(--muted-foreground);
}

.deployment-detail-actions {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
}

.deployment-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.deployment-detail-grid > div {
  display: grid;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--muted);
}

.deployment-detail-grid span {
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.deployment-detail-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.json-preview {
  max-height: 420px;
  margin: 0;
  overflow: auto;
  border-radius: var(--radius);
  padding: 14px;
  background: #0f172a;
  color: #e5e7eb;
  font: 12px/1.55 var(--font-mono);
  white-space: pre-wrap;
}

.mono {
  font-family: var(--font-mono);
}

@media (max-width: 1260px) {
  .workspace {
    grid-template-columns: 228px minmax(0, 1fr);
  }

  .summary-bar,
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .phones-workspace,
  .work-grid,
  .data-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .app-sidebar {
    position: static;
    height: auto;
  }

  .sidebar-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .sidebar-nav a {
    justify-content: center;
    padding-inline: 8px;
  }

  .sidebar-status {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .topbar {
    position: static;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .topbar-actions .button {
    flex: 1 1 160px;
  }

  .connection-alert-meta {
    grid-template-columns: 1fr;
  }

  .configured-row,
  .log-row {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .configured-header,
  .log-header {
    display: none;
  }

  .log-row span[data-label],
  .configured-row span[data-label] {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 8px;
  }

  .log-row span[data-label]::before,
  .configured-row span[data-label]::before {
    content: attr(data-label);
    color: var(--muted-foreground);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .history-toolbar,
  .deployment-detail-grid {
    grid-template-columns: 1fr;
  }

  .history-export-actions {
    justify-content: stretch;
  }

  .history-export-actions .button {
    flex: 1 1 180px;
  }

  .deployment-detail-header {
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .login-shell {
    padding: 12px;
  }

  .login-card {
    padding: 22px;
  }

  .sidebar-nav,
  .summary-bar,
  .dashboard-grid,
  .detail-kpis {
    grid-template-columns: 1fr;
  }

  .detail-actions .button,
  .action-row .button {
    flex-basis: 100%;
  }

  .action-row {
    flex-direction: column;
    align-items: stretch;
  }
}
