/* Portal Admin — dark H2O Protect chrome, vanilla CSS (no build step). */

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--navy-deep);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--gold); }

.admin-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px 72px;
}

/* ─── TOPBAR ─── */
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 0 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-brand svg { width: 34px; height: 34px; flex-shrink: 0; }

.admin-brand-name {
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  line-height: 1.1;
}

.admin-brand-name em { font-style: normal; color: var(--gold); }

.admin-brand-sub {
  font-family: 'DM Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: 'DM Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ─── HEADINGS ─── */
.admin-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 40px 0 24px;
  flex-wrap: wrap;
}

.admin-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 700;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #fff;
}

.admin-subtitle {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 8px;
  max-width: 640px;
  line-height: 1.65;
}

.admin-actions { display: flex; align-items: center; gap: 10px; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-mid);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s, border-color 0.18s, color 0.18s, opacity 0.18s;
}

.btn:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #0D1A00;
  font-weight: 700;
}

.btn-primary:hover { background: #ffd451; border-color: #ffd451; }

.btn-danger { color: #FCA5A5; border-color: rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.5); }

.btn-icon {
  padding: 6px 9px;
  font-size: 12px;
  line-height: 1;
  border-radius: 8px;
}

/* ─── TOAST ─── */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  max-width: 420px;
  padding: 13px 18px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid var(--border-mid);
  background: #0C1C33;
  box-shadow: 0 18px 48px rgba(0,0,0,0.55);
  display: none;
}

.toast.visible { display: block; }
.toast.ok { border-color: rgba(16,185,129,0.45); color: #A7F3D0; }
.toast.err { border-color: rgba(239,68,68,0.45); color: #FCA5A5; }

/* ─── TABLE ─── */
.panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--navy-panel);
  overflow: hidden;
}

table.portal-table { width: 100%; border-collapse: collapse; }

.portal-table thead th {
  font-family: 'DM Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.portal-table tbody td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

.portal-table tbody tr:last-child td { border-bottom: none; }
.portal-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.portal-table tbody tr.is-off { opacity: 0.55; }

.cell-name { display: flex; align-items: center; gap: 12px; }

.swatch {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.14);
}

.name-title { font-weight: 600; color: #fff; }

.name-key {
  font-family: 'DM Mono', monospace;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 3px;
}

.mono {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: #9FB2CA;
  word-break: break-all;
}

.badge {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 8px 3px;
  border-radius: 100px;
  border: 1px solid var(--border-mid);
  color: var(--muted);
}

.badge.bundled { color: #A7F3D0; border-color: rgba(16,185,129,0.3); }
.badge.external { color: #BFDBFE; border-color: rgba(59,130,246,0.3); }

.order-cell { display: flex; align-items: center; gap: 6px; }

.order-num {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--muted);
  min-width: 18px;
}

/* ─── SWITCH ─── */
.switch-row { display: flex; align-items: center; gap: 14px; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  user-select: none;
}

.switch input { position: absolute; opacity: 0; pointer-events: none; }

.switch-track {
  width: 34px;
  height: 18px;
  border-radius: 100px;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--border-mid);
  position: relative;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #8296AE;
  transition: transform 0.2s, background 0.2s;
}

.switch input:checked + .switch-track {
  background: rgba(16,185,129,0.24);
  border-color: rgba(16,185,129,0.5);
}

.switch input:checked + .switch-track::after {
  transform: translateX(16px);
  background: #10B981;
}

.switch input:focus-visible + .switch-track { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ─── EMPTY / LOADING ─── */
.table-note {
  padding: 44px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.7;
}

/* ─── MODAL ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(3, 8, 16, 0.78);
  backdrop-filter: blur(6px);
  display: none;
  overflow-y: auto;
  padding: 40px 20px;
}

.modal-backdrop.visible { display: block; }

.modal {
  max-width: 1080px;
  margin: 0 auto;
  border: 1px solid var(--border-mid);
  border-radius: 18px;
  background: #071426;
  box-shadow: 0 40px 100px rgba(0,0,0,0.65);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
}

.modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 28px;
  padding: 24px;
}

@media (max-width: 900px) {
  .modal-body { grid-template-columns: 1fr; }
  .admin-shell { padding: 0 18px 56px; }
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.015);
  flex-wrap: wrap;
}

/* ─── FORM ─── */
.field { margin-bottom: 18px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label.field-label {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}

.field-hint {
  font-size: 11.5px;
  color: rgba(122,144,170,0.8);
  margin-top: 6px;
  line-height: 1.55;
}

input[type="text"],
input[type="number"],
input[type="url"],
input[type="password"],
select,
textarea {
  width: 100%;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-mid);
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color 0.18s, background 0.18s;
}

textarea { resize: vertical; line-height: 1.6; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(254,201,37,0.5);
  background: rgba(255,255,255,0.06);
}

select option { background: #0C1C33; color: var(--text); }

.color-field { display: flex; align-items: center; gap: 10px; }

input[type="color"] {
  width: 46px;
  height: 40px;
  padding: 2px;
  border: 1px solid var(--border-mid);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  cursor: pointer;
}

.icon-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 8px;
  max-height: 148px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--border-mid);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
}

.icon-option {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}

.icon-option svg { width: 20px; height: 20px; }
.icon-option:hover { color: var(--text); background: rgba(255,255,255,0.08); }

.icon-option.selected {
  color: var(--gold);
  border-color: rgba(254,201,37,0.55);
  background: rgba(254,201,37,0.1);
}

.checks { display: flex; flex-direction: column; gap: 12px; }

/* ─── PREVIEW / SNIPPET ─── */
.preview-col { display: flex; flex-direction: column; gap: 18px; }

.preview-label {
  font-family: 'DM Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.snippet {
  font-family: 'DM Mono', monospace;
  font-size: 10.5px;
  line-height: 1.7;
  color: #9FB2CA;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-all;
}

.form-error {
  display: none;
  font-size: 12.5px;
  color: #FCA5A5;
  line-height: 1.55;
  flex: 1;
  min-width: 220px;
}

.form-error.visible { display: block; }

/* ─── LOGIN ─── */
.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border-mid);
  border-radius: 18px;
  background: var(--navy-card);
  padding: 36px 32px 32px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.login-brand svg { width: 34px; height: 34px; }

.login-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 30px;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 6px;
}

.login-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.login-alert {
  display: none;
  font-size: 12.5px;
  line-height: 1.55;
  color: #FCA5A5;
  background: rgba(239,68,68,0.09);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 10px;
  padding: 11px 13px;
  margin-bottom: 18px;
}

.login-alert.visible { display: block; }

.login-submit { width: 100%; justify-content: center; margin-top: 6px; }

.login-foot {
  margin-top: 22px;
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-foot a { color: rgba(255,255,255,0.28); text-decoration: none; }
.login-foot a:hover { color: rgba(255,255,255,0.55); }
