/* ═══════════════════════════════════════════
   WEB2DASH — style.css
   Color tokens:
     bg:       #0f172a  (dark navy)
     surface:  #1e293b  (card/panel)
     border:   #334155
     text:     #f1f5f9  (primary)
     muted:    #94a3b8  (secondary)
     green:    #22c55e  (accent / success)
     red:      #ef4444  (error / danger)
     yellow:   #f59e0b  (warning)
   ═══════════════════════════════════════════ */

/* ─── RESET & BASE ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  background: #0f172a;
  color: #f1f5f9;
  line-height: 1.5;
}

a { color: #22c55e; text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'Courier New', monospace; font-size: 12px; color: #94a3b8; }

/* ─── UTILITIES ─── */
.hidden { display: none !important; }
.text-green     { color: #22c55e; }
.text-red       { color: #ef4444; }
.text-yellow    { color: #f59e0b; }
.text-secondary { color: #94a3b8; }
.text-lg        { font-size: 16px; font-weight: 600; }
.mono           { font-family: 'Courier New', monospace; letter-spacing: 0.05em; }

/* ─── LAYOUT: LOGIN ─── */
.screen-full {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  z-index: 100;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 40px 36px;
}

.login-logo {
  font-size: 28px;
  font-weight: 700;
  color: #22c55e;
  text-align: center;
  margin-bottom: 32px;
  letter-spacing: -0.5px;
}

/* ─── LAYOUT: APP SHELL ─── */
#app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── SIDEBAR ─── */
#sidebar {
  width: 220px;
  min-width: 220px;
  background: #1e293b;
  border-right: 1px solid #334155;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 10;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid #334155;
}

.brand-mark {
  background: #22c55e;
  color: #0f172a;
  font-weight: 800;
  font-size: 12px;
  padding: 4px 7px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
}

.nav-list {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  color: #94a3b8;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(34, 197, 94, 0.08);
  color: #f1f5f9;
}

.nav-item.active {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border-left-color: #22c55e;
}

.nav-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  flex-shrink: 0;
}

/* ─── MAIN AREA ─── */
#main {
  margin-left: 220px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ─── TOPBAR ─── */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  min-height: 56px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

.screen-title {
  font-size: 16px;
  font-weight: 600;
  color: #f1f5f9;
}

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

.topbar-user {
  font-size: 13px;
  color: #94a3b8;
}

/* ─── CONTENT AREA ─── */
#content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.screen { display: block; }

/* ─── SECTION HEADERS ─── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  margin-top: 8px;
}

.section-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #f1f5f9;
}

.subsection { margin-bottom: 32px; }

.subsection h3 {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #334155;
}

/* ─── CARDS ─── */
.card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 20px;
}

/* ─── STATS GRID ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card.stat-green  .stat-value { color: #22c55e; }
.stat-card.stat-red    .stat-value { color: #ef4444; }
.stat-card.stat-yellow .stat-value { color: #f59e0b; }

.stat-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

/* ─── ALERT LIST ─── */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
}

.alert-item.alert-red    { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.3);  color: #fca5a5; }
.alert-item.alert-yellow { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #fcd34d; }
.alert-item.alert-green  { background: rgba(34,197,94,0.1);  border: 1px solid rgba(34,197,94,0.3);  color: #86efac; }

.alert-banner {
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 12px;
}

.alert-banner.alert-red {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.4);
  color: #fca5a5;
}

/* ─── FILTER BAR ─── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}

/* ─── TABLES ─── */
.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #334155;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  background: #1e293b;
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  color: #94a3b8;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid #334155;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #1e293b;
  color: #f1f5f9;
  vertical-align: middle;
}

