/* ── Variabelen ─────────────────────────────────────────── */
:root {
  --bg:         #0d1b2a;
  --surface:    #152032;
  --surface-2:  #1c2d40;
  --border:     #2a4057;
  --accent:     #00b4d8;
  --accent-dim: rgba(0,180,216,.15);
  --text:       #e8f4fd;
  --text-muted: #7a9ab5;
  --success:    #06d6a0;
  --warning:    #ffd166;
  --danger:     #ef476f;
  --radius:     12px;
  --radius-sm:  8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
}

/* ── Login ──────────────────────────────────────────────── */

.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.login-card h2 { font-size: 1.1rem; color: var(--text-muted); font-weight: 400; }

.login-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}
.login-input:focus { border-color: var(--accent); }
.login-error { color: var(--danger); font-size: 0.85rem; }

/* ── Knoppen ────────────────────────────────────────────── */

.btn-primary {
  background: var(--accent);
  color: #0d1b2a;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-secondary:hover { background: var(--border); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(239,71,111,.3);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-danger:hover { background: rgba(239,71,111,.1); }

.btn-icon {
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); }

.btn-link {
  background: none; border: none; padding: 0;
  color: var(--accent); font-size: .85rem; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.btn-link:hover { opacity: .75; }

/* ── Topbar ─────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 700;
  flex-shrink: 0;
}

.topbar-nav {
  display: flex;
  gap: 0;
  flex: 1;
  justify-content: center;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0 1.25rem;
  height: 56px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.topbar-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* ── Stats bar ──────────────────────────────────────────── */

.stats-bar {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.stat-item {
  flex: 1;
  padding: 0.875rem 1.5rem;
  border-right: 1px solid var(--border);
  text-align: center;
}
.stat-item:last-child { border-right: none; }

.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1; margin-bottom: 0.25rem; }
.stat-value.online  { color: var(--success); }
.stat-value.offline { color: var(--danger); }

.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

/* ── Hoofd layout ───────────────────────────────────────── */

.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.section { display: flex; flex-direction: column; gap: 1rem; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-header h2 {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

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

/* ── Kaart ──────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Formulier elementen ────────────────────────────────── */

.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.form-col {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.25rem;
}

.upload-feedback {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.upload-feedback.success { color: var(--success); }
.upload-feedback.error   { color: var(--danger); }

.form-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.25rem 0;
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  flex: 1;
}

.field-label-plain {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  align-self: center;
}

.field-hint {
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.7;
}

.field-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.6rem 0.875rem;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.field-input:focus { border-color: var(--accent); }

.field-textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.6rem 0.875rem;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  resize: vertical;
  min-height: 90px;
  transition: border-color 0.15s;
}
.field-textarea:focus { border-color: var(--accent); }

/* Test e-mail rij */
.test-email-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.test-email-row .field-input { flex: 1; }

/* Feedback */
.email-feedback {
  padding: 0.55rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.email-feedback.success { background: rgba(6,214,160,.1);  color: var(--success); border: 1px solid rgba(6,214,160,.25); }
.email-feedback.error   { background: rgba(239,71,111,.1); color: var(--danger);  border: 1px solid rgba(239,71,111,.25); }

/* ── Versie beheer ──────────────────────────────────────── */

.version-current-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.version-current-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.version-current-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.version-history {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.version-history-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid rgba(42,64,87,0.4);
}
.version-history-item:last-child { border-bottom: none; }

.vh-version { font-weight: 600; min-width: 64px; }

.vh-current-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 20px;
  font-weight: 600;
}

.vh-date { color: var(--text-muted); font-size: 0.8rem; margin-left: auto; }

.vh-instances {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.1rem 0.5rem;
}

.version-deploy-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.875rem;
  line-height: 1.5;
}

.version-history-item {
  cursor: pointer;
}
.version-history-item:hover { background: rgba(255,255,255,0.03); border-radius: 4px; }

/* ── Beheer secties (inklapbaar) ────────────────────────── */

.beheer-section {
  margin-bottom: 1.5rem;
}

.beheer-section > .card {
  margin-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: none;
}

.beheer-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  list-style: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  user-select: none;
  transition: background 0.15s;
}
.beheer-summary::-webkit-details-marker { display: none; }
.beheer-summary:hover { background: var(--surface-2); }

