:root {
  color-scheme: dark;
  --bg: #111312;
  --panel: #1b211e;
  --panel-2: #242b27;
  --line: #38423c;
  --text: #edf3ef;
  --muted: #a9b8af;
  --accent: #4cc38a;
  --danger: #ff8a7a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-panel,
.user-list,
.detail-panel,
.notice {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
}

.login-panel {
  width: min(440px, 100%);
  padding: 22px;
}

h1,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
}

p,
#summary {
  color: var(--muted);
  margin-top: 8px;
}

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

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  border-color: var(--accent);
}

.button.secondary {
  color: var(--muted);
}

.button.danger {
  color: var(--danger);
}

input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  background: #0d0f0e;
  color: var(--text);
  border-radius: 6px;
  padding: 8px 10px;
}

input[readonly] {
  color: var(--muted);
}

label span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.user-list,
.detail-panel {
  padding: 14px;
}

.panel-title {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

#accounts {
  display: grid;
  gap: 6px;
}

.status-heading {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  margin: 12px 0 2px;
}

.status-heading:first-child {
  margin-top: 0;
}

.user-button {
  min-height: 58px;
  justify-content: flex-start;
  width: 100%;
  overflow-wrap: anywhere;
  gap: 10px;
  text-align: left;
}

.user-button.active {
  border-color: var(--accent);
  color: var(--accent);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 10px;
  background: var(--danger);
}

.status-dot.online {
  background: var(--accent);
}

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

.user-name,
.user-status {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-status {
  color: var(--muted);
  font-size: 12px;
}

.thumb {
  width: 74px;
  aspect-ratio: 16 / 9;
  flex: 0 0 74px;
  border: 1px solid var(--line);
  border-radius: 4px;
  object-fit: cover;
  background: #050706;
}

.thumb[hidden] {
  display: none;
}

.selected-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: stretch;
}

.selected-preview video {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 240px;
  object-fit: contain;
  background: #050706;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.selected-thumbnail {
  width: min(320px, 100%);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #050706;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.meter {
  position: relative;
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background:
    linear-gradient(to top, rgba(76, 195, 138, 0.16), rgba(255, 205, 86, 0.16) 72%, rgba(255, 138, 122, 0.2)),
    #0d0f0e;
}

.meter-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background: linear-gradient(to top, var(--accent), #ffd45c 72%, var(--danger));
  transition: height 80ms linear;
}

#detailForm {
  display: grid;
  gap: 12px;
}

.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.empty {
  color: var(--muted);
  padding: 16px 0;
}

.notice,
.error {
  padding: 12px;
  margin-bottom: 14px;
  color: var(--muted);
}

.error {
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 6px;
}

@media (max-width: 900px) {
  .topbar,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .selected-preview {
    grid-template-columns: minmax(0, 1fr) 14px;
  }
}
