﻿:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #f3f6fa;
  --text: #111827;
  --muted: #687386;
  --line: #dbe3ee;
  --blue: #2aabee;
  --blue-dark: #1687c9;
  --green: #14b87a;
  --orange: #f97316;
  --red: #ef4444;
  --shadow: 0 18px 45px rgba(17, 24, 39, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.auth-screen.hidden {
  display: none;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-logo {
  width: 50px;
  height: 42px;
}

.auth-card h1 {
  margin: 4px 0 0;
  font-size: 28px;
}

.auth-card p {
  margin: 0 0 4px;
  color: var(--muted);
}

.auth-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.auth-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
}

.password-toggle:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.auth-error {
  margin: -2px 0 0;
  color: #b42318;
  font-size: 13px;
  font-weight: 800;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  font-size: 20px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 36px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0;
}

.tenant {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 700;
}

.tenant-switcher {
  display: grid;
  gap: 8px;
}

.tenant-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tenant-select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 6px 8px;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 30px;
}

.nav-item {
  border: 0;
  border-radius: 12px;
  padding: 11px 12px;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
}

.nav-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.nav-badge.hidden {
  display: none;
}

.nav-item:hover, .nav-item.active {
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 700;
}

.sidebar-status {
  position: absolute;
  right: 22px;
  bottom: 22px;
  left: 22px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--orange);
}

.dot.connected { background: var(--green); }
.dot.error { background: var(--red); }

.sidebar-status strong { display: block; }
.sidebar-status p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

.main {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 34px; line-height: 1.12; }
h2 { margin-bottom: 0; font-size: 20px; }

.topbar-actions, .add-row, .filterbar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.primary-button, .ghost-button, .danger-button {
  min-height: 40px;
  border-radius: 12px;
  padding: 0 16px;
  border: 1px solid transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.primary-button {
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

.primary-button:hover { background: var(--blue-dark); }

.ghost-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.danger-button {
  background: #fff;
  border-color: rgba(238, 56, 43, 0.35);
  color: var(--red);
  font-weight: 700;
}

.danger-button:hover {
  background: rgba(238, 56, 43, 0.08);
  border-color: rgba(238, 56, 43, 0.55);
}

.danger { color: var(--red); }

.csv-export-button {
  min-height: 40px;
  border: 1px solid rgba(20, 184, 122, 0.28);
  border-radius: 12px;
  padding: 0 16px;
  background: #dcfce7;
  color: #166534;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  white-space: nowrap;
}

.csv-export-button:hover {
  background: #bbf7d0;
  border-color: rgba(20, 184, 122, 0.42);
}

.log-path {
  margin: -4px 0 2px;
  padding: 9px 11px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.view { display: none; }
.view.active { display: block; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card, .panel, .table-panel, .balance-hero, .plans article {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi-card {
  padding: 20px;
}

.kpi-card span, .panel-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.kpi-card strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
  line-height: 1;
}

.kpi-value {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-top: 10px;
}

.kpi-value strong {
  margin-top: 0;
}

.kpi-value em {
  padding-bottom: 3px;
  color: var(--muted);
  font-size: 15px;
  font-style: normal;
  font-weight: 800;
}

.kpi-card p { margin: 10px 0 0; color: var(--muted); }

.dashboard-grid, .split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
  gap: 16px;
  margin-top: 16px;
}

#view-my-chat .split-grid {
  grid-template-columns: minmax(360px, 0.85fr) minmax(420px, 1.15fr);
  align-items: start;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.settings-tab {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
}

.settings-tab.active {
  border-color: rgba(42, 171, 238, 0.45);
  background: rgba(42, 171, 238, 0.1);
  color: var(--blue-dark);
}

.settings-panels {
  margin-top: 16px;
  max-width: 760px;
}

.settings-tab-panel {
  display: none;
}

.settings-tab-panel.active {
  display: grid;
}

.hidden {
  display: none !important;
}

.panel {
  padding: 20px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
  margin-bottom: 18px;
}

.chart-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.chart-controls select,
.chart-controls input {
  min-height: 36px;
  width: auto;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 700;
}

.date-range {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

#qrStatus.connection-status {
  color: var(--muted);
  font-size: 20px;
  line-height: 1.1;
  font-weight: 800;
  text-transform: lowercase;
}

#qrStatus.connection-status.connected { color: var(--green); }
#qrStatus.connection-status.disconnected { color: var(--red); }
#qrStatus.connection-status.pending { color: var(--orange); }

.chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 10px;
  height: 250px;
  padding: 16px;
  border-radius: 12px;
  background: var(--surface-soft);
  overflow-x: auto;
}

.bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  height: 100%;
  gap: 8px;
}

.bar i {
  display: block;
  min-height: 8px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, var(--blue), #86d8ff);
}

.bar span {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

.funnel {
  display: grid;
  gap: 12px;
}

.funnel div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 17px;
  border-radius: 12px;
  background: var(--surface-soft);
}

.funnel b { font-size: 26px; }
.funnel span { color: var(--muted); font-weight: 700; }

.filterbar {
  margin-bottom: 16px;
}

.chat-group-form {
  margin-top: 10px;
  margin-bottom: 16px;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.15);
}

