:root {
  color-scheme: light;
  --page-bg: #f5f5f7;
  --surface: #ffffff;
  --divider: #d2d2d7;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --danger: #f21a0f;
  --success: #34c759;
  --table-head: #f2f2f7;
  --table-first: #fafafc;
  --row-even: #f7f7f9;
  --row-odd: #ffffff;
  --control-bg: #ffffff;
  --control-border: #d2d2d7;
  --accent-blue: #2680ed;
  --hero-danger-bg: #fff1f0;
  --hero-success-bg: #f0fff4;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: var(--page-bg);
}

a,
button,
input,
select {
  font: inherit;
  color: inherit;
}

.page-shell {
  width: min(calc(100vw - 20px), 2400px);
  margin: 0 auto;
  padding: 10px 0;
}

.app-shell {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 16px;
  overflow: hidden;
}

.app-section {
  position: relative;
  background: var(--surface);
}

.app-section::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--divider);
}

.app-section:last-child::after {
  content: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
}

.brand-copy h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--text);
}

.logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-image {
  display: block;
  width: 132px;
  height: auto;
}

.secondary-button,
.primary-button,
.filter-trigger {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--control-border);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.help-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  background: var(--control-bg);
  color: var(--text);
}

.primary-button {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
}

.primary-button:hover {
  background: #1f6fcb;
  border-color: #1f6fcb;
}

.secondary-button,
.filter-trigger {
  background: var(--control-bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
}

.secondary-button:hover,
.filter-trigger:hover {
  background: #f9f9fb;
}

.hero-card {
  padding: 18px;
}

.hero-card.hero-card-danger {
  background: var(--hero-danger-bg);
}

.hero-card.hero-card-success {
  background: var(--hero-success-bg);
}

.hero-value {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 120px;
  text-align: center;
}

.hero-text {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--text);
}

.hero-number {
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
}

.hero-number-danger {
  color: var(--danger);
}

.hero-number-success {
  color: var(--success);
}

.filters-card {
  padding: 28px 18px;
}

.filters-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(240px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
}

.filter-field {
  display: grid;
  gap: 6px;
}

.filter-field span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.dropdown-filter {
  position: relative;
}

.filter-trigger {
  width: 100%;
  text-align: left;
  position: relative;
  padding-right: 36px;
}

.filter-trigger::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--text-secondary);
  border-bottom: 1.5px solid var(--text-secondary);
  transform: translateY(-70%) rotate(45deg);
}

.filter-trigger[aria-expanded="true"]::after {
  transform: translateY(-30%) rotate(-135deg);
}

.filter-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 10;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--control-border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.filter-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
}

.filter-option:hover {
  background: #f8f8fa;
}

.filter-option input {
  margin-top: 2px;
  accent-color: var(--accent-blue);
}

.filter-option-text {
  display: grid;
  gap: 2px;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
}

.filter-option-text small {
  color: var(--text-secondary);
  font-size: 12px;
}

.native-filter {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.actions {
  display: contents;
}

.report-card {
  padding: 16px 18px 14px;
}

.report-content {
  display: grid;
  gap: 10px;
}

.employee-card {
  border: 1px solid var(--divider);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

.employee-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  padding: 7px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
}

.employee-meta-inline,
.employee-deals-meta,
.employee-main-inline {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--text-secondary);
}

.employee-separator {
  color: var(--text-secondary);
  font-size: 12px;
  flex-shrink: 0;
}

.employee-id-value {
  font-size: 12px;
  font-weight: 400;
  color: var(--text);
}

.employee-id-label {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
}

.employee-main-inline {
  gap: 8px;
  min-width: 0;
}

