:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --sidebar: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-active: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #16a34a;
  --warning: #d97706;
  --muted: #64748b;
  --border: #e2e8f0;
  --text: #0f172a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 16px rgba(15, 23, 42, 0.04);
  --font: "Inter", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

.hidden { display: none !important; }

/* Auth */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #2563eb 100%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.auth-logo h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.auth-subtitle {
  color: var(--muted);
  margin: 0 0 28px;
}

.auth-card label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
}

.auth-card input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  margin-bottom: 8px;
}

.auth-card input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: var(--primary);
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 20px;
}

.hint code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
}

/* Layout */
.app {
  display: flex;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  height: 100vh;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 20px;
  color: var(--sidebar-active);
  font-weight: 700;
  font-size: 16px;
}

.sidebar-section {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 12px;
  margin: 8px 0 8px;
  color: #475569;
}

.module-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  overflow-y: auto;
}

.module-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.module-btn:hover:not(:disabled) {
  background: var(--sidebar-hover);
  color: var(--sidebar-active);
}

.module-btn.active {
  background: var(--primary);
  color: #fff;
}

.module-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.module-btn .badge-soon {
  margin-left: auto;
  font-size: 10px;
  background: #334155;
  padding: 2px 6px;
  border-radius: 4px;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid #1e293b;
  margin-top: 12px;
  flex-shrink: 0;
}

.user-badge {
  font-size: 12px;
  color: #94a3b8;
  margin: 0 0 8px;
  word-break: break-word;
}

