/* =============================================================================
   Alpha Password (release faadumo37)
   Every rule is scoped to .ap-root, so nothing else on the dashboard changes.
   Light/dark follow the dashboard's .dark class on <html>.
   ============================================================================= */

.ap-root {
  --ap-surface: #ffffff;
  --ap-canvas: #f8fafc;
  --ap-ink: #0f172a;
  --ap-text: #1e293b;
  --ap-muted: #64748b;
  --ap-faint: #94a3b8;
  --ap-line: #e2e8f0;
  --ap-line-soft: #f1f5f9;
  --ap-brand: #dc2626;
  --ap-brand-deep: #b91c1c;
  --ap-brand-soft: #fef2f2;
  --ap-good: #059669;
  --ap-bad: #dc2626;
  --ap-bad-soft: #fee2e2;
  --ap-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  --ap-radius: 16px;

  color: var(--ap-text);
  font-size: 14px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dark .ap-root {
  --ap-surface: #0f172a;
  --ap-canvas: #111c33;
  --ap-ink: #f8fafc;
  --ap-text: #e2e8f0;
  --ap-muted: #94a3b8;
  --ap-faint: #64748b;
  --ap-line: #1e293b;
  --ap-line-soft: #16213a;
  --ap-brand: #ef4444;
  --ap-brand-deep: #dc2626;
  --ap-brand-soft: rgba(239, 68, 68, 0.12);
  --ap-good: #34d399;
  --ap-bad: #f87171;
  --ap-bad-soft: rgba(248, 113, 113, 0.14);
  --ap-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.ap-root *,
.ap-root *::before,
.ap-root *::after { box-sizing: border-box; }
.ap-root h2,
.ap-root h3,
.ap-root h4,
.ap-root p { margin: 0; }
.ap-root button { font: inherit; color: inherit; }

/* ---------- helpers ---------- */
.ap-root .ap-ico-xs { width: 13px; height: 13px; flex: none; }
.ap-root .ap-ico-sm { width: 16px; height: 16px; flex: none; }
.ap-root .ap-ico { width: 20px; height: 20px; flex: none; }
.ap-root .ap-ico-lg { width: 34px; height: 34px; flex: none; color: var(--ap-faint); }
.ap-root .ap-muted { color: var(--ap-muted); }
.ap-root .ap-faint { color: var(--ap-faint); }
.ap-root .ap-spin { animation: ap-spin 0.9s linear infinite; }
@keyframes ap-spin { to { transform: rotate(360deg); } }

/* ---------- buttons ---------- */
.ap-root .ap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
}
.ap-root .ap-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.ap-root .ap-btn--sm { height: 32px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.ap-root .ap-btn--primary { background: var(--ap-brand); color: #fff; box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2); }
.ap-root .ap-btn--primary:hover:not(:disabled) { background: var(--ap-brand-deep); }
.ap-root .ap-btn--ghost { background: var(--ap-surface); border-color: var(--ap-line); color: var(--ap-text); }
.ap-root .ap-btn--ghost:hover:not(:disabled) { background: var(--ap-line-soft); }
.ap-root .ap-btn--edit { background: var(--ap-brand-soft); color: var(--ap-brand); }
.ap-root .ap-btn--edit:hover { background: var(--ap-brand); color: #fff; }
.ap-root .ap-btn--danger { background: var(--ap-bad); color: #fff; }

.ap-root .ap-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--ap-muted);
  cursor: pointer;
  flex: none;
}
.ap-root .ap-icon-btn:hover:not(:disabled) { background: var(--ap-line-soft); color: var(--ap-ink); }
.ap-root .ap-icon-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ap-root .ap-icon-btn--bordered { width: 38px; height: 38px; border: 1px solid var(--ap-line); background: var(--ap-surface); border-radius: 10px; }
.ap-root .ap-icon-btn--danger:hover:not(:disabled) { background: var(--ap-bad-soft); color: var(--ap-bad); }

.ap-root .ap-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  border: 0;
  background: none;
  padding: 0;
  color: var(--ap-brand);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.ap-root .ap-link:hover { text-decoration: underline; }

.ap-root .ap-btn:focus-visible,
.ap-root .ap-icon-btn:focus-visible,
.ap-root .ap-service:focus-visible,
.ap-root .ap-link:focus-visible {
  outline: 2px solid var(--ap-brand);
  outline-offset: 2px;
}

/* ---------- header & toolbar ---------- */
.ap-root .ap-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ap-root .ap-head-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ap-root .ap-head-title h2 { font-size: 20px; font-weight: 800; color: var(--ap-ink); letter-spacing: -0.01em; }
.ap-root .ap-head-title p { font-size: 13px; }
.ap-root .ap-head-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--ap-brand-soft);
  color: var(--ap-brand);
  flex: none;
}
.ap-root .ap-toolbar { display: flex; align-items: center; gap: 10px; }
.ap-root .ap-search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 6px 0 12px;
  border-radius: 10px;
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
}
.ap-root .ap-search:focus-within { border-color: var(--ap-brand); }
.ap-root .ap-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ap-text);
  font: inherit;
  font-size: 13px;
}
.ap-root .ap-search input::placeholder { color: var(--ap-faint); }
.ap-root .ap-total { font-size: 13px; color: var(--ap-muted); white-space: nowrap; }
.ap-root .ap-total strong { color: var(--ap-ink); }

