/* =============================================================
   sobi-dashboard-redesign.css
   Premium dashboard layout — v2
   Requires: CSS custom properties from index.html root vars
   ============================================================= */

/* ── Page wrapper ────────────────────────────────────────────── */
.dash-page {
  /* intentionally unstyled — inherits from main content area */
}

/* ── Hero ────────────────────────────────────────────────────── */
.dash-hero-v2 {
  background: linear-gradient(135deg, rgba(108,99,255,.06) 0%, rgba(56,189,248,.03) 50%, transparent 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 16px;
  overflow: hidden;
  position: relative;
}

.dash-hero-v2::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, var(--accent2) 0%, var(--accent3) 100%);
  border-radius: 0 2px 2px 0;
}

.dash-hero-v2::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(108,99,255,.2) 30%, rgba(56,189,248,.12) 70%, transparent 100%);
  pointer-events: none;
}

/* Hero inner layout */
.dash-hero-v2-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* Greeting text */
.dash-hero-greeting {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.4px;
  margin-bottom: 3px;
  line-height: 1.3;
}

/* Date line */
.dash-hero-date {
  font-size: 11px;
  color: var(--text3);
  font-weight: 500;
  margin-bottom: 6px;
}

/* Summary row */
.dash-hero-summary {
  font-size: 11px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.dash-hero-summary-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.dash-hero-summary-item i {
  font-size: 11px;
  opacity: .65;
}

/* Pills container */
.dash-hero-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ── Status pill ─────────────────────────────────────────────── */
.dash-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.4;
  letter-spacing: .05px;
}

.dash-status-pill.pill-ok {
  background: rgba(52,211,153,.08);
  border-color: rgba(52,211,153,.2);
  color: var(--success);
}

.dash-status-pill.pill-warn {
  background: rgba(251,191,36,.08);
  border-color: rgba(251,191,36,.2);
  color: var(--warn);
}

.dash-status-pill.pill-danger {
  background: rgba(248,113,113,.08);
  border-color: rgba(248,113,113,.2);
  color: var(--danger);
}

.dash-status-pill.pill-info {
  background: rgba(56,189,248,.08);
  border-color: rgba(56,189,248,.18);
  color: var(--accent3);
}

/* ── Pulse dot ───────────────────────────────────────────────── */
.dash-spulse {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
  background: currentColor;
}

.dash-spulse.pulse-anim {
  animation: dashSpulsePulse 2s ease-in-out infinite;
}

@keyframes dashSpulsePulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .35; transform: scale(.75); }
}

/* Light mode hero override */
.light .dash-hero-v2 {
  box-shadow: 0 1px 4px rgba(0,0,0,.07), 0 0 0 1px var(--border);
  background: linear-gradient(135deg, rgba(91,82,232,.035) 0%, rgba(14,165,233,.02) 60%, transparent 100%);
}

/* ── KPI Strip ───────────────────────────────────────────────── */
.dash-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

/* ── KPI Card ────────────────────────────────────────────────── */
.dash-kpi-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
  position: relative;
  overflow: hidden;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
  cursor: default;
}

.dash-kpi-card[onclick] {
  cursor: pointer;
}

.dash-kpi-card[onclick]:hover {
  border-color: rgba(108,99,255,.35);
  box-shadow: 0 4px 16px rgba(0,0,0,.2), 0 0 0 1px rgba(108,99,255,.12);
  transform: translateY(-1px);
}

.dash-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  width: 2px;
  height: 100%;
  background: var(--kpi-color, var(--accent2));
  opacity: .65;
  border-radius: 0 2px 2px 0;
}

/* KPI alert states */
.dash-kpi-card.kpi-warn {
  border-color: rgba(251,191,36,.28) !important;
  box-shadow: 0 0 0 1px rgba(251,191,36,.1) !important;
}

.dash-kpi-card.kpi-warn .dash-kpi-value {
  color: var(--warn);
}

.dash-kpi-card.kpi-danger {
  border-color: rgba(248,113,113,.28) !important;
  box-shadow: 0 0 0 1px rgba(248,113,113,.1) !important;
}

.dash-kpi-card.kpi-danger .dash-kpi-value {
  color: var(--danger);
}

/* KPI card internals */
.dash-kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.dash-kpi-icon-wrap {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--kpi-bg, rgba(108,99,255,.1));
  flex-shrink: 0;
}

.dash-kpi-icon-wrap i {
  font-size: 13px;
  color: var(--kpi-color, var(--accent2));
}

.dash-kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.dash-kpi-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.dash-kpi-sub {
  font-size: 10px;
  color: var(--text3);
  margin-top: 2px;
  font-weight: 400;
}

/* Light mode KPI */
.light .dash-kpi-card {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.light .dash-kpi-card[onclick]:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,.1), 0 0 0 1px rgba(91,82,232,.15);
}

/* ── Main grid ───────────────────────────────────────────────── */
.dash-main-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(295px, 1fr));
  gap: 10px;
  align-items: start;
  margin-bottom: 14px;
}