.data-table tbody tr { background: #0f172a; transition: background 0.1s; }
.data-table tbody tr:hover { background: #1e293b; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* status pills */
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pill-green  { background: rgba(34,197,94,0.15);   color: #22c55e; }
.pill-red    { background: rgba(239,68,68,0.15);   color: #ef4444; }
.pill-yellow { background: rgba(245,158,11,0.15);  color: #f59e0b; }
.pill-gray   { background: rgba(148,163,184,0.15); color: #94a3b8; }
.pill-blue   { background: rgba(59,130,246,0.15);  color: #93c5fd; }

/* ─── HEALTH GRID ─── */
.health-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.health-pill-wrap { margin-bottom: 16px; }

.health-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #334155;
  background: #1e293b;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.health-dot-green  { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.health-dot-red    { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
.health-dot-yellow { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; }

.dot-green {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
  flex-shrink: 0;
}
.dot-red {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
  flex-shrink: 0;
}

.health-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  font-size: 13px;
}
.health-label {
  font-weight: 600;
  color: #f1f5f9;
  flex: 1;
}
.health-value { font-size: 12px; }

/* ─── CONSTANTS GRID ─── */
.constants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.constant-item { display: flex; flex-direction: column; gap: 4px; }

.constant-label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.constant-value {
  font-size: 15px;
  font-weight: 600;
  color: #f1f5f9;
}

.constant-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #334155;
  font-size: 13px;
}
.constant-row:last-child { border-bottom: none; }
.constant-key { font-size: 12px; }
.constant-val { font-weight: 600; color: #f1f5f9; }

/* ─── RUN CONTROLS ─── */
.run-options {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.dry-run-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: #f1f5f9;
}

.dry-run-toggle input[type="checkbox"] { display: none; }

.toggle-track {
  width: 36px;
  height: 20px;
  background: #334155;
  border-radius: 99px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-track::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: #94a3b8;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.2s, background 0.2s;
}

.dry-run-toggle input:checked + .toggle-track { background: rgba(34,197,94,0.3); }
.dry-run-toggle input:checked + .toggle-track::after {
  transform: translateX(16px);
  background: #22c55e;
}

.toggle-text { font-weight: 500; }

.field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #94a3b8;
}

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.result-box {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  color: #94a3b8;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 12px;
}

/* ─── FORMS ─── */
.field-group { margin-bottom: 14px; }

.field-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field-group-sm { max-width: 100px; }

.field-group-divider {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 0 8px;
  border-top: 1px solid #334155;
  margin-top: 4px;
  margin-bottom: 12px;
}

.field-value { font-size: 14px; color: #f1f5f9; font-weight: 500; }

.form-row { display: flex; gap: 12px; }
.form-row .field-group { flex: 1; min-width: 0; }

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid #334155;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 12px;
  color: #f1f5f9;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}

textarea { resize: vertical; min-height: 72px; }

input:focus, select:focus, textarea:focus { border-color: #22c55e; }

input[type="number"].input-sm,
select.input-sm {
  width: auto;
  min-width: 70px;
  padding: 6px 10px;
}

.password-wrapper { position: relative; display: flex; }
.password-wrapper input { padding-right: 60px; }

.password-wrapper .btn-icon {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  padding: 0 12px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.password-wrapper .btn-icon:hover { color: #f1f5f9; }

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 28px;
  max-width: 420px;
  width: 100%;
}

.modal-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 8px; margin-top: 20px; }

/* ─── SIDE PANEL ─── */
.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 440px;
  max-width: 100vw;
  height: 100vh;
  background: #1e293b;
  border-left: 1px solid #334155;
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #334155;
  flex-shrink: 0;
}

.side-panel-header h3 { font-size: 16px; font-weight: 600; }
.side-panel form { padding: 20px 24px; overflow-y: auto; flex: 1; }

/* ─── KEY DISPLAY ─── */
.key-display { display: flex; align-items: center; gap: 10px; }

.key-value {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: #94a3b8;
  letter-spacing: 0.08em;
}

/* ─── BADGES ─── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-warning { background: rgba(245,158,11,0.2); color: #f59e0b; }
.badge-green   { background: rgba(34,197,94,0.2);  color: #22c55e; }
.badge-red     { background: rgba(239,68,68,0.2);  color: #ef4444; }

/* ─── BUTTONS ─── */
.btn-primary {
  background: #22c55e;
  color: #0f172a;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn-primary:hover    { background: #16a34a; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: #f1f5f9;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
}

.btn-secondary:hover { border-color: #94a3b8; background: rgba(255,255,255,0.04); }

.btn-ghost {
  background: transparent;
  color: #94a3b8;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s;
  white-space: nowrap;
}

.btn-ghost:hover { color: #f1f5f9; }

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-danger:hover { background: rgba(239,68,68,0.25); }

.btn-sm   { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 20px;
  line-height: 1;
  padding: 4px;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover { color: #f1f5f9; }

/* ─── MESSAGES ─── */
.error-msg {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  color: #fca5a5;
  margin-bottom: 12px;
}

.loading-msg { color: #94a3b8; font-size: 13px; padding: 12px 0; }
.text-warning { color: #f59e0b; font-size: 13px; margin-bottom: 12px; }

.link-muted {
  display: block;
  text-align: center;
  font-size: 13px;
  color: #94a3b8;
  margin-top: 14px;
}

.link-muted:hover { color: #f1f5f9; text-decoration: none; }

/* ─── TOAST NOTIFICATIONS ─── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: all;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.2s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.toast-success { background: #1e293b; border: 1px solid #22c55e; color: #86efac; }
.toast-error   { background: #1e293b; border: 1px solid #ef4444; color: #fca5a5; }
.toast-info    { background: #1e293b; border: 1px solid #334155; color: #f1f5f9; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── SCROLLBARS ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  #sidebar { width: 56px; min-width: 56px; }
  .brand-name,
  .nav-item span:not(.nav-icon) { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  #main { margin-left: 56px; }
  .side-panel { width: 100vw; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-direction: column; }
}
