
:root {
  --primary: #1e3a5f;
  --primary-light: #2d5a8e;
  --accent: #c8a951;
  --bg: #f5f5f0;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --success: #059669;
  --warning: #d97706;
  --error: #dc2626;
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Header */
header {
  background: var(--primary);
  color: white;
  padding: 1.5rem 2rem;
  text-align: center;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.subtitle {
  color: var(--accent);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* MomMak Tools — gedeelde topbar (matcht de facturatie/home-pagina op :3300) */
header.topbar {
  background: #fff;
  color: #646466;
  padding: 12px 24px;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid #b6cd3b;
}
.topbar .logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.topbar .huis { display: grid; grid-template-columns: 14px 14px; grid-gap: 2px; border: 2px solid #646466; padding: 3px; border-radius: 3px; }
.topbar .huis .v { width: 14px; height: 14px; display: block; }
.topbar .v.rood { background: #c0292d; }
.topbar .v.lime { background: #b6cd3b; }
.topbar .v.blauw { background: #38a8db; }
.topbar .v.oranje { background: #ea6628; }
.topbar .merk { color: #646466; font-size: 18px; font-weight: 400; }
.topbar nav { display: flex; align-items: center; gap: 16px; }
.topbar nav a { color: #38a8db; text-decoration: none; font-size: 14px; }
.topbar nav a:hover { text-decoration: underline; }
.topbar .huidig { color: #646466; font-size: 14px; font-weight: 600; }

/* Layout */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card h2 {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 1rem;
  font-weight: 600;
}

/* Upload Grid (two drop zones side by side) */
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.upload-column {
  display: flex;
  flex-direction: column;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted);
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(30, 58, 95, 0.04);
  color: var(--primary);
}

.drop-zone.uploading {
  opacity: 0.6;
  pointer-events: none;
}

.drop-zone.uploaded {
  border-color: var(--success);
  border-style: solid;
  background: #ecfdf5;
  cursor: pointer;
}

.drop-zone.uploaded:hover {
  background: #d1fae5;
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.drop-zone-content svg {
  opacity: 0.5;
}

.drop-zone-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.drop-zone-content p {
  margin: 0;
}

.drop-zone-check {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--success);
}

.drop-zone-check svg {
  stroke: var(--success);
}

.drop-zone-filename {
  font-size: 0.8rem;
  color: var(--text-muted);
  word-break: break-all;
}

.hint {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Status */
.status {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.status-loading { background: #eff6ff; color: #1d4ed8; }
.status-success { background: #ecfdf5; color: var(--success); }
.status-error { background: #fef2f2; color: var(--error); }

/* Summary Grid */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.summary-item .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.summary-item .value {
  font-size: 0.95rem;
  font-weight: 500;
}

/* Validation Banner */
.banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.banner-warn { background: #fffbeb; border-left: 3px solid var(--warning); }
.banner-error { background: #fef2f2; border-left: 3px solid var(--error); }

.banner ul {
  list-style: none;
  padding: 0;
}

.banner li {
  padding: 0.125rem 0;
}

.error-item::before { content: "X "; color: var(--error); }
.warn-item::before { content: "! "; color: var(--warning); }

/* Details */
details {
  margin-top: 1rem;
}

summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--primary);
  padding: 0.5rem 0;
}

/* Description Section */
.description-field {
  margin-bottom: 1rem;
}

.description-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
}

.description-field textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.6;
  resize: vertical;
  color: var(--text);
}

.description-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.1);
}

.description-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.word-count {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.word-count-over {
  color: var(--error);
  font-weight: 600;
}

.stamkaart-info {
  margin-top: 1rem;
}

/* Referentie Table */
#referenties-table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ref-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.ref-table th {
  text-align: left;
  padding: 0.5rem;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ref-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.ref-table tbody tr:hover {
  background: rgba(30, 58, 95, 0.02);
}

/* Status Badge */
.status-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.status-verkocht { background: #ecfdf5; color: var(--success); }
.status-te-koop { background: #eff6ff; color: #1d4ed8; }
.status-onder-bod { background: #fffbeb; color: var(--warning); }
.status-verkocht-onder-voorbehoud { background: #fef3c7; color: #92400e; }

/* Options */
.options-fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.options-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.option-group > label:first-child {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.375rem;
}

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

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: all 0.15s;
}

.radio-label:has(input:checked) {
  border-color: var(--primary);
  background: rgba(30, 58, 95, 0.06);
  color: var(--primary);
  font-weight: 500;
}

.radio-label input {
  display: none;
}

/* Buttons */
.btn {
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
}

.btn-primary:hover:not(:disabled) { background: var(--primary-light); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: #f3f4f6;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: #e5e7eb; }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:hover { background: rgba(30, 58, 95, 0.06); }

.btn-small {
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  text-decoration: none;
  display: inline-block;
}

.btn-delete {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
}

.btn-delete:hover {
  background: #fef2f2;
}

.session-actions {
  display: flex;
  gap: 0.375rem;
}

/* Email */
.email-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.email-preview {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
  font-size: 0.8rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 600px;
  overflow-y: auto;
}

/* Sessions */
.session-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.session-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.session-info strong {
  font-size: 0.9rem;
}

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

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 640px) {
  main { padding: 1rem; }
  .card { padding: 1rem; }
  .upload-grid { grid-template-columns: 1fr; }
  .drop-zone { padding: 1.5rem 1rem; min-height: 100px; }
  .description-columns { grid-template-columns: 1fr; }
  .options-row { grid-template-columns: 1fr; }
  .email-actions { flex-wrap: wrap; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .ref-table { font-size: 0.75rem; }
  .ref-table th, .ref-table td { padding: 0.375rem; }
}

/* Text inputs for email options */
.text-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  transition: border-color 0.2s;
}

.text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.1);
}

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

#email-html-container {
  position: absolute;
  left: -9999px;
  top: 0;
}
