/* ============================
   DOI Open Access — CyberLink Store Theme
   ============================ */

:root {
  color-scheme: light;
  --bg: #edf2f8;
  --bg-image: url('Fondo-BG-cl.webp');
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --surface-2: #eef3f9;
  --surface-3: #f5f8fc;
  --text: #1a2332;
  --muted: #5a6b7d;
  --line: #c8d5e2;
  --line-subtle: #dde6f0;

  /* CyberLink Store brand */
  --primary: #1B2A4A;
  --primary-strong: #0F1B30;
  --primary-light: #e4eaf2;
  --accent: #00C8FF;
  --accent-strong: #00A0CC;
  --accent-light: #e0f7ff;

  /* Status */
  --success: #0d8a52;
  --success-light: #e2f7ed;
  --success-bg: rgba(13, 138, 82, 0.08);
  --warning: #b07d00;
  --warning-light: #fef6de;
  --warning-bg: rgba(176, 125, 0, 0.07);
  --danger: #c0392b;
  --danger-light: #fdeaea;
  --danger-bg: rgba(192, 57, 43, 0.06);
  --info-bg: #e0f7ff;
  --info-line: #00A0CC;
  --info-text: #0F1B30;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 3px rgba(24, 32, 42, 0.06);
  --shadow: 0 4px 16px rgba(24, 32, 42, 0.08);
  --shadow-lg: 0 12px 40px rgba(24, 32, 42, 0.12);
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1018;
  --bg-image: none;
  --surface: rgba(22, 27, 34, 0.95);
  --surface-solid: #161b22;
  --surface-2: #1c2333;
  --surface-3: #21283b;
  --text: #e6edf3;
  --muted: #8b949e;
  --line: #30363d;
  --line-subtle: #262d38;

  --primary: #4CC9F0;
  --primary-strong: #80DEEA;
  --primary-light: #0a1929;
  --accent: #00E5FF;
  --accent-strong: #4DD0E1;
  --accent-light: #0a2030;

  --success: #56d364;
  --success-light: #0d2818;
  --success-bg: rgba(86, 211, 100, 0.10);
  --warning: #e3b341;
  --warning-light: #2d2200;
  --warning-bg: rgba(227, 179, 65, 0.10);
  --danger: #f85149;
  --danger-light: #3d1214;
  --danger-bg: rgba(248, 81, 73, 0.08);
  --info-bg: #0a1929;
  --info-line: #4CC9F0;
  --info-text: #b3ecff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.36);
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: var(--bg-image);
  background-size: cover;
  background-position: top center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

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

img,
svg {
  display: block;
  max-width: 100%;
}

h1, h2, h3, p {
  margin-top: 0;
}

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

a:hover {
  text-decoration: underline;
}

/* ============================
   App Shell
   ============================ */
.app-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

/* ============================
   Top Bar (Sticky)
   ============================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -24px calc(-1 * (50vw - min(600px, calc(50% - 16px)))) 24px;
  padding: 12px max(16px, calc(50vw - min(600px, calc(50% - 16px))));
  background: linear-gradient(135deg, rgba(27, 42, 74, 0.97), rgba(15, 27, 48, 0.95));
  backdrop-filter: blur(16px) saturate(1.8);
  -webkit-backdrop-filter: blur(16px) saturate(1.8);
  border-bottom: 2px solid var(--accent);
  box-shadow: 0 2px 12px rgba(0, 200, 255, 0.25);
}

.topbar,
.topbar a,
.topbar button {
  color: #fff;
}

.topbar-logo {
  height: 44px;
  width: auto;
  margin-right: 8px;
  border-radius: 4px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.eyebrow {
  margin: 0 0 2px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.3rem, 3.5vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: #fff;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.15rem;
  font-weight: 700;
}

/* ============================
   Shared Button Styles
   ============================ */
.icon-button,
.modal-close {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  transition: all var(--transition);
}

.icon-button:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.25);
}

.modal-close {
  border-color: var(--line);
  background: var(--surface-solid);
  color: var(--muted);
}

.modal-close:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.theme-toggle {
  position: relative;
}