.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.kanban-column {
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  padding: 12px;
}

.kanban-column h2 {
  display: flex;
  justify-content: space-between;
  margin: 4px 4px 12px;
  font-size: 16px;
}

.lead-card {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.lead-card p { margin: 0; }
.lead-meta { color: var(--muted); font-size: 12px; }
.lead-summary { font-weight: 700; }
.lead-text { color: #374151; }

.lead-link {
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.lead-link:hover { text-decoration: underline; }

.source-link {
  color: var(--text);
  text-decoration: none;
}

.source-link:hover {
  color: var(--blue-dark);
  text-decoration: underline;
}

.inline-link {
  margin-left: 8px;
  border: 0;
  border-radius: 8px;
  padding: 3px 7px;
  background: rgba(42, 171, 238, 0.1);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
}

.inline-link:hover {
  background: rgba(42, 171, 238, 0.18);
}

.chat-source-cell {
  display: grid;
  grid-template-columns: 18px 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.drag-handle {
  color: var(--muted);
  cursor: grab;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -2px;
  user-select: none;
}

.chat-row-disabled {
  opacity: 0.55;
}

.chat-group-row td {
  padding: 6px 16px;
  background: #eef6ff;
}

.chat-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--blue-dark);
  font-size: 12px;
  line-height: 1.2;
  text-transform: uppercase;
}

.layout-drop-row td {
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 42px;
  height: 24px;
  align-items: center;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.15s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.2);
  transition: transform 0.15s ease;
}

.switch input:checked + span {
  background: var(--green);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 0 6px 6px 0;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card-actions button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  background: var(--surface-soft);
  color: var(--text);
}

.add-row input { max-width: 540px; }

.table-panel {
  margin-top: 16px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

th:nth-child(3),
th:nth-child(4),
th:nth-child(5),
th:nth-child(6),
.count-cell {
  width: 88px;
  text-align: center;
}

th:nth-child(7),
th:nth-child(8) {
  width: 150px;
}

td:last-child { text-align: right; }

.row-actions {
  display: inline-flex;
  gap: 8px;
}

.row-actions button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  background: var(--surface);
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.22);
}

.dialog-panel {
  width: min(760px, calc(100vw - 28px));
  height: 100vh;
  padding: 20px;
  overflow: hidden;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.dialog-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.dialog-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.dialog-title h2 {
  margin: 4px 0 0;
  font-size: 24px;
}

.dialog-title button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--surface);
}

.dialog-messages {
  display: grid;
  gap: 10px;
  height: calc(100vh - 94px);
  overflow: auto;
  padding-right: 4px;
}

.dialog-message {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.dialog-message p {
  margin: 10px 0;
  white-space: pre-wrap;
}

.dialog-message-head,
.dialog-message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dialog-message-head span,
.dialog-message-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.dialog-status {
  border-radius: 999px;
  padding: 3px 8px;
}

.dialog-status.passed {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

.dialog-status.received {
  background: rgba(42, 171, 238, 0.12);
  color: var(--blue-dark);
}

.dialog-status.skipped {
  background: rgba(148, 163, 184, 0.18);
  color: #475569;
}

.dialog-status.error {
  background: #fee2e2;
  color: #b91c1c;
}

.error-log-entry {
  border-left: 3px solid #ef4444;
}

.error-log-content {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 10px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff7f7;
  color: var(--text);
  font: 12px/1.5 Consolas, "Courier New", monospace;
}

.dialog-message-meta a {
  color: var(--blue-dark);
  text-decoration: none;
}

.dialog-diagnostics {
  margin-top: 10px;
}

.dialog-diagnostics summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.dialog-diagnostics pre {
  max-height: 220px;
  margin: 8px 0 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  white-space: pre-wrap;
}

.form-panel {
  display: grid;
  gap: 13px;
}

#tagForm {
  gap: 10px;
  padding: 16px;
}

#tagForm .panel-heading {
  margin-bottom: 6px;
}

