:root {
  color-scheme: light;
  --brand-orange: #ea580c;
  --brand-orange-light: #fff7ed;
  --brand-orange-mid: #fed7aa;
  --brand-orange-dark: #c2410c;
  --brand-dark: #3d3d3d;
  --border: #e5e7eb;
  --border-soft: #f3f4f6;
  --text-1: #111827;
  --text-2: #374151;
  --text-3: #6b7280;
  --text-4: #9ca3af;
  --blue: #3b82f6;
  --cyan: #06b6d4;
  --green: #16a34a;
  --amber: #f59e0b;
  --red: #dc2626;
  --violet: #7c3aed;
  --slate: #64748b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  background: #f5f6f8;
  color: #1f2937;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

a {
  text-decoration: none;
}

.hide {
  display: none !important;
}

.dash-app {
  display: grid;
  grid-template-columns: 248px 1fr;
  height: 100vh;
  min-height: 720px;
}

.dash-sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: #fff;
  color: #4b5563;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-soft);
  padding: 18px 18px 16px;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.brand-logo img,
.brand-logo svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-name {
  color: #1f2937;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.2;
}

.brand-sub {
  color: #6b7280;
  font-size: 11px;
}

.brand-badge {
  align-self: flex-start;
  margin-top: 3px;
  border: 1px solid var(--brand-orange-mid);
  border-radius: 4px;
  background: var(--brand-orange-light);
  color: var(--brand-orange-dark);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-soft);
  background: #fafbfc;
  padding: 12px 18px;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  color: var(--text-1);
  font-size: 12px;
  font-weight: 600;
}

.user-role {
  color: var(--text-3);
  font-size: 10px;
}

.dash-nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0 16px;
}

.dash-nav-title {
  padding: 14px 18px 6px;
  color: #9ca3af;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.dash-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border-left: 3px solid transparent;
  color: #4b5563;
  font-size: 12.5px;
  padding: 7px 18px;
  transition: background 0.1s, color 0.1s;
}

.dash-nav-item .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: auto;
  min-height: 0;
  flex-shrink: 0;
  border-radius: 0;
  background: transparent;
  text-align: center;
  font-size: 12px;
  line-height: 1;
}

.dash-nav-item span:not(.icon) {
  min-width: 0;
  flex: 1;
}

.dash-nav-item:hover {
  background: #f9fafb;
  color: #111827;
}

.dash-nav-item.active {
  border-left-color: var(--brand-orange);
  background: var(--brand-orange-light);
  color: var(--brand-orange-dark);
  font-weight: 600;
}

.dash-nav-item b {
  margin-left: auto;
  min-width: 20px;
  border-radius: 10px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 7px;
  text-align: center;
}

.dash-nav-item.active b {
  background: var(--brand-orange-mid);
  color: var(--brand-orange-dark);
}

.dash-main {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
}

.dash-topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  padding: 0 20px;
}

.eyebrow {
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.2;
}

h1 {
  color: var(--text-1);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.25;
}

.dash-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.range-tabs {
  display: inline-flex;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  padding: 2px;
}

.range-tabs button {
  height: 28px;
  border-radius: 5px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  padding: 0 9px;
}

.range-tabs button.active {
  background: var(--brand-orange-light);
  color: var(--brand-orange-dark);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  padding: 0 11px;
}

.btn:hover {
  background: #f9fafb;
}

.btn-primary {
  border-color: var(--brand-orange);
  background: var(--brand-orange);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-orange-dark);
}

.dash-main > .status-banner,
.dash-main > .kpi-grid,
.dash-main > .dash-grid,
.dash-main > .panel {
  margin-left: 18px;
  margin-right: 18px;
}

.status-banner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text-3);
  margin-top: 18px;
  padding: 11px 14px;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 8px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.kpi-card,
.panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.kpi-card {
  min-height: 128px;
  padding: 14px;
}