.platform-nav {
  margin-top: 4px;
  flex-shrink: 0;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 28px 32px 40px;
  overflow-y: auto;
  height: 100vh;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.page-description {
  margin: 4px 0 0;
  color: var(--muted);
}

.sub-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.sub-nav-btn {
  padding: 10px 16px;
  border: none;
  background: none;
  font: inherit;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s;
}

.sub-nav-btn:hover:not(:disabled) { color: var(--text); }

.sub-nav-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.sub-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Cards & table */
.card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #f8fafc;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: #f8fafc; }

.mono {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 13px;
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-active { background: #dcfce7; color: #166534; }
.badge-active::before { background: var(--success); }

.badge-expired { background: #fef3c7; color: #92400e; }
.badge-expired::before { background: var(--warning); }

.badge-revoked { background: #fee2e2; color: #991b1b; }
.badge-revoked::before { background: var(--danger); }

.badge-sub-monthly { background: #e0e7ff; color: #3730a3; }
.badge-sub-yearly { background: #f3e8ff; color: #6b21a8; }

.badge-online { background: #dcfce7; color: #166534; }
.badge-online::before { background: #16a34a; }
.badge-offline { background: #f1f5f9; color: #475569; }
.badge-offline::before { background: #94a3b8; }

.badge-paused { background: #ffedd5; color: #9a3412; }
.badge-paused::before { background: var(--warning); }

.badge-no_license { background: #f1f5f9; color: #475569; }
.badge-no_license::before { background: #94a3b8; }

.badge-type-chain,
.badge-type-standalone {
  text-transform: none;
  letter-spacing: 0;
}
.badge-type-chain::before,
.badge-type-standalone::before { display: none; }
.badge-type-chain { background: #dbeafe; color: #1d4ed8; }
.badge-type-standalone { background: #e2e8f0; color: #334155; }

/* Filter bar (licenses / devices / sources / connections) */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
}
.filter-bar input[type="search"],
.filter-bar select {
  min-width: 200px;
  flex: 1 1 220px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: #fff;
  color: var(--text);
}
.filter-bar input[type="search"]:focus,
.filter-bar select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: var(--primary);
}
.filter-bar .filter-count,
.filter-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

/* Dropdown menus */
.dropdown {
  position: relative;
  display: inline-flex;
}
.dropdown-toggle {
  min-width: 34px;
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}
.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  min-width: 200px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.dropdown.open .dropdown-menu { display: flex; flex-direction: column; gap: 2px; }
.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}
.dropdown-item:hover { background: #f1f5f9; }
.dropdown-item-danger { color: var(--danger); }
.dropdown-item-danger:hover { background: #fef2f2; }

.presence-summary {
  margin-bottom: 16px;
}
.presence-summary .mono {
  font-size: 13px;
  word-break: break-all;
  margin: 0 0 8px;
}
.presence-summary .hint {
  color: #64748b;
  font-size: 13px;
  margin: 8px 0 0;
}
.muted { color: #94a3b8; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: #f1f5f9;
  color: var(--text);
}

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

.btn-icon {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
}

.btn-icon:hover { color: var(--text); }

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Forms */
.form-grid {
  display: grid;
  gap: 16px;
}

.form-field label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: #fff;
}

.form-field .row-actions select {
  width: auto;
  flex: 1;
  min-width: 160px;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: var(--primary);
}

.form-field .field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}

/* Placeholder */
.coming-soon {
  padding: 48px 32px;
  text-align: center;
}

.coming-soon-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.coming-soon h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.coming-soon p {
  color: var(--muted);
  max-width: 420px;
  margin: 0 auto;
}

.license-overview {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: overlayIn 0.18s ease;
}

.modal-overlay.closing {
  animation: overlayOut 0.16s ease forwards;
}

.modal {
  position: relative;
  background: var(--surface);
  border-radius: 18px;
  width: 100%;
  max-width: 480px;
  max-height: min(90vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.06),
    0 24px 64px rgba(15, 23, 42, 0.28);
  animation: modalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.modal-wide {
  max-width: min(1280px, 98vw);
  max-height: min(96vh, 980px);
}

.modal.modal-wide .grant-print-matrix {
  width: 100%;
  margin-top: 8px;
}

.modal.modal-wide .grant-print-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.modal.modal-wide .grant-print-card {
  border: 1px solid var(--border, #d8dee6);
  border-radius: 12px;
  background: var(--surface-2, #f7f8fa);
  padding: 12px 14px;
}

.modal.modal-wide .grant-print-card-title {
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 10px;
  color: var(--text, #101828);
}

.modal.modal-wide .grant-print-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px 12px;
}

.modal.modal-wide .grant-print-task-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted, #667085);
}

.modal.modal-wide .grant-print-task-field select.grant-print-task {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.modal-overlay.closing .modal {
  animation: modalOut 0.16s ease forwards;
}

.modal-accent {
  height: 4px;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  flex-shrink: 0;
}

.modal.variant-danger .modal-accent {
  background: linear-gradient(90deg, #dc2626, #f87171);
}

.modal.variant-success .modal-accent {
  background: linear-gradient(90deg, #16a34a, #4ade80);
}

.modal.variant-warning .modal-accent {
  background: linear-gradient(90deg, #d97706, #fbbf24);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px 0;
}

.modal-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.modal-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #eff6ff;
  color: #2563eb;
}

.modal.variant-danger .modal-icon {
  background: #fef2f2;
  color: #dc2626;
}

.modal.variant-success .modal-icon {
  background: #f0fdf4;
  color: #16a34a;
}

.modal.variant-warning .modal-icon {
  background: #fffbeb;
  color: #d97706;
}

.modal-heading-text {
  min-width: 0;
  padding-top: 2px;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.modal-subtitle:empty { display: none; }

.modal-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.modal-close-btn:hover {
  background: #f1f5f9;
  color: var(--text);
}

.modal-body {
  padding: 18px 24px 24px;
  overflow-y: auto;
}

.modal-meta {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 4px;
}

.modal-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}

.modal-meta-row .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-meta-row .value {
  font-weight: 600;
  text-align: right;
  word-break: break-all;
}

.modal-message {
  margin: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.55;
}

.modal-message strong {
  color: var(--text);
}

.confirm-card {
  display: grid;
  gap: 16px;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes overlayOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modalOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(8px) scale(0.98); }
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--sidebar);
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: slideIn 0.25s ease;
}

.toast-error { background: var(--danger); }
.toast-success { background: var(--success); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Stats row */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.stat-card .value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.stat-card .label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

@media (max-width: 768px) {
  .app { flex-direction: column; height: auto; overflow: visible; }
  .sidebar { width: 100%; height: auto; }
  .main { padding: 20px 16px; height: auto; }
}

/* REPORT-R connections (client → server → groups) */
.connections-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.connections-sidebar,
.connections-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px;
  min-height: 240px;
}
.connections-sidebar-header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 12px;
}
.connections-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.connections-panel-header h3 {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 650;
}
.connections-panel-header .muted {
  margin: 0;
  font-size: 13px;
}
.connections-panel-header .row-actions {
  justify-content: flex-end;
}
.connections-client-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(70vh, 720px);
  overflow: auto;
}
.connections-client-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.connections-client-item:hover {
  background: #f8fafc;
  border-color: var(--border);
}
.connections-client-item.active {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
  font-weight: 600;
}
.connections-empty-hint {
  color: var(--muted);
  font-size: 13px;
  padding: 16px 4px;
  line-height: 1.45;
}
.connections-empty {
  padding: 36px 8px;
  text-align: center;
  color: var(--muted);
}
.connections-empty p { margin: 0; }
.connections-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.connections-stats-grid { margin-bottom: 12px; }

.connection-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}
.connection-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.connection-card-main { min-width: 0; flex: 1; }
.connection-card-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}
.connection-card-name {
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
}
.connection-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 12px;
  color: var(--muted);
}
.connection-card-meta strong { color: var(--text); font-weight: 600; }
.connection-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  flex-shrink: 0;
}
.connection-tree {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tree-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 4px;
}
.tree-node-label .btn {
  margin-left: auto;
}
.tree-node {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  padding: 10px 12px;
}
.tree-node-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 8px;
}
.tree-children {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 8px;
  border-left: 2px solid #e2e8f0;
  margin-left: 4px;
}
.tree-group {
  background: #fff;
}
.tree-cash {
  font-size: 13px;
  color: var(--text);
  padding: 4px 0;
}
.tree-cash .mono {
  color: var(--muted);
  font-size: 12px;
}

.license-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.license-cell {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.license-cell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.license-cell-top strong {
  font-size: 13px;
}
.license-cell-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 12px;
  color: var(--muted);
}
.license-cell .btn {
  align-self: flex-start;
}
.licenses-orphan {
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
}
.licenses-orphan-title {
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: 4px;
}
.licenses-orphan .muted {
  margin: 0 0 8px;
  font-size: 12px;
}
.licenses-workspace .connections-layout {
  grid-template-columns: 220px minmax(0, 1fr);
}

@media (max-width: 1100px) {
  .license-grid { grid-template-columns: 1fr; }
}

.inventory-client-count {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.connections-client-item.active .inventory-client-count {
  background: #dbeafe;
  color: #1d4ed8;
}
.inventory-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid #e2e8f0;
}
.inventory-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.inventory-item:first-child {
  padding-top: 0;
}
.inventory-item-main {
  min-width: 0;
}
.inventory-item-title {
  font-weight: 650;
  margin-bottom: 6px;
  word-break: break-all;
}
.inventory-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--muted);
  align-items: center;
}
.inventory-item .row-actions {
  flex-shrink: 0;
  justify-content: flex-end;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  margin-bottom: 10px;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.checkbox-list-nested {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-left: 22px;
  padding-left: 12px;
  border-left: 2px solid #e2e8f0;
}
.grant-server-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.grant-modules {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 2px 22px;
}
.grant-mobilpos-binds {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 6px 0 2px 22px;
  max-width: 520px;
}
.grant-bind-label {
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
}
.grant-kkm-select,
.grant-ordertype-select,
.grant-pricecat-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: #fff;
}
.grant-check-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 160px;
  overflow: auto;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.choice-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  margin-bottom: 8px;
  cursor: pointer;
}
.choice-card input {
  margin-top: 3px;
}
.choice-card span {
  font-weight: 400;
  color: var(--text);
}
.schedule-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.schedule-row input[type="time"] {
  width: auto;
  flex: 1;
}
.schedule-days {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}
.schedule-day {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 400;
}
.net-printer-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 8px 0 12px;
}
.net-printer-row {
  border: 1px solid var(--border, #d8dee6);
  border-radius: 10px;
  background: var(--surface-2, #f7f8fa);
  padding: 12px 14px;
}
.net-printer-row-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #667085);
  margin-bottom: 8px;
}
.net-printer-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.4fr) 104px;
  gap: 10px;
  align-items: end;
}
.net-printer-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted, #667085);
}
.net-printer-field input {
  width: 100%;
  margin: 0;
}
@media (max-width: 720px) {
  .net-printer-fields {
    grid-template-columns: 1fr;
  }
  .net-printer-port {
    max-width: 120px;
  }
}
.grant-module-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.grant-module-chip input {
  margin: 0;
}
.grant-module-chip.is-soon {
  color: var(--muted);
  background: #f8fafc;
}
.grant-module-soon {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--warning);
}
.grant-module-chip:has(input:disabled) {
  opacity: 0.55;
  cursor: default;
}

/* Предпросмотр файла дисплея покупателя */
.display-preview {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.display-preview img,
.display-preview video {
  max-width: 100%;
  max-height: 220px;
  border-radius: 8px;
}

@media (max-width: 960px) {
  .connections-layout { grid-template-columns: 1fr; }
  .connection-card-top { flex-direction: column; }
  .connection-card-actions { width: 100%; justify-content: flex-start; }
}
