:root {
  --bg: #eef0fb;
  --bg-blob-1: #a5b4fc;
  --bg-blob-2: #f5b8e0;
  --bg-blob-3: #b6ecd9;
  --text: #14161a;
  --text-muted: #565c6b;
  --accent: #5b5bf6;
  --accent-hover: #4747e0;
  --accent-contrast: #ffffff;
  --success: #0f8a4f;
  --success-bg: rgba(26, 158, 92, 0.16);
  --danger: #c62f2f;
  --danger-bg: rgba(214, 69, 69, 0.14);
  --warning: #9a6108;
  --warning-bg: rgba(185, 118, 10, 0.16);

  --glass-bg: rgba(255, 255, 255, 0.5);
  --glass-bg-strong: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-highlight: rgba(255, 255, 255, 0.8);
  --input-bg: rgba(255, 255, 255, 0.55);
  --row-hover: rgba(255, 255, 255, 0.35);

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 8px 32px -8px rgba(31, 38, 135, 0.22);
  --blur: 18px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0e14;
    --bg-blob-1: #4c3fb0;
    --bg-blob-2: #7c2f6e;
    --bg-blob-3: #14554a;
    --text: #eef0f3;
    --text-muted: #a5abb8;
    --accent: #8686ff;
    --accent-hover: #9c9cff;
    --accent-contrast: #0e0f12;
    --success: #3ecf8e;
    --success-bg: rgba(62, 207, 142, 0.16);
    --danger: #ff6b6b;
    --danger-bg: rgba(255, 107, 107, 0.16);
    --warning: #f0b054;
    --warning-bg: rgba(240, 176, 84, 0.16);

    --glass-bg: rgba(28, 30, 38, 0.5);
    --glass-bg-strong: rgba(28, 30, 38, 0.68);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-highlight: rgba(255, 255, 255, 0.06);
    --input-bg: rgba(20, 21, 27, 0.5);
    --row-hover: rgba(255, 255, 255, 0.05);
    --shadow: 0 8px 32px -8px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  --bg: #0d0e14;
  --bg-blob-1: #4c3fb0;
  --bg-blob-2: #7c2f6e;
  --bg-blob-3: #14554a;
  --text: #eef0f3;
  --text-muted: #a5abb8;
  --accent: #8686ff;
  --accent-hover: #9c9cff;
  --accent-contrast: #0e0f12;
  --success: #3ecf8e;
  --success-bg: rgba(62, 207, 142, 0.16);
  --danger: #ff6b6b;
  --danger-bg: rgba(255, 107, 107, 0.16);
  --warning: #f0b054;
  --warning-bg: rgba(240, 176, 84, 0.16);

  --glass-bg: rgba(28, 30, 38, 0.5);
  --glass-bg-strong: rgba(28, 30, 38, 0.68);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-highlight: rgba(255, 255, 255, 0.06);
  --input-bg: rgba(20, 21, 27, 0.5);
  --row-hover: rgba(255, 255, 255, 0.05);
  --shadow: 0 8px 32px -8px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg);
}

body {
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
  background: var(--bg);
}

/* Soft, blurred color blobs behind the glass panels -- this is what the frosted-glass
   surfaces actually blur, so the effect is visible instead of just "translucent grey". */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(circle at 12% 8%, var(--bg-blob-1) 0%, transparent 38%),
    radial-gradient(circle at 88% 18%, var(--bg-blob-2) 0%, transparent 40%),
    radial-gradient(circle at 25% 92%, var(--bg-blob-3) 0%, transparent 42%),
    radial-gradient(circle at 92% 88%, var(--bg-blob-1) 0%, transparent 36%);
  opacity: 0.55;
  filter: blur(10px);
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}

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

select,
button,
input {
  font-family: inherit;
  font-size: 14px;
}

select,
input[type="text"],
input[type="url"],
input[type="email"],
input[type="password"] {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

select:focus,
input:focus {
  border-color: var(--accent);
}

.icon-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.icon-btn:hover {
  background: var(--glass-bg-strong);
}

.btn {
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 60%, transparent);
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--glass-bg-strong);
  color: var(--text);
  border: 1px solid var(--glass-border);
  box-shadow: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.hero {
  padding: 56px 20px 24px;
  text-align: center;
}

.hero h1 {
  font-size: 28px;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.hero p {
  color: var(--text-muted);
  margin: 0;
}

/* Shared glass panel treatment for cards, rows, tables and the login card. */
.submit-card,
.stat-card,
.file-row,
.login-card,
table,
.novnc-frame-wrap {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-highlight);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
}

.submit-card {
  padding: 20px;
  margin: 20px 0;
}

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

.url-row input {
  flex: 1 1 260px;
}

.url-row .btn {
  flex: 0 0 auto;
}

.quota-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 13px;
}

.quota-bar {
  flex: 1;
  height: 6px;
  background: rgba(127, 127, 127, 0.25);
  border-radius: 4px;
  overflow: hidden;
}

.quota-bar-fill {
  height: 100%;
  background: var(--accent);
}

.status-banner {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  display: none;
  border: 1px solid transparent;
}

.status-banner.visible {
  display: block;
}

.status-banner.info {
  background: var(--glass-bg-strong);
  color: var(--text-muted);
  border-color: var(--glass-border);
}

.status-banner.success {
  background: var(--success-bg);
  color: var(--success);
}

.status-banner.error {
  background: var(--danger-bg);
  color: var(--danger);
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 28px 0 10px;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-row {
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.file-meta {
  min-width: 0;
}

.file-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-sub {
  color: var(--text-muted);
  font-size: 12.5px;
  margin-top: 2px;
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge.queued,
.badge.processing {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge.completed {
  background: var(--success-bg);
  color: var(--success);
}

.badge.failed,
.badge.timeout,
.badge.expired {
  background: var(--danger-bg);
  color: var(--danger);
}

.empty-state {
  color: var(--text-muted);
  font-size: 13.5px;
  padding: 18px 0;
  text-align: center;
}

.privacy-note {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 30px 20px 50px;
}

.privacy-note a {
  color: inherit;
}

/* Admin layout */

.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border-right: 1px solid var(--glass-border);
}

.admin-sidebar a {
  display: block;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.admin-sidebar a.active,
.admin-sidebar a:hover {
  background: var(--row-hover);
  color: var(--text);
}

.admin-main {
  flex: 1;
  padding: 24px 28px;
  min-width: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.stat-card {
  padding: 16px;
}

.stat-card .value {
  font-size: 24px;
  font-weight: 700;
}

.stat-card .label {
  color: var(--text-muted);
  font-size: 12.5px;
  margin-top: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 13px;
  white-space: nowrap;
}

th {
  color: var(--text-muted);
  font-weight: 600;
  background: var(--row-hover);
}

tr:hover td {
  background: var(--row-hover);
}

tr:last-child td {
  border-bottom: none;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

.filters-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 28px;
}

.login-card h1 {
  font-size: 20px;
  margin: 0 0 18px;
}

.form-field {
  margin-bottom: 14px;
}

.form-field label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-field input {
  width: 100%;
}

.novnc-frame-wrap {
  padding: 8px;
  margin-top: 16px;
}

.novnc-frame {
  width: 100%;
  height: 70vh;
  border: none;
  border-radius: calc(var(--radius) - 6px);
  display: block;
}

@media (max-width: 860px) {
  .admin-shell {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
  }
  .admin-main {
    padding: 18px;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 36px 16px 16px;
  }
  .hero h1 {
    font-size: 22px;
  }
}
