:root {
  --bg: #0e1624;
  --panel: #162033;
  --panel-soft: #1b2740;
  --text: #f4f7fb;
  --muted: #9fb0c8;
  --accent: #ff7a1a;
  --accent-soft: rgba(255, 122, 26, 0.2);
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 122, 26, 0.16), transparent 34%),
    linear-gradient(180deg, #101b2d 0%, #0c1422 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
}

.dashboard-shell {
  min-height: 100vh;
  padding: 16px;
}

.auth-screen {
  min-height: calc(100vh - 32px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: min(480px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.auth-card--wide {
  width: min(560px, 100%);
}

.auth-brand {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
}

.auth-brand img {
  width: 72px;
  height: 72px;
}

.auth-brand h1 {
  margin: 0 0 6px;
  font-size: 2rem;
}

.auth-brand p,
.auth-empty,
.auth-error {
  margin: 0;
  color: var(--muted);
}

.auth-error {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 80, 80, 0.12);
  border: 1px solid rgba(255, 80, 80, 0.2);
  color: #ffc7c7;
  margin-bottom: 18px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  font-weight: 700;
  font-size: 0.9rem;
}

.auth-form input,
.auth-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0f1726;
  color: var(--text);
  padding: 11px 14px;
  font-size: 0.95rem;
}

.auth-form button,
.primary-button,
.ghost-button,
.mini-button,
.logout-link,
.ghost-link,
.metric-gear,
.download-option {
  border: 0;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.auth-form button,
.primary-button {
  background: linear-gradient(135deg, #ff8c30 0%, #ff6b00 100%);
  color: #fff;
  padding: 10px 12px;
}

.ghost-button,
.mini-button--ghost,
.ghost-link,
.metric-gear {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 10px 12px;
}

.button-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.button-icon svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

.mini-button,
.mini-button--ghost {
  padding: 6px 9px;
  font-size: 0.76rem;
}

.dashboard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

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

.dashboard-brand img {
  width: 56px;
  height: 56px;
}

.dashboard-eyebrow {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.66rem;
  color: #ffcf99;
}

.dashboard-brand h1 {
  margin: 2px 0 0;
  font-size: 2rem;
}

.dashboard-topbar__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.logout-link {
  color: #fff;
  padding: 10px 12px;
}

.dashboard-main {
  display: grid;
  gap: 12px;
}

.filter-ribbon,
.metric-card,
.panel-card,
.insight-chip,
.dashboard-empty,
.dashboard-error {
  background: rgba(18, 28, 46, 0.92);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.filter-ribbon {
  padding: 8px 10px;
}

.filter-ribbon__form {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  flex-wrap: nowrap;
}

.period-picker {
  position: relative;
  flex: 1 1 360px;
  min-width: 300px;
  max-width: 520px;
  display: grid;
  gap: 0;
}

.period-picker__label {
  color: #ffcf99;
  font-size: 0.67rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
}

.period-picker__toggle {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #303947;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 12px;
  font-weight: 850;
  cursor: pointer;
}

.period-picker__toggle svg {
  width: 15px;
  height: 15px;
  color: #ffcf99;
  flex: 0 0 15px;
}

.period-picker__toggle::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -3px;
  opacity: 0.82;
}

.period-picker.is-open .period-picker__toggle::after {
  transform: rotate(-135deg);
  margin-top: 3px;
}

.period-picker__dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  width: min(190px, 94vw);
  display: grid;
  grid-template-columns: 1fr;
  background: #111a2b;
  color: var(--text);
  border: 1px solid rgba(255, 122, 26, 0.2);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.36);
  overflow: hidden;
}

.period-picker.is-calendar-open .period-picker__dropdown {
  width: min(640px, 94vw);
  grid-template-columns: 146px minmax(0, 1fr);
}

.period-picker__dropdown[hidden] {
  display: none;
}

.period-presets {
  display: grid;
  align-content: start;
  background: #101827;
  padding: 8px 0;
}

.period-picker.is-calendar-open .period-presets {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.period-preset {
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 7px 12px;
  font-weight: 700;
  cursor: pointer;
}

.period-preset:hover,
.period-preset:focus-visible,
.period-preset.is-active {
  background: var(--accent-soft);
  color: #ffd6ad;
  outline: 0;
}

.period-calendar {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 12px 12px 8px;
  background: #121d30;
}

.period-calendar[hidden] {
  display: none;
}

.period-calendar__toolbar {
  position: absolute;
  left: 12px;
  top: 14px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.period-calendar__nav {
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #ffcf99;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
}

.period-calendar__nav:hover,
.period-calendar__nav:focus-visible {
  background: var(--accent-soft);
  border-color: rgba(255, 122, 26, 0.34);
  outline: 0;
}

.period-calendar__nav svg {
  width: 18px;
  height: 18px;
}

.period-calendar__months {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.period-calendar__month {
  display: grid;
  gap: 8px;
}

.period-calendar__month > strong {
  text-align: center;
  color: #ffcf99;
  font-size: 0.82rem;
}

.period-calendar__weekdays,
.period-calendar__days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.period-calendar__weekdays span {
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 0;
}

.period-calendar__day {
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: #1b2740;
  color: var(--text);
  font-weight: 750;
  cursor: pointer;
}

.period-calendar__day:hover,
.period-calendar__day:focus-visible {
  background: rgba(255, 122, 26, 0.24);
  border-color: rgba(255, 122, 26, 0.38);
  outline: 0;
}

.period-calendar__day.is-muted {
  color: #6d7b90;
  background: #141f33;
}

.period-calendar__day.is-range {
  background: rgba(255, 122, 26, 0.16);
  color: #ffd6ad;
}

.period-calendar__day.is-start,
.period-calendar__day.is-end {
  background: var(--accent);
  color: #18100a;
  border-radius: 4px;
  border-color: rgba(255, 207, 153, 0.7);
}

.period-calendar__footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.period-calendar__footer span {
  color: #ffcf99;
  font-size: 0.82rem;
  text-align: right;
}

.period-calendar__footer .ghost-button,
.period-calendar__footer .primary-button {
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 0.78rem;
}

.time-range-chip {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.time-range-chip svg {
  width: 15px;
  height: 15px;
  color: var(--accent);
  flex: 0 0 15px;
}

.time-range-chip span {
  color: var(--muted);
  font-size: 0.74rem;
}

.time-range-chip input {
  width: 84px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  font-size: 0.84rem;
  color-scheme: dark;
}

.time-range-chip input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: invert(60%) sepia(88%) saturate(1439%) hue-rotate(347deg) brightness(103%) contrast(101%);
  opacity: 1;
}

.sector-multi {
  position: relative;
  min-width: 210px;
  max-width: 280px;
  flex: 0 0 240px;
}

.sector-multi__toggle {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 9px 11px;
  text-align: left;
  font-weight: 700;
  font-size: 0.86rem;
}

.sector-multi__toggle::after {
  content: "";
  float: right;
  margin-top: 5px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
}

.sector-multi.is-open .sector-multi__toggle::after {
  transform: rotate(-135deg);
  margin-top: 9px;
}

.sector-multi__dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(320px, 92vw);
  max-height: 360px;
  overflow: auto;
  z-index: 30;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #182742;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.4);
  padding: 10px;
}

.sector-dropdown__toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.sector-dropdown__options {
  display: grid;
  gap: 8px;
}

.sector-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  font-size: 0.84rem;
}

.sector-option input {
  margin: 0;
}

.filter-actions {
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
  align-items: center;
  flex-shrink: 0;
}

.filter-actions .ghost-button,
.filter-actions .primary-button {
  padding: 8px 10px;
  font-size: 0.8rem;
}

.summary-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(290px, 1.28fr);
  grid-auto-flow: dense;
}

.metric-card {
  padding: 12px 14px;
  display: grid;
  gap: 6px;
}

.metric-card--accent {
  background: linear-gradient(135deg, rgba(255, 122, 26, 0.24) 0%, rgba(29, 191, 115, 0.14) 100%);
}

.metric-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  color: #ffcf99;
}