.theme-svg,
.guide-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-moon,
[data-theme="dark"] .theme-sun {
  display: none;
}

[data-theme="dark"] .theme-moon {
  display: block;
}

.guide-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-weight: 700;
  font-size: 0.875rem;
  text-decoration: none;
  transition: all var(--transition);
}

.guide-button:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.25);
  text-decoration: none;
}

/* ============================
   Primary / Secondary Buttons
   ============================ */
.primary,
.secondary,
.text-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: var(--radius-sm);
  padding: 0 18px;
  font-weight: 700;
  font-size: 0.875rem;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.primary {
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--primary), transparent 50%);
}

[data-theme="dark"] .primary {
  color: #fff;
}

.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-strong), var(--primary));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary), transparent 40%);
  transform: translateY(-1px);
}

.primary:active:not(:disabled) {
  transform: translateY(0);
}

.secondary {
  border: 1px solid var(--line);
  background: var(--surface-solid);
  color: var(--text);
}

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

.text-link {
  border: 1px solid transparent;
  background: transparent;
  color: var(--primary);
  padding: 0 12px;
}

.text-link:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  text-decoration: none;
}

/* ============================
   Hero Panel
   ============================ */
.hero-panel {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
}

.input-area,
.summary-panel,
.toolbar,
.results-section,
.management-panel,
.notice-band {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.input-area:hover,
.results-section:hover,
.management-panel:hover {
  box-shadow: var(--shadow);
}

.input-area {
  padding: 20px;
}

/* ============================
   Form Fields
   ============================ */
label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary), transparent 80%);
  background: var(--surface-solid);
}

textarea {
  min-height: 180px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.55;
  font-size: 0.9rem;
}

input,
select {
  height: 40px;
  padding: 0 12px;
  font-size: 0.875rem;
}

input[type="file"] {
  padding: 8px 12px;
  height: auto;
  font-size: 0.82rem;
  cursor: pointer;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

/* ============================
   Summary Panel
   ============================ */
.summary-panel {
  display: grid;
  gap: 8px;
  padding: 14px;
  align-content: start;
}

.metric {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 0;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background: var(--surface-2);
  transition: all var(--transition);
}

.metric:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.metric span {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--primary);
  min-width: 36px;
}

.metric small {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  line-height: 1.3;
}

/* ============================
   Notice Band
   ============================ */
.notice-band {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-color: var(--info-line);
  background: var(--info-bg);
  color: var(--info-text);
  line-height: 1.55;
  box-shadow: none;
  font-size: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.notice-band strong {
  color: var(--info-text);
  white-space: nowrap;
}

.notice-dismiss {
  margin-left: auto;
  padding: 2px 8px;
  border: none;
  background: transparent;
  color: var(--info-text);
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0.6;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 4px;
  transition: opacity var(--transition);
}

.notice-dismiss:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--info-line), transparent 80%);
}

/* ============================
   Toolbar / Filters
   ============================ */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.toolbar .field {
  flex: 1 1 180px;
  min-width: 0;
}

.toolbar .field.grow {
  flex: 2 1 260px;
}

.toolbar .field.compact {
  flex: 0 1 100px;
}

/* Collapsible toolbar on mobile */
.filter-toggle-btn {
  display: none;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.875rem;
  gap: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-toggle-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--transition);
}

.filter-toggle-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.filter-toggle-btn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.toolbar-fields {
  display: contents;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.check-field:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.check-field input {
  width: 18px;
  height: 18px;
  padding: 0;
  cursor: pointer;
  accent-color: var(--primary);
}

#downloadAllBtn {
  white-space: nowrap;
  flex: 0 0 auto;
}

.danger-action {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger), transparent 60%);
}

.danger-action:hover:not(:disabled) {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
}

/* ============================
   Management Panel
   ============================ */
.management-panel {
  margin-bottom: 16px;
  padding: 20px;
}

.management-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: stretch;
}

.management-grid .mgmt-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  min-height: 120px;
}

.management-grid .mgmt-group .field {
  margin: 0;
  flex: 1;
}

