/* BFR Dashboard Theme (Navy / Blue / Silver) */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
  --color-bg: #121214;
  --color-bg-2: #0E0E10;
  --color-text: #F0EDE8;
  --color-accent: #F0EDE8;
  --color-border: rgba(255,255,255,.14);
  --color-primary: #C41E3A;

  --color-blue: #D4A843;
  --color-blue-soft: rgba(212,168,67,.20);

  --color-green: #28965a;
  --color-green-soft: rgba(40,150,90,.14);

  --panel-1: rgba(34, 33, 32, .90);
  --panel-2: rgba(30, 29, 28, .90);
  --input-bg: rgba(18, 18, 20, .92);

  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 4px 18px rgba(0,0,0,.45);
}

/* ===== RESET & BASE ===== */
* { box-sizing: border-box; }

html, body {
  height: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "Source Sans 3", system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  background:
    radial-gradient(1100px circle at 85% 20%, rgba(197, 153, 30, .4), transparent 60%),
    radial-gradient(900px circle at 15% 48%, rgba(169, 38, 12, 0.7), transparent 80%),
    radial-gradient(1000px circle at 75% 48%, rgba(105, 0, 112, 0.5), transparent 80%),
    linear-gradient(180deg, #121214 0%, #0E0E10 70%, #050607 100%);
  background-attachment: fixed;
  color: var(--color-text);
  line-height: 1.5;
}

body > * { position: relative; z-index: 1; }

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0,0,0,.15);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.12);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,.22);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}

/* ===== LINKS ===== */
a { color: var(--color-accent); }
a:hover { color: #fff; }

/* ===== LUCIDE ICON HELPERS ===== */
.app-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.nav-shield {
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--color-primary) 0%, #9B1830 100%);
  border-radius: 0.5rem;
  box-shadow: 0 0 14px rgba(196,30,58,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.nav-shield svg { width: 1.2rem; height: 1.2rem; color: white; }

.nav-title {
  font-family: 'Oswald', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text);
  margin: 0;
}
.nav-title::after { display: none; }

.nav-subtitle {
  font-family: 'Oswald', sans-serif;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #D4A843;
  margin-top: -2px;
}

.titleIcon {
  width: 28px;
  height: 28px;
  vertical-align: -4px;
  color: var(--color-primary);
  filter: drop-shadow(0 0 6px rgba(204,0,0,.35));
}

.inlineIcon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  opacity: .7;
}

.thIcon {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
  opacity: .55;
  margin-right: 2px;
}

.btnIcon {
  width: 15px;
  height: 15px;
  vertical-align: -3px;
  margin-right: 3px;
}

.sectionIcon {
  width: 15px;
  height: 15px;
  vertical-align: -3px;
  margin-right: 4px;
  opacity: .65;
}

.eventIcon {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  margin-right: 4px;
}

/* ===== LAYOUT CONTAINERS ===== */
.wrap {
  max-width: 1650px;
  margin: 0 auto;
  padding: 22px 24px 42px;
  animation: fadeIn .4s ease;
}

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

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

header, .topbar, .header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.topbar {
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(47,129,247,.14);
  background: rgba(0,0,0,.18);
  backdrop-filter: blur(8px);
}

.layout, .split, .grid, .main {
  display: grid;
  gap: 20px;
  grid-template-columns: 1.3fr 1fr;
  align-items: start;
}

/* ===== TYPOGRAPHY ===== */
h1, .title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  color: var(--color-accent);
  letter-spacing: .2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

h1::after {
  content: "";
  display: block;
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(204,0,0,.4) 0%, rgba(47,129,247,.2) 50%, transparent 100%);
  margin-left: 12px;
}

.subtitle, .muted {
  color: rgba(224,224,224,.72);
}

