/* ===== Splash Screen ===== */
.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.4s ease-out;
}

.splash-screen.fade-out {
  opacity: 0;
}

.splash-logo {
  max-width: 280px;
  width: 60%;
  animation: splashPulse 1.8s ease-in-out infinite;
}

@keyframes splashPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.03); opacity: 0.85; }
}

/* ===== Theme Variables ===== */
:root, [data-theme="light"] {
  /* Page background — clean off-white matching logo backdrop */
  --bg-gradient-start: #e8eef3;
  --bg-gradient-end: #d4dee8;

  /* Surfaces */
  --surface: #ffffff;
  --surface-alt: #f0f4f7;

  /* Typography — charcoal from logo, all meet WCAG AA on white */
  --text-primary: #2b2f33;   /* ~14:1 on white */
  --text-secondary: #4d5760; /* ~7.5:1 on white */
  --text-muted: #6b7784;     /* ~4.6:1 on white — AA compliant */

  /* Borders */
  --border: #c8d3db;

  /* Accent — primary teal from couch outline */
  --accent: #1f7d94;         /* ~4.6:1 on white — AA compliant */
  --accent-hover: #165f70;   /* darker for hover */
  --accent-light: #e0f0f4;   /* very light teal tint for backgrounds */

  /* Series — steel blue from sofa body */
  --series-color: #1e6b8a;   /* ~5.0:1 on white — AA */
  --series-bg: #dceef5;

  /* Movie — warm coral (complementary to teal, accessible) */
  --movie-color: #b5451b;    /* ~5.5:1 on white — AA */
  --movie-bg: #fdeee8;

  /* Torrent — mid teal-green */
  --torrent-color: #1a7a6e;  /* ~4.7:1 on white — AA */
  --torrent-bg: #ddf2ef;

  /* State colours */
  --success: #2e7d32;        /* ~7.1:1 on white — AA */
  --success-bg: #e8f5e9;
  --info: #1565c0;           /* ~7.3:1 on white — AA */
  --info-bg: #e3f0fb;
  --danger: #c62828;         /* ~6.5:1 on white — AA */
  --danger-bg: #fdecea;
  --danger-border: #f5c6c2;

  /* Progress bar */
  --progress-bg: #eaf2f5;
  --progress-border: #c8d3db;
  --progress-fill-start: #1f7d94;
  --progress-fill-end: #2da0bc;

  /* Shadows */
  --shadow: rgba(30, 60, 80, 0.10);
  --shadow-strong: rgba(30, 60, 80, 0.18);

  /* Footer — dark text on light page background */
  --footer-text: #4d5760;

  /* Inputs */
  --input-bg: #ffffff;
  --select-bg: #ffffff;

  /* Unmatched tag — amber, accessible on its bg */
  --unmatched-tag-bg: #fff3e0;
  --unmatched-tag-color: #7a4000; /* ~7.1:1 on #fff3e0 — AA */
}

[data-theme="dark"] {
  --bg-gradient-start: #1a1a2e;
  --bg-gradient-end: #16213e;
  --surface: #1e1e2f;
  --surface-alt: #2a2a3d;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0b0;
  --text-muted: #707080;
  --border: #3a3a4d;
  --accent: #7c8cf0;
  --accent-hover: #6b7ce0;
  --accent-light: #2a2a4d;
  --series-color: #7c8cf0;
  --series-bg: #2a2a4d;
  --movie-color: #f080c0;
  --movie-bg: #3d2035;
  --torrent-color: #4dd0c8;
  --torrent-bg: #1a3d3a;
  --success: #66bb6a;
  --success-bg: #1a3d1e;
  --info: #64b5f6;
  --info-bg: #1a2d3d;
  --danger: #ef5350;
  --danger-bg: #3d1a1a;
  --danger-border: #5a2a2a;
  --progress-bg: #2a2020;
  --progress-border: #4a3030;
  --progress-fill-start: #66bb6a;
  --progress-fill-end: #81c784;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-strong: rgba(0, 0, 0, 0.4);
  --footer-text: rgba(200, 200, 220, 0.8);
  --input-bg: #2a2a3d;
  --select-bg: #2a2a3d;
  --unmatched-tag-bg: #3d2a00;
  --unmatched-tag-color: #ffb74d;
}