.management-grid .mgmt-group .secondary {
  width: 100%;
  margin-top: auto;
}

/* ============================
   Results Section
   ============================ */
.results-section {
  min-height: 200px;
  padding: 20px;
  margin-bottom: 16px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ============================
   Results Grid
   ============================ */
.results-grid {
  display: grid;
  gap: 12px;
}

/* ============================
   Pagination
   ============================ */
.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

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

.pager-actions span {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
}

.pager-actions .secondary {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.82rem;
}

/* ============================
   Result Card — Status colors
   ============================ */
.result-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--surface);
  transition: all var(--transition);
  border-left: 4px solid var(--line);
}

.result-card:hover {
  box-shadow: var(--shadow);
}

.result-card.status-pdf {
  background: var(--success-bg);
  border-left-color: var(--success);
  border-color: color-mix(in srgb, var(--success), transparent 60%);
}

.result-card.status-oa_no_pdf {
  background: var(--warning-bg);
  border-left-color: var(--warning);
  border-color: color-mix(in srgb, var(--warning), transparent 60%);
}

.result-card.status-closed,
.result-card.status-error {
  background: var(--danger-bg);
  border-left-color: var(--danger);
  border-color: color-mix(in srgb, var(--danger), transparent 60%);
}

.result-card.status-imported {
  background: color-mix(in srgb, var(--primary), transparent 94%);
  border-left-color: var(--primary);
  border-color: color-mix(in srgb, var(--primary), transparent 60%);
}

.result-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.result-card h3 {
  margin-bottom: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ============================
   Badges
   ============================ */
.badge {
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge.pdf {
  background: var(--success-light);
  color: var(--success);
}

.badge.oa_no_pdf {
  background: var(--warning-light);
  color: var(--warning);
}

.badge.imported {
  background: var(--primary-light);
  color: var(--primary);
}

.badge.closed,
.badge.error {
  background: var(--danger-light);
  color: var(--danger);
}

/* ============================
   Card Actions
   ============================ */
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-actions .primary,
.card-actions .secondary,
.card-actions .text-link {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.82rem;
}

/* ============================
   Organizer Grid
   ============================ */
.organizer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

.organizer-grid label {
  font-size: 0.78rem;
}

.organizer-grid input {
  height: 36px;
  font-size: 0.82rem;
}

.notes-input {
  min-height: 72px;
  font-size: 0.85rem;
}

/* ============================
   Tags
   ============================ */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
}

/* ============================
   RIS Details
   ============================ */
.ris-details {
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background: var(--surface-2);
  transition: border-color var(--transition);
}

.ris-details[open] {
  border-color: var(--primary);
}

.ris-details summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary);
  transition: color var(--transition);
}

.ris-details summary:hover {
  color: var(--primary-strong);
}

.ris-table {
  display: grid;
  gap: 4px;
  margin-top: 10px;
}

.ris-row {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 2px 0;
}

.ris-row strong {
  color: var(--text);
  font-weight: 700;
  font-size: 0.75rem;
}

/* ============================
   Mini Cards (Library)
   ============================ */
.muted-text {
  color: var(--muted);
  font-size: 0.82rem;
}

.mini-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--surface);
  transition: all var(--transition);
}

.mini-card:hover {
  border-color: color-mix(in srgb, var(--primary), transparent 50%);
  box-shadow: var(--shadow-sm);
}

.mini-card strong {
  font-size: 0.9rem;
  line-height: 1.35;
}

.mini-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

/* ============================
   Empty State
   ============================ */
.empty-state {
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 32px 20px;
  color: var(--muted);
  text-align: center;
  gap: 8px;
}

.empty-state strong {
  color: var(--text);
  font-size: 1rem;
}

.empty-state span {
  font-size: 0.88rem;
  max-width: 400px;
  line-height: 1.5;
}

/* ============================
   Modal
   ============================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 200ms ease;
}

.modal-backdrop[hidden],
[hidden] {
  display: none !important;
}

.modal {
  position: relative;
  width: min(480px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-lg);
  animation: slideUp 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  border: 1px solid var(--line);
}

.modal h3 {
  padding-right: 40px;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.modal p {
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.9rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.progress-wrap {
  margin-top: 18px;
}

.progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  transition: width 300ms ease;
}

.progress-wrap small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
}

/* ============================
   Scroll to Top
   ============================ */