.sectionTitle {
  margin: 14px 0 8px;
  font-weight: 900;
  letter-spacing: .5px;
  color: rgba(230,238,247,.88);
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

/* ===== CARDS & PANELS ===== */
.card, .panel, .left, .right {
  background: var(--panel-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: slideUp .35s ease;
}

.section, .panelInner, .content {
  padding: 14px;
}

.detailsPanel, #detailsPanel, .rightPanel, .right {
  padding: 18px 18px 22px;
}

/* ===== FORM ELEMENTS ===== */
input, select, textarea, button {
  font: inherit;
}

input, select, textarea {
  background: var(--input-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 44px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

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

input:focus, select:focus, textarea:focus {
  border-color: rgba(47,129,247,.55);
  box-shadow: 0 0 0 3px rgba(47,129,247,.18);
}

/* ===== SEARCH WRAP ===== */
.searchWrap {
  position: relative;
  display: flex;
  align-items: center;
}

.searchIcon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: rgba(224,224,224,.45);
  pointer-events: none;
  z-index: 1;
}

.searchWrap input {
  padding-left: 36px;
  width: 100%;
}

/* ===== BUTTONS ===== */
button {
  background: #202020;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform .05s ease, filter .15s ease, background .15s ease, box-shadow .15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

button:hover {
  filter: brightness(1.08);
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}

button:active { transform: translateY(1px); }

button.primary, .btnPrimary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 700;
}

button.primary:hover, .btnPrimary:hover {
  background: #e00000;
  box-shadow: 0 2px 14px rgba(204,0,0,.3);
}

button.danger, .btnDanger {
  background: #5a1111;
  border-color: #7f1d1d;
  color: #fff;
  font-weight: 700;
}

button.danger:hover, .btnDanger:hover {
  background: #6b1515;
  box-shadow: 0 2px 14px rgba(127,29,29,.3);
}

button svg, button i {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* ===== TOOLBAR & FILTERS ===== */
.toolbar, .filters, .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

/* ===== STATUS DOT INDICATOR ===== */
.statusDot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-NEW .statusDot { background: #cc0000; box-shadow: 0 0 6px rgba(204,0,0,.5); }
.status-CONTACTED .statusDot { background: #8899aa; box-shadow: 0 0 6px rgba(136,153,170,.4); }
.status-INTERVIEW .statusDot { background: #b0b8c4; box-shadow: 0 0 6px rgba(176,184,196,.4); }
.status-APPROVED .statusDot { background: #28965a; box-shadow: 0 0 6px rgba(40,150,90,.5); }
.status-DENIED .statusDot { background: #cc0000; box-shadow: 0 0 6px rgba(204,0,0,.5); }

/* ===== COUNTS ROW ===== */
.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
}

.counts .pill {
  transition: transform .1s ease, box-shadow .15s ease;
}

.counts .pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 12px rgba(0,0,0,.3);
}

/* ===== TABLES ===== */
.tableWrap, .tablewrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

thead th {
  text-align: left;
  font-size: 12px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: rgba(224,224,224,.75);
  padding: 12px 12px;
  border-bottom: 1px solid var(--color-border);
  background: rgba(0,0,0,.12);
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody td {
  padding: 12px 12px;
  border-bottom: 1px solid rgba(68,68,68,.6);
  vertical-align: top;
}

tbody tr {
  cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease;
}

tbody tr:hover {
  background: rgba(255,255,255,.045);
  box-shadow: inset 3px 0 0 var(--color-blue);
}

tbody tr.selected {
  background: rgba(47,129,247,.08);
  outline: 1px solid rgba(47,129,247,.25);
  box-shadow: inset 3px 0 0 var(--color-blue);
}

tbody tr.isSelected, .rowSelected {
  background: rgba(204,0,0,.08);
  outline: 1px solid rgba(204,0,0,.25);
  box-shadow: inset 3px 0 0 var(--color-primary);
}

/* ===== PILLS, BADGES & TAGS ===== */
.pill, .badge, .tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(192,192,192,.28);
  background: rgba(0,0,0,.18);
  color: rgba(224,224,224,.9);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}

.pill.good {
  border-color: rgba(40,150,90,.55);
  background: rgba(40,150,90,.14);
  color: #6ee7a0;
}

.roster-added-badge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(40,150,90,.55);
  background: rgba(40,150,90,.14);
  color: #6ee7a0;
  font-size: 13px;
  font-weight: 700;
}
.roster-added-meta {
  width: 100%;
  font-size: 11px;
  font-weight: 400;
  color: rgba(180,180,180,.8);
  word-break: break-word;
}

.pill.bad {
  border-color: rgba(204,0,0,.55);
  background: rgba(204,0,0,.14);
  color: #f87171;
}

/* Status colors */
.status-new, .status-NEW { border-color: rgba(204,0,0,.55); background: rgba(204,0,0,.12); }
.status-contacted, .status-CONTACTED { border-color: rgba(192,192,192,.35); background: rgba(192,192,192,.10); }
.status-interview, .status-INTERVIEW { border-color: rgba(192,192,192,.55); background: rgba(192,192,192,.14); }
.status-approved, .status-APPROVED { border-color: rgba(40,150,90,.55); background: rgba(40,150,90,.14); }
.status-denied, .status-DENIED { border-color: rgba(204,0,0,.65); background: rgba(204,0,0,.18); }
.status-archived, .status-ARCHIVED { border-color: rgba(128,128,128,.45); background: rgba(128,128,128,.12); }

.status-ARCHIVED .statusDot { background: #777; box-shadow: 0 0 6px rgba(128,128,128,.4); }

tr.archived { opacity: .55; }

/* ===== DETAIL PANEL ===== */
.detailsHeader, .detailHeader {
  padding: 14px;
  border-bottom: 1px solid rgba(68,68,68,.7);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detailsBody, .detailBody {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detailHeaderRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detailHeaderRow button {
  width: auto;
}

.detailsPanel input,
.detailsPanel select,
.detailsPanel textarea,
.detailsPanel button,
#detailsPanel input,
#detailsPanel select,
#detailsPanel textarea,
#detailsPanel button,
#detailPanel input,
#detailPanel select,
#detailPanel textarea,
#detailPanel button,
.right input,
.right select,
.right textarea,
.right button {
  width: 100%;
}

#detailPanel input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

#detailPanel textarea.callNotes,
#detailPanel textarea.noteBox {
  min-height: 130px;
}

/* ===== KEY-VALUE ROWS ===== */
.kv, .row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  align-items: start;
}

.kv .k, .label {
  color: rgba(224,224,224,.68);
  font-size: 12px;
  letter-spacing: .6px;
  text-transform: uppercase;
}

.kv .v, .value {
  color: rgba(224,224,224,.95);
}

/* ===== BADGE ROW ===== */
.badgeRow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

/* ===== CHECKBOX ROW ===== */
.checkboxRow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--input-bg);
}

/* ===== FIELD STACK ===== */
.fieldStack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fieldStack.tight {
  gap: 8px;
}

/* ===== ACTION SECTION ===== */
.actionSection {
  margin-top: 12px;
}

.actionSection h3,
.actionSection .sectionTitle {
  margin: 10px 0 6px;
  color: rgba(224,224,224,.85);
}

/* ===== TIMELINE ===== */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: 20px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: linear-gradient(180deg, var(--color-blue) 0%, rgba(47,129,247,.15) 100%);
  border-radius: 2px;
}

.event {
  background: rgba(0,0,0,.16);
  border: 1px solid rgba(68,68,68,.75);
  border-radius: 14px;
  padding: 10px 12px;
  position: relative;
  margin-bottom: 10px;
  transition: border-color .15s ease, background .15s ease;
}

.event:hover {
  border-color: rgba(47,129,247,.3);
  background: rgba(0,0,0,.22);
}

.event::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-blue);
  border: 2px solid var(--color-bg);
  box-shadow: 0 0 6px rgba(47,129,247,.4);
}

.eventTop {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.eventType {
  font-weight: 900;
  letter-spacing: .35px;
  color: var(--color-accent);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.eventMeta, .small {
  color: rgba(224,224,224,.68);
  font-size: 12px;
}

.eventNote {
  white-space: pre-wrap;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  transition: opacity .2s ease, transform .2s ease;
  opacity: 0;
  transform: translateY(-4px);
}

.toast.ok, .toast.err {
  opacity: 1;
  transform: translateY(0);
}

.toast.ok {
  background: rgba(40,150,90,.15);
  border: 1px solid rgba(40,150,90,.35);
  color: #6ee7a0;
}

.toast.err {
  background: rgba(204,0,0,.15);
  border: 1px solid rgba(204,0,0,.35);
  color: #f87171;
}

/* ===== AUTH GATE ===== */
#authGate {
  display: flex; /* default: prevent a flash of dashboard UI on first load */
}
#appWrap {
  display: none; /* shown once authorized */
}

.authGate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(6px);
  z-index: 1000;
}