[data-theme="mono"] {
  --bg-gradient-start: #222222;
  --bg-gradient-end: #333333;
  --surface: #1a1a1a;
  --surface-alt: #252525;
  --text-primary: #d0d0d0;
  --text-secondary: #909090;
  --text-muted: #606060;
  --border: #404040;
  --accent: #b0b0b0;
  --accent-hover: #c8c8c8;
  --accent-light: #303030;
  --series-color: #c0c0c0;
  --series-bg: #303030;
  --movie-color: #c0c0c0;
  --movie-bg: #303030;
  --torrent-color: #c0c0c0;
  --torrent-bg: #303030;
  --success: #a0a0a0;
  --success-bg: #2a2a2a;
  --info: #a0a0a0;
  --info-bg: #2a2a2a;
  --danger: #909090;
  --danger-bg: #2a2a2a;
  --danger-border: #484848;
  --progress-bg: #2a2a2a;
  --progress-border: #404040;
  --progress-fill-start: #808080;
  --progress-fill-end: #a0a0a0;
  --shadow: rgba(0, 0, 0, 0.4);
  --shadow-strong: rgba(0, 0, 0, 0.5);
  --footer-text: rgba(180, 180, 180, 0.7);
  --input-bg: #252525;
  --select-bg: #252525;
  --unmatched-tag-bg: #2a2a2a;
  --unmatched-tag-color: #a0a0a0;
}

/* ===== Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  min-height: 100vh;
  transition: background 0.3s;
}

.app {
  min-height: 100vh;
  padding: 16px;
  max-width: 1200px;
  margin: 0 auto;
}

/* ===== Header ===== */
.app-header {
  background: var(--surface);
  padding: 14px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px var(--shadow);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  transition: background 0.3s;
}

.app-header h1 {
  color: var(--text-primary);
  font-size: 1.4rem;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-alt);
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 0.85rem;
}

.user-label {
  color: var(--text-muted);
  font-weight: 500;
}

.user-name {
  color: var(--accent);
  font-weight: bold;
  font-size: 0.9rem;
}

.logout-btn {
  padding: 4px 12px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: opacity 0.2s;
}

.logout-btn:hover {
  opacity: 0.85;
}

/* ===== Theme Switcher ===== */
.theme-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-alt);
  padding: 3px;
  border-radius: 16px;
}

.theme-btn {
  padding: 4px 10px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.75rem;
  background: transparent;
  color: var(--text-muted);
  transition: all 0.2s;
}

.theme-btn.active {
  background: var(--accent);
  color: white;
}

.theme-btn:hover:not(.active) {
  color: var(--text-primary);
}

/* ===== Refresh Control ===== */
.refresh-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.refresh-control label {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.refresh-control select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--select-bg);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.8rem;
}

/* ===== Error / Loading ===== */
.error-message {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 12px;
  border-left: 3px solid var(--danger);
  font-size: 0.9rem;
}

.loading {
  text-align: center;
  padding: 30px;
  color: var(--footer-text);
  font-size: 1rem;
}

/* ===== Downloads Container ===== */
.downloads-container {
  background: var(--surface);
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px var(--shadow);
  transition: background 0.3s;
}

