@import url("/assets/application.tailwind-98a72522.css");

/* Base app shell styles to align with design_tasks.md without introducing Tailwind yet. */

:root {
  --bg: #0b1220;
  --panel: #121a2a;
  --muted: #8190a5;
  --text: #e8edf5;
  --brand: #60a5fa; /* blue-400 */
  --brand-strong: #3b82f6; /* blue-500 */
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --border: #233045;
  --panel-soft: #0e1626;
  --panel-hover: #0f1a2e;
}

html, body {
  height: 100%;
}

body.app-shell {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar content";
}

.app-shell__sidebar {
  grid-area: sidebar;
  background: linear-gradient(180deg, #0f172a, #0b1220);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.app-shell__brand {
  font-weight: 600;
  margin-bottom: 12px;
}

.brand-link {
  color: var(--text);
  text-decoration: none;
}

.app-shell__nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 4px;
}

.app-shell__nav a {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
}

.app-shell__nav a:hover {
  background: rgba(96, 165, 250, 0.12);
}

.app-shell__main {
  grid-area: content;
  display: grid;
  grid-template-rows: auto 1fr;
}

.app-shell__topbar {
  grid-area: topbar;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 18, 32, 0.6);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
}

.app-shell__content {
  padding: 16px;
}

.btn {
  background: var(--brand);
  border: 1px solid var(--brand-strong);
  color: #0b1220;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.btn:hover { background: var(--brand-strong); }
.btn:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; box-shadow: 0 0 0 2px #1e3a8a inset; }

/* Button size variants */
.btn--sm { padding: 6px 10px; font-size: 13px; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.btn-ghost:hover { background: rgba(255,255,255,0.04); }
.btn-ghost:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; box-shadow: 0 0 0 2px #1e3a8a inset; }

/* Inputs */
.input, select.input, textarea.input {
  width: 100%;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: 2px solid #60a5fa55;
  border-color: var(--brand);
}
.input:disabled { opacity: 0.6; cursor: not-allowed; }

/* Increase contrast and readability of field labels, especially on light backgrounds */
label.input-label { display: block; margin-bottom: 6px; color: #cbd5e1; font-size: 13px; }
.input-help { color: var(--muted); font-size: 12px; margin-top: 6px; }
.input-error { color: var(--error); font-size: 12px; margin-top: 6px; }

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card__header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card__title { font-weight: 600; }
.card__body { padding: 14px; }
.card__footer { padding: 12px 14px; border-top: 1px solid var(--border); }

/* White surface card variant: ensures dark text on light background */
.card--white {
  background: #ffffff;
  border: 1px solid #e2e8f0; /* slate-200 */
  color: #0f172a; /* slate-900 */
}
.card--white .card__header {
  background: #f8fafc; /* slate-50 */
  border-bottom-color: #e2e8f0;
}
.card--white .card__footer { border-top-color: #e2e8f0; }
.card--white .card__title { color: #0f172a; }
.card--white a { color: #2563eb; /* blue-600 */ }
.card--white a:hover { color: #1d4ed8; /* blue-700 */ }

/* KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.kpi__value { font-size: 20px; font-weight: 600; color: var(--text); }
.kpi__label { margin-top: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--border); background: var(--panel-soft); color: var(--text); }
.badge--success { background: #0b2a1a; border-color: #22c55e33; color: #86efac; }
.badge--warning { background: #2a220b; border-color: #f59e0b33; color: #facc15; }
.badge--error { background: #2a0b10; border-color: #ef444433; color: #fca5a5; }
.badge--info { background: #0b2946; border-color: #60a5fa33; color: #93c5fd; }
/* Neutral badge can use base styles */

/* Tables */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.table thead th {
  text-align: left;
  font-weight: 600;
  color: var(--text);
  font-size: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  position: sticky;
  top: 0; /* sticky header within card */
}
.table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.table tbody tr:hover { background: var(--panel-hover); }
.table--dense thead th, .table--dense tbody td { padding-top: 8px; padding-bottom: 8px; }
.table .numeric { text-align: right; }

/* Table wrapper for overflow */
.table-scroll { overflow-x: auto; }

/* Light table variant for white surfaces */
.table--light thead th {
  color: #475569; /* slate-600 */
  background: #f8fafc; /* slate-50 */
  border-bottom-color: #e2e8f0; /* slate-200 */
}
.table--light tbody td {
  color: #0f172a; /* slate-900 */
  border-bottom-color: #e2e8f0;
}
.table--light tbody td.emphasis { color: #334155; /* slate-700 */ }
.table--light tbody tr:hover { background: #f1f5f9; /* slate-100 */ }

/* Auto-apply light table styling when a table is inside a white card */
.card--white .table thead th {
  color: #475569; /* slate-600 */
  background: #f8fafc; /* slate-50 */
  border-bottom-color: #e2e8f0;
}
.card--white .table tbody td {
  color: #0f172a; /* slate-900 */
  border-bottom-color: #e2e8f0;
}
.card--white .table tbody tr:hover { background: #f1f5f9; }

/* Empty state */
.empty {
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 24px;
  background: var(--panel-soft);
}
.empty__title { font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty__actions { margin-top: 12px; }

.user-pill {
  color: var(--muted);
  margin-right: 8px;
}

/* Utilities */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.sr-only.focusable:active, .sr-only.focusable:focus, .sr-only.focusable:focus-visible { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal; }

/* Skip link visible style */
.skip-link { position: absolute; left: 8px; top: 8px; background: #0b2946; color: #fff; padding: 6px 10px; border-radius: 8px; border: 1px solid #60a5fa33; }
.skip-link:focus-visible { outline: 2px solid #93c5fd; }

/* Flash banners */
.ui-flash {
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: #0e1626;
  margin: 8px 0 12px;
}
.ui-flash__dot {
  width: 10px; height: 10px; border-radius: 999px; display: inline-block;
}
.ui-flash--info { border-color: #60a5fa33; background: #0b2946; }
.ui-flash--info .ui-flash__dot { background: var(--brand); }
.ui-flash--success { border-color: #22c55e33; background: #0b2a1a; }
.ui-flash--success .ui-flash__dot { background: var(--success); }
.ui-flash--warning { border-color: #f59e0b33; background: #2a220b; }
.ui-flash--warning .ui-flash__dot { background: var(--warning); }
.ui-flash--error { border-color: #ef444433; background: #2a0b10; }
.ui-flash--error .ui-flash__dot { background: var(--error); }

/* Link focus states */
a:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; border-radius: 6px; }

/* Responsive: collapse sidebar on small screens */
@media (max-width: 900px) {
  body.app-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "content";
  }
  .app-shell__sidebar { display: none; }
}

/* Two-column utility for show pages */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

/* Segmented control styling (used for payment_type) */
.segmented {
  display: inline-flex;
  gap: 6px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}
.segmented__option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
}
.segmented__option input { display: none; }
.segmented__option--active {
  background: rgba(96,165,250,0.18);
  border: 1px solid #60a5fa33;
}

/* Phase 1: include Tailwind-like base tokens and components (imported at top so our theme overrides it) */