.authShell {
  width: 100%;
  max-width: 560px;
  border-radius: 22px;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(47,129,247,0.55),
    rgba(220,38,38,0.40),
    rgba(255,255,255,0.18)
  );
  box-shadow: 0 24px 70px rgba(0,0,0,0.60);
  animation: authPulse .4s ease;
}

@keyframes authPulse {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}

.authInner {
  border-radius: 21px;
  padding: 28px 24px;
  background: rgba(17, 24, 39, 0.82);
  border: 1px solid rgba(255,255,255,0.10);
  text-align: center;
}

.authIcon {
  margin-bottom: 12px;
}

.authIcon svg {
  width: 48px;
  height: 48px;
  color: var(--color-blue);
  filter: drop-shadow(0 0 12px rgba(47,129,247,.3));
}

.authInner h2 {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.2px;
  color: rgba(255,255,255,0.95);
}

.authButtons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}

.authButtons button {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 800;
}

.authNote {
  margin-top: 12px;
  font-size: 12px;
  color: rgba(224,224,224,0.75);
  line-height: 1.4;
}

/* ===== EMPTY STATE ===== */
.emptyState {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 16px;
  color: rgba(224,224,224,.55);
}

.emptyState svg {
  width: 32px;
  height: 32px;
  opacity: .4;
}