.downloads-container h2 {
  color: var(--text-primary);
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.no-downloads {
  text-align: center;
  padding: 30px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.no-downloads p {
  margin: 6px 0;
}

.downloads-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ===== Download Card (Compact) ===== */
.download-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: box-shadow 0.2s, background 0.3s;
  background: var(--surface);
}

.download-card:hover {
  box-shadow: 0 2px 8px var(--shadow);
}

.download-card.series {
  border-left: 3px solid var(--series-color);
}

.download-card.movie {
  border-left: 3px solid var(--movie-color);
}

.download-card.torrent {
  border-left: 3px solid var(--torrent-color);
}

/* ===== Cover Art ===== */
.download-cover {
  flex-shrink: 0;
  width: 50px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 4px var(--shadow-strong);
}

.download-cover img {
  width: 100%;
  height: auto;
  display: block;
}

/* ===== Download Info ===== */
.download-info {
  flex: 1;
  min-width: 0;
}

.download-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.download-type {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.download-type.series {
  background: var(--series-bg);
  color: var(--series-color);
}

.download-type.movie {
  background: var(--movie-bg);
  color: var(--movie-color);
}

.download-type.torrent {
  background: var(--torrent-bg);
  color: var(--torrent-color);
}

.download-status {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: capitalize;
}

.download-status.downloading,
.download-status.Downloading {
  background: var(--success-bg);
  color: var(--success);
}

.download-status.completed,
.download-status.Completed {
  background: var(--info-bg);
  color: var(--info);
}

.download-status.failed,
.download-status.Failed {
  background: var(--danger-bg);
  color: var(--danger);
}

.download-title {
  color: var(--text-primary);
  margin-bottom: 2px;
  font-size: 0.9rem;
  font-weight: 600;
  overflow-wrap: break-word;
  word-break: break-word;
  overflow: hidden;
}

.download-series,
.download-movie {
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-style: italic;
  font-size: 0.8rem;
}

/* ===== Detail Row (Inline) ===== */
.download-details {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  align-items: center;
}

.detail-item {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-size: 0.78rem;
  background: var(--bg-secondary, rgba(0,0,0,0.04));
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
}

.detail-item.availability-warning .detail-value {
  color: var(--danger, #e53e3e);
  font-weight: 700;
}

.detail-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-size: 0.65rem;
  font-weight: 600;
}

.detail-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* ===== Progress Bar (Compact) ===== */
.progress-item {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  background: none;
  padding: 0;
  white-space: normal;
  border-radius: 0;
}

.progress-container {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
}

.progress-bar {
  flex: 1;
  height: 10px;
  background: var(--progress-bg);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--progress-border);
}

.progress-segment {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  transition: width 0.3s ease;
}

.progress-segment.downloaded {
  background: linear-gradient(90deg, var(--progress-fill-start) 0%, var(--progress-fill-end) 100%);
}

.progress-text {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.78rem;
  white-space: nowrap;
}

.missing-text {
  color: var(--danger);
  font-size: 0.72rem;
  font-weight: 500;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ===== Main Tabs ===== */
.main-tabs {
  max-width: 1200px;
  margin: 16px auto 0;
  padding: 0 16px;
}

.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  border-radius: 4px 4px 0 0;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--surface);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--surface);
}

.tab-panel {
  padding-top: 0;
}

/* ===== Recently Completed History ===== */
.history-container {
  max-width: unset;
  margin: 0;
  padding: 0;
}

.history-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.history-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text-primary);
  flex: 1 1 auto;
}

.history-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.history-days-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.history-days-input {
  width: 52px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.85rem;
  text-align: center;
}

.history-refresh-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 7px;
  line-height: 1.4;
  transition: background 0.15s, color 0.15s;
}

.history-refresh-btn:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.history-loading,
.history-error,
.no-history {
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 8px 0;
}