.beheer-section[open] > .beheer-summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}

.summary-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.summary-version {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
}

.summary-chevron {
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.beheer-section[open] .summary-chevron { transform: rotate(180deg); }

/* ── Instances tabel ────────────────────────────────────── */

.instances-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.875rem;
}

.instances-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.instances-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(42,64,87,0.5);
  vertical-align: middle;
}

.instances-table tr:last-child td { border-bottom: none; }
.instances-table tbody tr { cursor: pointer; transition: background 0.12s; }
.instances-table tbody tr:hover td { background: var(--surface-2); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.4rem;
  flex-shrink: 0;
}
.status-dot.online  { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.offline { background: var(--text-muted); }

.instance-name { font-weight: 600; }
.instance-name-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.version-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--accent-dim);
  color: var(--accent);
}
.version-badge.outdated { background: rgba(255,209,102,.12); color: var(--warning); }

.salt-bar-wrap { display: flex; align-items: center; gap: 0.5rem; }
.salt-bar-bg   { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; min-width: 60px; }
.salt-bar-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width 0.3s; }
.salt-bar-fill.low      { background: var(--warning); }
.salt-bar-fill.critical { background: var(--danger); }
.salt-bar-label { font-size: 0.8rem; color: var(--text-muted); min-width: 32px; text-align: right; }

.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem;
  text-align: center;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Modal ──────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,27,42,.75);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 85dvh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; font-weight: 600; }

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--border);
}

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

.detail-item {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}
.detail-item-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 0.3rem;
}
.detail-item-value { font-size: 0.95rem; font-weight: 600; }

/* ── Footer ─────────────────────────────────────────────── */

.app-footer {
  text-align: center;
  padding: 2rem 1.5rem 2.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.5;
}

/* ── Hulpklassen ────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ─────────────────────────────────────────── */
@media (min-width: 600px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: var(--radius); max-height: 80dvh; }
}

@media (max-width: 600px) {
  .topbar { padding: 0 1rem; }
  .topbar-brand span { display: none; }

  .stats-bar { flex-wrap: wrap; }
  .stat-item { flex: 1 1 50%; border-bottom: 1px solid var(--border); }
  .stat-item:nth-child(even) { border-right: none; }
  .stat-item:last-child { border-bottom: none; }

  .form-row { flex-direction: column; }

  .test-email-row { flex-wrap: wrap; }
  .test-email-row .field-label-plain { width: 100%; }

  .instances-table th:nth-child(3),
  .instances-table td:nth-child(3) { display: none; }

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

/* ── Bestellingen ───────────────────────────────────────── */

.orders-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  padding: 0 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.orders-toprow {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.orders-stats {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.order-stat-chip {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .75rem;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.filter-strip {
  display: flex;
  gap: .4rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}

.filter-tab {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: .3rem .8rem;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.filter-tab.active, .filter-tab:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.orders-table th {
  padding: .6rem 1rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.orders-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.orders-table tr:last-child td { border-bottom: none; }
.orders-table tr:hover td { background: rgba(255,255,255,.02); }

.order-pill {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.pill-pending  { background: rgba(255,209,102,.15); color: #ffd166; }
.pill-paid     { background: rgba(6,214,160,.15);   color: #06d6a0; }
.pill-shipped  { background: rgba(0,180,216,.15);   color: #00b4d8; }
.pill-delivered{ background: rgba(86,203,138,.15);  color: #56cb8a; }
.pill-skipped  { background: rgba(122,154,181,.15); color: #7a9ab5; }
.pill-cancelled{ background: rgba(239,71,111,.15);  color: #ef476f; }

/* Order detail modal */
.order-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem .75rem;
  margin-bottom: 1.25rem;
}
.order-detail-label {
  font-size: .75rem;
  color: var(--text-muted);
  margin-bottom: .2rem;
}
.order-detail-value { font-size: .9rem; font-weight: 500; }

.ship-form {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
