/* LienEngine styles — intentionally lightweight.
   First pass is neutral/clean. When deploying, port over
   /v2/css/styles.css colors, tab-bar, buttons for visual parity with SocialEngine. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #1f2937;
  background: #f7f8fa;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

#app { display: flex; flex-direction: column; min-height: 100vh; }

.top-bar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand .logo { font-size: 16px; letter-spacing: -0.2px; }
.back-link { font-size: 18px; color: #6b7280; padding: 0 6px; }
.env-chip {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 2px 6px; border-radius: 4px;
  background: #fde68a; color: #78350f;
}
.env-chip[data-env="production"] { background: #dcfce7; color: #065f46; }

.tab-bar { display: flex; gap: 2px; flex: 1; }
.tab-bar button {
  background: transparent; border: none;
  padding: 8px 14px; border-radius: 6px;
  color: #4b5563; cursor: pointer; font-size: 14px;
}
.tab-bar button:hover { background: #f3f4f6; }
.tab-bar button.active { background: #eef2ff; color: #3730a3; font-weight: 600; }

.user-chip { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #6b7280; }
.btn-ghost { background: transparent; border: 1px solid #d1d5db; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.btn-ghost:hover { background: #f3f4f6; }

.view { flex: 1; padding: 24px; }
.loading { text-align: center; color: #9ca3af; padding: 48px 0; }

.status-bar {
  font-size: 12px; color: #6b7280; background: #ffffff;
  border-top: 1px solid #e5e7eb; padding: 6px 20px;
}

/* ---- Components ---- */

.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 16px; }

.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.metric { padding: 14px; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; }
.metric .label { color: #6b7280; font-size: 12px; }
.metric .value { font-size: 24px; font-weight: 600; margin-top: 4px; }
.metric .sub { color: #9ca3af; font-size: 11px; margin-top: 4px; }

table.list { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
table.list th { background: #f9fafb; font-weight: 600; color: #374151; }
table.list tr:last-child td { border-bottom: none; }
table.list tr:hover td { background: #f9fafb; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.pill.pass { background: #dcfce7; color: #065f46; }
.pill.fail { background: #fee2e2; color: #991b1b; }
.pill.warn { background: #fef3c7; color: #78350f; }
.pill.skipped { background: #e5e7eb; color: #374151; }
.pill.active { background: #dbeafe; color: #1e3a8a; }
.pill.hold { background: #fce7f3; color: #9d174d; }
.pill.resolved_paid { background: #dcfce7; color: #065f46; }
.pill.resolved_auction { background: #ede9fe; color: #5b21b6; }

.btn { background: #4f46e5; color: #fff; border: none; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn:hover { background: #4338ca; }
.btn.secondary { background: #6b7280; }
.btn.danger { background: #dc2626; }
.btn.ghost { background: transparent; color: #374151; border: 1px solid #d1d5db; }

.error-banner {
  background: #fee2e2; color: #991b1b;
  border: 1px solid #fecaca; padding: 10px 14px; border-radius: 6px;
  margin-bottom: 16px; font-size: 13px;
}

/* Banners used by shared views helper (hbBanner, errorBanner) */
.banner { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }
.banner-warn { background: #fef3c7; color: #78350f; border: 1px solid #fde68a; }
.banner-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.banner code { background: rgba(0,0,0,0.06); padding: 1px 4px; border-radius: 3px; }

/* View header: title + action button row */
.view-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.view-header h2 { margin: 0; font-size: 18px; flex: 1; }

/* Status/stage chips (match existing .pill palette) */
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; background: #e5e7eb; color: #374151; }
.chip-active { background: #dbeafe; color: #1e3a8a; }
.chip-hold { background: #fce7f3; color: #9d174d; }
.chip-pass { background: #dcfce7; color: #065f46; }
.chip-fail { background: #fee2e2; color: #991b1b; }
.chip-warn { background: #fef3c7; color: #78350f; }
.chip-resolved_paid { background: #dcfce7; color: #065f46; }
.chip-resolved_auction { background: #ede9fe; color: #5b21b6; }

/* Cards layout used in dashboard + case detail */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.cards .card { margin-bottom: 0; }
.cards .card h3, .cards .card h4 { margin: 0 0 6px; font-size: 13px; color: #6b7280; font-weight: 500; }
.cards .card .big { font-size: 28px; font-weight: 600; color: #111827; }

/* Empty state */
.empty { text-align: center; padding: 40px 16px; color: #6b7280; background: #fff; border: 1px dashed #d1d5db; border-radius: 8px; }
.empty h3 { margin: 0 0 6px; color: #374151; font-size: 15px; }
.empty p { margin: 4px 0; }

/* Row layout helper */
.row-between { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }

/* Clickable table rows */
tr.clickable { cursor: pointer; }

/* Primary button used by view headers */
.btn-primary { background: #4f46e5; color: #fff; border: none; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn-primary:hover { background: #4338ca; }

/* Muted + log list helpers */
.muted { color: #6b7280; font-size: 13px; }
ul.log { list-style: none; padding: 0; }
ul.log li { padding: 6px 0; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
ul.log time { color: #9ca3af; font-size: 11px; margin-right: 8px; }
ul.log code { background: #f3f4f6; padding: 1px 4px; border-radius: 3px; font-size: 11px; }

/* Modal */
dialog.modal { border: none; border-radius: 10px; padding: 20px 24px; min-width: 360px; box-shadow: 0 20px 40px rgba(0,0,0,0.2); }
dialog.modal h3 { margin: 0 0 14px; }
dialog.modal label { display: block; margin-bottom: 10px; font-size: 13px; color: #374151; }
dialog.modal input, dialog.modal select, dialog.modal textarea { width: 100%; padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; margin-top: 4px; }
dialog.modal textarea { min-height: 60px; resize: vertical; }
dialog.modal .form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
dialog.modal::backdrop { background: rgba(0,0,0,0.35); }

/* Toggle switch (settings) */
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.switch input[type="checkbox"] { accent-color: #4f46e5; }
