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

html {
  background: #0f0f0f;
  color-scheme: dark;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  line-height: 1.6;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

h1 {
  margin-bottom: 1.5rem;
  color: #fff;
}

/* === Header row with auth === */

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.header-row h1 {
  margin-bottom: 0;
}

#auth-area {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.auth-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auth-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.auth-name {
  color: #ccc;
  font-size: 0.85rem;
  white-space: nowrap;
}

.auth-login-area {
  display: flex;
  justify-content: flex-end;
  padding: 2rem 0 1rem;
}

#g-signin-btn {
  background-color: transparent !important;
}

#g-signin-btn iframe {
  color-scheme: light;
}

.auth-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  color: #666;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.auth-logout-btn:hover { background: #2a1a1a; color: #ff6b6b; }

#auth-error {
  margin-bottom: 0.5rem;
}

/* Admin toolbar: always visible, positioned right */
.admin-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 8px;
  background: #1a1a1a;
  border: 1px solid #333;
  color: #999;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.toolbar-btn:hover { background: #2a1a1a; color: #ff6b6b; }

h2 {
  margin: 1.5rem 0 0.75rem;
  color: #ccc;
  font-size: 1.1rem;
}

.input-group {
  display: flex;
  gap: 0.5rem;
}

input[type="url"] {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #333;
  border-radius: 6px;
  background: #1a1a1a;
  color: #e0e0e0;
  font-size: 1rem;
}

input[type="url"]:focus {
  outline: none;
  border-color: #ff4444;
}

button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  background: #cc0000;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  white-space: nowrap;
}

button:hover { background: #e60000; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

#submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}

#submit-btn svg.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.error {
  color: #ff6b6b;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.hidden { display: none !important; }

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

th, td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #222;
}

th {
  color: #999;
  font-weight: 600;
  font-size: 0.85rem;
}

td { font-size: 0.9rem; }

.th-action { text-align: center; width: 70px; }
.td-action { text-align: center; vertical-align: middle; }

td a {
  color: #6babf5;
  text-decoration: none;
}
td a:hover { text-decoration: underline; }

.title-link {
  color: #e0e0e0;
  padding: 0.2rem 0;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.title-link:hover {
  background: #1a2a3a;
  color: #6babf5;
  text-decoration: none;
}

.thumb {
  width: 60px;
  height: auto;
  border-radius: 4px;
  display: block;
}

.td-action svg { width: 20px; height: 20px; }

.td-action button,
.td-action a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  border-radius: 6px;
  background: transparent;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}

