/*
 * Collecthor — Application Styles
 * CSS puro com custom properties, sem framework externo.
 */

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-bg:          #0f1117;
  --color-surface:     #1a1d27;
  --color-surface-2:   #252836;
  --color-border:      #2e3249;
  --color-accent:      #f59e0b;
  --color-accent-dim:  #d97706;
  --color-text:        #e2e8f0;
  --color-text-muted:  #94a3b8;
  --color-success:     #22c55e;
  --color-warning:     #f97316;
  --color-danger:      #ef4444;
  --color-info:        #3b82f6;

  --flash-success-bg:  rgba(34,197,94,.15);
  --flash-success-bd:  rgba(34,197,94,.3);
  --flash-success-tx:  #86efac;
  --flash-alert-bg:    rgba(239,68,68,.15);
  --flash-alert-bd:    rgba(239,68,68,.3);
  --flash-alert-tx:    #fca5a5;
  --flash-warn-bg:     rgba(245,158,11,.15);
  --flash-warn-bd:     rgba(245,158,11,.3);
  --flash-warn-tx:     #fcd34d;

  --badge-pending-bg:  rgba(148,163,184,.15);
  --badge-pending-tx:  #94a3b8;
  --badge-processing-bg: rgba(59,130,246,.15);
  --badge-processing-tx: #93c5fd;
  --badge-done-bg:     rgba(34,197,94,.15);
  --badge-done-tx:     #86efac;
  --badge-failed-bg:   rgba(239,68,68,.15);
  --badge-failed-tx:   #fca5a5;
  --badge-comic-bg:    rgba(245,158,11,.15);
  --badge-comic-tx:    #fcd34d;
  --badge-book-bg:     rgba(59,130,246,.15);
  --badge-book-tx:     #93c5fd;
  --badge-music-bg:    rgba(168,85,247,.15);
  --badge-music-tx:    #d8b4fe;
  --badge-movie-bg:    rgba(6,182,212,.15);
  --badge-movie-tx:    #67e8f9;
  --badge-tag-bg:      rgba(59,130,246,.1);
  --badge-tag-tx:      #93c5fd;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;

  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;

  --shadow: 0 4px 24px rgba(0,0,0,.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.3);

  --nav-height: 60px;
  --sidebar-width: 220px;
  --content-max: 1280px;
}

[data-theme="light"] {
  --color-bg:          #faf8f5;
  --color-surface:     #ffffff;
  --color-surface-2:   #f5f0eb;
  --color-border:      #e8e0d6;
  --color-accent:      #d97706;
  --color-accent-dim:  #b45309;
  --color-text:        #1f1d1a;
  --color-text-muted:  #8c7f6b;
  --color-success:     #16a34a;
  --color-warning:     #ea580c;
  --color-danger:      #dc2626;
  --color-info:        #2563eb;

  --flash-success-bg:  rgba(34,197,94,.12);
  --flash-success-bd:  rgba(34,197,94,.25);
  --flash-success-tx:  #15803d;
  --flash-alert-bg:    rgba(239,68,68,.12);
  --flash-alert-bd:    rgba(239,68,68,.25);
  --flash-alert-tx:    #991b1b;
  --flash-warn-bg:     rgba(245,158,11,.12);
  --flash-warn-bd:     rgba(245,158,11,.25);
  --flash-warn-tx:     #92400e;

  --badge-pending-bg:  rgba(140,127,107,.12);
  --badge-pending-tx:  #5c5348;
  --badge-processing-bg: rgba(37,99,235,.12);
  --badge-processing-tx: #1e40af;
  --badge-done-bg:     rgba(22,163,74,.12);
  --badge-done-tx:     #14532d;
  --badge-failed-bg:   rgba(220,38,38,.12);
  --badge-failed-tx:   #7f1d1d;
  --badge-comic-bg:    rgba(249,115,22,.12);
  --badge-comic-tx:    #9a3412;
  --badge-book-bg:     rgba(37,99,235,.12);
  --badge-book-tx:     #1e40af;
  --badge-music-bg:    rgba(147,51,234,.12);
  --badge-music-tx:    #6b21a8;
  --badge-movie-bg:    rgba(6,182,212,.12);
  --badge-movie-tx:    #155e75;
  --badge-tag-bg:      rgba(37,99,235,.08);
  --badge-tag-tx:      #1e40af;

  --shadow: 0 4px 24px rgba(0,0,0,.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.06);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.6;
}

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