.employee-name {
  display: inline;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.employee-role {
  display: inline;
  margin-left: 8px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
}

.employee-deals-count {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.employee-deals-label {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
}

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

.deals-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.col-index { width: 64px; }

.col-id {
  width: 110px;
}

.col-title {
  width: auto;
}

.col-category {
  width: 390px;
}

.col-date {
  width: 160px;
}

.deals-table thead th {
  padding: 8px 10px;
  background: var(--table-head);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  line-height: 1.2;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 1px solid var(--divider);
}

.sortable-header {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  width: 100%;
  min-height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  user-select: none;
  cursor: pointer;
  line-height: 1.2;
  text-align: left;
  vertical-align: middle;
}

.sortable-header:hover {
  color: var(--text);
}

.sortable-header-label {
  display: inline-block;
}

.sort-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  margin-left: 4px;
  color: var(--text-secondary);
}

.deals-table tbody tr:first-child td {
  background: var(--table-first);
}

.deals-table tbody tr:nth-child(even) td {
  background: var(--row-even);
}

.deals-table tbody tr:nth-child(odd):not(:first-child) td {
  background: var(--row-odd);
}

.deals-table td {
  padding: 6px 10px;
  border-top: 1px solid #ececef;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
  vertical-align: top;
  color: var(--text);
  word-break: normal;
  overflow-wrap: break-word;
}

.deal-id {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color: var(--text-secondary);
}

.deal-link {
  color: var(--text);
  text-decoration: none;
}

.deal-link:hover {
  text-decoration: underline;
}

.empty-state {
  padding: 22px 16px;
  border: 1px solid var(--divider);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-secondary);
  text-align: center;
  font-size: 14px;
  font-weight: 400;
}

.design-check {
  padding: 8px 0 0;
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
}

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

@media (max-width: 860px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  .employee-summary {
    align-items: flex-start;
  }

  .employee-role {
    display: block;
    margin-left: 0;
  }

  .employee-separator {
    display: none;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(calc(100vw - 20px), 2400px);
  }

  .brand {
    align-items: flex-start;
  }

  .deals-table {
    min-width: 760px;
  }
}


.hero-card-loading {
  background: #ffffff;
}

.loading-stopwatch {
  display: block;
  margin-top: 8px;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  color: #1d1d1f;
}

.loading-hint {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 400;
  color: #6e6e73;
}

.employee-summary-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: #1d1d1f;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.employee-summary-toggle:hover {
  background: #f7f7f9;
}

.employee-chevron {
  margin-left: auto;
  font-size: 18px;
  font-weight: 600;
  color: #6e6e73;
  line-height: 1;
}

.employee-card-collapsed .deals-table-wrap {
  display: none;
}

.deals-table th:first-child,
.deals-table td:first-child {
  white-space: nowrap;
}


.filter-option-action {
  border-bottom: 1px solid #d2d2d7;
  background: #f7f7f9;
}

.employee-expand-label {
  margin-left: auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f2f2f7;
  color: #6e6e73;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.employee-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: 8px;
  border: 1px solid #d2d2d7;
  border-radius: 999px;
  background: #ffffff;
  color: #6e6e73;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}


/* Report interaction fixes */
.hero-card-loading {
  position: relative;
  padding-right: 230px;
}

.loading-progress {
  position: absolute;
  right: 24px;
  top: 50%;
  display: grid;
  gap: 4px;
  transform: translateY(-50%);
  color: #6e6e73;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}

.filter-dropdown {
  z-index: 1000;
}

.page-shell,
.main-card,
.filters,
.filter-group {
  overflow: visible;
}

.filter-empty {
  color: #86868b;
}

.col-index {
  width: 72px;
  min-width: 72px;
}

.deals-table th:first-child,
.deals-table td:first-child {
  white-space: nowrap;
}

.employee-chevron {
  display: inline;
  align-items: initial;
  justify-content: initial;
  width: auto;
  height: auto;
  margin-left: 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #8e8e93;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
}

@media (max-width: 760px) {
  .hero-card-loading {
    padding-right: 0;
  }

  .loading-progress {
    position: static;
    margin-top: 12px;
    transform: none;
  }
}


/* Dropdown and loading progress visibility fix */
.app-shell {
  overflow: visible;
}

.app-section,
.filters,
.filters-grid,
.filter-group {
  overflow: visible;
}

.filter-dropdown {
  z-index: 9999;
  max-height: 360px;
}

.hero-card-loading {
  position: relative;
  padding-right: 260px;
}

.hero-card-loading .loading-progress {
  position: absolute;
  right: 24px;
  top: 50%;
  display: grid;
  gap: 4px;
  transform: translateY(-50%);
  color: #6e6e73;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
}

@media (max-width: 760px) {
  .hero-card-loading {
    padding-right: 0;
  }

  .hero-card-loading .loading-progress {
    position: static;
    margin-top: 12px;
    transform: none;
  }
}


/* Hide old employee chevrons and return loading block to centered text */
.employee-chevron {
  display: none !important;
}

.hero-card-loading {
  padding-right: 0 !important;
}

.hero-card-loading .loading-progress {
  display: none !important;
}
