.panel-wide {
  max-width: 1320px !important;
}

html[data-theme="dark"] {
  --bg: #121214;
  --surface: #1a1a1d;
  --surface-alt: #222226;
  --border: #2c2c31;
  --border-strong: #3a3a40;
  --text: #f4f4f5;
  --text-secondary: #d4d4d8;
  --text-muted: #9a9aa2;
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-soft: rgba(16, 185, 129, 0.13);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.42);
}

.workspace-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.workspace-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 0.55rem 1rem;
}

.ws-topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: nowrap;
}

.ws-brand {
  flex-shrink: 0;
  white-space: nowrap;
}

.ws-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.ws-user-badge {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-summary-trigger {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.my-summary-trigger:hover {
  border-color: var(--primary);
}

.my-summary-trigger.active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
}

.my-summary-trigger.active .happy-person-icon {
  color: #ffffff !important;
}

.happy-person-icon {
  flex-shrink: 0;
  color: var(--primary);
}

.my-services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 0.8rem;
}

.kpi-soon {
  opacity: 0.62;
}

.ws-app-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.2rem;
  flex-shrink: 0;
}

.ws-app-tab {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.36rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.ws-app-tab:hover:not(:disabled) {
  color: var(--text);
}

.ws-app-tab.active {
  background: var(--primary);
  color: #ffffff;
}

.ws-app-soon {
  opacity: 0.5;
  cursor: not-allowed;
}

.ws-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.08rem 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.ws-app-tab:not(.active) .ws-badge {
  background: var(--border);
  color: var(--text-secondary);
}

.ws-iframe-pane {
  flex: 1;
  display: flex;
  min-height: calc(100vh - 58px);
}

.ws-iframe {
  width: 100%;
  height: calc(100vh - 58px);
  border: 0;
  background: var(--bg);
}

.panel-container {
  width: 100%;
  margin: 1.25rem auto 3rem;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-hero-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.admin-hero-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cloud-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--ok-bg);
  color: var(--ok-fg);
}

.period-pills {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.18rem;
  gap: 0.18rem;
}

.period-pill {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 7px;
  cursor: pointer;
}

.period-pill.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.kpi-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.95rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.kpi-accent {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary-soft), var(--surface));
}

.kpi-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 1.85rem;
  line-height: 1.1;
  font-weight: 800;
  color: var(--text);
}

.kpi-value-sm {
  font-size: 1.15rem;
  line-height: 1.25;
  font-weight: 800;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.chart-section {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}

.section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.section-sub {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.dot-sat {
  background: var(--primary);
}

.dot-fed {
  background: #6366f1;
}

.dot-inex {
  background: #f59e0b;
}

.daily-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  min-height: 145px;
  padding: 0.5rem 0.25rem 0.15rem;
  overflow-x: auto;
}

.chart-col {
  flex: 1 0 34px;
  max-width: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.chart-bars {
  width: 100%;
  height: 100px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
}

.chart-bar {
  width: 11px;
  border-radius: 4px 4px 0 0;
  min-height: 2px;
}

.bar-sat {
  background: var(--primary);
}

.bar-fed {
  background: #6366f1;
}

.bar-inex {
  background: #f59e0b;
}

.edit-user-panel {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-alt);
}

.edit-user-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
}

.edit-user-actions {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

@media (max-width: 720px) {
  .edit-user-grid {
    grid-template-columns: 1fr;
  }
}

.chart-val {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.chart-lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.rank-1 {
  background: #fef3c7;
  color: #92400e;
  border-color: #f59e0b;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.35rem;
}

.status-dot.online {
  background: #10b981;
}

.status-dot.offline {
  background: #94a3b8;
}

.cat-summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.95rem;
  list-style: none;
}

.catalog-split {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1rem;
}

.catalog-col {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.catalog-right-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.catalog-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface-alt);
}

.catalog-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.84rem;
  cursor: pointer;
}

.catalog-item:last-child {
  border-bottom: 0;
}

.catalog-item.active {
  background: var(--primary-soft);
  color: var(--text);
  font-weight: 700;
}

html[data-theme="dark"] {
  --bg: #121214;
  --surface: #1a1a1d;
  --surface-alt: #222226;
  --border: #2c2c31;
  --border-strong: #3a3a40;
  --text: #f4f4f5;
  --text-secondary: #d4d4d8;
  --text-muted: #9a9aa2;
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-soft: rgba(16, 185, 129, 0.13);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.42);
}

.workspace-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.ws-iframe-pane {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ws-iframe {
  flex: 1 1 auto;
  width: 100%;
  min-height: calc(100dvh - 60px);
  border: 0;
}

.ws-app-tabs {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: 100%;
}
.ws-app-tabs::-webkit-scrollbar {
  display: none;
}
.ws-app-tab {
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .ws-topbar-row {
    flex-wrap: wrap;
    gap: 0.45rem;
  }
  .ws-app-tabs {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }
  #ws-popout-btn {
    display: none !important;
  }
  .kpi-grid,
  .my-services-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .catalog-split {
    grid-template-columns: 1fr;
  }
  .create-user-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 640px) {
  .workspace-topbar {
    padding: 0.5rem 0.65rem;
  }
  .ws-brand h1 {
    font-size: 0.92rem;
  }
  .ws-user-badge #panel-user-name {
    display: none;
  }
  .ws-user-badge {
    padding: 0.34rem 0.5rem;
  }
  .panel-container {
    padding: 0.75rem 0.6rem 2rem;
    gap: 0.75rem;
  }
  .card {
    padding: 0.9rem;
  }
  .create-user-form {
    grid-template-columns: 1fr;
  }
  .period-pills {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .period-pills::-webkit-scrollbar {
    display: none;
  }
  .period-pill {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .ws-iframe {
    min-height: calc(100dvh - 96px);
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .workspace-topbar {
    padding: 0.32rem 0.65rem;
  }
  .ws-topbar-row {
    flex-wrap: nowrap;
    gap: 0.4rem;
  }
  .ws-brand h1,
  #panel-role-pill,
  #ws-popout-btn,
  .ws-user-badge #panel-user-name {
    display: none !important;
  }
  .ws-app-tabs {
    order: 0;
    width: auto;
    flex: 1 1 auto;
  }
  .ws-app-tab {
    padding: 0.28rem 0.6rem;
    font-size: 0.78rem;
  }
  .ws-iframe {
    min-height: calc(100dvh - 48px);
  }
  .kpi-grid,
  .my-services-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.version-btn {
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--primary);
  font-weight: 800;
}

.version-btn:hover {
  border-color: var(--primary);
}

.changelog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 9999;
}

.changelog-backdrop[hidden] {
  display: none;
}

.changelog-card {
  width: 100%;
  max-width: 640px;
  max-height: 85dvh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.changelog-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.changelog-entry {
  padding: 0.9rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
}

.changelog-ver-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
}

.changelog-entry ul {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.81rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.changelog-entry li {
  margin-bottom: 0.3rem;
}

.release-anim-card {
  max-width: 560px;
}

.release-progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.9rem 0 0.85rem;
}

.release-progress-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  overflow: hidden;
}

.release-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #34d399);
  border-radius: 999px;
  transition: width 0.12s linear;
}

.release-progress-pct {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--primary);
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.release-features-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.95rem;
}

.release-features-box ul {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.81rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.release-features-box li {
  margin-bottom: 0.35rem;
}

.release-anim-foot {
  display: flex;
  justify-content: flex-end;
}
