:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-hover: #eef1f5;
  --border: #e3e6eb;
  --border-strong: #d4d8de;
  --text: #1a1f2a;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --error: #dc2626;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

.small {
  font-size: 12px;
}

.error {
  color: var(--error);
  font-size: 13px;
  margin-top: 8px;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 14px;
  transition: background 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

button:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 500;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button.secondary {
  background: transparent;
}

input[type="text"],
input[type="password"],
input[type="number"] {
  font: inherit;
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
}

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

/* ---------- login ---------- */

.login-body {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-md);
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.login-card form {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-card label {
  font-size: 12px;
  color: var(--muted);
}

.login-card button {
  margin-top: 8px;
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 500;
}

.login-card button:hover:not(:disabled) {
  background: var(--accent-hover);
}

/* ---------- topbar ---------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  font-size: 14px;
}

/* ---------- container ---------- */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

/* ---------- dropzone ---------- */

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 56px 20px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
  box-shadow: var(--shadow-sm);
}

.dropzone:hover,
.dropzone:focus,
.dropzone.is-drag {
  border-color: var(--accent);
  background: #f0f5ff;
  outline: none;
}

.dropzone-icon {
  font-size: 28px;
  color: var(--muted);
  margin-bottom: 8px;
}

.dropzone-title {
  margin: 0 0 4px;
  font-size: 16px;
}

/* ---------- settings ---------- */

.settings {
  margin-top: 16px;
}

.settings details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.settings summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  list-style: none;
}

.settings summary::-webkit-details-marker {
  display: none;
}

.settings summary::before {
  content: "› ";
  display: inline-block;
  transition: transform 120ms ease;
}

.settings details[open] summary::before {
  transform: rotate(90deg);
}

.settings-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.settings-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.settings-grid .checkbox-label {
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  grid-column: 1 / -1;
  cursor: pointer;
  color: var(--text);
}

.settings-grid .checkbox-label input {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.block {
  display: block;
  margin-top: 2px;
}

/* ---------- queue ---------- */

.queue-section {
  margin-top: 28px;
}

.queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.queue-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
}

.queue-actions {
  display: flex;
  gap: 8px;
}

.queue-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.queue-table th,
.queue-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

.queue-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.filename {
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
}

.dim {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.action-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.action-upscale {
  background: #dbeafe;
  color: #1e40af;
}

.action-compress {
  background: #fef3c7;
  color: #92400e;
}

.action-passthrough {
  background: #dcfce7;
  color: #166534;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

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

.status-pending .dot {
  background: var(--muted);
}

.status-processing .dot {
  background: var(--accent);
  animation: pulse 1s infinite;
}

.status-done .dot {
  background: var(--success);
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
