/* nutek-mock-ecw admin UI — lavender palette per ADR-022.
   Distinct from mock-practices (cyan #0891B2) + mock-payer (amber #D97706).
*/

:root {
  --primary: #A78BFA;          /* lavender 400 */
  --primary-dark: #8B5CF6;     /* lavender 500 (buttons hover) */
  --primary-darker: #7C3AED;   /* lavender 600 (active) */
  --primary-bg-soft: #F5F3FF;  /* lavender 50 */
  --primary-bg-tinted: #EDE9FE;/* lavender 100 */
  --primary-border: #DDD6FE;   /* lavender 200 */

  --gray-900: #0F172A;
  --gray-800: #1E293B;
  --gray-700: #334155;
  --gray-600: #475569;
  --gray-500: #64748B;
  --gray-400: #94A3B8;
  --gray-300: #CBD5E1;
  --gray-200: #E2E8F0;
  --gray-100: #F1F5F9;
  --gray-50:  #F8FAFC;
  --white:    #FFFFFF;

  --success: #16A34A;
  --warning: #D97706;
  --danger:  #DC2626;
  --info:    #0EA5E9;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.18);

  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.4;
}

/* ===================== Topbar ===================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: baseline; gap: 0.5rem; }
.brand-mark { font-size: 1.25rem; }
.brand-name { font-weight: 600; font-size: 1rem; letter-spacing: 0.5px; }
.brand-tagline { font-size: 0.85rem; opacity: 0.9; margin-left: 0.5rem; }

.topbar-status { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
.status-dot {
  display: inline-block;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}
.status-dot-running { background: var(--success); }
.status-dot-paused  { background: var(--warning); }
.status-dot-error   { background: var(--danger); }
.status-dot-unknown { background: var(--gray-400); }

/* ===================== Layout ===================== */
.container {
  max-width: 1280px;
  margin: 1.25rem auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--primary-bg-soft);
  border-bottom: 1px solid var(--primary-border);
}
.card-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-darker);
  letter-spacing: 0.3px;
}
.card-subtitle { font-size: 0.8rem; color: var(--gray-500); }

.card-body { padding: 1.25rem; }

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.row:last-child { margin-bottom: 0; }

.engine-summary { display: flex; flex-wrap: wrap; gap: 1.5rem; }

.kv { display: flex; flex-direction: column; gap: 0.15rem; min-width: 140px; }
.kv-wide { min-width: 480px; flex: 1; }
.kv-key { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray-500); }
.kv-value { font-size: 0.95rem; font-weight: 500; color: var(--gray-800); }
.kv-value-mono {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: var(--gray-700);
  word-break: break-all;
}

.separator {
  height: 1px;
  background: var(--gray-200);
  margin: 0.5rem 0;
}

/* ===================== Inputs ===================== */
.inline-input {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 200px;
}
.inline-input-wide { flex: 1; min-width: 320px; }

.inline-input-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
}

.inline-input input,
.inline-input select,
.inline-input button {
  height: 2.25rem;
}

.inline-input input,
.inline-input select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.9rem;
  color: var(--gray-800);
  font-family: inherit;
  outline: none;
}
.inline-input input:focus,
.inline-input select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg-tinted);
}
.inline-input.inline-input-wide {
  display: grid;
  grid-template-columns: 1fr;
}
.inline-input.inline-input-wide > .inline-input-label { grid-column: 1; }
.inline-input.inline-input-wide > input {
  grid-column: 1;
}
.inline-input.inline-input-wide > button {
  grid-column: 1;
  justify-self: start;
  margin-top: 0.25rem;
}

.button-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ===================== Buttons ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.95rem;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--gray-100);
  color: var(--gray-800);
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--gray-200); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { background: var(--primary-darker); }

.btn-warn {
  background: var(--warning);
  color: var(--white);
}
.btn-warn:hover { filter: brightness(0.95); }

.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover { filter: brightness(0.95); }

.btn-ghost {
  background: transparent;
  color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn-ghost:hover { background: var(--gray-100); }

/* ===================== Activity table ===================== */
.table-wrap {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 480px;
}

.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.grid thead th {
  position: sticky;
  top: 0;
  background: var(--gray-100);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  color: var(--gray-600);
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--gray-200);
}
.grid tbody td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
.grid tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}
.grid tbody tr:hover { background: var(--primary-bg-soft); }
.grid tbody tr.empty-row {
  cursor: default;
}
.grid tbody tr.empty-row:hover { background: transparent; }
.grid tbody tr.empty-row td {
  text-align: center;
  color: var(--gray-500);
  padding: 1.5rem;
  font-style: italic;
}

.cell-mono {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.8rem;
}

.tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.tag-success { background: rgba(22, 163, 74, 0.12); color: var(--success); }
.tag-warn    { background: rgba(217, 119, 6, 0.12);  color: var(--warning); }
.tag-danger  { background: rgba(220, 38, 38, 0.12);  color: var(--danger); }
.tag-info    { background: rgba(14, 165, 233, 0.12); color: var(--info); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

/* ===================== Hint + helpers ===================== */
.hint {
  font-size: 0.8rem;
  color: var(--gray-500);
  font-style: italic;
}

.hidden { display: none !important; }

/* ===================== Dialog ===================== */
/*
 * IMPORTANT: HTML `hidden` attribute is overridden by author CSS like
 * `display: grid` (per MDN). Per session-71 lesson + ADR-022 dialog rule,
 * use class-toggled `.is-open` for visibility. Default = NOT shown.
 */
.dialog-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.dialog-overlay.is-open { display: flex; }

.dialog {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 1024px;
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
}
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  background: var(--primary-bg-soft);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}
.dialog-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-darker);
}
.dialog-body {
  padding: 1rem 1.25rem;
  overflow: auto;
}

.dialog-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--gray-200);
}
.dialog-tab {
  background: transparent;
  border: 0;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.dialog-tab:hover { color: var(--primary-dark); }
.dialog-tab.is-active {
  color: var(--primary-darker);
  border-bottom-color: var(--primary);
}

.dialog-content {
  background: var(--gray-900);
  color: var(--gray-100);
  padding: 1rem;
  border-radius: var(--radius);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 560px;
  overflow: auto;
}

/* ===================== Toast ===================== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--gray-900);
  color: var(--white);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: 0.85rem;
  opacity: 0;
  transform: translateY(0.5rem);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
  max-width: 480px;
}
.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.toast.toast-error { background: var(--danger); }
.toast.toast-success { background: var(--success); }
