﻿:root {
  --bg: #0d0d0d;
  --panel: #151515;
  --panel-2: #1d1d1d;
  --panel-3: #242424;
  --ink: #f6f1e7;
  --muted: #9a9285;
  --accent: #d4a04a;
  --accent-2: #4dd4b1;
  --danger: #c95a4b;
  --border: rgba(255, 255, 255, 0.08);
  --card-border: rgba(212, 160, 74, 0.45);
  --shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-orbit {
  position: fixed;
  inset: -20vh -10vw auto auto;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(212, 160, 74, 0.18) 0%, rgba(13, 13, 13, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.2;
  pointer-events: none;
  z-index: 0;
}

.login-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  z-index: 1;
}

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border-radius: 28px;
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--card-border);
}

.login-card h1 {
  margin: 24px 0 8px;
  font-family: 'Fraunces', serif;
  font-size: 32px;
}

.login-card .muted {
  color: var(--muted);
  margin-bottom: 24px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2b2b2b, #141414);
  color: var(--accent);
  font-weight: 700;
  font-size: 18px;
}

.brand-mark.small {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 16px;
}

.brand-title {
  font-weight: 600;
  letter-spacing: 0.5px;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}

.radio-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--ink);
}
.radio-group input[type="radio"] {
  margin: 0;
}

.field input,
.field select,
.field textarea {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--ink);
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(212, 160, 74, 0.6);
  box-shadow: 0 0 0 3px rgba(212, 160, 74, 0.15);
}

.form-error {
  display: none;
  background: rgba(201, 90, 75, 0.15);
  color: var(--danger);
  border: 1px solid rgba(201, 90, 75, 0.4);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 12px;
}

.form-error.is-visible {
  display: block;
}

.login-foot {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
}