.metric-card strong {
  font-size: clamp(1.16rem, 1.6vw, 1.8rem);
}

.metric-card small {
  color: var(--muted);
  font-size: 0.78rem;
}

.metric-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.metric-gear {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.metric-gear svg {
  width: 14px;
  height: 14px;
}

.metric-card--gauge {
  order: -1;
  display: grid;
  gap: 12px;
  grid-column: 6;
  grid-row: 1 / span 2;
  align-content: space-between;
  padding: 14px 16px;
}

.sla-gauge-block {
  display: grid;
  align-items: center;
  gap: 12px;
  justify-items: center;
}

.sla-gauge {
  --score: 0;
  --needle-angle: calc((var(--score) * 1.8deg) - 180deg);
  width: min(100%, 272px);
  height: 142px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
}

.sla-gauge::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 8px;
  width: 256px;
  height: 256px;
  border-radius: 50%;
  transform: translateX(-50%);
  background:
    radial-gradient(circle, #122033 0 52%, transparent 53%),
    conic-gradient(from 270deg, #ef4444 0deg 36deg, #fb923c 36deg 72deg, #facc15 72deg 108deg, #84cc16 108deg 144deg, #16a34a 144deg 180deg, transparent 180deg 360deg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.sla-gauge::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 25px;
  width: 104px;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent 0 9px, #f43f5e 9px 100%);
  clip-path: polygon(0 50%, 12px 0, 100% 50%, 12px 100%);
  transform: translateX(-9px) rotate(var(--needle-angle));
  transform-origin: 9px 50%;
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.34);
  z-index: 3;
}

.sla-gauge__value {
  position: relative;
  z-index: 4;
  min-width: 74px;
  min-height: 44px;
  border-radius: 999px;
  background: #122033;
  border: 7px solid rgba(255, 122, 26, 0.9);
  display: grid;
  place-items: center;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 800;
  margin-bottom: 0;
}

.sla-gauge-meta {
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
}

.sla-gauge-meta strong {
  font-size: 0.96rem;
}

.sla-gauge-meta small {
  font-size: 0.76rem;
  color: var(--muted);
}

.insight-strip {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.insight-chip {
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}

.insight-chip span {
  color: var(--muted);
  font-size: 0.77rem;
}

.insight-chip strong {
  font-size: 1rem;
}

.panel-card {
  padding: 14px;
}

.analytics-grid-5 {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
}

.panel-span-3 {
  grid-column: span 3;
}

.panel-span-2 {
  grid-column: span 2;
}

.analytics-grid-3 {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel-card--chart,
.panel-card--pie {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}

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

.panel-card__header h2 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.panel-card__header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.hour-chart {
  min-height: 300px;
  height: 100%;
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding-top: 4px;
}

.chart-bar {
  flex: 1;
  min-width: 18px;
  align-self: stretch;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 6px;
  justify-items: center;
}

.chart-bar__track {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: flex-end;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.chart-bar__fill {
  width: 100%;
  min-height: 3px;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, #ff8a33 0%, #ff6510 100%);
}

.chart-bar strong {
  font-size: 0.84rem;
}

.chart-bar span {
  font-size: 0.7rem;
  color: var(--muted);
}

.group-pie-wrap {
  display: grid;
  gap: 12px;
  align-items: center;
  align-content: center;
  min-height: 100%;
}

.group-pie-chart {
  width: 176px;
  height: 176px;
  border-radius: 50%;
  margin: 0 auto;
  position: relative;
  display: grid;
  place-items: center;
}

.group-pie-total {
  font-size: 1.06rem;
  font-weight: 800;
}

.group-pie-legend {
  display: grid;
  gap: 6px;
  align-content: start;
}

.pie-legend-row {
  position: relative;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.055);
  font-size: 0.82rem;
}

.pie-legend-row::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: min(320px, 78vw);
  background: #0d1626;
  border: 1px solid var(--border);
  color: #dce8f8;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 0.74rem;
  line-height: 1.35;
  font-weight: 600;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 20;
}

.pie-legend-row:hover::after,
.pie-legend-row:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.pie-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.pie-legend-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pie-legend-value {
  font-size: 0.8rem;
}

.top-items {
  display: grid;
  gap: 8px;
}

.top-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
}

.top-item__rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: #ffb56f;
  font-weight: 900;
  font-size: 0.9rem;
}