.summary-link-btn { color: #999; }
.summary-link-btn:hover { background: #1a2a3a; color: #6babf5; }
.summary-link-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.download-link-btn { color: #999; }
.download-link-btn:hover { background: #1a2a1a; color: #6bdf6b; text-decoration: none; }

.audio-link-btn { color: #999; }
.audio-link-btn:hover { background: #2a1a2a; color: #c78bf5; text-decoration: none; }

.regenerate-btn { color: #666; }
.regenerate-btn:hover { background: #2a2a1a; color: #f5a623; text-decoration: none; }
.regenerate-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.delete-btn {
  color: #666;
  padding: 0.35rem;
}
.delete-btn:hover { background: #2a1a1a; color: #ff6b6b; }

.restore-btn {
  color: #666;
  padding: 0.35rem;
}
.restore-btn:hover { background: #1a2a1a; color: #6bff6b; }

.muted { color: #666; font-size: 0.9rem; }



.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 1.5rem;
  min-width: 320px;
  max-width: 600px;
  width: 90vw;
  position: relative;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-header h3 {
  color: #fff;
  font-size: 1.1rem;
}

.modal-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: 6px;
  background: transparent;
  color: #666;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.modal-close-btn:hover { background: #2a1a1a; color: #ff6b6b; }

.error-modal-text {
  color: #ccc;
  font-size: 0.95rem;
  line-height: 1.6;
}

.modal-section-label {
  color: #666;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #2a2a2a;
}

.modal-field-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-field-row span {
  color: #ccc;
  font-size: 0.85rem;
  line-height: 1;
}

.modal-field-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
  border: 1.5px solid #555;
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
}

.modal-field-row input[type="checkbox"]:checked {
  background: #cc0000 url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.5 6L5 8.5L9.5 3.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/10px no-repeat;
  border-color: #cc0000;
}

.modal-section-label + .modal-field {
  margin-top: 0.5rem;
}

.modal-field {
  margin-bottom: 1rem;
}

.modal-field label {
  display: block;
  color: #999;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

/* === Custom select dropdown === */

.custom-select {
  position: relative;
}

.custom-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #333;
  border-radius: 6px;
  background: #0f0f0f;
  color: #e0e0e0;
  font-size: 1rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s;
}

.custom-select-trigger:hover {
  border-color: #555;
}

.custom-select-trigger:focus {
  outline: none;
  border-color: #ff4444;
}

.custom-select-trigger svg {
  flex-shrink: 0;
  color: #666;
  transition: transform 0.15s;
}

.custom-select.open .custom-select-trigger svg {
  transform: rotate(180deg);
}

.custom-select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  z-index: 110;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.custom-select-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: background 0.1s;
  min-height: 44px;
}

.custom-select-option:hover {
  background: #252525;
}

.custom-select-option.selected {
  background: #1a1012;
}

.custom-select-option-text {
  flex: 1;
  min-width: 0;
}

.custom-select-option-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e0e0e0;
  line-height: 1.3;
}

.custom-select-option-desc {
  font-size: 0.8rem;
  color: #888;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-check {
  flex-shrink: 0;
  color: #cc0000;
  display: none;
}

.custom-select-option.selected .custom-select-check {
  display: block;
}

.speed-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.speed-row input[type="range"] {
  flex: 1;
  accent-color: #cc0000;
}

.speed-step-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #333;
  border-radius: 6px;
  background: #0f0f0f;
  color: #e0e0e0;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.speed-step-btn:hover {
  background: #1a1a1a;
  border-color: #555;
}

.speed-row span {
  color: #e0e0e0;
  font-size: 0.9rem;
  min-width: 2rem;
  text-align: right;
}

.modal-save-btn {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.6rem 1rem;
}


.audio-progress {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.audio-progress-spinner {
  position: absolute;
  inset: 0;
}

.audio-progress-dot {
  position: absolute;
  width: 4.5px;
  height: 4.5px;
  border-radius: 50%;
  background: #ccc;
  left: 50%;
  top: 50%;
  margin: -2.25px 0 0 -2.25px;
  transform: rotate(calc(var(--i) * 30deg)) translateY(-14px);
  animation: dot-pulse 1.2s linear infinite;
  animation-delay: calc(var(--i) * 0.1s - 1.2s);
}

.audio-progress-pct {
  position: relative;
  font-size: 9px;
  font-weight: 600;
  color: #e0e0e0;
  z-index: 1;
}

@keyframes dot-pulse {
  0% { opacity: 1; }
  100% { opacity: 0.1; }
}

/* === Impersonation banner === */

.impersonate-banner {
  background: #2a1a00;
  border-bottom: 1px solid #f5a623;
  color: #f5a623;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.impersonate-banner-btn {
  padding: 0.15rem 0.6rem !important;
  border-radius: 4px !important;
  background: transparent !important;
  border: 1px solid #f5a623 !important;
  color: #f5a623 !important;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s;
}

.impersonate-banner-btn:hover {
  background: #3a2a10 !important;
}

/* === Summary page: back bar === */

.back-bar {
  position: sticky;
  top: 0;
  background: #0f0f0f;
  padding: 1rem 0;
  z-index: 10;
  border-bottom: 1px solid #222;
}
.back-link {
  display: inline-block;
  color: #e0e0e0;
  text-decoration: none;
  font-size: 1.0rem;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.back-link:hover {
  background: #1a2a3a;
  color: #6babf5;
  text-decoration: none;
}

/* === Summary page: video header === */

.video-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
}

.video-header-thumb {
  width: 120px;
  height: auto;
  border-radius: 6px;
  display: block;
}

.video-header-info {
  flex: 1;
  min-width: 0;
}

.video-header-title {
  color: #e0e0e0;
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-header-title:hover {
  color: #6babf5;
}

.pdf-download-btn {
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.pdf-download-btn:hover {
  background: #1a2a1a;
  color: #6bdf6b;
  text-decoration: none;
}

/* === Summary page: title & meta === */

.summary-title {
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.summary-meta {
  color: #888;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

/* === Summary page: content === */

.summary-content {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 1.5rem;
  line-height: 1.8;
  font-size: 0.95rem;
}

.summary-content h2 {
  color: #fff;
  font-size: 1.2rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid #333;
  padding-bottom: 0.3rem;
}

.summary-content h2:first-child { margin-top: 0; }

.summary-content h3 {
  color: #ddd;
  font-size: 1.05rem;
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}

.summary-content p { margin-bottom: 0.75rem; }

.summary-content ul, .summary-content ol {
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
}

.summary-content li { margin-bottom: 0.3rem; }

.summary-content strong { color: #fff; }

.summary-content blockquote {
  border-left: 3px solid #555;
  padding-left: 1rem;
  color: #aaa;
  margin: 0.75rem 0;
}

/* === Summary page: audio player === */

.audio-player {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.audio-player button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: #999;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.audio-player button:hover { background: #2a1a1a; color: #ff0050; }
.audio-player button:disabled { opacity: 0.4; cursor: not-allowed; }
.audio-player button:disabled:hover { background: transparent; color: #999; }

.audio-time {
  color: #888;
  font-size: 0.8rem;
  min-width: 5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.audio-progress-wrap {
  flex: 1;
  height: 20px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
}

/* Track background (grey rail) */
.audio-progress-wrap::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: #444;
  border-radius: 2px;
}

/* Filled progress (red) — scoped to player bar only */
.audio-progress-wrap .audio-progress {
  height: 4px;
  background: #ff0050;
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
  pointer-events: none;
  position: relative;
  z-index: 1;
}

/* Dot indicator on hover */
.audio-progress-wrap .audio-progress::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  background: #ff0050;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.15s;
}

.audio-progress-wrap:hover .audio-progress::after,
.audio-progress-wrap.dragging .audio-progress::after {
  opacity: 1;
}

.audio-progress-wrap.dragging {
  cursor: grabbing;
}

/* Prevent text selection while dragging */
.audio-progress-wrap.dragging * {
  user-select: none;
}

.audio-label {
  color: #666;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* === Speed control popup === */

.speed-control-wrap {
  position: relative;
}

.speed-toggle-btn {
  width: 30px !important;
  height: 30px !important;
}

.speed-popup {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  right: 0;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 0.75rem;
  width: 220px;
  z-index: 20;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.speed-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.speed-popup-title {
  color: #999;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.speed-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px !important;
  height: 24px !important;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #666;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.speed-close-btn:hover { background: #2a1a1a; color: #ff6b6b; }

.speed-display {
  text-align: center;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.5rem;
}

.speed-slider-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.speed-step-btn {
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  background: #2a2a2a !important;
  color: #ccc !important;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.speed-step-btn:hover { background: #3a3a3a !important; color: #fff !important; }

.speed-slider-row input[type="range"] {
  flex: 1;
  accent-color: #ff0050;
  height: 4px;
}

.speed-presets {
  display: flex;
  gap: 0.25rem;
}

.speed-preset-btn {
  flex: 1;
  padding: 0.3rem 0 !important;
  border-radius: 4px !important;
  background: #2a2a2a !important;
  color: #999 !important;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, color 0.15s;
  width: auto !important;
  height: auto !important;
}
.speed-preset-btn:hover { background: #3a3a3a !important; color: #fff !important; }
.speed-preset-btn.active { background: #ff0050 !important; color: #fff !important; }

/* === Responsive: mobile (<= 768px) === */

@media (max-width: 768px) {
  .container { padding: 1rem 0.75rem; }
  h1 { font-size: 1.3rem; margin-bottom: 0.75rem; }

  .header-row { margin-bottom: 0.75rem; }
  .auth-name { display: none; }

  .admin-toolbar {
    margin-bottom: 0.75rem;
  }

  /* Form: keep inline on mobile */
  .input-group input[type="url"] { min-width: 0; }

  /* HR below "Recent Summaries" */
  h2 { border-bottom: 1px solid #333; padding-bottom: 0.5rem; }

  /* Table → card layout */
  #history-table thead { display: none; }

  #history-table tbody tr {
    display: grid;
    grid-template-columns: 60px auto auto auto 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.2rem 0.5rem;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #222;
    max-width: 100%;
    overflow: hidden;
  }

  /* Hide: regenerate(6) */
  #history-table tbody tr td:nth-child(6) { display: none; }

  /* Thumbnail(1): small, spans 2 rows */
  #history-table tbody tr td:nth-child(1) {
    grid-row: 1 / 3;
    grid-column: 1;
    padding: 0;
    border-bottom: none;
    align-self: start;
  }
  #history-table tbody tr td:nth-child(1) .thumb {
    width: 60px;
    border-radius: 3px;
  }

  /* Title(2): row 1, spans remaining columns */
  #history-table tbody tr td:nth-child(2) {
    grid-row: 1;
    grid-column: 2 / -1;
    padding: 0;
    border-bottom: none;
  }

  /* Summary(3): row 2, col 2 */
  #history-table tbody tr td:nth-child(3) {
    grid-row: 2;
    grid-column: 2;
    padding: 0;
    border-bottom: none;
    text-align: left;
  }

  /* PDF(4): row 2, col 3 */
  #history-table tbody tr td:nth-child(4) {
    grid-row: 2;
    grid-column: 3;
    padding: 0;
    border-bottom: none;
    text-align: left;
  }

  /* Audio(5): row 2, col 4 */
  #history-table tbody tr td:nth-child(5) {
    grid-row: 2;
    grid-column: 4;
    padding: 0;
    border-bottom: none;
    text-align: left;
  }

  /* Delete(7): row 2, right side */
  #history-table tbody tr td:nth-child(7) {
    grid-row: 2;
    grid-column: 6;
    padding: 0;
    border-bottom: none;
    text-align: right;
  }

  /* Shrink audio progress spinner on mobile (table only, not player bar) */
  .td-audio .audio-progress {
    width: 30px;
    height: 30px;
  }
  .td-audio .audio-progress-dot {
    width: 3.5px;
    height: 3.5px;
    margin: -1.75px 0 0 -1.75px;
    transform: rotate(calc(var(--i) * 30deg)) translateY(-10px);
  }

  /* Modal: fit mobile screen */
  .modal { min-width: unset; width: 95vw; padding: 1rem; }

  /* Custom select: bigger touch targets on mobile */
  .custom-select-option {
    padding: 0.75rem;
  }
  .custom-select-option-name {
    font-size: 1rem;
  }
  .custom-select-option-desc {
    font-size: 0.85rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
  .custom-select-dropdown {
    max-height: 50vh;
  }

  /* Audio player: two-row layout on mobile */
  .audio-player { flex-wrap: wrap; }
  .audio-label { display: none; }
  .audio-progress-wrap {
    order: 10;
    flex-basis: 100%;
    height: 10px;
    margin-top: 0.25rem;
  }

  /* Action icons: 30% bigger on mobile */
  .td-action svg { width: 30px; height: 30px; }

  /* Summary content: tighter padding */
  .summary-content { padding: 1rem; }

  /* === Archive table: mobile card layout === */
  #archive-table thead { display: none; }

  #archive-table tbody tr {
    display: grid;
    grid-template-columns: 60px 1fr auto auto;
    grid-template-rows: auto auto;
    gap: 0.2rem 0.5rem;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #222;
  }

  /* Thumbnail: spans 2 rows */
  #archive-table tbody tr td:nth-child(1) {
    grid-row: 1 / 3;
    grid-column: 1;
    padding: 0;
    border-bottom: none;
    align-self: start;
  }
  #archive-table tbody tr td:nth-child(1) .thumb {
    width: 60px;
    border-radius: 3px;
  }

  /* Title: row 1, spans remaining columns */
  #archive-table tbody tr td:nth-child(2) {
    grid-row: 1;
    grid-column: 2 / -1;
    padding: 0;
    border-bottom: none;
  }

  /* Restore(3) + Delete(4): row 2, grouped on the right */
  #archive-table tbody tr td:nth-child(3) {
    grid-row: 2;
    grid-column: 3;
    padding: 0;
    border-bottom: none;
  }

  #archive-table tbody tr td:nth-child(4) {
    grid-row: 2;
    grid-column: 4;
    padding: 0;
    border-bottom: none;
  }
}