.history-error {
  color: var(--error, #e74c3c);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-card {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  transition: background 0.2s;
  align-items: flex-start;
}

.history-card.failed {
  border-left: 3px solid var(--error, #e74c3c);
}

.history-card.imported {
  border-left: 3px solid var(--success, #27ae60);
}

.history-cover {
  flex: 0 0 48px;
  width: 48px;
}

.history-cover img {
  width: 48px;
  height: 68px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.history-info {
  flex: 1 1 auto;
  min-width: 0;
}

.history-card-header {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  margin-bottom: 4px;
}

.history-type-badge,
.history-outcome-badge,
.history-instance-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

.history-type-badge.series {
  background: var(--badge-series-bg, #2980b9);
  color: #fff;
}

.history-type-badge.movie {
  background: var(--badge-movie-bg, #8e44ad);
  color: #fff;
}

.history-outcome-badge.imported {
  background: var(--success, #27ae60);
  color: #fff;
}

.history-outcome-badge.failed {
  background: var(--error, #e74c3c);
  color: #fff;
}

.history-instance-badge {
  background: var(--tag-bg, #ecf0f1);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.history-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 2px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-media-name {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0 0 4px;
}

.history-details {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.history-failure-message {
  font-size: 0.78rem;
  color: var(--error, #e74c3c);
  background: var(--error-bg, rgba(231, 76, 60, 0.08));
  border-radius: 4px;
  padding: 3px 7px;
  flex-basis: 100%;
}

@media (max-width: 480px) {
  .history-cover {
    display: none;
  }
  .history-title {
    white-space: normal;
  }
}

/* ===== Footer ===== */
.app-footer {
  margin-top: 12px;
  text-align: center;
  color: var(--footer-text);
  font-size: 0.8rem;
}

.app-footer p {
  opacity: 0.8;
}

/* ===== Login ===== */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.3s ease-out;
}

.login-container.fade-out {
  opacity: 0;
}

.login-box {
  background: var(--surface);
  padding: 36px;
  border-radius: 10px;
  box-shadow: 0 4px 6px var(--shadow);
  width: 100%;
  max-width: 380px;
  transition: background 0.3s;
  text-align: center;
}

.login-logo {
  max-width: 180px;
  width: 60%;
  margin-bottom: 12px;
}

.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 0.85rem;
}

.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-group label {
  display: block;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.form-group input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.95rem;
  background: var(--input-bg);
  color: var(--text-primary);
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group--checkbox {
  margin-bottom: 20px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-label span {
  line-height: 1;
}

.login-btn {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.2s;
}

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

/* ===== Admin Controls ===== */
.admin-controls {
  display: flex;
  align-items: center;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--surface-alt);
  padding: 4px 12px;
  border-radius: 14px;
}

.toggle-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* ===== Arr Links (Admin) ===== */
.arr-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}

.arr-link:hover {
  opacity: 0.8;
  border-bottom-style: solid;
}

/* ===== Download Paths (Admin) ===== */
.download-paths {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
}

.path-item {
  font-size: 0.7rem;
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
  color: var(--text-muted);
  overflow-wrap: break-word;
  word-break: break-all;
  overflow: hidden;
}

.path-label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.path-value {
  color: var(--text-muted);
}

/* ===== Import Issue Badge ===== */
.import-issue-badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
  background: #ffebee;
  color: #c62828;
  cursor: help;
  position: relative;
  white-space: nowrap;
}

.import-issue-badge:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #424242;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 400;
  white-space: pre-line;
  max-width: 320px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  line-height: 1.4;
  pointer-events: none;
}

.download-user-badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: capitalize;
  background: var(--accent-light);
  color: var(--accent);
  margin-left: auto;
  white-space: nowrap;
}

.download-user-badge.unmatched {
  background: var(--unmatched-tag-bg);
  color: var(--unmatched-tag-color);
  margin-left: 0;
}

/* ===== Status Button ===== */
.status-btn {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.status-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ===== Status Panel ===== */
.status-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 4px var(--shadow);
}

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

.status-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.status-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.status-close:hover {
  color: var(--text-primary);
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.status-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.status-card-wide {
  grid-column: 1 / -1;
}

.status-card-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.status-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-row span:last-child {
  font-weight: 500;
  color: var(--text-primary);
}

.status-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.status-table th {
  text-align: left;
  padding: 4px 8px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
}

.status-table td {
  padding: 5px 8px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}

.status-table code {
  font-size: 0.75rem;
  background: var(--surface);
  padding: 1px 4px;
  border-radius: 3px;
}

.status-expired {
  color: #c62828;
  font-weight: 600;
  font-size: 0.7rem;
}

.status-fg-badge {
  background: #fff3e0;
  color: #e65100;
  padding: 1px 8px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-row-sub {
  padding-left: 12px;
  font-size: 0.75rem;
  opacity: 0.8;
}

.status-row-sub span:first-child {
  font-style: italic;
}

.status-timings {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.timing-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
}

.timing-label {
  width: 110px;
  flex-shrink: 0;
  color: var(--text-secondary);
  white-space: nowrap;
}

.timing-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.timing-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  min-width: 2px;
  transition: width 0.3s ease;
}

.timing-value {
  width: 50px;
  flex-shrink: 0;
  text-align: right;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.75rem;
}

.status-loading, .status-error {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.status-error {
  color: #c62828;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .app {
    padding: 10px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 12px;
    gap: 8px;
  }

  .header-controls {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .user-info {
    width: 100%;
    justify-content: space-between;
    box-sizing: border-box;
  }

  .admin-controls {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }

  .downloads-container {
    padding: 12px;
  }

  .download-card {
    padding: 8px 10px;
  }

  .download-cover {
    width: 40px;
  }

  .progress-container {
    flex-wrap: wrap;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .status-table {
    font-size: 0.72rem;
  }

  .status-table th,
  .status-table td {
    padding: 4px 4px;
  }

  .status-table td code {
    word-break: break-all;
  }

  .timing-label {
    width: 90px;
  }

  .timing-value {
    width: 40px;
  }

  .import-issue-badge:hover::after {
    left: auto;
    right: 0;
    max-width: calc(100vw - 24px);
  }
}

/* ===== Very small screens (≤ 400px) ===== */
@media (max-width: 400px) {
  .app {
    padding: 6px;
  }

  .download-cover {
    display: none;
  }

  .theme-switcher {
    flex-shrink: 0;
  }

  .user-info {
    font-size: 0.78rem;
    padding: 5px 10px;
  }

  .download-card {
    padding: 8px;
  }

  .timing-label {
    width: 75px;
    font-size: 0.7rem;
  }
}
