
/* ======================================
   AC7 CRM — Premium UI Design System
   ====================================== */

:root {
  --pu-bg: #0b1220;
  --pu-surface: #131f31;
  --pu-raised: #19283e;
  --pu-sidebar: #0d1727;
  --pu-border: #2b3c53;
  --pu-text: #ecf3ff;
  --pu-muted: #a8bad0;
  --pu-primary: #498fff;
  --pu-primary-soft: rgba(73,143,255,.15);
  --pu-table-head: #1b3454;
  --pu-row-hover: #1b3049;
  --pu-row-alt: #111d2e;
  --pu-input: #101c2c;
  --pu-button: #22334b;
  --pu-shadow: 0 12px 35px rgba(0,0,0,.16);
}

html[data-theme="light"] {
  --pu-bg: #f3f7fc;
  --pu-surface: #ffffff;
  --pu-raised: #f6f9ff;
  --pu-sidebar: #ffffff;
  --pu-border: #dce6f2;
  --pu-text: #1a2b43;
  --pu-muted: #647993;
  --pu-primary: #216adf;
  --pu-primary-soft: rgba(33,106,223,.09);
  --pu-table-head: #e7f0fc;
  --pu-row-hover: #edf5ff;
  --pu-row-alt: #f9fbfe;
  --pu-input: #ffffff;
  --pu-button: #eaf1fa;
  --pu-shadow: 0 10px 30px rgba(30,65,115,.07);
}

/* General */

body {
  font-family:
    "Segoe UI", Tahoma, Arial, sans-serif;
  line-height: 1.65;
}

.app-shell,
.app-shell .main {
  background: var(--pu-bg);
  color: var(--pu-text);
}

.app-shell .muted,
.app-shell .section-header p {
  color: var(--pu-muted);
}

/* Sidebar */

.app-shell .sidebar {
  background: var(--pu-sidebar);
  color: var(--pu-text);
  border-color: var(--pu-border);
}

.sidebar .brand {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--pu-border);
}

.sidebar .brand b {
  color: var(--pu-text);
  font-weight: 800;
  letter-spacing: .2px;
}

.sidebar .brand small,
.sidebar .nav-title {
  color: var(--pu-muted);
}

.sidebar .navigation .nav-button {
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--pu-muted);
  font-weight: 650;
  transition:
    background .18s ease,
    color .18s ease,
    border-color .18s ease;
}

.sidebar .navigation .nav-button:hover {
  background: var(--pu-primary-soft);
  color: var(--pu-text);
}

.sidebar .navigation .nav-button.active {
  background: var(--pu-primary-soft);
  border-color: rgba(87,156,255,.32);
  border-right: 3px solid var(--pu-primary);
  color: var(--pu-text);
  font-weight: 800;
}

.sidebar .navigation .ni {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  width: 23px;
  font-size: 17px;
}

/* Header */

.app-shell .topbar {
  background: var(--pu-surface);
  color: var(--pu-text);
  border-color: var(--pu-border);
  box-shadow: 0 3px 18px rgba(0,0,0,.04);
  gap: 15px;
}

.topbar .crumb {
  color: var(--pu-muted);
  font-size: 12px;
}

.topbar h1 {
  color: var(--pu-text);
  font-size: clamp(22px,2vw,29px);
  font-weight: 800;
  letter-spacing: -.4px;
}

.topbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.topbar-right .ac7-unified-bell {
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(53,118,221,.12);
}

/* Main content */

.app-shell .content {
  color: var(--pu-text);
}

.section-header {
  margin-bottom: 20px;
}

.section-header h2 {
  color: var(--pu-text);
  font-size: clamp(20px,1.8vw,25px);
  font-weight: 800;
}

.section-header p {
  margin-top: 5px;
  font-size: 13px;
}

/* Cards and dashboard */

.app-shell .panel,
.app-shell .kpi,
.app-shell .settings-row {
  background: var(--pu-surface);
  color: var(--pu-text);
  border: 1px solid var(--pu-border);
  border-radius: 16px;
  box-shadow: var(--pu-shadow);
}

.app-shell .kpi {
  position: relative;
  overflow: hidden;
  transition:
    transform .18s ease,
    border-color .18s ease;
}

.app-shell .kpi:hover {
  transform: translateY(-2px);
  border-color: rgba(83,151,255,.45);
}

.app-shell .kpi .glyph {
  color: var(--pu-primary);
}

.app-shell .panel h3 {
  color: var(--pu-text);
  font-weight: 800;
}

/* Buttons */

.app-shell .btn {
  border-radius: 10px;
  border: 1px solid var(--pu-border);
  background: var(--pu-button);
  color: var(--pu-text);
  min-height: 39px;
  font-weight: 700;
  transition:
    background .16s ease,
    border-color .16s ease,
    box-shadow .16s ease;
}

.app-shell .btn:hover {
  border-color: var(--pu-primary);
  background: var(--pu-primary-soft);
}

.app-shell .btn.primary {
  background: linear-gradient(
    115deg,
    #347ae9,
    #2360d2
  );
  border-color: #4289f3;
  color: white;
  box-shadow: 0 5px 15px rgba(40,105,218,.18);
}