.btn-primary {
  width: 100%;
  border: none;
  background: linear-gradient(135deg, #d4a04a, #f0c172);
  color: #2b1a03;
  font-weight: 600;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.btn-ghost {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
}

.btn-ghost:hover {
  border-color: rgba(212, 160, 74, 0.4);
}

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

.btn-ghost.btn-small {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 10px;
}

.btn-ghost.btn-danger {
  color: var(--danger);
  border-color: rgba(201, 90, 75, 0.45);
}

.btn-ghost.btn-danger:hover {
  border-color: rgba(201, 90, 75, 0.7);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.crm-stage-select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--ink);
  font-size: 12px;
  padding: 6px 10px;
  outline: none;
}

.crm-stage-select:focus {
  border-color: rgba(212, 160, 74, 0.6);
  box-shadow: 0 0 0 3px rgba(212, 160, 74, 0.15);
}

.lead-row-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.lead-row-status.is-pending {
  color: #f0c172;
  border-color: rgba(240, 193, 114, 0.35);
  background: rgba(240, 193, 114, 0.12);
}

.lead-row-status.is-success {
  color: #8bd0a2;
  border-color: rgba(139, 208, 162, 0.35);
  background: rgba(139, 208, 162, 0.12);
}

.lead-row-status.is-error {
  color: #e08a83;
  border-color: rgba(224, 138, 131, 0.35);
  background: rgba(224, 138, 131, 0.12);
}

.finance-payable-kpis {
  margin-top: 4px;
}

.finance-payable-kpis .card {
  padding: 14px;
}

.panel-sub {
  background: rgba(16, 16, 16, 0.45);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.finance-import input {
  display: none;
}

.payable-details {
  display: none;
  background: rgba(16, 16, 16, 0.35);
}

.payable-details.is-open {
  display: table-row;
}

.payable-details td {
  padding: 14px;
  font-size: 13px;
  color: var(--muted);
}

.payable-details-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.payable-details-grid strong {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.payable-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.payable-attachments a {
  font-size: 12px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
}

.app-shell {
  display: block;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  background: linear-gradient(180deg, #141414 0%, #101010 100%);
  border-right: 1px solid var(--border);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  overflow-y: auto;
  z-index: 15;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nav-section {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 11px;
  color: var(--muted);
  margin: 8px 0 0;
}

.nav-item {
  text-decoration: none;
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.nav-item:hover {
  border-color: rgba(255, 255, 255, 0.08);
  background: var(--panel-2);
}

.nav-item.active {
  background: var(--panel-3);
  border-color: rgba(212, 160, 74, 0.45);
}

.nav-item.card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-sub {
  font-size: 12px;
  color: var(--muted);
}

.nav-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.nav-logout {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
}

.sidebar-avatar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.avatar-picker {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-frame {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.avatar-frame.has-avatar {
  background: transparent;
}

.avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder {
  color: var(--accent);
  font-weight: 600;
  font-size: 18px;
}

.avatar-action {
  position: relative;
  overflow: hidden;
}

.avatar-action input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.login-avatar {
  margin-top: 18px;
}

.login-avatar .avatar-frame {
  width: 64px;
  height: 64px;
  border-radius: 18px;
}

.nav-pill {
  border: none;
  background: rgba(212, 160, 74, 0.12);
  color: var(--accent);
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.quick-actions-title {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.quick-actions-control {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.quick-actions-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: rgba(212, 160, 74, 0.14);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}

.quick-actions-main:hover {
  background: rgba(212, 160, 74, 0.2);
}

.quick-actions-icon {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(212, 160, 74, 0.22);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 600;
}

.quick-actions-toggle {
  border: 0;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.quick-actions-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.quick-actions-toggle span {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(45deg);
}

.quick-actions-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 15, 15, 0.98);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
  z-index: 4;
}

.quick-actions-item {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}

.quick-actions-item + .quick-actions-item {
  margin-top: 6px;
}

.quick-actions-item:hover {
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.session-pill {
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 12px;
}

.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: rgba(9, 9, 9, 0.75);
  margin-left: 280px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(14, 14, 14, 0.92);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-toggle {
  border: 1px solid var(--border);
  background: transparent;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  gap: 4px;
  place-items: center;
  cursor: pointer;
}

.nav-toggle span {
  width: 18px;
  height: 2px;
  background: var(--ink);
  display: block;
}

.topbar-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 560px;
  margin-left: 12px;
  margin-right: 12px;
  padding: 6px 8px 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
}

.topbar-search input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  outline: none;
}

.topbar-search input::placeholder {
  color: var(--muted);
}

.topbar-search .search-btn {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--primary);
  color: #0b0b0b;
  font-weight: 600;
  cursor: pointer;
}

.page-title {
  font-size: 20px;
  font-weight: 600;
}

.page-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  margin-left: auto;
}

.search-panel .search-info {
  margin: 12px 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.search-panel .search-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  min-width: 0;
}

.search-panel .search-info-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}

.search-panel .search-info-actions .notice {
  margin: 0;
}

.search-panel .search-info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.search-panel .search-info-item strong {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
}

.content {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.view {
  display: none;
  animation: fadeUp 0.4s ease;
}

.view.is-active {
  display: block;
}

.view-header h2 {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-size: 28px;
}

.view-header p {
  margin-top: 6px;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.cards {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.dashboard-charts-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.chart-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chart-frame {
  background: rgba(12, 12, 12, 0.45);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  min-height: 140px;
  overflow: hidden;
}

.chart-frame.chart-list {
  padding: 12px 14px;
}

.chart-svg {
  width: 100%;
  height: 140px;
  display: block;
}

.chart-svg.chart-donut {
  width: 140px;
  height: 140px;
  margin: 0 auto;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.chart-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 18px 8px;
  text-align: center;
}

.chart-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18px, 1fr));
  gap: 8px;
  align-items: end;
  height: 120px;
}

.chart-bar {
  background: linear-gradient(180deg, rgba(77, 212, 177, 0.9), rgba(77, 212, 177, 0.25));
  border-radius: 10px 10px 4px 4px;
  min-height: 6px;
}

.chart-bar.secondary {
  background: linear-gradient(180deg, rgba(212, 160, 74, 0.9), rgba(212, 160, 74, 0.25));
}

.chart-list {
  display: grid;
  gap: 10px;
}

.chart-row {
  display: grid;
  gap: 6px;
}

.chart-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.chart-row-head strong {
  color: var(--ink);
  font-weight: 600;
}

.chart-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.chart-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: var(--accent);
  border-radius: inherit;
}

.crm-extra-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.orders-kpis {
  margin-bottom: 18px;
}

.crm-exec-panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(20, 26, 38, 0.8), rgba(12, 16, 26, 0.68));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.crm-exec-panel::after {
  content: '';
  position: absolute;
  inset: -40% auto auto -20%;
  width: 70%;
  height: 180%;
  background: radial-gradient(circle at 20% 30%, rgba(77, 212, 177, 0.18), transparent 60%);
  pointer-events: none;
}

.crm-exec-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.crm-exec-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.crm-exec-kicker {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  color: var(--muted);
}

.crm-exec-title h3 {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-size: 24px;
}

.crm-exec-progress-card {
  background: rgba(9, 12, 18, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 14px 16px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.crm-exec-progress-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.crm-exec-gap {
  font-size: 13px;
  color: var(--accent);
}

.crm-exec-progress {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.crm-exec-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4dd4b1, #d4a04a);
  transition: width 0.3s ease;
}

.crm-exec-progress-note {
  font-size: 12px;
  color: var(--muted);
}

.crm-exec-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  position: relative;
  z-index: 1;
}

.crm-exec-kpi {
  background: rgba(9, 12, 18, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.crm-exec-kpi span {
  color: var(--muted);
  font-size: 12px;
}

.crm-exec-kpi strong {
  font-size: 20px;
}

.crm-exec-note {
  font-size: 12px;
  color: var(--muted);
}

.card {
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card.highlight {
  border-color: var(--card-border);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card-header h3 {
  margin: 0;
  font-size: 16px;
}

.card-value {
  font-size: 28px;
  font-weight: 600;
}

.card-note {
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
}

.chip {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
}

.mini-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
}

.mini-list .item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.status-line {
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tickets-float {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: linear-gradient(135deg, rgba(28, 28, 28, 0.72), rgba(18, 18, 18, 0.55));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 40;
}

.stock-float {
  left: 24px;
  right: auto;
}

.chat-float {
  right: 24px;
  bottom: 320px;
  width: 380px;
  min-width: 320px;
  min-height: 320px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  resize: both;
  overflow: hidden;
}

.chat-float.is-collapsed {
  min-height: 0;
  height: auto !important;
  width: 260px !important;
  max-width: calc(100vw - 32px);
  min-width: 0;
  resize: none;
}

.chat-float .tickets-float-body {
  flex: 1 1 auto;
  min-height: 0;
}

.chat-room-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-room-row select {
  flex: 1;
  min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--ink);
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
}

.chat-room-row select:focus {
  border-color: rgba(212, 160, 74, 0.6);
  box-shadow: 0 0 0 3px rgba(212, 160, 74, 0.15);
}

.chat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #1b1206;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}

.chat-messages {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  max-height: none;
  min-height: 120px;
  flex: 1 1 auto;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 10px 6px;
  text-align: center;
}

.chat-message {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-message.is-mine {
  align-self: flex-end;
  border-color: rgba(77, 212, 177, 0.35);
  background: rgba(77, 212, 177, 0.12);
}

.chat-message-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
}

.chat-message-body {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.4;
  word-break: break-word;
}

.chat-form textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--ink);
  padding: 10px 12px;
  font-size: 13px;
  resize: none;
  outline: none;
}

.chat-form textarea:focus {
  border-color: rgba(212, 160, 74, 0.6);
  box-shadow: 0 0 0 3px rgba(212, 160, 74, 0.15);
}

.chat-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.chat-actions .btn-primary {
  width: auto;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 10px;
}

.chat-status {
  font-size: 12px;
  color: var(--muted);
  min-height: 16px;
}

.tickets-float-grip {
  width: 54px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  align-self: center;
  cursor: grab;
  touch-action: none;
}

.tickets-float.is-dragging {
  user-select: none;
}

.tickets-float.is-dragging .tickets-float-grip {
  cursor: grabbing;
}

.tickets-float-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tickets-float-title {
  font-weight: 600;
}

.tickets-float-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.tickets-float-controls {
  display: flex;
  gap: 8px;
}

.tickets-float-btn {
  padding: 6px 10px;
  font-size: 12px;
}

.tickets-float-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tickets-float .mini-list {
  margin-top: 0;
  max-height: 220px;
  overflow: auto;
}

.tickets-float-actions {
  display: flex;
  gap: 8px;
}

.tickets-float.is-collapsed .tickets-float-body {
  display: none;
}

.crm-metas-panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(140deg, rgba(26, 34, 49, 0.96), rgba(17, 23, 35, 0.98));
}

.crm-metas-panel::after {
  content: '';
  position: absolute;
  inset: -40% 40% auto -20%;
  height: 140%;
  background: radial-gradient(circle at 30% 40%, rgba(77, 212, 177, 0.18), transparent 70%);
  pointer-events: none;
}

.crm-metas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.crm-metas-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.crm-metas-title h3 {
  margin: 0;
  font-size: 20px;
}

.crm-metas-kicker {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.crm-metas-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}

.crm-metas-btn-icon {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  color: var(--ink);
  font-weight: 600;
}

.crm-metas-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
  gap: 14px;
  align-items: end;
  position: relative;
  z-index: 1;
}

.crm-metas-range {
  display: flex;
  align-items: center;
  gap: 12px;
}

.crm-metas-range input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.crm-metas-range output {
  min-width: 88px;
  text-align: right;
  font-weight: 600;
  color: var(--ink);
}

.crm-metas-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  position: relative;
  z-index: 1;
}

.crm-metas-kpi {
  padding: 12px 14px;
  background: rgba(9, 12, 18, 0.4);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.crm-metas-kpi span {
  font-size: 12px;
  color: var(--muted);
}

.crm-metas-kpi strong {
  font-size: 18px;
}

.crm-metas-mix {
  margin-top: 12px;
}

.crm-metas-hint {
  margin: 0;
  position: relative;
  z-index: 1;
}

body.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 5, 5, 0.7);
  z-index: 60;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
}

.modal-card {
  position: relative;
  width: min(980px, 94vw);
  max-height: 90vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
}

.modal-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.modal-body {
  padding: 20px;
  overflow: auto;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.panel-actions h3 {
  margin: 0;
  font-size: 16px;
}

.panel-actions input,
.panel-actions select {
  min-width: 200px;
}

.panel-meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.data-table th {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.order-items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.item-group {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}

.transfer-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.field-full {
  grid-column: 1 / -1;
}

.transfer-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  margin-top: 4px;
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.check-field input {
  accent-color: var(--accent);
}

.panel .field span {
  color: var(--muted);
  font-size: 12px;
}

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

.notice {
  padding: 12px;
  border-radius: 12px;
  background: rgba(77, 212, 177, 0.1);
  color: var(--accent-2);
  border: 1px solid rgba(77, 212, 177, 0.3);
  font-size: 13px;
}

.notice.warn {
  background: rgba(201, 90, 75, 0.1);
  color: var(--danger);
  border-color: rgba(201, 90, 75, 0.3);
}

.response-output {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color: var(--muted);
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  margin-top: 8px;
}

.badge {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.card,
.panel,
.panel-sub,
.modal-card,
.login-card,
.nav-item.card,
.tickets-float,
.search-panel .search-info,
.topbar-search,
.quick-actions-control,
.quick-actions-menu,
.crm-exec-panel,
.crm-exec-kpi,
.crm-exec-progress-card,
.response-output {
  border-color: var(--card-border);
}

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

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 20;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .main {
    min-height: 100vh;
    margin-left: 0;
  }

  .content {
    padding: 24px 18px 80px;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .topbar-search {
    order: 3;
    width: 100%;
    max-width: none;
    margin: 8px 0 0;
  }

  .topbar-actions {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 16px;
  }

  .crm-metas-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .crm-metas-controls {
    grid-template-columns: 1fr;
  }

  .crm-metas-range {
    flex-direction: column;
    align-items: stretch;
  }

  .crm-metas-range output {
    text-align: left;
  }

  .panel-actions {
    align-items: stretch;
  }

  .panel-actions input,
  .panel-actions select {
    width: 100%;
  }

  .modal-card {
    width: 96vw;
    max-height: 92vh;
  }

  .modal-body {
    padding: 16px;
  }

  .tickets-float {
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
  }

  .stock-float {
    left: 16px;
    right: 16px;
    bottom: 260px;
    width: auto;
  }

  .chat-float {
    left: 16px;
    right: 16px;
    top: 80px;
    bottom: auto;
    width: auto;
    min-width: 0;
    min-height: 240px;
  }

  .tickets-float-controls {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}