.top-item__content {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.top-item__content strong {
  font-size: 0.92rem;
}

.top-item__content span {
  color: var(--muted);
  font-size: 0.8rem;
}

.panel-card--table {
  padding: 14px;
}

.sector-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.sector-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
}

.sector-table th,
.sector-table td {
  border-bottom: 1px solid var(--border);
  padding: 9px 10px;
  text-align: left;
  font-size: 0.82rem;
  white-space: nowrap;
}

.sector-table th {
  color: #ffcf99;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sector-table td {
  color: var(--text);
}

.sector-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.sector-table__empty {
  text-align: center !important;
  color: var(--muted) !important;
  padding: 14px !important;
}

.sort-button {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  padding: 0;
}

.sort-button.is-active {
  color: #ffbe85;
}

.table-pagination {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.table-pagination .ghost-button {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.table-pagination .ghost-button[disabled] {
  opacity: 0.45;
  cursor: default;
}

.table-pagination span {
  color: var(--muted);
  font-size: 0.8rem;
}

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

.tma-row {
  cursor: pointer;
  transition: background 0.2s ease;
}

.tma-row:focus-visible {
  outline: 2px solid rgba(255, 122, 26, 0.45);
  outline-offset: -2px;
}

.tma-status-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.tma-status-tag.tag-efficient {
  background: rgba(56, 189, 132, 0.16);
  border-color: rgba(56, 189, 132, 0.38);
  color: #8ef2c8;
}

.tma-status-tag.tag-attention {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.38);
  color: #ffd08a;
}

.tma-status-tag.tag-break {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.42);
  color: #ffb0b0;
}

