:root {
  --bg: #0f1419;
  --panel: #171e27;
  --line: #2a3544;
  --text: #e8eef6;
  --muted: #93a0b0;
  --accent: #3d9cf0;
  --ok: #3ecf8e;
  --off: #8b98a8;
  --warn: #e1a94b;
  --danger: #e05a6f;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 10% -10%, #1d3b5a 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.login-body {
  display: grid;
  place-items: center;
}

.login-card,
.top,
.stats article,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-card {
  width: min(420px, calc(100% - 32px));
  padding: 28px;
  border-radius: 16px;
  display: grid;
  gap: 10px;
}

.top {
  margin: 24px auto 16px;
  width: min(1100px, calc(100% - 32px));
  padding: 20px 24px;
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

h1, h2 { margin: 0; font-weight: 650; }
.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.muted { color: var(--muted); margin: 6px 0 0; }

label { font-size: 14px; color: var(--muted); }
input {
  width: 100%;
  margin: 4px 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #10161d;
  color: var(--text);
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--accent);
  color: #061018;
  font-weight: 650;
  cursor: pointer;
  font-size: 14px;
}
button.small,
.btn.small,
a.btn.small {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}
button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
button.ghost.small {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--accent);
  color: #061018;
  font-weight: 650;
  font-size: 14px;
  cursor: pointer;
  border: 0;
}
a.btn.accent,
button.btn.accent,
button.accent {
  background: linear-gradient(135deg, #3ecf8e, #3d9cf0);
  color: #04151b;
}

button.files {
  background: #1e3a5f;
  color: #cfe4ff;
  padding: 8px 12px;
  white-space: nowrap;
}

button.watch:disabled,
button.files:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.stats {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.stats article {
  padding: 16px 18px;
  border-radius: 14px;
}
.stats span { color: var(--muted); font-size: 13px; }
.stats strong { display: block; font-size: 28px; margin-top: 6px; }

.panel {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto 32px;
  border-radius: 16px;
  overflow: hidden;
}
.panel-head { padding: 18px 20px 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; }
.empty { color: var(--muted); text-align: center; padding: 28px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--off);
}
.badge.online .dot { background: var(--ok); }
.badge.online { color: var(--ok); }
.badge.offline { color: var(--off); }

.note {
  width: 160px;
  margin: 0;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button.watch {
  padding: 8px 12px;
  white-space: nowrap;
}

.viewer {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 16, 0.72);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 20;
  overflow: auto;
}

.viewer.hidden,
.viewer[hidden] {
  display: none;
}

.viewer-card {
  width: min(1100px, 100%);
  max-height: 92vh;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.viewer-card.files-card,
.viewer-card.downloads-card {
  width: min(920px, 100%);
}

.viewer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

#viewer-frame {
  display: block;
  width: 100%;
  border-radius: 12px;
  background: #0b1016;
  min-height: 280px;
  object-fit: contain;
  max-height: 72vh;
}

.files-path {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: #0f1620;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.path-text {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}

.files-list {
  border: 1px solid var(--line);
  background: #0d141d;
  border-radius: 12px;
  padding: 4px;
  overflow-y: auto;
  max-height: 55vh;
}

.file-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  margin: 2px;
}
.file-row:hover {
  background: #132033;
}

.file-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: #182436;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.file-info {
  min-width: 0;
}
.file-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.file-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr; }
  .top { flex-direction: column; align-items: flex-start; }
  .files-path { grid-template-columns: 1fr; }
  .file-row { grid-template-columns: 40px 1fr; }
  .file-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
