:root {
  color-scheme: dark;
  --bg: #060b12;
  --panel: rgba(2, 6, 14, 0.94);
  --panel-soft: rgba(5, 12, 24, 0.92);
  --ink: #f5f7fb;
  --muted: #9aa8ba;
  --line: #214d96;
  --blue: #0a84ff;
  --green: #55c95a;
  --amber: #f6b44b;
  --red: #ff6b6b;
  --cyan: #22c4d6;
}

/* Sales MVP dashboard: Power BI inspired coffee/gold layout */
:root {
  --mvp-bg: #05040a;
  --mvp-panel: rgba(12, 14, 24, 0.94);
  --mvp-panel-2: rgba(18, 19, 32, 0.88);
  --mvp-line: rgba(212, 164, 74, 0.22);
  --mvp-line-blue: rgba(40, 126, 255, 0.34);
  --mvp-text: #fff8ea;
  --mvp-muted: #aeb4c6;
  --mvp-coffee: #5a2e17;
  --mvp-caramel: #b8671f;
  --mvp-gold: #f2b84b;
  --mvp-gold-strong: #ffd66b;
  --mvp-green: #22e49a;
  --mvp-red: #ff5c6c;
}

body {
  color: var(--mvp-text);
  background:
    radial-gradient(circle at 6% 0%, rgba(108, 48, 161, 0.32), transparent 28%),
    radial-gradient(circle at 94% 8%, rgba(128, 80, 24, 0.25), transparent 32%),
    linear-gradient(180deg, #06050b 0%, #05040a 100%);
}

.app {
  max-width: 1720px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(680px, 1.8fr);
  gap: 22px;
  align-items: center;
  margin-bottom: 18px;
  border: 1px solid rgba(242, 184, 75, 0.18);
  border-top: 0;
  border-radius: 0 0 28px 28px;
  background: rgba(4, 5, 12, 0.94);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
}

.brand-block h1 {
  color: var(--mvp-text);
  font-size: 34px;
}

.eyebrow,
.subtitle {
  color: var(--mvp-muted);
}

.header-controls {
  display: grid;
  grid-template-columns: 260px minmax(240px, 1fr) 150px 170px;
  gap: 12px;
  align-items: end;
}

.header-controls label,
.utility-controls label {
  display: grid;
  gap: 7px;
  color: var(--mvp-muted);
  font-size: 13px;
}

.month-pickers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

select,
input {
  min-height: 56px;
  border: 1px solid rgba(242, 184, 75, 0.22);
  border-radius: 16px;
  background: rgba(7, 8, 18, 0.92);
  color: var(--mvp-text);
  font-size: 16px;
  font-weight: 700;
}

button.primary {
  min-height: 58px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--mvp-gold-strong), var(--mvp-gold));
  color: #1a1105;
  font-weight: 900;
}

.live-status {
  display: grid;
  min-height: 58px;
  place-items: center;
  border: 1px solid rgba(34, 228, 154, 0.34);
  border-radius: 18px;
  background: rgba(34, 228, 154, 0.09);
  color: var(--mvp-green);
  font-weight: 900;
}

.utility-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 210px 210px minmax(220px, 1fr) minmax(220px, 0.8fr);
  gap: 12px;
  align-items: start;
}

.period-hidden,
#roleSelect {
  display: none;
}

.connection-details,
.realtime-box,
.access-card {
  border: 1px solid rgba(242, 184, 75, 0.16);
  border-radius: 18px;
  background: rgba(8, 10, 18, 0.8);
}

.connection-details {
  grid-column: 1 / span 2;
  padding: 12px 14px;
}

.realtime-box {
  padding: 12px 14px;
}

.dashboard-shell {
  display: grid;
  gap: 18px;
  padding: 0 20px 28px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metrics article.kpi-card {
  min-height: 128px;
  padding: 18px 20px;
  border: 1px solid rgba(242, 184, 75, 0.18);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.06), transparent),
    var(--mvp-panel-2);
}

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background: rgba(242, 184, 75, 0.16);
  color: var(--mvp-gold-strong);
}

.metrics span {
  color: var(--mvp-muted);
  font-size: 13px;
}

.metrics strong {
  color: var(--mvp-text);
  font-size: 30px;
}

.metrics small {
  color: var(--mvp-muted);
}

.kpi-card.good small {
  color: var(--mvp-green);
}

.kpi-card.bad small {
  color: var(--mvp-red);
}

.main-board {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(360px, 0.85fr);
  gap: 18px;
  min-height: 62vh;
}