/* ---------- states ---------- */
.ap-root .ap-state,
.ap-root .ap-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 16px;
  border-radius: var(--ap-radius);
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  color: var(--ap-muted);
  font-weight: 600;
  text-align: center;
}
.ap-root .ap-empty { flex-direction: column; border-style: dashed; font-weight: 500; }
.ap-root .ap-empty strong { color: var(--ap-ink); font-size: 15px; }
.ap-root .ap-empty .ap-btn { margin-top: 6px; }
.ap-root .ap-error {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--ap-bad-soft);
  color: var(--ap-bad);
  font-weight: 600;
  font-size: 13px;
}
.ap-root .ap-error span { flex: 1; }

/* ---------- cards ---------- */
.ap-root .ap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; align-items: start; }
.ap-root .ap-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: var(--ap-radius);
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  box-shadow: var(--ap-shadow);
  min-width: 0;
}
.ap-root .ap-card:hover { border-color: var(--ap-faint); }
.ap-root .ap-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.ap-root .ap-card-title { display: flex; flex-direction: column; min-width: 0; }
.ap-root .ap-card-title h4 { font-size: 15px; font-weight: 800; color: var(--ap-ink); overflow-wrap: anywhere; }
.ap-root .ap-card-title span { font-size: 11.5px; font-weight: 600; }
.ap-root .ap-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  flex: none;
}
.ap-root .ap-line {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 10px;
  border-radius: 10px;
  background: var(--ap-canvas);
  border: 1px solid var(--ap-line-soft);
  min-width: 0;
}
.ap-root .ap-line-label { width: 64px; flex: none; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ap-faint); }
.ap-root .ap-line-value { flex: 1; min-width: 0; font-weight: 600; color: var(--ap-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-root .ap-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.ap-root .ap-line-value.is-hidden { letter-spacing: 0.1em; color: var(--ap-muted); }
.ap-root .ap-note { font-size: 12.5px; color: var(--ap-muted); white-space: pre-line; overflow-wrap: anywhere; }
.ap-root .ap-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }

/* ---------- dialogs ---------- */
.ap-root .ap-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.ap-root .ap-dialog {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
  overflow: hidden;
}
.ap-root .ap-dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--ap-line); }
.ap-root .ap-dialog-title { font-size: 16px; font-weight: 800; color: var(--ap-ink); }
.ap-root .ap-dialog-body { display: flex; flex-direction: column; gap: 16px; padding: 16px 18px; overflow-y: auto; }
.ap-root .ap-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--ap-line); background: var(--ap-canvas); }
.ap-root .ap-dialog--sm { max-width: 400px; padding: 22px; align-items: center; text-align: center; gap: 8px; }
.ap-root .ap-confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: var(--ap-bad-soft);
  color: var(--ap-bad);
}
.ap-root .ap-confirm-text { font-size: 13px; overflow-wrap: anywhere; }
.ap-root .ap-confirm-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ---------- form ---------- */
.ap-root .ap-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ap-root .ap-label { font-size: 13px; font-weight: 800; color: var(--ap-ink); }
.ap-root .ap-label .ap-faint { font-weight: 500; }
.ap-root .ap-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--ap-line);
  background: var(--ap-surface);
  color: var(--ap-text);
  font: inherit;
  font-size: 14px;
  outline: 0;
}
.ap-root .ap-input:focus { border-color: var(--ap-brand); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12); }
.ap-root .ap-input::placeholder { color: var(--ap-faint); }
.ap-root .ap-pass-input { position: relative; }
.ap-root .ap-pass-input .ap-input { padding-right: 44px; }
.ap-root .ap-pass-input .ap-icon-btn { position: absolute; right: 5px; top: 5px; }
.ap-root .ap-services { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ap-root .ap-service {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 36px;
  padding: 0 8px 0 4px;
  border-radius: 10px;
  border: 1px solid var(--ap-line);
  background: var(--ap-surface);
  color: var(--ap-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-root .ap-service .ap-avatar { width: 26px; height: 26px; border-radius: 7px; font-size: 12px; }
.ap-root .ap-service:hover { border-color: var(--ap-faint); }
.ap-root .ap-service.is-active { border-color: var(--ap-brand); background: var(--ap-brand-soft); color: var(--ap-brand); box-shadow: 0 0 0 1px var(--ap-brand); }
.ap-root .ap-form-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--ap-bad-soft);
  color: var(--ap-bad);
  font-size: 13px;
  font-weight: 600;
}

/* ---------- toasts ---------- */
.ap-root .ap-toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 210;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: calc(100vw - 32px);
}
.ap-root .ap-toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 12px;
  border-radius: 12px;
  background: var(--ap-ink);
  color: var(--ap-surface);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
  animation: ap-toast-in 0.18s ease-out;
}
.ap-root .ap-toast .ap-icon-btn { color: inherit; opacity: 0.7; width: 26px; height: 26px; }
.ap-root .ap-toast--success svg:first-child { color: #34d399; }
.ap-root .ap-toast--error svg:first-child { color: #f87171; }
@keyframes ap-toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .ap-root .ap-head > .ap-btn { width: 100%; }
  .ap-root .ap-total { display: none; }
  .ap-root .ap-grid { grid-template-columns: 1fr; }
  .ap-root .ap-services { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ap-root .ap-overlay { align-items: flex-end; padding: 0; }
  .ap-root .ap-dialog { max-width: none; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .ap-root .ap-dialog--sm { border-radius: 18px; margin: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .ap-root .ap-spin,
  .ap-root .ap-toast { animation: none; }
}

/* ---------- dashboard menu (outside .ap-root, release faadumo37) ----------
   With eight tabs, the "Alpha Digital Agency • N Active Records" text next to
   the menu is shown only on very wide screens so every tab fits. */
.alpha-nav-meta { display: none; }
@media (min-width: 1600px) {
  .alpha-nav-meta { display: flex; }
}