.scroll-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 50;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-solid);
  color: var(--primary);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  transition: all var(--transition);
  pointer-events: none;
}

.scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.scroll-top-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============================
   Footer
   ============================ */
.app-footer {
  margin-top: 32px;
  padding: 16px 0;
  border-top: 1px solid var(--line-subtle);
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.app-footer p {
  margin-bottom: 4px;
}

.app-footer .credits {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0;
}

/* ============================
   Guide Page
   ============================ */
.guide-shell {
  max-width: 1060px;
}

.guide-content {
  display: grid;
  gap: 16px;
}

.guide-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.guide-panel:hover {
  box-shadow: var(--shadow);
}

.guide-panel p,
.guide-panel li {
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.9rem;
}

.guide-panel h2 {
  margin-bottom: 10px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

.guide-grid article {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--surface-2);
  transition: all var(--transition);
}

.guide-grid article:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.guide-grid span {
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.85rem;
}

/* ============================
   Animations
   ============================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================
   Responsive — Tablet (<=940px)
   ============================ */
@media (max-width: 940px) {
  .hero-panel {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    grid-template-columns: repeat(5, 1fr);
  }

  .metric {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    padding: 10px 8px;
  }

  .metric span {
    font-size: 1.3rem;
  }

  .metric small {
    font-size: 0.7rem;
  }

  .toolbar {
    gap: 10px;
  }

  .toolbar .field,
  .toolbar .field.grow {
    flex: 1 1 calc(50% - 6px);
  }

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

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

/* ============================
   Responsive — Mobile (<=640px)
   ============================ */
@media (max-width: 640px) {
  .app-shell {
    width: calc(100% - 16px);
    padding-top: 16px;
  }

  .topbar {
    margin-left: calc(-1 * (50vw - 50% + 8px));
    margin-right: calc(-1 * (50vw - 50% + 8px));
    padding-left: 12px;
    padding-right: 12px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .topbar-logo {
    height: 34px;
  }

  h1 {
    font-size: 1.2rem;
  }

  .guide-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .guide-button {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

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

  .summary-panel .metric:last-child {
    grid-column: span 2;
  }

  /* Collapsible filters on mobile */
  .filter-toggle-btn {
    display: flex;
  }

  .toolbar-fields {
    display: none;
    width: 100%;
  }

  .toolbar-fields.open {
    display: contents;
  }

  .toolbar .field,
  .toolbar .field.grow,
  .toolbar .field.compact {
    flex: 1 1 100%;
  }

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

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

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .result-top {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .pagination-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .pager-actions {
    justify-content: space-between;
  }

  .card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .card-actions .primary,
  .card-actions .secondary,
  .card-actions .text-link {
    width: 100%;
  }

  .card-actions .text-link {
    border: 1px solid var(--line);
    background: var(--surface-2);
    justify-content: center;
  }

  .actions {
    flex-direction: column;
  }

  .actions button {
    width: 100%;
  }

  .scroll-top-btn {
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
}

/* ============================
   Responsive — Small Mobile (<=400px)
   ============================ */
@media (max-width: 400px) {
  .summary-panel {
    grid-template-columns: 1fr;
  }

  .summary-panel .metric:last-child {
    grid-column: span 1;
  }

  .card-actions {
    grid-template-columns: 1fr;
  }

  .pager-actions {
    flex-direction: column;
    gap: 6px;
  }

  .pager-actions .secondary {
    width: 100%;
  }
}

/* ============================
   Print (basic)
   ============================ */
@media print {
  .topbar,
  .toolbar,
  .management-panel,
  .notice-band,
  .scroll-top-btn,
  .card-actions,
  .modal-backdrop {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  body {
    background-image: none !important;
  }

  .result-card {
    break-inside: avoid;
    border: 1px solid #ccc;
    box-shadow: none;
  }
}