.panel {
  border: 1px solid rgba(242, 184, 75, 0.16);
  border-radius: 26px;
  background:
    radial-gradient(circle at 10% 0%, rgba(242, 184, 75, 0.08), transparent 30%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.045), transparent),
    var(--mvp-panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.calendar-panel {
  min-height: 62vh;
}

.panel-head h2 {
  color: var(--mvp-text);
  font-size: 22px;
  text-transform: none;
}

.panel-head span {
  color: var(--mvp-muted);
}

.calendar {
  height: calc(100% - 44px);
  min-height: 540px;
}

.calendar-title {
  color: var(--mvp-gold-strong);
  font-size: 24px;
  font-weight: 900;
}

.calendar-weekdays {
  margin: 16px 0 10px;
  color: var(--mvp-muted);
  font-weight: 800;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  height: calc(100% - 74px);
}

.calendar-cell {
  display: grid;
  min-height: 92px;
  align-content: space-between;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  color: #fff8ea;
  text-align: left;
  cursor: pointer;
}

.calendar-cell strong {
  font-size: 18px;
}

.calendar-cell span {
  font-size: 18px;
  font-weight: 900;
}

.calendar-cell.blank {
  cursor: default;
  opacity: 0.22;
}

.calendar-cell.level-0 {
  background: rgba(28, 21, 17, 0.64);
}

.calendar-cell.level-1 {
  background: linear-gradient(145deg, #25140d, #3b2012);
}

.calendar-cell.level-2 {
  background: linear-gradient(145deg, #4b2815, #70401e);
}

.calendar-cell.level-3 {
  background: linear-gradient(145deg, #7b431e, #b96c25);
}

.calendar-cell.level-4 {
  background: linear-gradient(145deg, #b96c25, #e19b32);
  color: #160d04;
}

.calendar-cell.level-5 {
  background: linear-gradient(145deg, #f2b84b, #ffd66b);
  color: #160d04;
  box-shadow: 0 0 28px rgba(255, 214, 107, 0.24);
}

.calendar-cell.active {
  outline: 4px solid #ffffff;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(242, 184, 75, 0.33), 0 0 38px rgba(255, 214, 107, 0.44);
  transform: translateY(-2px);
}

.day-panel {
  min-height: 62vh;
}

.day-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.day-kpis article {
  border: 1px solid rgba(242, 184, 75, 0.16);
  border-radius: 18px;
  padding: 14px;
  background: rgba(6, 8, 17, 0.78);
}

.day-kpis span {
  display: block;
  color: var(--mvp-muted);
  font-size: 12px;
}

.day-kpis strong {
  display: block;
  margin-top: 7px;
  color: var(--mvp-gold-strong);
  font-size: 22px;
}

.top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
}

.line-chart {
  min-height: 300px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(242, 184, 75, 0.08), transparent),
    rgba(4, 6, 13, 0.74);
}

.line-bar,
.bar-fill {
  background: linear-gradient(90deg, #2f82ff, var(--mvp-gold));
}

table {
  color: var(--mvp-text);
}

th,
td {
  border-bottom: 1px solid rgba(242, 184, 75, 0.14);
}

th {
  color: var(--mvp-muted);
}

.hidden-support {
  display: none;
}

@media (max-width: 1100px) {
  .topbar,
  .header-controls,
  .main-board,
  .top-grid,
  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .calendar-panel,
  .day-panel {
    min-height: auto;
  }

  .calendar {
    min-height: 620px;
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: 0;
  }

  .topbar {
    padding: 18px 14px;
    border-radius: 0 0 22px 22px;
  }

  .brand-block h1 {
    font-size: 26px;
  }

  .dashboard-shell {
    padding: 0 12px 22px;
  }

  .header-controls,
  .metrics,
  .day-kpis {
    grid-template-columns: 1fr;
  }

  .month-pickers {
    grid-template-columns: 1fr 1fr;
  }

  .utility-controls {
    grid-template-columns: 1fr;
  }

  .connection-details {
    grid-column: auto;
  }

  .metrics article.kpi-card {
    min-height: 112px;
  }

  .calendar {
    min-height: 560px;
  }

  .calendar-grid {
    gap: 7px;
  }

  .calendar-cell {
    min-height: 72px;
    border-radius: 14px;
    padding: 9px;
  }

  .calendar-cell strong,
  .calendar-cell span {
    font-size: 13px;
  }
}

/* Final UI lock, loaded last: keep the heatmap useful and brand-colored. */
.calendar-panel {
  min-height: 70vh;
}

.calendar {
  display: block;
  min-height: 0;
  height: auto;
}

.calendar-weekdays {
  margin: 20px 0 12px;
}

.calendar-grid {
  height: auto;
  grid-auto-rows: minmax(112px, auto);
  align-content: start;
}

.calendar-cell {
  min-height: 112px;
}

.calendar-cell.level-0 {
  background: linear-gradient(145deg, rgba(24, 17, 13, 0.9), rgba(18, 12, 9, 0.96));
}

.calendar-cell.level-1 {
  background: linear-gradient(145deg, #24150e, #3f2415);
}

.calendar-cell.level-2 {
  background: linear-gradient(145deg, #4d2b17, #73451f);
}

.calendar-cell.level-3 {
  background: linear-gradient(145deg, #8b551f, #bd7929);
}

.calendar-cell.level-4 {
  background: linear-gradient(145deg, #c98a2f, #e9ad43);
  color: #170f05;
}

.calendar-cell.level-5 {
  background: linear-gradient(145deg, #f1b847, #ffdc79);
  color: #170f05;
}

.calendar-cell.level-4 span,
.calendar-cell.level-5 span {
  color: #170f05;
}

.calendar-cell.active {
  outline: 4px solid #fff6c9;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(242, 184, 75, 0.28), 0 0 42px rgba(255, 214, 107, 0.42);
}

@media (max-width: 760px) {
  .calendar-panel {
    min-height: auto;
  }

  .calendar-grid {
    grid-auto-rows: minmax(70px, auto);
  }

  .calendar-cell {
    min-height: 70px;
  }
}

.day-panel .table-wrap {
  overflow-x: hidden;
}

.day-panel table {
  table-layout: fixed;
  width: 100%;
}

.day-panel th,
.day-panel td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-panel th:nth-child(1),
.day-panel td:nth-child(1) {
  width: 42%;
}

.day-panel th:nth-child(2),
.day-panel td:nth-child(2) {
  width: 30%;
}

.day-panel th:nth-child(3),
.day-panel td:nth-child(3) {
  width: 12%;
  text-align: right;
}

.day-panel th:nth-child(4),
.day-panel td:nth-child(4) {
  width: 16%;
  text-align: right;
}

/* Final lock: calendar must dominate without empty dead space. */
.calendar-panel {
  min-height: 70vh;
}

.calendar {
  display: flex;
  min-height: 620px;
  height: auto;
  flex-direction: column;
}

.calendar-weekdays {
  margin: 18px 0 10px;
}

.calendar-grid {
  flex: 1;
  height: auto;
  grid-auto-rows: minmax(96px, 1fr);
  align-content: stretch;
}

.calendar-cell {
  min-height: 96px;
}

@media (max-width: 760px) {
  .calendar-panel {
    min-height: auto;
  }

  .calendar {
    min-height: auto;
  }

  .calendar-grid {
    grid-auto-rows: minmax(70px, auto);
  }

  .calendar-cell {
    min-height: 70px;
  }
}

/* Final polish: approved dashboard, UI/UX only. */
.topbar {
  grid-template-columns: minmax(420px, 1.1fr) minmax(620px, 1.35fr);
  align-items: start;
}

.brand-block {
  gap: 8px;
}

.brand-block h1 {
  font-size: clamp(30px, 2.5vw, 44px);
  line-height: 1.08;
}

.subtitle {
  color: rgba(255, 248, 234, 0.72);
  font-size: 16px;
}

.smart-summary {
  display: grid;
  gap: 5px;
  max-width: 760px;
  margin-top: 10px;
  border: 1px solid rgba(255, 214, 107, 0.18);
  border-radius: 18px;
  padding: 13px 15px;
  background:
    linear-gradient(135deg, rgba(255, 214, 107, 0.08), transparent 54%),
    rgba(12, 9, 8, 0.72);
  color: rgba(255, 248, 234, 0.76);
  font-size: 14px;
  line-height: 1.35;
}

.smart-summary strong {
  color: var(--mvp-gold-strong);
}

.metrics {
  gap: 12px;
}

.metrics article.kpi-card {
  min-height: 112px;
  padding: 16px 18px;
  border-radius: 20px;
}

.metrics strong {
  font-size: clamp(22px, 1.85vw, 30px);
  line-height: 1.08;
}

.metrics small {
  color: rgba(255, 248, 234, 0.64);
  font-size: 13px;
}

.kpi-card.bad small {
  color: #f0a84f;
}

.main-board {
  grid-template-columns: minmax(0, 2.25fr) minmax(340px, 0.72fr);
  min-height: 74vh;
}

.calendar-panel,
.day-panel {
  min-height: 74vh;
}

.calendar {
  min-height: 670px;
}

.calendar-grid {
  gap: 12px;
}

.calendar-cell {
  min-height: 112px;
  padding: 16px;
  border-radius: 20px;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.calendar-cell:not(.blank):hover {
  transform: translateY(-3px);
  border-color: rgba(255, 214, 107, 0.62);
}

.calendar-cell strong {
  font-size: 20px;
}

.calendar-cell span {
  font-size: clamp(15px, 1.2vw, 20px);
}

.calendar-cell.level-0 {
  background: linear-gradient(145deg, rgba(24, 17, 13, 0.82), rgba(17, 12, 10, 0.9));
}

.calendar-cell.level-1 {
  background: linear-gradient(145deg, #24150e, #3e2416);
}

.calendar-cell.level-2 {
  background: linear-gradient(145deg, #4d2b17, #70451f);
}

.calendar-cell.level-3 {
  background: linear-gradient(145deg, #8b551f, #b77729);
}

.calendar-cell.level-4 {
  background: linear-gradient(145deg, #c88930, #e7aa3d);
  color: #170f05;
}

.calendar-cell.level-5 {
  background: linear-gradient(145deg, #f1b847, #ffd977);
  color: #170f05;
}

.calendar-cell.active {
  outline: 0;
  border-color: #fff6c9;
  box-shadow:
    0 0 0 3px rgba(255, 246, 201, 0.92),
    0 0 0 8px rgba(242, 184, 75, 0.36),
    0 18px 50px rgba(255, 214, 107, 0.25);
  transform: translateY(-4px);
}

.day-panel {
  display: flex;
  flex-direction: column;
}

.day-panel .table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.day-kpis article {
  border-color: rgba(255, 214, 107, 0.18);
  background:
    linear-gradient(145deg, rgba(255, 214, 107, 0.07), transparent),
    rgba(8, 8, 16, 0.82);
}

.day-kpis strong {
  color: var(--mvp-gold-strong);
}

.top-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.bottom-grid {
  grid-template-columns: 1fr;
}

@media (max-width: 1100px) {
  .topbar,
  .header-controls,
  .main-board,
  .top-grid {
    grid-template-columns: 1fr;
  }

  .calendar-panel,
  .day-panel {
    min-height: auto;
  }

  .calendar {
    min-height: 720px;
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .brand-block h1 {
    font-size: 28px;
  }

  .smart-summary {
    font-size: 13px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics article.kpi-card {
    min-height: 118px;
  }

  .calendar {
    min-height: 650px;
  }

  .calendar-grid {
    gap: 7px;
  }

  .calendar-cell {
    min-height: 86px;
    padding: 10px;
    border-radius: 14px;
  }

  .calendar-cell strong {
    font-size: 14px;
  }

  .calendar-cell span {
    font-size: 12px;
  }

  .day-kpis {
    grid-template-columns: 1fr;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    repeating-radial-gradient(ellipse at 70% 38%, rgba(42, 178, 255, 0.18) 0 1px, transparent 2px 13px),
    radial-gradient(circle at 28% 95%, rgba(10, 132, 255, 0.34), transparent 32%),
    linear-gradient(180deg, #000 0%, #030816 62%, #061a45 100%);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

.app {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 28px;
  background: #000;
  color: white;
  border-bottom: 4px solid var(--blue);
}

.eyebrow,
p {
  margin: 0;
}

.eyebrow {
  margin-bottom: 5px;
  color: #aeb9c8;
  font-size: 13px;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: 26px;
  font-weight: 650;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 14px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status {
  min-width: 128px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 9px 12px;
  text-align: center;
  font-size: 14px;
}

.workspace {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  padding: 18px;
}

.panel,
.metrics article {
  background: var(--panel);
  border: 1px solid rgba(45, 120, 255, 0.78);
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(85, 190, 255, 0.12), 0 18px 60px rgba(0, 0, 0, 0.5);
}

.sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
  padding: 18px;
}

label {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

select,
input,
button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #020712;
  color: var(--ink);
  font: inherit;
}

select {
  width: 100%;
  padding: 8px 10px;
}

input {
  width: 100%;
  padding: 8px 10px;
}

button {
  padding: 0 14px;
  cursor: pointer;
}

button.primary {
  width: 100%;
  margin-top: 16px;
  border-color: var(--blue);
  background: linear-gradient(90deg, #0a84ff, #0c5cff);
  color: white;
}

.note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.access-card {
  display: grid;
  gap: 5px;
  margin-top: 16px;
  border-left: 4px solid var(--green);
  padding: 12px;
  background: rgba(21, 180, 134, 0.11);
  font-size: 13px;
}

.access-card span {
  color: var(--muted);
  line-height: 1.4;
}

.realtime-box {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(10, 132, 255, 0.08);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 0;
  color: var(--ink);
  font-weight: 700;
}

.toggle-row input {
  width: 20px;
  min-height: 20px;
}

.live-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.connection-details {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel-soft);
}

.custom-period {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.custom-period[hidden] {
  display: none;
}

.connection-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.content {
  display: grid;
  gap: 18px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab.active {
  border-color: var(--blue);
  background: linear-gradient(180deg, #1677ff, #0b3cbb);
  color: white;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metrics article {
  padding: 16px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  color: #ff4f67;
  font-size: 28px;
  line-height: 1;
}

.metrics article:nth-child(3) strong {
  color: #22c55e;
}

.grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 18px;
}

.grid-main.hidden {
  display: none;
}

.wide {
  grid-column: 1 / -1;
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.bar-chart {
  display: grid;
  gap: 10px;
}

.bar-chart.compact {
  max-height: 420px;
  overflow: auto;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 210px) 1fr 100px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 16px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0a84ff 0 58%, #5fc65c 58% 100%);
}

.bar-value {
  color: var(--muted);
  text-align: right;
}

.line-chart {
  display: flex;
  align-items: end;
  gap: 14px;
  min-height: 250px;
  overflow-x: auto;
  padding-top: 20px;
}

.line-column {
  display: grid;
  align-items: end;
  justify-items: center;
  gap: 8px;
  min-width: 46px;
  height: 220px;
}

.line-bar {
  width: 24px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, #0a84ff, #15b486);
  box-shadow: 0 0 16px rgba(10, 132, 255, 0.4);
}

.line-column span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  transform: rotate(-45deg);
}

.calendar {
  display: grid;
  gap: 10px;
}

.calendar-title {
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.calendar-cell {
  display: grid;
  align-content: space-between;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: var(--panel-soft);
  text-align: left;
}

.calendar-cell.blank {
  border-color: transparent;
  background: transparent;
  pointer-events: none;
}

.calendar-cell strong {
  font-size: 13px;
}

.calendar-cell span {
  overflow: hidden;
  color: #dbe7f5;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-cell.level-0 {
  color: var(--muted);
}

.calendar-cell.level-1 {
  background: #3a1414;
}

.calendar-cell.level-2 {
  background: #652020;
}

.calendar-cell.level-3 {
  background: #982828;
}

.calendar-cell.level-4 {
  background: #d13a2f;
  color: white;
}

.calendar-cell.level-5 {
  background: #f04438;
  color: white;
}

.calendar-cell.level-4 span,
.calendar-cell.level-5 span {
  color: white;
}

.calendar-cell.active {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.day-panel table td:nth-child(2) {
  min-width: 220px;
}

.day-insights {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.day-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.day-kpis article,
.day-detail-grid section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-soft);
}

.day-kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.day-kpis strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.day-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.day-detail-grid h3 {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 15px;
}

.mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: baseline;
  border-top: 1px solid var(--line);
  padding: 8px 0;
  font-size: 13px;
}

caption {
  padding: 12px 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  text-align: left;
}

.mini-row:first-of-type {
  border-top: 0;
}

.mini-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-row small {
  color: var(--muted);
}

.muted-line {
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  display: grid;
  min-height: 90px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.tag {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--panel-soft);
}

.tag.franciza {
  background: rgba(246, 180, 75, 0.14);
  color: var(--amber);
}

.tag.proprie {
  background: rgba(21, 180, 134, 0.14);
  color: var(--green);
}

.tag.istorica {
  background: var(--panel-soft);
  color: var(--muted);
}

.franchise-grid,
.module-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.franchise-grid > div,
.module-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-soft);
}

.big-number {
  margin-bottom: 4px;
  font-size: 26px;
  font-weight: 700;
}

.muted,
.module-list span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.module-list article {
  display: grid;
  gap: 6px;
}

.rules {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rules span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  background: var(--panel-soft);
  font-size: 13px;
}

@media (max-width: 1100px) {
  .workspace,
  .grid-main {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 760px) {
  body {
    background:
      repeating-radial-gradient(ellipse at 70% 30%, rgba(42, 178, 255, 0.11) 0 1px, transparent 2px 14px),
      linear-gradient(180deg, #000 0%, #061225 100%);
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    gap: 10px;
    padding: 8px;
  }

  .topbar {
    gap: 12px;
    padding: 14px 12px;
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 17px;
  }

  .sidebar,
  .panel {
    padding: 12px;
  }

  .sidebar {
    top: 0;
  }

  label {
    margin-top: 12px;
  }

  select,
  input,
  button {
    min-height: 46px;
    font-size: 16px;
  }

  button.primary {
    min-height: 50px;
    font-weight: 700;
  }

  .tabs {
    position: sticky;
    top: 124px;
    z-index: 15;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0;
    background: rgba(3, 8, 22, 0.96);
  }

  .tab {
    min-width: 112px;
    padding: 0 12px;
    white-space: nowrap;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .metrics article {
    min-height: 92px;
    padding: 13px;
  }

  .metrics strong {
    font-size: 25px;
  }

  .day-kpis,
  .day-detail-grid,
  .franchise-grid,
  .module-list {
    grid-template-columns: 1fr;
  }

  .mini-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .bar-value {
    text-align: left;
  }

  .line-chart {
    min-height: 180px;
    gap: 12px;
    padding-bottom: 10px;
  }

  .line-column {
    min-width: 44px;
    height: 160px;
  }

  .line-bar {
    width: 20px;
  }

  .calendar-weekdays,
  .calendar-grid {
    gap: 4px;
  }

  .calendar-cell {
    min-height: 62px;
    padding: 6px;
    border-radius: 5px;
  }

  .calendar-cell strong,
  .calendar-cell span {
    font-size: 11px;
  }

  .calendar-title {
    font-size: 15px;
  }

  .custom-period {
    grid-template-columns: 1fr;
  }

  .realtime-box {
    padding: 10px;
  }

  .day-panel .table-wrap,
  .products-panel .table-wrap {
    max-height: 420px;
    overflow: auto;
  }

  th,
  td {
    padding: 8px 6px;
    font-size: 12px;
  }
}

@media (max-width: 430px) {
  .topbar {
    padding: 12px 10px;
  }

  h1 {
    font-size: 20px;
  }

  .workspace {
    padding: 6px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .metrics article {
    min-height: 78px;
  }

  .calendar-weekdays span {
    font-size: 10px;
  }

  .calendar-cell {
    min-height: 56px;
    padding: 5px;
  }

  .calendar-cell span {
    font-size: 10px;
  }
}

/* Power BI dark look - visible override package */
:root {
  --bg: #00040a;
  --panel: rgba(0, 3, 9, 0.94);
  --panel-soft: rgba(2, 8, 19, 0.92);
  --ink: #ffffff;
  --muted: #b4c3d6;
  --line: rgba(57, 134, 255, 0.7);
  --blue: #148cff;
  --green: #5ac85a;
  --red: #ff425c;
  --orange: #f27a00;
}

body {
  background:
    radial-gradient(ellipse at 18% 92%, rgba(18, 128, 255, 0.38), transparent 34%),
    repeating-radial-gradient(ellipse at 63% 58%, rgba(92, 216, 255, 0.22) 0 1px, transparent 2px 12px),
    linear-gradient(180deg, #000 0%, #020716 50%, #082769 100%);
}

.topbar {
  padding: 18px 26px;
  background: #000;
  border-bottom: 3px solid #1d6cff;
}

.eyebrow {
  color: #7fb4ff;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
}

.workspace {
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}

.panel,
.metrics article {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 34%),
    var(--panel);
  border: 1px solid rgba(54, 132, 255, 0.72);
  border-radius: 7px;
  box-shadow: 0 0 0 1px rgba(89, 185, 255, 0.13), 0 22px 64px rgba(0, 0, 0, 0.58);
}

.sidebar {
  background: rgba(0, 5, 16, 0.96);
}

select,
input,
button {
  background: #01050d;
  border-color: rgba(87, 145, 255, 0.62);
  border-radius: 4px;
}

.tabs {
  align-items: center;
}

.tab {
  min-width: 92px;
  border-color: rgba(87, 145, 255, 0.65);
  background: rgba(0, 6, 18, 0.94);
}

.tab.active {
  background: linear-gradient(180deg, #1f87ff, #0d53ca);
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.18);
}

.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metrics article {
  min-height: 102px;
  padding: 18px;
}

.metrics span {
  color: #c7d4e7;
}

.metrics strong {
  color: var(--red);
  font-size: 30px;
  line-height: 1.05;
}

.metrics article:nth-child(3) strong {
  color: #16c757;
}

.metrics article:nth-child(4) strong {
  color: var(--red);
}

.grid-main {
  gap: 10px;
}

.panel-head {
  border-bottom: 1px solid rgba(54, 132, 255, 0.35);
  padding-bottom: 10px;
}

.daily-panel,
.calendar-panel,
.day-panel,
.products-panel {
  min-height: 0;
}

.line-chart {
  min-height: 230px;
  align-items: end;
  background:
    linear-gradient(135deg, rgba(20, 140, 255, 0.08), transparent 40%),
    rgba(0, 0, 0, 0.36);
  border-radius: 6px;
  padding: 12px 14px 20px;
}

.line-bar {
  width: 22px;
  background: linear-gradient(180deg, #168cff, #5ac85a);
  border-radius: 5px 5px 0 0;
  box-shadow: 0 0 18px rgba(25, 142, 255, 0.25);
}

.bar-fill {
  background: linear-gradient(90deg, #127de2, #62c85c);
}

.bar-track {
  background: rgba(255, 255, 255, 0.08);
}

.calendar-panel {
  background:
    radial-gradient(ellipse at 15% 90%, rgba(42, 178, 255, 0.16), transparent 42%),
    rgba(0, 3, 9, 0.94);
}

.calendar-cell {
  background: rgba(8, 14, 25, 0.92);
  border-color: rgba(94, 151, 255, 0.44);
}

.calendar-cell.level-0 {
  background: rgba(12, 20, 32, 0.9);
}

.calendar-cell.level-1 {
  background: #4b1d16;
}

.calendar-cell.level-2 {
  background: #8a2b16;
}

.calendar-cell.level-3 {
  background: #c9471e;
}

.calendar-cell.level-4 {
  background: #f06d13;
}

.calendar-cell.level-5 {
  background: #ff2727;
  color: #fff;
}

.calendar-cell.active {
  outline: 3px solid #148cff;
  outline-offset: -3px;
}

.day-kpis article {
  background: rgba(2, 8, 19, 0.92);
}

th,
td {
  border-bottom-color: rgba(70, 134, 255, 0.36);
}

@media (max-width: 760px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    padding: 12px;
  }
}

@media (max-width: 430px) {
  .metrics {
    grid-template-columns: 1fr;
  }

  .tabs {
    top: 112px;
  }
}

/* Buono Coffee mobile premium redesign */
:root {
  --coffee-bg: #06050a;
  --coffee-panel: rgba(19, 20, 38, 0.78);
  --coffee-panel-strong: rgba(24, 25, 48, 0.92);
  --coffee-line: rgba(255, 255, 255, 0.09);
  --coffee-gold: #d8a640;
  --coffee-gold-soft: #ffcf70;
  --coffee-purple: #9b5cff;
  --coffee-green: #2ee59d;
  --coffee-red: #ff596d;
  --coffee-warn: #f7b733;
  --coffee-text: #fff8ed;
  --coffee-muted: #a9a7b8;
}

body {
  background:
    radial-gradient(circle at 12% 8%, rgba(155, 92, 255, 0.22), transparent 26%),
    radial-gradient(circle at 88% 4%, rgba(216, 166, 64, 0.18), transparent 25%),
    radial-gradient(circle at 50% 108%, rgba(13, 72, 126, 0.35), transparent 38%),
    linear-gradient(180deg, #05050b 0%, #090812 48%, #05050b 100%);
  color: var(--coffee-text);
}

.app {
  max-width: 1720px;
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 22px 30px;
  background: rgba(6, 6, 14, 0.84);
  border-bottom: 1px solid rgba(155, 92, 255, 0.28);
  backdrop-filter: blur(18px);
}

.menu-button {
  width: 48px;
  min-height: 48px;
  border: 0;
  background: transparent;
  color: var(--coffee-text);
  font-size: 30px;
}

.brand-block {
  display: grid;
  gap: 2px;
}

.eyebrow {
  color: rgba(255, 248, 237, 0.62);
  font-size: 12px;
  text-transform: none;
}

h1 {
  color: var(--coffee-text);
  font-size: 30px;
  letter-spacing: 0;
}

.subtitle {
  color: var(--coffee-muted);
  font-size: 16px;
}

.top-actions {
  align-items: center;
}

.today-chip {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 12px;
  min-width: 172px;
  border: 1px solid var(--coffee-line);
  border-radius: 20px;
  padding: 10px 14px;
  background: rgba(21, 21, 42, 0.72);
}

.chip-icon {
  display: grid;
  grid-row: span 2;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(155, 92, 255, 0.36);
  border-radius: 16px;
  color: var(--coffee-purple);
  font-size: 20px;
}

.today-chip strong {
  font-size: 16px;
}

.today-chip small {
  color: var(--coffee-muted);
}

.workspace {
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  padding: 22px;
}

.panel,
.metrics article {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.055), transparent 42%),
    var(--coffee-panel);
  border: 1px solid var(--coffee-line);
  border-radius: 22px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sidebar {
  top: 92px;
  padding: 20px;
  background: rgba(13, 14, 29, 0.78);
}

.month-pickers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  color: var(--coffee-muted);
  font-size: 13px;
}

select,
input,
button {
  min-height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 15px;
  background: rgba(13, 14, 29, 0.94);
  color: var(--coffee-text);
}

button {
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

button:active {
  transform: scale(0.98);
}

button.primary {
  min-height: 58px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--coffee-gold-soft), var(--coffee-gold));
  color: #170f05;
  font-weight: 800;
}

.connection-details,
.realtime-box,
.access-card {
  border-color: var(--coffee-line);
  border-radius: 18px;
  background: rgba(10, 11, 24, 0.72);
}

.access-card {
  border-left: 4px solid var(--coffee-gold);
}

.content {
  gap: 16px;
}

.tabs {
  gap: 10px;
}

.tab {
  min-width: 116px;
  border-color: var(--coffee-line);
  border-radius: 15px;
  background: rgba(19, 20, 38, 0.8);
  color: var(--coffee-muted);
  font-weight: 700;
}

.tab span {
  display: inline-block;
  margin-right: 6px;
}

.tab.active {
  border-color: rgba(155, 92, 255, 0.5);
  background: linear-gradient(135deg, #a65cff, #6b2cff);
  color: white;
  box-shadow: 0 14px 30px rgba(155, 92, 255, 0.28);
}

.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metrics article.kpi-card {
  position: relative;
  display: grid;
  min-height: 188px;
  align-content: start;
  gap: 10px;
  padding: 26px;
  overflow: hidden;
}

.metrics article.kpi-card::after {
  position: absolute;
  inset: auto -20px -42px auto;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  content: "";
}

.kpi-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 22px;
  background: rgba(155, 92, 255, 0.24);
  color: var(--coffee-purple);
  font-size: 25px;
}

.kpi-card.good .kpi-icon {
  background: rgba(46, 229, 157, 0.16);
  color: var(--coffee-green);
}

.kpi-card.warn .kpi-icon {
  background: rgba(247, 183, 51, 0.18);
  color: var(--coffee-warn);
}

.metrics span {
  color: rgba(255, 248, 237, 0.72);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.metrics strong {
  margin-top: 0;
  color: var(--coffee-text);
  font-size: 30px;
  letter-spacing: 0;
}

.metrics small {
  color: var(--coffee-muted);
  font-size: 15px;
}

.kpi-card.good small,
.kpi-card.good strong {
  color: var(--coffee-green);
}

.kpi-card.bad small {
  color: var(--coffee-red);
}

.kpi-card.warn small {
  color: var(--coffee-warn);
}

.grid-main {
  gap: 18px;
}

.panel {
  padding: 22px;
}

.panel-head h2 {
  font-size: 20px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel-head span {
  color: var(--coffee-muted);
}

.line-chart {
  min-height: 290px;
  align-items: end;
  gap: 18px;
  border-radius: 20px;
  padding: 22px 22px 28px;
  background:
    linear-gradient(180deg, rgba(155, 92, 255, 0.13), transparent 78%),
    rgba(7, 8, 18, 0.56);
}

.line-bar {
  width: 20px;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, #b973ff, #7a35ff);
  box-shadow: 0 0 26px rgba(155, 92, 255, 0.52);
}

.bar-track {
  height: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.bar-fill {
  border-radius: 999px;
  background: linear-gradient(90deg, #8f4dff, var(--coffee-green));
}

.calendar-title {
  margin-bottom: 4px;
  font-size: 18px;
}

.calendar-cell {
  min-height: 78px;
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(25, 23, 28, 0.86);
}

.calendar-cell.level-0 {
  background: rgba(29, 29, 39, 0.86);
}

.calendar-cell.level-1 {
  background: #451d1d;
}

.calendar-cell.level-2 {
  background: #743022;
}

.calendar-cell.level-3 {
  background: #a94624;
}

.calendar-cell.level-4 {
  background: #df6128;
}

.calendar-cell.level-5 {
  background: #ff3737;
}

.calendar-cell.active {
  outline: 3px solid var(--coffee-gold-soft);
  outline-offset: 2px;
  box-shadow: 0 0 24px rgba(216, 166, 64, 0.35);
}

table {
  font-size: 14px;
}

th,
td {
  border-bottom-color: rgba(255, 255, 255, 0.09);
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .top-actions {
    grid-column: 1 / -1;
  }

  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: 92px;
    background:
      radial-gradient(circle at 0% 0%, rgba(155, 92, 255, 0.24), transparent 32%),
      radial-gradient(circle at 90% 4%, rgba(216, 166, 64, 0.16), transparent 28%),
      linear-gradient(180deg, #06050a 0%, #0a0914 55%, #05050a 100%);
  }

  .topbar {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    padding: 18px 16px;
  }

  .top-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
  }

  .today-chip {
    display: none;
  }

  h1 {
    font-size: 24px;
  }

  .subtitle {
    font-size: 15px;
  }

  .workspace {
    padding: 14px;
  }

  .sidebar {
    padding: 18px;
  }

  .month-pickers {
    grid-template-columns: 1fr 1fr;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics article.kpi-card {
    min-height: 172px;
    padding: 22px;
  }

  .metrics strong {
    font-size: 28px;
  }

  .daily-panel {
    order: 1;
  }

  .calendar-panel {
    order: 2;
  }

  .day-panel {
    order: 3;
  }

  .tabs {
    position: fixed;
    inset: auto 12px 10px;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 10px;
    overflow: visible;
    border: 1px solid var(--coffee-line);
    border-radius: 22px;
    background: rgba(17, 18, 34, 0.92);
    backdrop-filter: blur(18px);
    box-shadow: 0 -18px 52px rgba(0, 0, 0, 0.38);
  }

  .tab {
    min-width: 0;
    min-height: 58px;
    border: 0;
    border-radius: 16px;
    padding: 4px;
    background: transparent;
    font-size: 12px;
  }

  .tab span {
    display: block;
    margin: 0 0 3px;
    font-size: 19px;
  }

  .tab.active {
    background: rgba(155, 92, 255, 0.16);
    color: var(--coffee-purple);
    box-shadow: none;
  }

  .line-chart {
    min-height: 230px;
  }

  .calendar-cell {
    min-height: 68px;
    padding: 8px;
  }

  .day-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .workspace {
    padding: 10px;
  }

  .panel,
  .metrics article {
    border-radius: 18px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics article.kpi-card {
    min-height: 154px;
    padding: 18px;
  }

  .kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 18px;
  }

  .metrics strong {
    font-size: 24px;
  }

  .metrics small {
    font-size: 12px;
  }

  .month-pickers {
    grid-template-columns: 1fr;
  }
}

/* Final MVP override: keep this last so the old dashboard skin cannot win. */
body {
  padding-bottom: 0;
  color: var(--mvp-text);
  background:
    radial-gradient(circle at 6% 0%, rgba(108, 48, 161, 0.32), transparent 28%),
    radial-gradient(circle at 94% 8%, rgba(128, 80, 24, 0.25), transparent 32%),
    linear-gradient(180deg, #06050b 0%, #05040a 100%);
}

.app {
  max-width: 1720px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(680px, 1.8fr);
  gap: 22px;
  align-items: center;
  margin-bottom: 18px;
  border: 1px solid rgba(242, 184, 75, 0.18);
  border-top: 0;
  border-radius: 0 0 28px 28px;
  background: rgba(4, 5, 12, 0.94);
}

.menu-button,
.top-actions,
.tabs,
.period-hidden,
#roleSelect {
  display: none;
}

.brand-block h1 {
  color: var(--mvp-text);
  font-size: 34px;
}

.header-controls {
  display: grid;
  grid-template-columns: 260px minmax(240px, 1fr) 150px 170px;
  gap: 12px;
  align-items: end;
}

.dashboard-shell {
  display: grid;
  gap: 18px;
  padding: 0 20px 28px;
}

.utility-controls {
  display: none !important;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metrics article.kpi-card {
  min-height: 128px;
  padding: 18px 20px;
  border: 1px solid rgba(242, 184, 75, 0.18);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.06), transparent),
    var(--mvp-panel-2);
}

.main-board {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(360px, 0.85fr);
  gap: 18px;
  min-height: 62vh;
}

.top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
}

.calendar-panel,
.day-panel {
  min-height: 62vh;
}

.calendar {
  min-height: 540px;
  height: calc(100% - 44px);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  height: calc(100% - 74px);
}

.calendar-cell {
  min-height: 92px;
  border-radius: 18px;
  padding: 13px;
  cursor: pointer;
}

.calendar-cell strong,
.calendar-cell span {
  font-size: 18px;
}

.calendar-cell.level-0 {
  background: rgba(28, 21, 17, 0.64);
}

.calendar-cell.level-1 {
  background: linear-gradient(145deg, #25140d, #3b2012);
}

.calendar-cell.level-2 {
  background: linear-gradient(145deg, #4b2815, #70401e);
}

.calendar-cell.level-3 {
  background: linear-gradient(145deg, #7b431e, #b96c25);
}

.calendar-cell.level-4 {
  background: linear-gradient(145deg, #b96c25, #e19b32);
  color: #160d04;
}

.calendar-cell.level-5 {
  background: linear-gradient(145deg, #f2b84b, #ffd66b);
  color: #160d04;
}

.calendar-cell.active {
  outline: 4px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(242, 184, 75, 0.33), 0 0 38px rgba(255, 214, 107, 0.44);
  transform: translateY(-2px);
}

.day-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.hidden-support {
  display: none;
}

@media (max-width: 1100px) {
  .topbar,
  .header-controls,
  .main-board,
  .top-grid,
  .bottom-grid,
  .utility-controls {
    grid-template-columns: 1fr;
  }

  .calendar {
    min-height: 620px;
  }
}

@media (max-width: 760px) {
  .app {
    width: 100%;
    max-width: none;
  }

  .topbar {
    width: calc(100% - 24px);
    margin: 0 12px 14px;
    box-sizing: border-box;
    grid-template-columns: 1fr;
    padding: 18px 14px;
    border-radius: 0 0 22px 22px;
  }

  .brand-block h1 {
    font-size: 26px;
  }

  .dashboard-shell {
    padding: 0 12px 22px;
  }

  .metrics,
  .day-kpis {
    grid-template-columns: 1fr;
  }

  .month-pickers {
    grid-template-columns: 1fr 1fr;
  }

  .calendar {
    min-height: 560px;
  }

  .calendar-grid {
    gap: 7px;
  }

  .calendar-cell {
    min-height: 72px;
    border-radius: 14px;
    padding: 9px;
  }

  .calendar-cell strong,
  .calendar-cell span {
    font-size: 13px;
  }
}

/* Final UI lock, loaded last: keep the heatmap useful and brand-colored. */
.calendar-panel {
  min-height: 70vh;
}

.calendar {
  display: block;
  min-height: 0;
  height: auto;
}

.calendar-weekdays {
  margin: 20px 0 12px;
}

.calendar-grid {
  height: auto;
  grid-auto-rows: minmax(112px, auto);
  align-content: start;
}

.calendar-cell {
  min-height: 112px;
}

.calendar-cell.level-0 {
  background: linear-gradient(145deg, rgba(24, 17, 13, 0.9), rgba(18, 12, 9, 0.96));
}

.calendar-cell.level-1 {
  background: linear-gradient(145deg, #24150d, #3f2414);
}

.calendar-cell.level-2 {
  background: linear-gradient(145deg, #4d2b17, #73451f);
}

.calendar-cell.level-3 {
  background: linear-gradient(145deg, #8b551f, #bd7929);
}

.calendar-cell.level-4 {
  background: linear-gradient(145deg, #c98a2f, #e9ad43);
  color: #170f05;
}

.calendar-cell.level-5 {
  background: linear-gradient(145deg, #f1b847, #ffdc79);
  color: #170f05;
}

.calendar-cell.level-4 span,
.calendar-cell.level-5 span {
  color: #170f05;
}

.calendar-cell.active {
  outline: 4px solid #fff6c9;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(242, 184, 75, 0.28), 0 0 42px rgba(255, 214, 107, 0.42);
}

@media (max-width: 760px) {
  .calendar-panel {
    min-height: auto;
  }

  .calendar-grid {
    grid-auto-rows: minmax(70px, auto);
  }

  .calendar-cell {
    min-height: 70px;
  }
}

/* === Puls IQ: interval de date in header (inlocuieste An/Luna) — 2026-06-28 === */
.date-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* === Puls IQ: panou sublocatii & reduceri — 2026-06-28 === */
.subloc-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.subloc-card { border: 1px solid var(--mvp-line, rgba(212,164,74,0.22)); border-radius: 16px; padding: 14px 16px; background: linear-gradient(145deg, rgba(255,214,107,0.06), transparent 60%), rgba(8,8,16,0.82); }
.subloc-card.is-flag { border-color: rgba(255,92,108,0.5); }
.subloc-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.subloc-card-head h3 { color: var(--mvp-text, #fff8ea); font-size: 15px; font-weight: 650; }
.subloc-sales { color: var(--mvp-gold-strong, #ffd66b); font-size: 18px; font-weight: 700; white-space: nowrap; }
.subloc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.subloc-stats > div { display: flex; flex-direction: column; gap: 2px; }
.subloc-stats .k { color: var(--mvp-muted, #aeb4c6); font-size: 11px; }
.subloc-stats .v { color: var(--mvp-text, #fff8ea); font-size: 15px; font-weight: 600; }
.subloc-warn { margin-top: 8px; color: var(--mvp-red, #ff5c6c); font-size: 11px; }
.subloc-empty { color: var(--mvp-muted, #aeb4c6); font-size: 14px; line-height: 1.4; }
@media (max-width: 760px) { .subloc-list { grid-template-columns: 1fr; } }

/* === Puls IQ: sublocatie clicabila + reset — 2026-06-28 === */
.subloc-card { cursor: pointer; transition: border-color 120ms ease, box-shadow 120ms ease; }
.subloc-card.is-active { border-color: var(--mvp-gold-strong, #ffd66b); box-shadow: 0 0 0 2px rgba(255,214,107,0.35); }
.subloc-reset { background: transparent; border: 1px solid var(--mvp-line, rgba(212,164,74,0.3)); color: var(--mvp-gold-strong, #ffd66b); border-radius: 8px; padding: 2px 9px; font-size: 11px; cursor: pointer; margin-left: 8px; }
.subloc-reset:hover { background: rgba(255,214,107,0.1); }

/* === Puls IQ: ecran de login (PASUL 4) — 2026-06-29 === */
.app[hidden] { display: none; }

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 6% 0%, rgba(108, 48, 161, 0.32), transparent 28%),
    radial-gradient(circle at 94% 8%, rgba(128, 80, 24, 0.25), transparent 32%),
    linear-gradient(180deg, #06050b 0%, var(--mvp-bg, #05040a) 100%);
}
.login-overlay[hidden] { display: none; }

.login-card {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 380px;
  padding: 30px 28px;
  border: 1px solid var(--mvp-line, rgba(212, 164, 74, 0.22));
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.05), transparent 40%),
    var(--mvp-panel, rgba(12, 14, 24, 0.94));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
}

.login-card .eyebrow {
  margin: 0;
  color: var(--mvp-muted, #aeb4c6);
  font-size: 13px;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--mvp-muted, #aeb4c6);
  font-size: 13px;
}

.login-card input {
  min-height: 52px;
  border: 1px solid var(--mvp-line, rgba(242, 184, 75, 0.22));
  border-radius: 14px;
  background: rgba(7, 8, 18, 0.92);
  color: var(--mvp-text, #fff8ea);
  font-size: 16px;
  padding: 0 14px;
}

.login-card button.primary {
  margin-top: 4px;
}

.login-error {
  margin: 0;
  color: var(--mvp-red, #ff5c6c);
  font-size: 13px;
  font-weight: 700;
}
.login-error[hidden] { display: none; }

.login-status {
  margin: 0;
  min-height: 16px;
  color: var(--mvp-muted, #aeb4c6);
  font-size: 13px;
}

/* === Puls IQ: caseta utilizator + logout (PASUL 4) — 2026-06-29 === */
.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 0 14px;
  border: 1px solid var(--mvp-line, rgba(242, 184, 75, 0.22));
  border-radius: 18px;
  background: rgba(8, 10, 18, 0.8);
  color: var(--mvp-text, #fff8ea);
  font-size: 13px;
  font-weight: 700;
}
.user-box[hidden] { display: none; }

#logoutBtn.ghost,
#todayBtn.ghost {
  min-height: 40px;
  border: 1px solid var(--mvp-line, rgba(212, 164, 74, 0.3));
  border-radius: 12px;
  background: transparent;
  color: var(--mvp-gold-strong, #ffd66b);
  font-size: 13px;
  font-weight: 800;
  padding: 0 12px;
  cursor: pointer;
}
#logoutBtn.ghost:hover,
#todayBtn.ghost:hover { background: rgba(255, 214, 107, 0.1); }

/* Login - buton "ochi" pentru afisarea parolei */
.pass-wrap { position: relative; display: block; }
.pass-wrap input { width: 100%; padding-right: 38px; box-sizing: border-box; }
.pass-eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; display: flex; align-items: center;
  line-height: 1; padding: 2px; opacity: 0.7; color: var(--mvp-muted);
}
.pass-eye:hover { opacity: 1; }

/* Mobil ingust: fara overflow orizontal, topbar nu mai sta fixat, calendar mai mic */
@media (max-width: 560px) {
  html, body { overflow-x: hidden; }
  .app { max-width: 100%; }
  .topbar { position: static; }
  .header-controls, .utility-controls, .metrics, .day-kpis { grid-template-columns: 1fr; }
  .panel, .main-board, .top-grid, .bottom-grid, .metrics article { min-width: 0; }
  .table-wrap { overflow-x: auto; }
  .calendar-grid { grid-auto-rows: minmax(54px, auto); gap: 5px; }
  .calendar-cell { min-height: 54px; padding: 6px; }
  .calendar-cell strong, .calendar-cell span { font-size: 12px; }
}

/* === Puls IQ: calendar compact + filtre stivuite pe telefon — 2026-07-01 === */
.cal-val-short { display: none; }              /* desktop: arata valoarea completa */

@media (max-width: 560px) {
  /* #3 - valoare compacta pe celula de calendar */
  .calendar-cell .cal-val-full { display: none; }
  .calendar-cell .cal-val-short { display: inline; }
  .calendar-cell span { font-size: 11px; font-weight: 800; }
  .calendar-cell strong { font-size: 12px; }

  /* #4 v5 - header compact: date jum-jum (appearance:none pt iOS) + Date live/Actualizeaza pe un rand */
  .header-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
  .header-controls > * { min-width: 0; }
  .header-controls > .date-range { grid-column: 1 / -1; }
  .header-controls > label { grid-column: 1 / -1; }
  .header-controls > .live-status { grid-column: 1; }
  .header-controls > .primary { grid-column: 2; }
  .header-controls > .user-box { grid-column: 1 / -1; }

  .date-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .date-range > label { min-width: 0; }
  .date-range input {
    width: 100%; min-width: 0; box-sizing: border-box;
    -webkit-appearance: none; appearance: none;
    padding: 9px 10px; font-size: 13px;
  }
  .header-controls select { width: 100%; box-sizing: border-box; padding: 9px 10px; font-size: 13px; }
  .header-controls .primary,
  .header-controls .live-status { padding: 12px 8px; font-size: 14px; text-align: center; box-sizing: border-box; }
  .header-controls label { font-size: 12px; }
}

/* === Puls IQ: navigare luni pe calendar (sageti + swipe) — 2026-07-01 === */
.calendar-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cal-nav {
  background: transparent; border: 1px solid rgba(212,164,74,0.35);
  color: var(--mvp-gold-strong, #ffd66b); border-radius: 10px;
  width: 34px; height: 34px; font-size: 20px; line-height: 1; cursor: pointer;
}
.cal-nav:hover { background: rgba(212,164,74,0.12); }

/* === Puls IQ: compactare mobil — etichete ascunse, calendar sus, KPI 2/rand fara litere — 2026-07-01 === */
@media (max-width: 560px) {
  /* 1+2: ascunde etichetele "De la"/"Pana la"/"Locatie" (datele-s clare singure) */
  .date-range > label { font-size: 0; }
  .header-controls > label { font-size: 0; }

  /* 3: ordinea panourilor pe telefon (aplatizez sectiunile + order)
     dorit: header > Calendar > KPI > Detaliu zi > Top produse > Ore de varf > Evolutie lunara */
  .dashboard-shell { display: flex; flex-direction: column; }
  .dashboard-shell > .main-board,
  .dashboard-shell > .top-grid,
  .dashboard-shell > .bottom-grid { display: contents; }
  .dashboard-shell .freebie-banner { order: 0; }
  .dashboard-shell .calendar-panel { order: 1; }
  .dashboard-shell .metrics { order: 2; }
  .dashboard-shell .day-panel { order: 3; }
  .dashboard-shell .products-panel { order: 4; }
  .dashboard-shell .hours-panel { order: 5; }
  .dashboard-shell .daily-panel { order: 6; }
  .dashboard-shell .subloc-panel { order: 10; }

  /* 4+5: KPI fara cercurile V/L/B/M, cate 2 pe rand, compacte */
  .metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-icon { display: none; }
  .metrics article.kpi-card { min-height: auto; padding: 12px 14px; }

  /* 6: scot sagetile (swipe e suficient) si titlul calendarului (spatiu) */
  .cal-nav { display: none; }
  .calendar-panel .panel-head { display: none; }
}

/* === Puls IQ: header live-dot + pull-to-refresh + spacing compact (telefon) — 2026-07-02 === */
.live-dot { display: none; }   /* desktop: invizibila (ramane textul "Date live" + butonul "Actualizeaza") */

@media (max-width: 560px) {
  body { overscroll-behavior-y: contain; }   /* opreste reload-ul nativ al browserului -> merge pull-to-refresh-ul nostru */

  /* scot "Date live" (text) + "Actualizeaza" (buton) din header */
  .header-controls > .live-status,
  .header-controls > .primary { display: none; }

  /* pun bulinuta de stare in randul cu Azi/Iesire, la capat */
  .user-box { display: flex; align-items: center; gap: 8px; }
  .live-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: #888; flex-shrink: 0; }
  .live-dot.ok      { background: #35c759; box-shadow: 0 0 0 3px rgba(53,199,89,.18); }   /* verde = live */
  .live-dot.err     { background: #ff3b30; box-shadow: 0 0 0 3px rgba(255,59,48,.18); }   /* rosu = eroare */
  .live-dot.loading { background: #ffcc00; }                                              /* galben = se incarca */

  /* indiciu pull-to-refresh */
  .ptr-hint {
    position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 50;
    padding: 6px 14px; border-radius: 999px; background: rgba(20,20,24,.92);
    color: var(--mvp-gold, #ffd66b); font-size: 13px; font-weight: 600; border: 1px solid rgba(212,164,74,.4);
  }

  /* panourile mai sus, mai putin spatiu intre ele (era 18px) */
  .dashboard-shell { gap: 10px; }
}

/* === Puls IQ: apropii banner-ul de filtrele de perioada (telefon) — 2026-07-02 === */
@media (max-width: 560px) {
  .topbar { gap: 10px; }              /* era ~20px - apropie blocul din stanga de filtre */
  .brand-block { gap: 6px; }          /* randurile logo/salut/profil/banner mai stranse */
  .smart-summary { margin-top: 6px; } /* era 10px */
  .header-controls { margin-top: 0; } /* datele urca spre banner */
}