body.modal-open {
  overflow: hidden;
}

body.is-exporting-pdf .dashboard-modal,
body.is-exporting-pdf .sector-multi__dropdown {
  display: none !important;
}

.dashboard-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 16px;
}

.dashboard-modal[hidden] {
  display: none;
}

.dashboard-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 18, 0.72);
  backdrop-filter: blur(3px);
}

.dashboard-modal__dialog {
  position: relative;
  width: min(500px, 100%);
  background: #132035;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.5);
  display: grid;
  gap: 12px;
  padding: 14px;
}

.dashboard-modal__dialog--wide {
  width: min(680px, 100%);
}

.dashboard-modal__dialog--downloads {
  width: min(520px, 100%);
}

.dashboard-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.dashboard-modal__header h3 {
  margin: 0;
  font-size: 1rem;
}

.dashboard-modal__close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
}

.dashboard-modal__content {
  display: grid;
  gap: 10px;
}

.dashboard-modal__field {
  display: grid;
  gap: 6px;
}

.dashboard-modal__field > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #ffcf99;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 800;
}

.dashboard-modal__field input {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0f1a2c;
  color: var(--text);
  padding: 8px 10px;
  min-height: 38px;
}

.dashboard-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.download-options {
  display: grid;
  gap: 10px;
}

.download-option {
  width: 100%;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border);
}

.download-option:hover,
.download-option:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  outline: 2px solid rgba(255, 122, 26, 0.28);
  outline-offset: 0;
}