img { max-width: 100%; height: auto; display: block; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-rows: var(--nav-height) 1fr;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-areas:
    "nav nav"
    "sidebar main";
  min-height: 100vh;
}

.app-layout--fullwidth {
  grid-template-columns: 1fr;
  grid-template-areas:
    "nav"
    "main";
}

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
  grid-area: nav;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-text);
  letter-spacing: -.5px;
}

.navbar__logo {
  height: 22px;
  width: auto;
  display: block;
}

.navbar__brand span { color: var(--color-accent); }

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.navbar__search {
  display: flex;
  align-items: center;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .35rem .75rem;
  gap: .5rem;
  flex: 0 0 280px;
}

.navbar__search input {
  background: none;
  border: none;
  outline: none;
  color: var(--color-text);
  font-size: .875rem;
  width: 100%;
}

.navbar__search input::placeholder { color: var(--color-text-muted); }

.navbar__user {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--color-text-muted);
  font-size: .875rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  padding: 0;
}

.theme-toggle:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: 1.5rem 0;
  overflow-y: auto;
  position: sticky;
  top: var(--nav-height);
  height: calc(100vh - var(--nav-height));
}

.sidebar__section { margin-bottom: 1.5rem; }

.sidebar__label {
  padding: .25rem 1.25rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: .25rem;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5rem 1.25rem;
  color: var(--color-text-muted);
  font-size: .875rem;
  transition: background .15s, color .15s;
  border-left: 2px solid transparent;
}

.sidebar__link:hover, .sidebar__link.active {
  background: var(--color-surface-2);
  color: var(--color-text);
  text-decoration: none;
  border-left-color: var(--color-accent);
}

.sidebar__link svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Main Content ─────────────────────────────────────────────────────────── */
.main-content {
  grid-area: main;
  padding: 2rem;
  max-width: var(--content-max);
  width: 100%;
}

/* ── Flash Messages ───────────────────────────────────────────────────────── */
.flash { padding: .875rem 1.25rem; border-radius: var(--radius); margin-bottom: 1.5rem; font-size: .9rem; }
.flash--notice  { background: var(--flash-success-bg);  border: 1px solid var(--flash-success-bd);  color: var(--flash-success-tx); }
.flash--alert   { background: var(--flash-alert-bg);    border: 1px solid var(--flash-alert-bd);    color: var(--flash-alert-tx); }
.flash--warning { background: var(--flash-warn-bg);     border: 1px solid var(--flash-warn-bd);     color: var(--flash-warn-tx); }

/* ── Page Header ──────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header__title { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
.page-header__subtitle { color: var(--color-text-muted); font-size: .9rem; margin-top: .25rem; }
.page-header__actions { display: flex; gap: .75rem; align-items: center; flex-shrink: 0; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover { opacity: .85; text-decoration: none; }
.btn:active { transform: scale(.98); }

.btn--primary   { background: var(--color-accent); color: #fff; }
.btn--secondary { background: var(--color-surface-2); color: var(--color-text); border: 1px solid var(--color-border); }
.btn--ghost     { background: transparent; color: var(--color-text-muted); border: 1px solid var(--color-border); }
.btn--danger    { background: var(--color-danger); color: #fff; }
.btn--sm        { padding: .3rem .75rem; font-size: .8rem; }
.btn--icon      { padding: .4rem; border-radius: var(--radius-sm); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card__header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--color-border); }
.card__body   { padding: 1.5rem; }
.card__footer { padding: 1rem 1.5rem; border-top: 1px solid var(--color-border); background: var(--color-surface-2); }

/* ── Cover Grid ───────────────────────────────────────────────────────────── */
.cover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
}

.cover-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  cursor: pointer;
  position: relative;
}

.cover-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--color-accent);
  text-decoration: none;
}

.cover-card__image {
  aspect-ratio: 2/3;
  object-fit: cover;
  width: 100%;
  background: var(--color-surface-2);
}

.cover-card__image--placeholder {
  aspect-ratio: 2/3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: 2.5rem;
}

.cover-card--square .cover-card__image,
.cover-card--square .cover-card__image--placeholder {
  aspect-ratio: 1/1;
}

.cover-card__body {
  padding: .625rem .75rem;
}

