/* Platform admin layout – self-contained (shared styles.css has no span-12/span-4) */

body.platform-admin .shell {
  width: 100%;
  max-width: 100%;
}

body.platform-admin .workspace {
  min-width: 0;
  width: 100%;
}

body.platform-admin .page.grid.active {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
  width: 100%;
}

body.platform-admin .span-12 {
  grid-column: 1 / -1;
  min-width: 0;
  width: 100%;
}

body.platform-admin #pageStatus.grid.active .span-4 {
  grid-column: span 4;
  min-width: 0;
}

body.platform-admin .panel-head {
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
}

body.platform-admin .panel-head > div:first-child {
  flex: 1 1 200px;
}

body.platform-admin .panel-actions {
  flex: 1 1 320px;
  justify-content: flex-end;
}

.platform-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.platform-nav .nav-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}

.platform-nav .nav-item:hover,
.platform-nav .nav-item.active {
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.platform-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  flex-shrink: 0;
}

.health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}

.health-dot.ok { background: var(--green); }
.health-dot.bad { background: var(--red); }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.dashboard-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 18px 16px;
}

.dashboard-card strong {
  display: block;
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
}

.dashboard-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-card.live {
  border-color: rgba(255, 45, 85, .35);
  background: rgba(255, 45, 85, .1);
}