.download-option__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
}

.download-option__icon svg {
  width: 28px;
  height: 28px;
  display: block;
}

.download-option__text {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.download-option__text strong {
  font-size: 0.95rem;
}

.download-option__text small {
  color: var(--muted);
  font-size: 0.8rem;
}

.help-tip {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  color: #ffd7ad;
  font-size: 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: help;
  position: relative;
}

.help-tip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: min(290px, 72vw);
  background: #0d1626;
  border: 1px solid var(--border);
  color: #dce8f8;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.74rem;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 5;
}

.help-tip:hover::after,
.help-tip:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.order-details-meta {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.84rem;
}

.order-details-meta strong {
  color: var(--text);
}

.order-details-items {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.order-item-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
}

.order-item-qty {
  color: #ffbe85;
  font-weight: 800;
  font-size: 0.8rem;
}

.order-item-name {
  color: var(--text);
  font-weight: 700;
  font-size: 0.86rem;
}

.dashboard-empty,
.dashboard-error,
.empty-block {
  padding: 16px;
  text-align: center;
  color: var(--muted);
}

.dashboard-empty strong,
.dashboard-error strong,
.empty-block strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

@media (max-width: 1560px) {
  .filter-ribbon__form {
    flex-wrap: wrap;
    min-height: auto;
  }

  .filter-actions {
    margin-left: 0;
  }
}

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

  .metric-card--gauge {
    order: 0;
    grid-column: span 3;
    grid-row: auto;
  }

  .sla-gauge-block {
    grid-template-columns: minmax(190px, 230px) minmax(0, 1fr);
    justify-items: start;
  }

  .sla-gauge-meta {
    justify-items: start;
    text-align: left;
  }
}

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

  .metric-card--gauge {
    grid-column: span 2;
  }

  .insight-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-grid-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-span-3,
  .panel-span-2 {
    grid-column: span 2;
  }

  .analytics-grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1181px) {
  .group-pie-wrap {
    grid-template-columns: minmax(154px, 190px) minmax(0, 1fr);
    gap: 16px;
  }

  .group-pie-chart {
    width: min(190px, 100%);
    height: auto;
    aspect-ratio: 1;
    margin: 0;
    justify-self: center;
  }

  .group-pie-legend {
    padding-right: 2px;
  }
}

@media (max-width: 900px) {
  .period-picker {
    flex: 1 1 100%;
    max-width: none;
  }

  .period-picker.is-calendar-open .period-picker__dropdown {
    width: min(640px, calc(100vw - 20px));
  }

  .time-range-chip {
    flex: 1 1 auto;
  }
}

@media (max-width: 760px) {
  .dashboard-shell {
    padding: 10px;
  }

  .dashboard-topbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .dashboard-topbar__actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .summary-grid,
  .insight-strip {
    grid-template-columns: 1fr;
  }

  .metric-card--gauge {
    grid-column: auto;
  }

  .sla-gauge-block {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .sla-gauge-meta {
    justify-items: center;
    text-align: center;
  }

  .analytics-grid-5,
  .analytics-grid-3 {
    grid-template-columns: 1fr;
  }

  .panel-span-3,
  .panel-span-2 {
    grid-column: auto;
  }

  .filter-ribbon__form {
    align-items: stretch;
  }

  .filter-actions {
    flex-wrap: wrap;
  }

  .sector-multi {
    flex: 1 1 100%;
    max-width: none;
  }

  .period-picker__dropdown {
    grid-template-columns: 1fr;
  }

  .period-presets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-right: 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.12);
  }

  .period-calendar__months {
    grid-template-columns: 1fr;
  }

  .period-calendar__footer {
    grid-template-columns: 1fr auto auto;
  }

  .period-calendar__footer span {
    grid-column: 1 / -1;
    text-align: left;
  }

  .hour-chart {
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .chart-bar {
    min-width: 30px;
  }
}
