:root {
  --bg: #0b1021;
  --card-bg: #161b34;
  --border: #262c4f;
  --text: #f7f8ff;
  --muted: #9aa4bf;
  --accent: #ff8c42;
  --danger: #ff5370;
  --success: #58e1a3;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px clamp(16px, 4vw, 48px);
  background: rgba(11, 16, 33, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.brand-link {
  text-decoration: none;
  color: inherit;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff8c42, #ff427b);
  display: grid;
  place-items: center;
  font-weight: 600;
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
}

.user-meta {
  text-align: right;
}

.user-name {
  font-weight: 600;
}

.user-email {
  font-size: 12px;
  color: var(--muted);
}

.page-container {
  padding: clamp(16px, 4vw, 48px);
  max-width: 1200px;
  margin: 0 auto;
}

.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.flash {
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.flash-success {
  border: 1px solid rgba(88, 225, 163, 0.4);
}
.flash-danger {
  border: 1px solid rgba(255, 83, 112, 0.4);
}
.flash-info {
  border: 1px solid rgba(66, 167, 255, 0.4);
}
.flash-warning {
  border: 1px solid rgba(255, 159, 67, 0.4);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

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

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

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  min-width: 320px;
}

.metric-card {
  background: var(--card-bg);
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.metric-label {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 6px;
}

.metric-value {
  font-size: 26px;
  font-weight: 600;
  margin: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.card {
  background: var(--card-bg);
  border-radius: 24px;
  border: 1px solid var(--border);
  padding: 24px;
}

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

.call-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.call-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.call-item {
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.01);
}

.transcript-panel {
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.01);
  min-height: 200px;
}

.transcript-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.call-meta {
  margin-bottom: 12px;
}

.call-number {
  margin: 0;
  font-weight: 600;
  font-size: 16px;
}

.call-name {
  margin: 4px 0 0;
  color: #ffffff;
  font-size: 15px;
  font-weight: 500;
}

.transcript-header {
  margin-bottom: 12px;
}

.transcript-title {
  margin: 0 0 4px;
  font-weight: 600;
  font-size: 15px;
}

.transcript-summary-block {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.transcript-summary-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

.transcript-content {
  margin-bottom: 12px;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.3;
  font-size: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.transcript-content p {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.transcript-content pre {
  margin: 0;
  padding: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

audio {
  width: 100%;
  margin: 12px 0;
}

.call-actions,
.transcript-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 500;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
}

.primary-btn {
  background: linear-gradient(135deg, #ff8c42, #ff427b);
}

.danger-btn {
  background: rgba(255, 83, 112, 0.15);
  color: #ff9fb3;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.08);
}

.log-table table,
.users-table table {
  width: 100%;
  border-collapse: collapse;
}

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

.users-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.action-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.statistics-table {
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.01);
}

.statistics-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.statistics-header {
  flex-wrap: wrap;
  gap: 16px;
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sort-chip {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: 0.7;
}

.sort-chip.is-active {
  background: rgba(255, 255, 255, 0.15);
  opacity: 1;
}

.sort-arrow {
  font-size: 14px;
}

.call-direction-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.manager-dropdown {
  position: relative;
  min-width: 200px;
}

.manager-dropdown__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: space-between;
  padding-right: 16px;
}

.manager-dropdown__chevron {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #fff;
  opacity: 0.7;
  transition: transform 120ms ease;
}

.manager-dropdown.is-open .manager-dropdown__chevron {
  transform: rotate(180deg);
}

.manager-dropdown__menu {
  list-style: none;
  margin: 8px 0 0;
  padding: 6px;
  position: absolute;
  right: 0;
  min-width: 220px;
  background: rgba(22, 27, 52, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 25;
  max-height: 280px;
  overflow-y: auto;
}

.manager-dropdown.is-open .manager-dropdown__menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.manager-dropdown__option {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
}

.manager-dropdown__option:hover,
.manager-dropdown__option:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.manager-dropdown__option.is-active {
  background: rgba(255, 255, 255, 0.15);
}

.statistics-table table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.staff-report thead th {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
}

.staff-report thead tr:first-child th {
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.staff-report tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}

.staff-report tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.staff-report__summary {
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600;
}

.staff-report__summary td:first-child {
  text-align: left;
}

.staff-report__summary-caption {
  display: block;
  font-size: 12px;
}

.manager-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
}

.manager-chip {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

.number-cell {
  font-weight: 600;
  letter-spacing: 0.04em;
}

.sticky-col {
  text-align: left !important;
}

.user-form {
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: uppercase;
}

.badge-info {
  background: rgba(66, 167, 255, 0.2);
}

.badge-warning {
  background: rgba(255, 159, 67, 0.2);
}

.badge-danger {
  background: rgba(255, 83, 112, 0.2);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 15, 0.86);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.is-open {
  display: flex;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 24px;
  border: 1px solid var(--border);
  max-width: 640px;
  width: 100%;
  padding: 24px;
}

.close-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
}

.login-page .top-bar {
  justify-content: center;
}

.login-card {
  max-width: 360px;
  margin: 80px auto;
  padding: 32px;
  background: var(--card-bg);
  border-radius: 24px;
  border: 1px solid var(--border);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.search-form {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 600px;
  flex-wrap: wrap;
  align-items: center;
}

.search-form--stacked {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  max-width: 100%;
}

.search-form--stacked .search-row {
  width: 100%;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.search-form--stacked .search-row .search-input {
  flex: 1;
}

.filter-group {
  display: flex;
  gap: 8px;
}

.date-input {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  min-width: 140px;
}

.date-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}

.date-input::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.7;
  cursor: pointer;
}

.date-input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.pagination-info {
  color: var(--muted);
  font-size: 14px;
}

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

.pagination-controls button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .call-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .card-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-form {
    max-width: 100%;
  }
  
  .filter-group {
    width: 100%;
    flex-direction: column;
  }
  
  .date-input {
    width: 100%;
  }

  .call-actions,
  .transcript-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