/* ===== CLICKABLE COUNT PILLS ===== */
.counts .pill {
  cursor: pointer;
  user-select: none;
}

.counts .pill.active {
  outline: 2px solid var(--color-blue);
  outline-offset: 1px;
  background: rgba(47,129,247,.12);
}

/* ===== SORTABLE TABLE HEADERS ===== */
thead th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color .12s ease;
}

thead th.sortable:hover {
  color: rgba(224,224,224,.95);
}

.sortArrow {
  display: inline-block;
  width: 12px;
  margin-left: 3px;
  opacity: .5;
  font-size: 10px;
  vertical-align: 0;
}

thead th.sortable.sortActive {
  color: var(--color-blue);
}

thead th.sortable.sortActive .sortArrow {
  opacity: 1;
}

/* ===== STALE INDICATOR (days since contact) ===== */
.staleBadge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
}

.staleBadge.warm {
  background: rgba(234,179,8,.12);
  border: 1px solid rgba(234,179,8,.35);
  color: #fbbf24;
}

.staleBadge.hot {
  background: rgba(204,0,0,.12);
  border: 1px solid rgba(204,0,0,.4);
  color: #f87171;
}

/* ===== INTERVIEW ROW ===== */
.interview-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.interview-row input[type="datetime-local"] {
  flex: 1;
  min-width: 0;
}