#tagForm input,
#tagForm textarea {
  padding: 9px 10px;
}

#tagName {
  min-height: 40px;
}

#tagDescription {
  min-height: 190px;
  resize: vertical;
}

#tagKeywords {
  min-height: 46px;
  max-height: 88px;
  resize: vertical;
}

#tagForm .primary-button {
  margin-top: 2px;
}

.settings-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}

.settings-subtitle {
  margin: 0 0 4px;
  font-size: 16px;
}

.service-action {
  display: grid;
  grid-template-columns: minmax(190px, max-content) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.service-path {
  padding: 9px 11px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.service-reset-block {
  display: grid;
  gap: 12px;
  margin-top: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.service-reset-block .panel-heading {
  margin-bottom: 0;
}

.service-reset-block .muted {
  margin-bottom: 0;
}

.service-reset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bot-chat-list {
  display: grid;
  gap: 8px;
}

.bot-chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.bot-chat-item b { display: block; }
.bot-chat-item span { color: var(--muted); font-size: 12px; }

.bot-chat-item button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  background: var(--surface);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

label input, label textarea { color: var(--text); font-weight: 400; }

.checkbox {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox input { width: auto; }

.color-picker-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: max-content;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #2AABEE;
  box-shadow: 0 0 0 1px var(--line), 0 6px 16px rgba(17, 24, 39, 0.12);
}

.native-color-input {
  position: absolute;
  inset: 0;
  width: 32px;
  height: 32px;
  opacity: 0;
  pointer-events: none;
}

.tag-list {
  display: grid;
  gap: 10px;
}

.tag-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.tag-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tag-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.balance-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 26px;
}

.balance-hero h2 {
  margin: 4px 0 8px;
  font-size: 34px;
}

.balance-hero p { color: var(--muted); max-width: 600px; }

.balance-ring {
  width: 160px;
  height: 160px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--blue) var(--balance, 0%), #e6edf5 0);
}

.balance-ring span {
  display: grid;
  place-items: center;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: var(--surface);
  font-size: 26px;
  font-weight: 800;
}

.plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.plans article { padding: 18px; }
.plans b { display: block; font-size: 18px; }
.plans span { display: block; margin-top: 8px; color: var(--blue-dark); font-weight: 800; }
.plans p { margin: 10px 0 0; color: var(--muted); }

.admin-panel {
  overflow: hidden;
}

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

.admin-table {
  min-width: 1180px;
}

.admin-table th,
.admin-table td {
  white-space: nowrap;
  text-align: center;
}

.admin-table th:nth-child(2),
.admin-table td:nth-child(2),
.admin-table th:nth-child(3),
.admin-table td:nth-child(3) {
  text-align: left;
}

.admin-check {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
}

.admin-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.admin-root-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e0f2fe;
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 800;
}

.qr-panel {
  display: grid;
  gap: 12px;
  justify-items: start;
}

#view-settings .settings-tab-panel:not(.active) {
  display: none;
}

#view-settings .settings-tab-panel.active {
  display: grid;
}

.qr-box {
  display: grid;
  place-items: center;
  width: 300px;
  max-width: 100%;
  aspect-ratio: 1;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  overflow: hidden;
}

.qr-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  background: #fff;
}

.qr-placeholder {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  border-radius: 24px;
  background: #fff;
  color: var(--muted);
  font-size: 26px;
  font-weight: 900;
}

.muted { color: var(--muted); }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    display: grid;
    gap: 16px;
  }
  .nav { grid-template-columns: repeat(3, 1fr); margin-top: 0; }
  .sidebar-status { position: static; }
  .kpi-grid, .dashboard-grid, .split-grid, .kanban, .plans {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main { padding: 18px; }
  .topbar, .topbar-actions, .add-row, .filterbar, .balance-hero {
    align-items: stretch;
    flex-direction: column;
  }
  .nav { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 28px; }
}
