:root {
  --bg: #f6f7fa;
  --surface: #fff;
  --text: #202437;
  --muted: #73788a;
  --border: #e8eaf1;
  --accent: #6538db;
  --soft: #f0ebff;
  --shadow: 0 8px 40px #1d244015;
  --sidebar: 235px;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.5 "Segoe UI",
    system-ui,
    sans-serif;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 3px;
}
a {
  color: var(--accent);
  text-decoration: none;
}
button,
.button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
button:hover,
.button:hover {
  border-color: #b5a1ec;
  background: var(--soft);
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 600;
}
.primary:hover {
  background: #5227bc;
  color: white;
}
.danger {
  color: #ba2e4a;
}
.full {
  width: 100%;
}
.icon-button {
  border: 0;
  padding: 8px 10px;
  background: transparent;
  font-size: 20px;
  position: relative;
}
.muted,
small {
  color: var(--muted);
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 28px;
  letter-spacing: -0.8px;
  line-height: 1.3;
  margin-bottom: 8px;
}
h2 {
  font-size: 18px;
  letter-spacing: -0.4px;
  margin-bottom: 16px;
}
h3 {
  font-size: 14px;
}
input,
select,
textarea {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 7px;
  padding: 9px 11px;
  width: 100%;
}
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #ad94ed;
}
textarea {
  resize: vertical;
  min-height: 75px;
}
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
}
label input,
label select,
label textarea {
  margin-top: 5px;
}
form label {
  margin-bottom: 14px;
}
.sidebar {
  width: var(--sidebar);
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 28px 17px;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  font-weight: 750;
  color: var(--text);
  padding: 0 8px;
}
.brand-logo {
  display: block;
  background: #000;
  object-fit: cover;
  border-radius: 12px;
  max-width: 100%;
}
.sidebar-logo {
  width: 180px;
  height: 120px;
}
.login-logo {
  width: 240px;
  height: 150px;
  margin-bottom: 24px;
}
.brand-mark {
  background: var(--accent);
  color: white;
  font-weight: 800;
  font-size: 36px;
  width: 65px;
  height: 65px;
  border-radius: 18px;
  display: grid;
  place-items: center;
}
.brand-mark.small {
  width: 39px;
  height: 39px;
  border-radius: 12px;
  font-size: 24px;
}
.brand-sub {
  display: block;
  font-size: 9px;
  letter-spacing: 2.4px;
  color: var(--muted);
  line-height: 1.2;
}
.workspace-label {
  font-size: 9px;
  letter-spacing: 1.7px;
  color: var(--muted);
  margin: 42px 12px 12px;
  font-weight: 700;
}
nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  border-radius: 8px;
  padding: 12px;
  margin: 4px 0;
  font-size: 16px;
}
nav a span {
  font-size: 13px;
}
nav a.active {
  color: var(--accent);
  background: var(--soft);
  font-weight: 650;
}
nav a:hover {
  background: var(--bg);
}
.sidebar-bottom {
  margin-top: auto;
}
.sidebar-bottom > a {
  display: block;
  padding: 9px 12px;
  color: var(--muted);
}
.connection {
  font-size: 11px;
  display: flex;
  gap: 7px;
  align-items: center;
  margin: 20px 12px;
  color: var(--muted);
}
.online-dot {
  width: 6px;
  height: 6px;
  background: #37a57a;
  border-radius: 50%;
  display: inline-block;
}
.online-dot.offline {
  background: #e39736;
}
.profile {
  border-top: 1px solid var(--border);
  padding-top: 19px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.profile strong {
  font-size: 12px;
}
.profile small {
  display: block;
  font-size: 10px;
}
.profile form {
  margin-left: auto;
}
.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  color: var(--accent);
  font-weight: 700;
}
.main-shell {
  margin-left: var(--sidebar);
}
.topbar {
  height: 78px;
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 32px;
}
.global-search {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 410px;
  flex: 1;
  font-size: 22px;
  color: var(--muted);
}
.global-search input {
  border: 0;
  background: transparent;
  margin: 0;
  font-weight: 400;
  font-size: 12px;
}
.global-search kbd {
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
#mobile-menu {
  display: none;
}
#content {
  padding: 32px;
  max-width: 1700px;
  margin: auto;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 26px;
}
.eyebrow {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
  margin-bottom: 9px;
}
.page-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}
.date-pill {
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 8px 13px;
  border-radius: 8px;
  font-size: 12px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 18px;
}
.stat-icon {
  color: var(--accent);
  background: var(--soft);
  padding: 5px 9px;
  border-radius: 7px;
  display: inline-block;
  font-size: 16px;
  margin-bottom: 17px;
}
.stat b {
  display: block;
  font-size: 27px;
  line-height: 1.2;
  margin-bottom: 5px;
}
.stat label {
  font-weight: 400;
  color: var(--muted);
  font-size: 11px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(270px, 1fr);
  gap: 22px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 22px;
  margin-bottom: 22px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.card-header h2 {
  margin: 0;
}
.card-header a {
  font-size: 11px;
  font-weight: 600;
}
.empty {
  text-align: center;
  padding: 40px 18px;
  color: var(--muted);
}
.empty strong {
  color: var(--text);
  display: block;
  font-size: 15px;
  margin-bottom: 8px;
}
.empty-symbol {
  font-size: 30px;
  color: #b8a6e7;
  margin-bottom: 12px;
}
.event-row {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  padding: 13px 0;
}
.event-row:last-child {
  border: 0;
}
.event-time {
  background: var(--soft);
  color: var(--accent);
  padding: 7px 10px;
  border-radius: 7px;
  text-align: center;
  font-size: 12px;
  min-width: 65px;
}
.event-info {
  flex: 1;
}
.event-info strong {
  display: block;
  font-size: 12px;
}
.event-info small {
  font-size: 11px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 16px;
  align-items: center;
}
.toolbar input {
  max-width: 250px;
}
.toolbar select {
  width: auto;
  max-width: 210px;
}
.toolbar .spacer {
  flex: 1;
}
.quick-views {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 21px;
}
.quick-views button {
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 20px;
}
.quick-views button.selected {
  color: var(--accent);
  background: var(--soft);
  border-color: #d4c8f2;
}
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  white-space: nowrap;
}
th {
  font-size: 10px;
  letter-spacing: 0.3px;
  color: var(--muted);
  font-weight: 600;
  background: var(--bg);
  padding: 13px 12px;
  text-align: left;
}
td {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
}
tr:hover td {
  background: #faf8ff;
}
td .company {
  font-weight: 650;
  color: var(--text);
  cursor: pointer;
  display: block;
}
td small {
  font-size: 10px;
  display: block;
}
td input[type="checkbox"] {
  width: 16px;
}
.status {
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 5px;
  font-weight: 600;
}
.status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.status-new {
  background: #eef0f5;
  color: #687085;
}
.status-no_answer {
  background: #fff2dd;
  color: #a36a10;
}
.status-refused {
  background: #ffe9ed;
  color: #ba2e4a;
}
.status-callback {
  background: #f0e9ff;
  color: #7541bd;
}
.status-appointment {
  background: #e7efff;
  color: #3c6ec4;
}
.status-quote {
  background: #def5f2;
  color: #1b8582;
}
.status-signed {
  background: #e1f4e9;
  color: #288359;
}
.status-invalid {
  background: #e0e3e8;
  color: #454f5b;
}
.status-check {
  background: #f9f6da;
  color: #8a7817;
}
.priority {
  font-size: 11px;
  color: var(--accent);
  background: var(--soft);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 700;
}
.table-actions {
  display: flex;
  gap: 3px;
}
.table-actions button,
.table-actions a {
  font-size: 17px;
  padding: 3px 6px;
  display: inline-block;
}
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 17px 2px;
  font-size: 11px;
  color: var(--muted);
}
.pagination div {
  display: flex;
  gap: 8px;
}
.badge-count {
  font-size: 9px;
  padding: 1px 5px;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  margin-left: auto;
}
.badge-count:empty {
  display: none;
}
.icon-button .badge-count {
  position: absolute;
  right: 0;
  top: 0;
}
.detail-panel {
  position: fixed;
  inset: 0 0 0 auto;
  width: 550px;
  background: var(--surface);
  box-shadow: var(--shadow);
  z-index: 40;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  padding: 24px;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 20px;
}
.panel-header h2 {
  margin: 0;
}
.detail-title {
  font-size: 26px;
  margin-top: 18px;
}
.detail-meta {
  display: flex;
  gap: 9px;
  align-items: center;
  margin: 12px 0 22px;
}
.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 15px 0 24px;
}
.section {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 20px;
}
.data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.data-grid small {
  display: block;
  font-size: 11px;
}
.data-grid p {
  margin: 3px 0 0;
  word-break: break-word;
}
.note {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 8px;
  margin-top: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.note small {
  display: block;
  margin-bottom: 6px;
}
.warning {
  background: #fff3dc;
  color: #8f6118;
  border: 1px solid #f4dfb6;
  border-radius: 7px;
  padding: 10px 13px;
  margin-bottom: 15px;
  font-size: 12px;
}
.error {
  background: #ffedf1;
  color: #b42c4c;
  padding: 10px;
  border-radius: 7px;
  font-size: 12px;
}
.chat-panel {
  position: fixed;
  right: 22px;
  bottom: 20px;
  width: 380px;
  height: min(650px, 80vh);
  z-index: 45;
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.chat-panel[hidden],
.detail-panel[hidden] {
  display: none;
}
.chat-panel .panel-header {
  margin-bottom: 8px;
}
.chat-messages {
  flex: 1;
  overflow: auto;
  padding: 10px 0;
}
.message {
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 9px;
  margin: 9px 30px 9px 0;
  word-break: break-word;
  white-space: pre-wrap;
  font-size: 12px;
}
.message.mine {
  background: var(--soft);
  margin: 9px 0 9px 30px;
}
.message small {
  display: block;
  font-size: 9px;
  margin-bottom: 4px;
}
.message a {
  display: block;
  margin-top: 7px;
}
#chat-form {
  padding-top: 10px;
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border);
}
#chat-input {
  min-height: 44px;
  height: 44px;
}
.chat-panel button {
  font-size: 11px;
}
dialog {
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  color: var(--text);
  width: min(580px, 94vw);
  max-height: 90vh;
  box-shadow: var(--shadow);
  padding: 24px;
}
dialog::backdrop {
  background: #171c3a60;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}
.form-grid .wide {
  grid-column: 1/-1;
}
.list-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.list-card {
  margin: 0;
  cursor: pointer;
}
.list-card .list-icon {
  color: var(--accent);
  font-size: 26px;
  margin-bottom: 18px;
}
.list-card h2 {
  margin-bottom: 5px;
}
.list-card footer {
  display: flex;
  gap: 7px;
  margin-top: 20px;
}
.list-card footer button {
  font-size: 11px;
  padding: 5px 10px;
}
.agenda-grid {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.agenda-grid.week {
  grid-template-columns: repeat(7, minmax(105px, 1fr));
}
.agenda-grid.month {
  grid-template-columns: repeat(7, minmax(90px, 1fr));
}
.agenda-day {
  background: var(--surface);
  padding: 12px;
  min-height: 140px;
}
.week .agenda-day {
  min-height: 430px;
}
.agenda-day header {
  font-size: 11px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 12px;
}
.agenda-day.today header {
  color: var(--accent);
  font-weight: 700;
}
.agenda-event {
  font-size: 10px;
  background: var(--soft);
  color: var(--accent);
  padding: 8px;
  border-radius: 5px;
  margin: 6px 0;
  cursor: pointer;
  word-break: break-word;
}
.agenda-event.reminder {
  background: #fff3dc;
  color: #a7791f;
}
.agenda-event.absence {
  background: #e9ecf1;
  color: #606a7a;
}
.slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 210px;
  overflow: auto;
  margin: 12px 0;
}
.slots button {
  padding: 6px 9px;
  font-size: 11px;
}
.slots .selected {
  background: var(--accent);
  color: white;
}
.mapping-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.import-sample {
  margin: 20px 0;
  overflow: auto;
  max-height: 220px;
}
.activity-row {
  display: flex;
  gap: 15px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.activity-row time {
  color: var(--muted);
  min-width: 43px;
  font-size: 11px;
}
.activity-row strong {
  font-size: 12px;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.settings-grid .card {
  margin: 0;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: #28223f;
  color: white;
  padding: 12px 20px;
  border-radius: 9px;
  box-shadow: var(--shadow);
  max-width: 90vw;
  font-size: 13px;
}
#toast.error {
  background: #9e2440;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 80% 20%, #eee6ff, transparent 60%), #f7f8fb;
}
.login-card {
  width: 410px;
  padding: 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 18px;
}
.login-card .brand-mark {
  margin-bottom: 30px;
}
.login-card h1 {
  font-size: 32px;
  margin-bottom: 15px;
}
.login-card form {
  margin-top: 26px;
}
.login-footer {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  margin: 25px 0 0;
}
.theme-dark {
  --bg: #171922;
  --surface: #20232e;
  --text: #ebedf5;
  --muted: #a2a8bc;
  --border: #333849;
  --soft: #33284d;
  color-scheme: dark;
}
.theme-dark tr:hover td {
  background: #292437;
}
.theme-dark .status {
  filter: brightness(0.85);
}
.theme-dark .warning {
  background: #47381f;
  color: #f5d091;
}
.theme-dark .login-page {
  background: var(--bg);
}
.select-status {
  font-size: 10px;
  width: 155px;
  padding: 5px;
}
.summary-banner {
  background: var(--soft);
  border: 1px solid #dfd3f7;
  border-radius: 9px;
  padding: 17px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.summary-banner strong {
  color: var(--accent);
  font-size: 13px;
}
.summary-banner p {
  color: var(--muted);
  font-size: 11px;
  margin: 4px 0 0;
}
.summary-banner button {
  font-size: 12px;
}
@media (min-width: 1500px) {
  #content {
    padding: 38px 44px;
  }
}
@media (max-width: 1150px) {
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .list-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .topbar {
    padding: 0 20px;
  }
  .global-search {
    max-width: 260px;
  }
}
@media (max-width: 800px) {
  :root {
    --sidebar: 0px;
  }
  .sidebar {
    width: 235px;
    transform: translateX(-100%);
  }
  body.menu-open .sidebar {
    transform: translateX(0);
  }
  #mobile-menu {
    display: block;
  }
  .topbar {
    height: 65px;
    padding: 0 12px;
  }
  .global-search input {
    width: 100%;
    font-size: 11px;
  }
  .global-search kbd {
    display: none;
  }
  .top-actions {
    gap: 2px;
  }
  .top-actions > a {
    display: none;
  }
  .top-actions .primary {
    font-size: 11px;
    padding: 7px;
  }
  #content {
    padding: 22px 15px;
  }
  .page-header {
    align-items: flex-start;
  }
  .page-header .date-pill {
    display: none;
  }
  h1 {
    font-size: 24px;
  }
  .stats {
    gap: 8px;
  }
  .stat {
    padding: 13px;
  }
  .stat-icon {
    margin-bottom: 10px;
  }
  .stat b {
    font-size: 23px;
  }
  .card {
    padding: 17px;
  }
  .detail-panel {
    width: 100%;
  }
  .list-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .agenda-grid.week,
  .agenda-grid.month {
    overflow: visible;
    min-width: 770px;
  }
  .agenda-scroll {
    overflow: auto;
  }
  .chat-panel {
    width: calc(100% - 24px);
    right: 12px;
    bottom: 12px;
  }
  .mapping-grid {
    grid-template-columns: 1fr 1fr;
  }
  .login-card {
    width: calc(100% - 30px);
    max-width: 410px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .toolbar input {
    max-width: 100%;
  }
  .summary-banner {
    align-items: flex-start;
  }
  .summary-banner button {
    white-space: normal;
  }
}
:root .detail-panel {
  top: 78px;
}
.event-time small {
  display: block;
  font-size: 9px;
}
.pagination {
  flex-wrap: wrap;
  gap: 10px;
}
.pagination div {
  flex-wrap: wrap;
}
@media (max-width: 800px) {
  :root .detail-panel {
    top: 65px;
  }
}