.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.blue { background: #dbeafe; }
.cyan { background: #cffafe; }
.green { background: #dcfce7; }
.amber { background: #fef3c7; }
.violet { background: #ede9fe; }
.slate { background: #f1f5f9; }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
  padding: 1px 7px;
  white-space: nowrap;
}

.pill.green { background: #dcfce7; color: #166534; }
.pill.blue { background: #dbeafe; color: #1e40af; }
.pill.amber { background: #fef3c7; color: #92400e; }
.pill.gray { background: #f3f4f6; color: #4b5563; }

.kpi-label {
  color: var(--text-3);
  font-size: 11px;
}

.kpi-value {
  color: var(--text-1);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.1;
  margin-top: 2px;
}

.mini-note {
  color: var(--text-4);
  font-size: 11px;
  margin-top: 10px;
}

.spark {
  height: 30px;
  margin-top: 9px;
}

.spark canvas {
  width: 100% !important;
  height: 30px !important;
}

.dash-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.dash-grid.two-one {
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
}

.dash-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  padding: 14px 16px;
  margin-top: 12px;
}

.dash-grid .panel {
  margin: 0;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel h2 {
  color: var(--text-1);
  font-size: 14px;
  font-weight: 700;
}

.panel p {
  color: var(--text-3);
  font-size: 11px;
  margin-top: 2px;
}

.legend {
  display: flex;
  gap: 12px;
  color: var(--text-3);
  font-size: 11px;
}

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

.legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.blue-bg { background: var(--brand-orange); }
.cyan-bg { background: #3d3d3d; }

.chart-box {
  position: relative;
  height: 220px;
}

.chart-box.tall {
  height: 245px;
}

.chart-box canvas {
  width: 100% !important;
  height: 100% !important;
}

.service-score-panel .panel-head {
  align-items: flex-start;
}

.service-overall {
  align-items: baseline;
  color: var(--text-1);
  display: flex;
  gap: 4px;
}

.service-overall strong {
  font-size: 34px;
  letter-spacing: -0.8px;
  line-height: 1;
}

.service-overall span {
  color: var(--text-4);
  font-size: 12px;
}

.service-score-grid {
  display: grid;
  gap: 12px 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 8px;
}

.service-score-top {
  align-items: center;
  color: var(--text-3);
  display: flex;
  font-size: 11px;
  justify-content: space-between;
  margin-bottom: 6px;
}

.service-score-top strong {
  color: var(--text-1);
  font-size: 13px;
}

.donut-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 170px;
}

.donut-wrap.small {
  min-height: 150px;
}

.donut-wrap canvas {
  width: 150px !important;
  height: 150px !important;
  max-width: 150px;
  max-height: 150px;
}

.donut-wrap.small canvas {
  width: 132px !important;
  height: 132px !important;
  max-width: 132px;
  max-height: 132px;
}

.status-panel,
.priority-panel {
  display: flex;
  flex-direction: column;
}

.status-panel .donut-wrap,
.priority-panel .donut-wrap {
  flex: 1;
  min-height: 205px;
}

.status-panel .donut-wrap canvas,
.priority-panel .donut-wrap canvas {
  width: 176px !important;
  height: 176px !important;
  max-width: 176px;
  max-height: 176px;
}

.direction-panel .donut-wrap canvas {
  width: 142px !important;
  height: 142px !important;
  max-width: 142px;
  max-height: 142px;
}

.donut-center {
  position: absolute;
  display: grid;
  place-items: center;
}

.donut-center strong {
  color: var(--text-1);
  font-size: 22px;
  line-height: 1;
}

.donut-center span {
  color: var(--text-3);
  font-size: 11px;
}

.mini-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mini-box {
  border-radius: 8px;
  background: #fafbfc;
  padding: 8px;
  text-align: center;
}

.mini-box strong {
  display: block;
  color: var(--text-1);
  font-size: 15px;
}

.mini-box span {
  color: var(--text-3);
  font-size: 10px;
}

.bar-list,
.metric-bars {
  display: grid;
  gap: 11px;
}

.bar-row-top,
.metric-row-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-2);
  font-size: 12px;
  margin-bottom: 6px;
}

.bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #f3f4f6;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-orange);
}

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

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}

th {
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 9px 11px;
  text-align: left;
  text-transform: uppercase;
}

td {
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-2);
  padding: 11px;
}

tr:last-child td {
  border-bottom: 0;
}

.agent {
  display: flex;
  align-items: center;
  gap: 9px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, var(--brand-orange));
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.heatmap {
  display: grid;
  grid-template-columns: 38px repeat(24, minmax(0, 1fr));
  gap: 4px;
  overflow-x: auto;
}

.heat-label,
.heat-hour {
  color: var(--text-4);
  font-size: 10px;
}

.heat-label {
  display: flex;
  align-items: center;
}

.heat-hour {
  text-align: center;
}

.heat-cell {
  height: 20px;
  border-radius: 5px;
  background: rgba(234, 88, 12, 0.08);
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dash-grid.two-one,
  .dash-grid.three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .dash-app {
    grid-template-columns: 1fr;
    height: auto;
  }

  .dash-sidebar {
    height: auto;
  }

  .dash-main {
    display: block;
    overflow: visible;
  }

  .dash-topbar,
  .status-banner {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .dash-main > .status-banner,
  .dash-main > .kpi-grid,
  .dash-main > .dash-grid,
  .dash-main > .panel {
    margin-left: 12px;
    margin-right: 12px;
  }
}