/* ===== INTERVIEW BADGES ===== */
.interviewBadge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  vertical-align: middle;
}
.interviewBadge.upcoming {
  background: rgba(60,130,246,.18);
  color: #93bbfc;
  border: 1px solid rgba(60,130,246,.35);
}
.interviewBadge.overdue {
  background: rgba(220,38,38,.18);
  color: #f87171;
  border: 1px solid rgba(220,38,38,.35);
}

/* ===== RELATIVE TIME ===== */
.relTime {
  font-size: 11px;
  color: rgba(224,224,224,.5);
  margin-left: 4px;
}

/* ===== CONFIRM DIALOG ===== */
.confirmOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn .15s ease;
}

.confirmBox {
  background: var(--panel-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  padding: 22px 24px;
  max-width: 380px;
  width: 90%;
  text-align: center;
}

.confirmBox p {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.4;
}

.confirmActions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.confirmActions button {
  min-width: 90px;
}

/* ===== MOBILE-ONLY LINKS ===== */
.contactLink {
  color: inherit;
  text-decoration: none;
  pointer-events: none;
}

/* ===== KEYBOARD HINT ===== */
.kbdHint {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.06);
  font-size: 10px;
  font-family: monospace;
  color: rgba(224,224,224,.5);
  margin-left: 4px;
  vertical-align: 1px;
}

/* ===== LANDING PAGE CARDS ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 640px;
  margin: 24px 0;
}

.app-card {
  display: block;
  background: var(--panel-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
  cursor: pointer;
}

.app-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,.5);
  border-color: rgba(196,30,58,.45);
  color: inherit;
}

.card-accent-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary) 0%, #9B1830 100%);
}

.card-accent-bar.card-accent-gold {
  background: linear-gradient(90deg, #D4A843 0%, #a37e2e 100%);
}

.app-card-body {
  padding: 24px 20px;
}

.app-card-icon {
  width: 32px;
  height: 32px;
  color: var(--color-primary);
  margin-bottom: 12px;
  filter: drop-shadow(0 0 8px rgba(196,30,58,.3));
}

.card-accent-gold + .app-card-body .app-card-icon {
  color: #D4A843;
  filter: drop-shadow(0 0 8px rgba(212,168,67,.3));
}

.app-card h2 {
  margin: 0 0 6px;
  font-family: 'Oswald', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.app-card p {
  margin: 0;
  font-size: 13px;
}

/* ===== STATS CARDS ===== */
.app-card-split {
  display: flex;
  flex-direction: column;
}
.app-card-split .app-card-link {
  display: block;
  flex: 1;
  text-decoration: none;
  color: inherit;
}

.stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 8px;
  font-size: 12px;
}
.stats-grid .stat-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgba(224,224,224,.8);
}
.stats-grid .stat-item b {
  color: #fff;
  font-size: 14px;
}
.stats-grid .stat-divider {
  width: 100%;
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: 4px 0;
}
.stats-grid .stat-highlight {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(60,130,246,.12);
  border: 1px solid rgba(60,130,246,.25);
  color: #93bbfc;
  font-weight: 600;
}
.stats-grid .stat-highlight.stat-empty {
  background: transparent;
  border-color: transparent;
  color: rgba(180,180,180,.5);
  font-weight: 400;
}
.stats-grid .stat-label {
  color: rgba(180,180,180,.6);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-size: 10px;
  width: 100%;
  margin-top: 4px;
}

/* ===== BACK LINK ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgba(224,224,224,.75);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: color .12s ease;
}

.back-link:hover {
  color: #fff;
}

/* ===== MEDIA QUERIES ===== */

/* Tablet breakpoint */
@media (max-width: 980px) {
  .layout, .split, .grid, .main {
    grid-template-columns: 1fr;
  }

  .cards-grid {
    grid-template-columns: 1fr;
    max-width: 340px;
  }
}

