* {
  box-sizing: border-box;
}

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #d8dee6;
  --text: #0f172a;
  --muted: #475569;
  --ink: #1e293b;
  --ink-hover: #0f172a;
  --row-alt: #f1f5f9;
  --cell-border: #94a3b8;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

.page-shell {
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.workspace {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 420px);
  gap: 32px;
  align-items: start;
  flex: 1;
}

/* Linkerkolom */
.left-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.site-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 11px;
  margin-bottom: 10px;
}

.hero h1 {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
}

.subtitle {
  margin: 8px 0 0;
  font-size: 0.96rem;
  color: var(--muted);
  line-height: 1.55;
}

.control-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.title-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.title-field input {
  padding: 11px 12px;
  font-size: 0.95rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  width: 100%;
}

.title-field input::placeholder {
  color: #94a3b8;
}

.title-field input:focus {
  outline: 2px solid var(--ink);
  outline-offset: -1px;
  border-color: var(--ink);
  background: var(--surface);
}

.button-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.download-menu {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.download-menu.is-open {
  display: flex;
}

.download-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.download-choice:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.download-choice strong {
  font-size: 0.86rem;
}

.download-choice span {
  font-size: 0.76rem;
  color: var(--muted);
}

.btn {
  padding: 11px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  text-align: center;
}

.btn-primary {
  background: var(--ink);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--ink-hover);
}

.btn-secondary {
  background: var(--surface-muted);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: #e2e8f0;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.status-note {
  margin: 0;
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.45;
}

.info-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 16px;
}

.info-toggle {
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.info-chevron {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-right: 2px;
}

.info-card.is-open .info-chevron {
  transform: rotate(-135deg);
}

.info-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.24s ease;
}

.info-card.is-open .info-body {
  grid-template-rows: 1fr;
}

.info-body-inner {
  min-height: 0;
  overflow: hidden;
}

.info-card p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
}

.info-card.is-open .info-body-inner p {
  padding-top: 8px;
}

.mobile-only-btn,
.mobile-preview-drawer {
  display: none;
}

/* Rechterkolom: enkele A6-kaart */
.right-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 20px;
}

.preview-bar {
  width: 100%;
  display: flex;
  justify-content: center;
}

.tab-group {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  background: #e2e8f0;
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border);
  width: 100%;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tab-btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.card-stage {
  width: 100%;
  min-height: 594px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-stage.is-empty .auth-table tbody td:not(.day-cell) {
  color: #cbd5e1;
}

.preview-caption {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

/* Kaart-opmaak (alle 31 rijen passen ruim) */
.card {
  width: 100%;
  flex: 1;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  color: #000000;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1.5px solid #0f172a;
  padding-bottom: 4px;
  margin-bottom: 4px;
  gap: 8px;
}

.card-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-subtitle,
.card-date {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.15;
  color: #94a3b8;
  white-space: nowrap;
}

.auth-table {
  width: 100%;
  flex: 1;
  border-collapse: collapse;
  table-layout: fixed;
}

.auth-table th,
.auth-table td {
  border: 1px solid var(--cell-border);
  text-align: center;
  vertical-align: middle;
  padding: 0;
}

.auth-table thead th {
  height: 20px;
  background: #e2e8f0;
  font-size: 0.64rem;
  font-weight: 700;
}

.auth-table th.day-col {
  width: 26px;
  font-size: 0.6rem;
}

.icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.icon-wrap svg {
  width: 13px;
  height: 13px;
  display: block;
}

.auth-table tbody td {
  height: 16.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.64rem;
  font-weight: 600;
  line-height: 1;
}

.auth-table tbody td.day-cell {
  background: #f8fafc;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.62rem;
  color: #1e293b;
}

.auth-table tbody tr:nth-child(even) td:not(.day-cell) {
  background: var(--row-alt);
}

.auth-table tbody tr.group-end td {
  border-bottom: 1.8px solid #334155;
}

/* Achterkant: uitleg + notities */
.back-card {
  justify-content: space-between;
  padding: 14px 16px;
}

.back-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1.5px solid #0f172a;
  padding-bottom: 3px;
  margin-bottom: 6px;
  gap: 8px;
}

.back-header h2 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.back-header .back-card-name {
  margin: 0;
  font-size: 0.66rem;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  font-size: 0.67rem;
  line-height: 1.2;
}

.step-num {
  flex: 0 0 14px;
  height: 14px;
  border-radius: 50%;
  background: #0f172a;
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.example-box {
  border: 1px solid #94a3b8;
  border-radius: 6px;
  background: #f8fafc;
  padding: 5px 7px;
  margin: 6px 0;
}

.example-title {
  font-size: 0.66rem;
  font-weight: 700;
  margin: 0 0 3px;
  color: #0f172a;
}

.example-diagram {
  width: 100%;
  height: auto;
  display: block;
}

.tips-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tip-box {
  border-left: 3px solid #0f172a;
  background: #f1f5f9;
  padding: 4px 6px;
  font-size: 0.64rem;
  line-height: 1.2;
}

.notes-box {
  margin-top: 6px;
}

.notes-title {
  margin: 0;
  font-size: 0.65rem;
  font-weight: 700;
  color: #334155;
}

.note-line {
  height: 22px;
  border-bottom: 1px solid #94a3b8;
}

.back-footer {
  font-size: 0.6rem;
  color: #475569;
  padding-top: 4px;
  line-height: 1.25;
}

.back-footer .site-credit {
  display: block;
  margin-top: 2px;
  color: #64748b;
}

.site-footer {
  text-align: center;
  padding: 14px 16px 26px;
  font-size: 0.8rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.github-link {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  transition: color 0.15s ease;
  vertical-align: middle;
}

.github-link:hover {
  color: var(--text);
}

.github-link svg {
  width: 16px;
  height: 16px;
  display: block;
}

.mit-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  background: var(--surface);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.mit-badge:hover {
  color: var(--text);
  border-color: #94a3b8;
}

/* Tablet: behoud compacte stapeling zonder mobiele accordeons */
@media (max-width: 860px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding: 20px 16px 12px;
  }

  .left-panel {
    min-width: 0;
    width: 100%;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .right-panel {
    position: static;
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
  }
}

/* Mobiel (telefoon): inklapbare infoblokken & schuifbare preview-knop */
@media (max-width: 640px) {
  .workspace {
    display: block;
    width: 100%;
    padding: 18px 16px 12px;
  }

  .control-panel {
    padding: 14px;
  }

  .hero,
  .subtitle,
  .control-panel,
  .button-stack,
  .mobile-preview-drawer,
  .mobile-preview-inner,
  .right-panel,
  .info-stack,
  .info-card,
  .info-body,
  .info-body-inner,
  .site-footer {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }

  .status-note {
    display: none;
  }

  .mobile-only-btn {
    display: block;
    width: 100%;
  }

  .mobile-preview-drawer {
    display: none;
  }

  .mobile-preview-drawer.is-open {
    display: block;
  }

  .mobile-preview-drawer.is-open .mobile-preview-inner {
    padding: 6px 0 4px;
  }

  .right-panel {
    max-width: 100%;
    gap: 10px;
  }

  .card-stage {
    min-height: 0;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  }

  .info-card {
    padding: 12px 14px;
  }

  .info-toggle {
    font-size: 0.86rem;
  }
}