.cover-card__title {
  font-size: .8rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cover-card__meta {
  font-size: .7rem;
  color: var(--color-text-muted);
  margin-top: .15rem;
}

/* ── Badges / Status ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
}

.badge--pending    { background: var(--badge-pending-bg);    color: var(--badge-pending-tx); }
.badge--processing { background: var(--badge-processing-bg); color: var(--badge-processing-tx); }
.badge--done, .badge--cataloged { background: var(--badge-done-bg); color: var(--badge-done-tx); }
.badge--failed     { background: var(--badge-failed-bg);     color: var(--badge-failed-tx); }
.badge--comic      { background: var(--badge-comic-bg);      color: var(--badge-comic-tx); }
.badge--book       { background: var(--badge-book-bg);       color: var(--badge-book-tx); }
.badge--music      { background: var(--badge-music-bg);      color: var(--badge-music-tx); }
.badge--movie      { background: var(--badge-movie-bg);      color: var(--badge-movie-tx); }
.badge--tag        { background: var(--badge-tag-bg);        color: var(--badge-tag-tx); text-transform: none; font-weight: 600; }

.badge--solid-success { background: var(--color-success); color: #fff; }
.badge--solid-warning { background: var(--color-warning); color: #fff; }

[data-theme="light"] .badge--solid-success { background: var(--color-success); color: #fff; }
[data-theme="light"] .badge--solid-warning { background: var(--color-warning); color: #fff; }

/* ── Stats Row ────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--color-text);
}

.stat-card__label {
  font-size: .8rem;
  color: var(--color-text-muted);
  margin-top: .35rem;
}

.stat-card__accent { color: var(--color-accent); }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th {
  text-align: left;
  padding: .75rem 1rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}
td { padding: .75rem 1rem; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--color-surface-2); }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-size: .825rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: .4rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: .9rem;
  padding: .6rem .875rem;
  outline: none;
  transition: border-color .15s;
}

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

textarea { resize: vertical; min-height: 100px; }

.field-hint { font-size: .75rem; color: var(--color-text-muted); margin-top: .3rem; }
.field-error { font-size: .75rem; color: var(--color-danger); margin-top: .3rem; }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  margin-top: 2rem;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 .5rem;
  border-radius: var(--radius);
  font-size: .875rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
}

.pagination a:hover { border-color: var(--color-accent); color: var(--color-accent); text-decoration: none; }
.pagination .current { background: var(--color-accent); color: #fff; border-color: var(--color-accent); font-weight: 700; }

/* ── Detail Panel ─────────────────────────────────────────────────────────── */
.detail-layout { display: grid; grid-template-columns: 260px 1fr; gap: 2rem; align-items: start; }

.detail-cover {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
  aspect-ratio: 2/3;
  object-fit: cover;
  width: 100%;
  background: var(--color-surface-2);
}

.detail-cover--square {
  aspect-ratio: 1/1;
}

.detail-section { margin-bottom: 1.75rem; }
.detail-section__title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  margin-bottom: .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--color-border);
}

.detail-row { display: flex; gap: 1rem; margin-bottom: .6rem; font-size: .9rem; }
.detail-row__label { color: var(--color-text-muted); flex: 0 0 140px; }
.detail-row__value { color: var(--color-text); flex: 1; }

.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: .2rem .75rem;
  font-size: .75rem;
  color: var(--color-text-muted);
}

/* ── Auth Pages ───────────────────────────────────────────────────────────── */
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
}

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.auth-card__logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .65rem;
  margin-bottom: 1.75rem;
}

.auth-card__logo img {
  height: 72px;
  width: auto;
  display: block;
}

.auth-card__wordmark {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-text);
}

.auth-card__wordmark span { color: var(--color-accent); }

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.empty-state__icon  { font-size: 3.5rem; margin-bottom: 1rem; opacity: .4; }
.empty-state__title { font-size: 1.25rem; font-weight: 700; margin-bottom: .5rem; }
.empty-state__desc  { color: var(--color-text-muted); font-size: .9rem; max-width: 360px; margin-bottom: 1.5rem; }

/* ── Progress bar ─────────────────────────────────────────────────────────── */
.progress { background: var(--color-surface-2); border-radius: 999px; height: 6px; overflow: hidden; }
.progress__bar { height: 100%; background: var(--color-accent); border-radius: 999px; transition: width .3s; }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.text-muted  { color: var(--color-text-muted); }
.text-sm     { font-size: .875rem; }
.text-xs     { font-size: .75rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: 1rem; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.search-tools {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.hidden-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Collection Filters ───────────────────────────────────────────────────── */
.collection-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.5rem;
  padding: .75rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

/* ── Mobile Menu Toggle ───────────────────────────────────────────────────── */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-text);
  cursor: pointer;
  padding: .4rem;
}