.app-shell .btn.primary:hover {
  background: linear-gradient(
    115deg,
    #4b97ff,
    #3476e3
  );
  color: white;
}

.app-shell .btn.danger {
  color: #f16d83;
  border-color: rgba(241,109,131,.36);
}

.app-shell .btn.small {
  min-height: 33px;
  border-radius: 9px;
}

/* Search and form fields */

.app-shell input:not(
  [type="checkbox"]
):not(
  [type="radio"]
):not(
  [type="file"]
),
.app-shell select,
.app-shell textarea,
#modal-host input:not(
  [type="checkbox"]
):not(
  [type="radio"]
):not(
  [type="file"]
),
#modal-host select,
#modal-host textarea {
  background: var(--pu-input);
  color: var(--pu-text);
  border: 1px solid var(--pu-border);
  border-radius: 10px;
}

.app-shell input:focus,
.app-shell select:focus,
.app-shell textarea:focus,
#modal-host input:focus,
#modal-host select:focus,
#modal-host textarea:focus {
  outline: 2px solid rgba(73,143,255,.28);
  outline-offset: 1px;
  border-color: var(--pu-primary);
}

.app-shell input::placeholder,
#modal-host input::placeholder {
  color: var(--pu-muted);
  opacity: .85;
}

.app-shell .toolbar {
  gap: 10px;
  margin-bottom: 18px;
}

.app-shell .toolbar .search {
  min-height: 44px;
}

/* Tables */

.app-shell .data-table-wrap {
  background: var(--pu-surface);
  border: 1px solid var(--pu-border);
  border-radius: 16px;
  box-shadow: var(--pu-shadow);
  overflow-x: auto;
}

.app-shell .data-table-wrap table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.app-shell .data-table-wrap thead th {
  background: var(--pu-table-head);
  color: var(--pu-text);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  padding: 15px 13px;
  border-bottom: 1px solid var(--pu-border);
}

.app-shell .data-table-wrap tbody td {
  color: var(--pu-text);
  padding: 14px 13px;
  border-bottom: 1px solid var(--pu-border);
  vertical-align: middle;
}

.app-shell .data-table-wrap tbody tr:nth-child(even) {
  background: var(--pu-row-alt);
}

.app-shell .data-table-wrap tbody tr:hover {
  background: var(--pu-row-hover);
}

.app-shell .data-table-wrap tbody tr:last-child td {
  border-bottom: none;
}

.app-shell .name-cell {
  color: var(--pu-text);
  font-weight: 800;
}

.app-shell .table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Badges */

.app-shell .pill {
  border-radius: 999px;
  font-weight: 750;
}

.app-shell .pill.dim {
  background: var(--pu-primary-soft);
  color: var(--pu-primary);
  border-color: rgba(73,143,255,.24);
}

.app-shell .ac7-type {
  font-weight: 800;
  border-width: 1px;
}

.app-shell .ac7-staff-tag {
  font-weight: 800;
  border-width: 1px;
}

.app-shell .ac7-result,
.app-shell .ac7-interest {
  font-weight: 800;
  padding: 6px 11px;
}

/* Modals */

#modal-host .modal {
  background: var(--pu-surface);
  color: var(--pu-text);
  border: 1px solid var(--pu-border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 26px 70px rgba(0,0,0,.3);
}

#modal-host .modal-header {
  background: var(--pu-raised);
  border-bottom: 1px solid var(--pu-border);
}

#modal-host .modal-header h2 {
  color: var(--pu-text);
  font-weight: 800;
}

#modal-host .modal-content {
  color: var(--pu-text);
}

#modal-host .modal-footer {
  background: var(--pu-raised);
  border-top: 1px solid var(--pu-border);
}

/* Calendar polish */

.app-shell .ac7-calendar-day {
  transition: background .18s ease;
}

.app-shell .ac7-calendar-day:hover {
  background: var(--pu-row-hover);
}

.app-shell .ac7-event {
  transition:
    transform .16s ease,
    filter .16s ease;
}

.app-shell .ac7-event:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.app-shell .ac7-event:focus-visible {
  outline: 2px solid var(--pu-primary);
  outline-offset: 2px;
}

/* Keyboard accessibility */

.app-shell button:focus-visible,
.app-shell a:focus-visible {
  outline: 2px solid var(--pu-primary);
  outline-offset: 3px;
}

/* Responsive refinements */

@media (max-width: 900px) {
  .app-shell .topbar {
    flex-wrap: wrap;
  }

  .app-shell .toolbar {
    flex-wrap: wrap;
  }

  .app-shell .data-table-wrap {
    max-width: 100%;
  }
}

@media (max-width: 600px) {
  .app-shell .topbar {
    gap: 12px;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .topbar-right {
    gap: 7px;
  }

  .app-shell .btn {
    min-height: 40px;
  }

  .app-shell .data-table-wrap table {
    min-width: 690px;
  }

  .app-shell .section-header h2 {
    font-size: 20px;
  }

  #modal-host .modal {
    border-radius: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell .btn,
  .app-shell .kpi,
  .app-shell .ac7-event {
    transition: none;
    transform: none;
  }
}