.dashboard-card.live strong { color: #ff7f9b; }

.dashboard-card.trial {
  border-color: rgba(91, 124, 255, .35);
  background: rgba(91, 124, 255, .1);
}

.dashboard-card.premium {
  border-color: rgba(0, 229, 199, .35);
  background: rgba(0, 229, 199, .08);
}

.dashboard-card.pro {
  border-color: rgba(177, 76, 255, .35);
  background: rgba(177, 76, 255, .1);
}

.dashboard-card.videos {
  border-color: rgba(255, 221, 0, .35);
  background: rgba(255, 221, 0, .08);
}

.dashboard-meta {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.search-input {
  min-width: 180px;
  flex: 1 1 180px;
  max-width: 280px;
}

.platform-table-wrap {
  overflow-x: auto;
  width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.platform-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: fixed;
}

.platform-table th,
.platform-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

/* Auto layout so the actions column can size to its icons (fixed layout clipped them). */
.users-table { min-width: 960px; table-layout: auto; }

.users-table th:nth-child(1),
.users-table td:nth-child(1) { width: 48px; }

.users-table th:nth-child(2),
.users-table td:nth-child(2) { width: 14%; }

.users-table th:nth-child(3),
.users-table td:nth-child(3) { width: 22%; }

.users-table th:nth-child(4),
.users-table td:nth-child(4) { width: 9%; }

.users-table th:nth-child(5),
.users-table td:nth-child(5) { width: 9%; }

.users-table th:nth-child(6),
.users-table td:nth-child(6) { width: 14%; }

.users-table th:nth-child(7),
.users-table td:nth-child(7) { width: 7%; }

/* Műveletek: shrink-to-content (the icon row), never compressed → never clipped. */
.users-table th:nth-child(8),
.users-table td:nth-child(8) { width: 1%; white-space: nowrap; }

.marketing-form {
  display: grid;
  gap: 14px;
  max-width: 760px;
}

.marketing-form label {
  display: grid;
  gap: 6px;
}

.marketing-form textarea {
  min-height: 220px;
  resize: vertical;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.marketing-count,
.marketing-mail-mode {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.marketing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.videos-meta {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.videos-table {
  min-width: 1180px;
}

.muted-inline {
  color: var(--muted);
}

.video-preview-dialog {
  max-width: 860px;
  width: calc(100% - 32px);
  padding: 20px;
}

.video-preview-dialog video {
  width: 100%;
  max-height: 60vh;
  border-radius: 14px;
  background: #000;
}

.video-preview-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.platform-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.platform-table tr:hover td {
  background: rgba(255, 255, 255, .03);
}

.platform-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-pending { background: rgba(255, 221, 0, .18); color: #ffe566; }
.badge-trial { background: rgba(91, 124, 255, .18); color: #9eb4ff; }
.badge-active { background: rgba(22, 199, 132, .18); color: #5fe0a8; }
.badge-expired { background: rgba(255, 84, 112, .18); color: #ff8da3; }
.badge-muted { background: rgba(255, 255, 255, .08); color: var(--muted); }
.badge-live { background: rgba(255, 45, 85, .2); color: #ff7f9b; }

.expiry-soon { color: #ffe566; }
.expiry-over { color: #ff8da3; }

/* A <td> must stay a normal table-cell — display:flex here breaks column sizing and the
   buttons overflow into neighbouring columns. Keep it a cell; lay the icons out inline. */
.actions-cell {
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
}

.actions-cell .icon-btn {
  vertical-align: middle;
}

.actions-cell .icon-btn + .icon-btn {
  margin-left: 5px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.icon-btn-good {
  color: var(--green);
  border-color: rgba(22, 199, 132, .35);
}

.icon-btn-good:hover {
  background: rgba(22, 199, 132, .12);
}

.icon-btn-danger {
  color: #ff8da3;
  border-color: rgba(255, 84, 112, .35);
}

.icon-btn-danger:hover {
  background: rgba(255, 84, 112, .12);
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 24px !important;
}

.stat-block p {
  margin: 0 0 10px;
}

.platform-dialog {
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 0;
  background: var(--bg-2);
  color: var(--text);
  max-width: 520px;
  width: calc(100% - 32px);
}

.platform-dialog::backdrop {
  background: rgba(0, 0, 0, .65);
}

.platform-dialog form {
  padding: 20px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.dialog-head h3 {
  margin: 0;
}

.dialog-user {
  color: var(--muted);
  margin: 0 0 16px;
}

.dialog-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 1100px) {
  body.platform-admin #pageStatus.grid.active {
    grid-template-columns: 1fr;
  }

  body.platform-admin #pageStatus.grid.active .span-4 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  body.platform-admin .shell {
    grid-template-columns: 1fr;
  }

  body.platform-admin .sidebar {
    position: static;
    height: auto;
  }

  .platform-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .search-input {
    max-width: none;
    width: 100%;
  }
}

/* ── Owner dashboard additions (todos / finance / live / audit / drill-down) ── */

.todos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.todos-col h4 {
  margin: 0 0 10px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.todo-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
}

.todo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface);
}

.todo-main {
  min-width: 0;
}

.todo-main strong {
  display: block;
  font-size: 14px;
}

.todo-main small {
  color: var(--muted);
  font-size: 12px;
}

.days-left {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.days-left.urgent {
  color: #ff7f9b;
}

button.primary.small {
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* Funnel */
.funnel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.funnel-row {
  display: grid;
  grid-template-columns: 150px 1fr 50px;
  align-items: center;
  gap: 12px;
}

.funnel-label {
  font-size: 13px;
  color: var(--muted);
}

.funnel-bar-wrap {
  height: 16px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.funnel-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(91, 124, 255, .9), rgba(0, 229, 199, .9));
  min-width: 2px;
  transition: width .4s var(--ease);
}

.funnel-value {
  text-align: right;
  font-weight: 700;
  font-size: 14px;
}

/* Streamer earnings (this month) */
.earnings-total {
  text-align: right;
  flex-shrink: 0;
}

.earnings-total strong {
  display: block;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  color: #ffe566;
}

.earnings-total span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.platform-table th.num,
.platform-table td.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.earnings-table td.num {
  font-weight: 700;
}

/* Live */
.live-now-pill {
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
  padding: 3px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  vertical-align: middle;
}

.live-now-pill.active {
  border-color: rgba(255, 45, 85, .45);
  background: rgba(255, 45, 85, .12);
  color: #ff7f9b;
}

.live-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff2d55;
  margin-right: 6px;
  box-shadow: 0 0 0 0 rgba(255, 45, 85, .6);
  animation: live-pulse 1.6s infinite;
}

@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 45, 85, .5); }
  70% { box-shadow: 0 0 0 8px rgba(255, 45, 85, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 45, 85, 0); }
}

tr.row-suspended {
  opacity: .55;
}

/* User drill-down dialog */
.user-detail-dialog {
  max-width: 720px;
  width: calc(100vw - 40px);
}

.user-detail-body h4 {
  margin: 18px 0 8px;
  font-size: 14px;
}

.detail-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.detail-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 12px 14px;
}

.detail-card strong {
  display: block;
  font-size: 20px;
  font-weight: 800;
}

.detail-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.detail-sub {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-channels {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.ch-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface);
}

.ch-view {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ch-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.ch-edit.hidden {
  display: none;
}

.ch-edit label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  flex: 1 1 180px;
}

.ch-edit input {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
}

.ch-edit-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex: 0 0 auto;
}

.ch-edit .hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

button.secondary.small {
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 10px;
}

.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.secondary.danger,
button.secondary.danger {
  border-color: rgba(255, 45, 85, .4);
  color: #ff8da3;
}

@media (max-width: 720px) {
  .todos-grid {
    grid-template-columns: 1fr;
  }
  .funnel-row {
    grid-template-columns: 110px 1fr 40px;
  }
}

/* ── Forgalom (web-traffic analytics) ───────────────────────────────────────── */
body.platform-admin .span-6 { grid-column: span 6; min-width: 0; }
body.platform-admin .span-4 { grid-column: span 4; min-width: 0; }

@media (max-width: 900px) {
  body.platform-admin .page.grid.active { grid-template-columns: 1fr; }
  body.platform-admin .span-6,
  body.platform-admin .span-4 { grid-column: auto; }
}

.traffic-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.range-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.range-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
}
.range-tab:hover { color: var(--text); }
.range-tab.active {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}

.traffic-bars {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 4px;
}
.traffic-bar {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.traffic-bar__label {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.traffic-bar__track {
  height: 8px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow: hidden;
}
.traffic-bar__fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #7c5cff, #a78bff);
}
.traffic-bar__fill.fb { background: linear-gradient(90deg, #1877f2, #4e93f7); }
.traffic-bar__value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  text-align: right;
}

.traffic-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  padding-top: 8px;
  overflow-x: auto;
}
.traffic-col {
  flex: 1 0 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 14px;
}
.traffic-col__bars {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  height: 120px;
}
.traffic-col__bar {
  width: 9px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #a78bff, #7c5cff);
  min-height: 2px;
}
.traffic-col__bar.fb { background: linear-gradient(180deg, #4e93f7, #1877f2); }
.traffic-col__label {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.traffic-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}
.dashboard-card.fb strong { color: #4e93f7; }
.muted-legend { font-size: 12px; font-weight: 500; color: var(--muted); }