/* ── Section card ────────────────────────────────────────────── */
.dash-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Section header */
.dash-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  gap: 8px;
  flex-shrink: 0;
}

.dash-section-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.dash-section-title-wrap i {
  font-size: 13px;
  flex-shrink: 0;
}

.dash-section-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .55px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-section-right {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.dash-section-count {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text3);
  background: var(--bg4);
  border: 1px solid var(--border);
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.dash-section-action {
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  font-family: inherit;
  transition: color 120ms, background 120ms;
}

.dash-section-action:hover {
  color: var(--accent2);
  background: rgba(108,99,255,.1);
}

/* Section body */
.dash-section-body {
  flex: 1;
  padding: 4px 6px 6px;
}

.dash-section-body-inner {
  padding: 6px 8px;
}

/* ── Row item ────────────────────────────────────────────────── */
.dash-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 7px;
  cursor: pointer;
  margin-bottom: 1px;
  transition: background 120ms ease;
  min-width: 0;
  position: relative;
}

.dash-row:hover {
  background: var(--bg3);
}

.dash-row:active {
  background: var(--bg4);
}

.dash-row-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-row-icon i {
  font-size: 13px;
}

.dash-row-body {
  flex: 1;
  min-width: 0;
}

.dash-row-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.dash-row-sub {
  font-size: 10px;
  color: var(--text3);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.dash-row-badge {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Server status dot ───────────────────────────────────────── */
.dash-srv-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(52,211,153,.15);
  display: inline-block;
}

.dash-srv-dot.offline {
  background: var(--text3);
  box-shadow: none;
}

/* More indicator */
.dash-more {
  font-size: 10px;
  color: var(--text3);
  padding: 4px 14px 5px;
  display: block;
  border-top: 1px solid var(--border);
  margin: 3px 2px 0;
  opacity: .7;
}

/* ── Health rows ─────────────────────────────────────────────── */
.dash-health-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 6px;
  margin-bottom: 3px;
}

.dash-health-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  min-width: 74px;
  flex-shrink: 0;
}

.dash-health-bar-wrap {
  flex: 1;
  min-width: 0;
}

.dash-health-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--bg4);
  overflow: hidden;
  display: flex;
}

.dash-health-bar-seg {
  height: 100%;
  min-width: 4px;
}

.dash-health-count {
  font-size: 10px;
  font-weight: 700;
  min-width: 36px;
  text-align: end;
  font-variant-numeric: tabular-nums;
  color: var(--text3);
  flex-shrink: 0;
}

.dash-health-count.h-ok     { color: var(--success); }
.dash-health-count.h-warn   { color: var(--warn); }
.dash-health-count.h-danger { color: var(--danger); }

/* ── Light mode sections ─────────────────────────────────────── */
.light .dash-section {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.light .dash-section-head {
  background: var(--bg3);
}

/* ── Compact density mode ────────────────────────────────────── */
body.density-compact .dash-hero-v2        { padding: 12px 16px; margin-bottom: 10px; }
body.density-compact .dash-kpi-strip      { gap: 6px; margin-bottom: 10px; }
body.density-compact .dash-kpi-card       { padding: 10px 12px; }
body.density-compact .dash-kpi-value      { font-size: 22px; }
body.density-compact .dash-main-grid      { gap: 8px; }
body.density-compact .dash-row            { padding: 5px 8px; }
body.density-compact .dash-section-head  { padding: 8px 12px; }
body.density-compact .dash-hero-greeting  { font-size: 14px; }

/* ── Responsive — Mobile (≤700px) ────────────────────────────── */
@media (max-width: 700px) {
  .dash-hero-v2-inner    { flex-direction: column; align-items: flex-start; gap: 10px; }
  .dash-hero-pills       { justify-content: flex-start; }
  .dash-kpi-strip        { grid-template-columns: repeat(2, 1fr); }
  .dash-kpi-value        { font-size: 22px; }
  .dash-main-grid        { grid-template-columns: 1fr; }
  .dash-hero-greeting    { font-size: 14px; }
  .dash-hero-v2          { padding: 14px 16px; }
}

/* ── Responsive — Tablet (701–1100px) ────────────────────────── */
@media (min-width: 701px) and (max-width: 1100px) {
  .dash-kpi-strip  { grid-template-columns: repeat(3, 1fr); }
  .dash-main-grid  { grid-template-columns: repeat(2, 1fr); }
}

/* ── Responsive — Wide (≥1400px) ─────────────────────────────── */
@media (min-width: 1400px) {
  .dash-kpi-strip  { grid-template-columns: repeat(6, 1fr); }
  .dash-main-grid  { grid-template-columns: repeat(3, 1fr); }
}

/* =============================================================
   Sobi Desk operations dashboard pass
   ============================================================= */
.dash-v2 {
  padding: 18px 20px 28px;
  max-width: 1480px;
  margin: 0 auto;
}

.dash-hero-v2 {
  background: var(--bg2);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: none;
}

.dash-hero-v2::before,
.dash-hero-v2::after {
  display: none;
}

.dash-hero-v2-inner {
  align-items: stretch;
}

.dash-command-copy {
  min-width: 260px;
  flex: 1 1 420px;
}

.dash-hero-greeting {
  font-size: 20px;
  letter-spacing: 0;
  margin-bottom: 8px;
}

.dash-hero-date {
  margin-bottom: 5px;
  color: var(--text3);
}

.dash-hero-summary {
  gap: 8px 14px;
  line-height: 1.5;
}

.dash-hero-summary-item {
  color: var(--text2);
}

.dash-hero-summary-item i {
  color: var(--text3);
  font-size: 13px;
}

.dash-hero-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex: 0 1 430px;
}