/* Mobile breakpoint - larger phones/small tablets */
@media (max-width: 860px) {
  body.detailOpen { overflow: hidden; }

  /* Layout becomes single column */
  .layout {
    grid-template-columns: 1fr !important;
  }

  .wrap, .layout, .card, .left, .right, #detailPanel {
    max-width: 100%;
    width: 100%;
  }

  .left {
    min-width: 0;
  }

  /* Topbar grid layout */
  .topbar {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
    justify-content: start;
  }

  #btnLogin, #btnLogout { width: auto; }
  #authBadge { justify-self: start; }
  label[for="statusFilter"] { width: auto; }
  #statusFilter { width: 100%; }
  .searchWrap { grid-column: 1 / -1; width: 100%; }
  #toast { grid-column: 1 / -1; }

  /* Counts pills: wrap in 2-per-row */
  .counts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
    margin-bottom: 10px;
  }

  .counts .pill {
    flex: 1 1 calc(50% - 10px);
    justify-content: center;
  }

  /* Table mobile styles */
  .tableWrap, .tablewrap {
    overflow-x: hidden;
  }

  table {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: fixed;
  }

  thead th, tbody td {
    padding: 10px 10px;
  }

  /* Show only Name + Status columns */
  thead th:nth-child(n+3),
  tbody td:nth-child(n+3) {
    display: none !important;
  }

  thead th:nth-child(1),
  tbody td:nth-child(1) {
    width: 70%;
  }

  thead th:nth-child(2),
  tbody td:nth-child(2) {
    width: 30%;
    text-align: right;
  }

  tbody td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  tbody td:nth-child(2) .pill {
    margin-left: auto;
  }

  .pill {
    padding: 6px 10px;
    font-size: 11px;
  }

  /* Textarea mobile fixes */
  textarea {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 110px;
  }

  input, select, button {
    max-width: 100%;
  }

  #detailPanel input[type="checkbox"] {
    width: auto !important;
  }

  #detailPanel input,
  #detailPanel select,
  #detailPanel textarea,
  #detailPanel button {
    max-width: 100%;
  }

  /* Detail panel drawer */
  #detailPanel {
    position: fixed;
    inset: 0;
    z-index: 9999;
    border-radius: 0;
    max-height: 100vh;
    overflow-y: auto;
    left: 0;
    right: 0;
    width: 100% !important;
    max-width: 100% !important;
    padding-left: calc(14px + env(safe-area-inset-left));
    padding-right: calc(14px + env(safe-area-inset-right));
    transform: translateX(105%);
    transition: transform .18s ease;
  }

  body.detailOpen #detailPanel {
    transform: translateX(0);
  }

  .right {
    padding: 14px 14px 18px;
  }

  .kv, .row {
    grid-template-columns: 1fr;
  }

  /* Timeline adjustments */
  .timeline { padding-left: 16px; }
  .timeline::before { left: 4px; }
  .event::before { left: -14px; width: 8px; height: 8px; }

  /* Hide h1 gradient line on mobile */
  h1::after { display: none; }

  /* Enable tel:/mailto: links on mobile */
  .contactLink {
    pointer-events: auto;
    text-decoration: underline;
    text-decoration-color: rgba(47,129,247,.35);
    text-underline-offset: 2px;
  }

  .contactLink:hover {
    color: var(--color-blue);
  }
}

/* Small phone breakpoint */
@media (max-width: 720px) {
  textarea { min-height: 96px; }
  .kv, .row { grid-template-columns: 120px 1fr; }
}

/* Extra small phone breakpoint */
@media (max-width: 460px) {
  .wrap { padding: 16px 12px 30px; }
  h1, .title { font-size: 22px; }
  .kv, .row { grid-template-columns: 1fr; }
  .titleIcon { width: 22px; height: 22px; }
}

/* Auth gate mobile */
@media (max-width: 420px) {
  .authInner { padding: 22px 18px; }
  .authInner h2 { font-size: 24px; }
  .authIcon svg { width: 40px; height: 40px; }
}