/* ── Mobile Sidebar Overlay ───────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 149;
}

.sidebar-overlay.open { display: block; }

/* ── Mobile Responsiveness ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --nav-height: 52px;
    --sidebar-width: 0px;
  }

  html { font-size: 15px; }

  .app-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "nav"
      "main";
  }

  .navbar {
    padding: 0 .75rem;
    gap: .5rem;
  }

  .navbar__brand {
    font-size: 1rem;
    gap: .35rem;
  }

  .navbar__logo {
    height: 18px;
    width: 18px;
  }

  .navbar__search {
    flex: 1 1 auto;
    min-width: 0;
    padding: .25rem .5rem;
  }

  .navbar__search input {
    font-size: .8rem;
  }

  .navbar__user {
    display: none;
  }

  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    width: 260px;
    height: calc(100vh - var(--nav-height));
    z-index: 150;
    transform: translateX(-100%);
    transition: transform .25s ease;
    border-right: 1px solid var(--color-border);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    padding: 1rem;
    max-width: 100%;
  }

  .page-header {
    margin-bottom: 1.25rem;
    gap: .75rem;
  }

  .page-header__title {
    font-size: 1.35rem;
  }

  .page-header__actions {
    flex-wrap: wrap;
    gap: .5rem;
    width: 100%;
  }

  .page-header__actions .btn {
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
  }

  .cover-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .75rem;
  }

  .cover-card__title {
    font-size: .75rem;
  }

  .cover-card__body {
    padding: .5rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .75rem;
    margin-bottom: 1.5rem;
  }

  .stat-card {
    padding: .875rem 1rem;
  }

  .stat-card__value {
    font-size: 1.5rem;
  }

  .stat-card__label {
    font-size: .75rem;
  }

  .collection-filters {
    flex-direction: column;
    align-items: stretch;
    gap: .4rem;
    padding: .5rem .75rem;
  }

  .collection-filters select,
  .collection-filters .btn {
    width: 100%;
    justify-content: center;
  }

  .card__body {
    padding: 1rem;
  }

  .card__header {
    padding: 1rem;
  }

  .card__footer {
    padding: .75rem 1rem;
  }

  .detail-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .detail-cover {
    max-width: 200px;
    margin: 0 auto;
  }

  .detail-row {
    flex-direction: column;
    gap: .2rem;
    margin-bottom: .75rem;
  }

  .detail-row__label {
    flex: none;
    font-size: .75rem;
  }

  .detail-row__value {
    font-size: .85rem;
  }

  .auth-card {
    padding: 1.5rem;
    margin: 1rem;
  }

  .empty-state {
    padding: 2.5rem 1rem;
  }

  .empty-state__icon {
    font-size: 2.5rem;
  }

  .empty-state__title {
    font-size: 1.1rem;
  }

  .btn {
    padding: .55rem .875rem;
    font-size: .85rem;
    min-height: 40px;
  }

  .btn--sm {
    padding: .4rem .65rem;
    font-size: .78rem;
    min-height: 36px;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  select,
  textarea {
    padding: .65rem .75rem;
    font-size: 1rem;
    min-height: 44px;
  }

  select {
    padding-right: 2rem;
  }

  .pagination a,
  .pagination span {
    min-width: 40px;
    height: 40px;
  }

  table {
    font-size: .8rem;
  }

  th, td {
    padding: .5rem .625rem;
  }

  .search-tools {
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
  }

  .search-tools .btn {
    width: 100%;
    justify-content: center;
  }

  .form-group {
    margin-bottom: 1rem;
  }

  /* Series view on mobile */
  .series-group-header {
    padding: .75rem;
  }

  .series-group-header img {
    width: 48px;
    height: 72px;
  }

  .series-issues-grid {
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: .5rem;
  }

  .cover-card__image,
  .cover-card__image--placeholder {
    height: 120px;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .cover-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .5rem;
  }

  .page-header__actions .btn {
    font-size: .75rem;
    padding: .45rem .5rem;
  }

  .navbar__search {
    padding: .2rem .4rem;
  }

  .navbar__search input {
    font-size: .75rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-card__value {
    font-size: 1.25rem;
  }

  .collection-filters {
    padding: .4rem .5rem;
  }
}