.dash-action-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.dash-quick-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text2);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}

.dash-quick-action:hover,
.dash-quick-action:focus-visible {
  color: var(--text);
  border-color: var(--accent2);
  outline: none;
}

.dash-quick-action i {
  color: var(--accent2);
  font-size: 14px;
}

.dash-status-pill {
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 10.5px;
}

.dash-kpi-strip {
  grid-template-columns: repeat(6, minmax(132px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.dash-command-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) minmax(260px, 1.2fr);
  gap: 8px;
  margin-bottom: 12px;
}

.dash-command-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg2);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: start;
}

.dash-command-tile:hover,
.dash-command-tile:focus-visible {
  border-color: var(--accent2);
  outline: none;
}

.dash-command-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: rgba(167,139,250,.12);
  color: var(--accent2);
  flex-shrink: 0;
}

.dash-command-icon i {
  font-size: 17px;
}

.dash-command-text {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.dash-command-label {
  color: var(--text3);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .35px;
}

.dash-command-text strong {
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.dash-command-text small {
  color: var(--text3);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-command-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg2);
}

.dash-kpi-card {
  border-radius: 8px;
  padding: 12px;
  min-height: 106px;
  box-shadow: none;
}

.dash-kpi-card[onclick]:hover {
  box-shadow: none;
  transform: none;
}

.dash-kpi-card::before {
  opacity: .9;
}

.dash-kpi-header {
  margin-bottom: 12px;
}

.dash-kpi-icon-wrap {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.dash-kpi-value {
  font-size: 25px;
  letter-spacing: 0;
}

.dash-kpi-label,
.dash-kpi-sub,
.dash-section-title {
  letter-spacing: .3px;
}

.dash-main-grid {
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 10px;
}

.dash-section {
  border-radius: 8px;
  box-shadow: none;
  min-width: 0;
}

.dash-main-grid .dash-section:nth-child(-n+4) {
  border-color: rgba(167,139,250,.25);
}

.dash-section-head {
  background: transparent;
  padding: 11px 12px;
}

.dash-section-title {
  color: var(--text);
  font-size: 11px;
}

.dash-section-body {
  padding: 5px 6px 7px;
}

.dash-row {
  min-height: 42px;
  border-radius: 7px;
}

.dash-row:hover {
  background: var(--bg3);
}

.dash-row-name {
  font-size: 12.5px;
}

.dash-row-sub {
  font-size: 10.5px;
}

.dash-empty {
  min-height: 126px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text3);
  text-align: center;
  font-size: 12px;
}

.dash-empty i {
  font-size: 22px;
  color: var(--success);
}

.dash-pipeline-row {
  padding: 9px 8px;
  border-radius: 7px;
  cursor: pointer;
}

.dash-pipeline-row:hover {
  background: var(--bg3);
}

.dash-pipeline-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--text2);
  font-size: 11.5px;
}

.dash-pipeline-meta strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.dash-pipeline-bar {
  height: 6px;
  border-radius: 99px;
  background: var(--bg4);
  overflow: hidden;
}

.dash-pipeline-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent2);
}

.light .dash-hero-v2,
.light .dash-kpi-card,
.light .dash-section {
  box-shadow: none;
}

@media (max-width: 1100px) {
  .dash-kpi-strip {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
  .dash-command-board {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
  .dash-command-actions {
    grid-column: span 2;
  }
  .dash-main-grid {
    grid-template-columns: repeat(2, minmax(250px, 1fr));
  }
}

@media (max-width: 700px) {
  .dash-v2 {
    padding: 12px 12px 20px;
  }
  .dash-hero-v2 {
    padding: 13px;
  }
  .dash-hero-actions,
  .dash-action-row {
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
  }
  .dash-quick-action {
    flex: 1 1 calc(50% - 7px);
    justify-content: center;
  }
  .dash-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dash-command-board {
    grid-template-columns: 1fr;
  }
  .dash-command-tile {
    min-height: 76px;
  }
  .dash-command-actions {
    grid-column: auto;
  }
  .dash-kpi-card {
    min-height: 98px;
  }
  .dash-main-grid {
    grid-template-columns: 1fr;
  }
}
