/* ============================================================
   RCS Design System — Alps Ventures Returns & Claims System
   One shared stylesheet for every page: Home, PDI, Cancelled,
   Reports, Users. Defines tokens + reusable components so every
   module looks like part of the same product.
   ============================================================ */

:root {
  /* Color: neutral surfaces */
  --rcs-bg: #f4f5f7;
  --rcs-surface: #ffffff;
  --rcs-border: #e2e4e9;
  --rcs-border-strong: #d3d6dd;

  /* Color: text */
  --rcs-text: #1a1d23;
  --rcs-text-secondary: #6b7280;
  --rcs-text-muted: #9aa0ab;

  /* Color: brand / primary action */
  --rcs-brand: #b91c1c;
  --rcs-brand-hover: #991b1b;
  --rcs-brand-bg: #fdecec;

  /* Color: status */
  --rcs-success: #16a34a;
  --rcs-success-bg: #dcfce7;
  --rcs-success-text: #166534;
  --rcs-warning: #d97706;
  --rcs-warning-bg: #fef3c7;
  --rcs-warning-text: #92400e;
  --rcs-danger: #dc2626;
  --rcs-danger-bg: #fee2e2;
  --rcs-danger-text: #991b1b;
  --rcs-info: #2563eb;
  --rcs-info-bg: #dbeafe;
  --rcs-info-text: #1e40af;
  --rcs-neutral-bg: #f1f2f5;
  --rcs-neutral-text: #4b5563;

  /* Radius */
  --rcs-radius-sm: 6px;
  --rcs-radius-md: 10px;

  /* Spacing scale */
  --rcs-sp-1: 4px;
  --rcs-sp-2: 8px;
  --rcs-sp-3: 12px;
  --rcs-sp-4: 16px;
  --rcs-sp-5: 20px;
  --rcs-sp-6: 24px;
  --rcs-sp-7: 32px;

  /* Elevation — used sparingly per design brief */
  --rcs-shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --rcs-shadow-md: 0 2px 8px rgba(16, 24, 40, .06);
  --rcs-shadow-lg: 0 8px 24px rgba(16, 24, 40, .12);
}

/* ---------- Reset / base ---------- */
.rcs-app, .rcs-app * { box-sizing: border-box; }
.rcs-app {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--rcs-text);
  background: var(--rcs-bg);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.45;
}
.rcs-app h1, .rcs-app h2, .rcs-app h3 { margin: 0; font-weight: 700; color: var(--rcs-text); }
.rcs-app a { color: inherit; }

/* ---------- Page shell ---------- */
.rcs-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--rcs-sp-6) var(--rcs-sp-5) 70px;
}
.rcs-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--rcs-sp-3);
  margin-bottom: var(--rcs-sp-6);
}
.rcs-page-header-text h1 {
  font-size: 24px;
  margin-bottom: 4px;
}
.rcs-page-header-text p {
  margin: 0;
  font-size: 13px;
  color: var(--rcs-text-secondary);
}
.rcs-page-header-actions {
  display: flex;
  gap: var(--rcs-sp-2);
  flex-wrap: wrap;
}

/* ---------- KPI cards ---------- */
.rcs-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--rcs-sp-3);
  margin-bottom: var(--rcs-sp-6);
}
.rcs-kpi-card {
  background: var(--rcs-surface);
  border: 1px solid var(--rcs-border);
  border-radius: var(--rcs-radius-md);
  padding: var(--rcs-sp-4) var(--rcs-sp-5);
  text-decoration: none;
  display: block;
  color: inherit;
  transition: border-color .15s;
}
a.rcs-kpi-card:hover { border-color: var(--rcs-border-strong); }
.rcs-kpi-card.is-active { border-color: var(--rcs-brand); border-width: 1px; box-shadow: 0 0 0 1px var(--rcs-brand); }
.rcs-kpi-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--rcs-text);
  line-height: 1.2;
}
.rcs-kpi-label {
  font-size: 12px;
  color: var(--rcs-text-secondary);
  margin-top: 4px;
}
.rcs-kpi-target {
  font-size: 11px;
  color: var(--rcs-text-muted);
  margin-top: 6px;
}
.rcs-kpi-card.tone-success .rcs-kpi-num { color: var(--rcs-success); }
.rcs-kpi-card.tone-warning .rcs-kpi-num { color: var(--rcs-warning); }
.rcs-kpi-card.tone-danger  .rcs-kpi-num { color: var(--rcs-danger); }
.rcs-kpi-card.tone-info    .rcs-kpi-num { color: var(--rcs-info); }

/* ---------- Cards ---------- */
.rcs-card {
  background: var(--rcs-surface);
  border: 1px solid var(--rcs-border);
  border-radius: var(--rcs-radius-md);
  padding: var(--rcs-sp-5);
  margin-bottom: var(--rcs-sp-4);
}
.rcs-card > h2, .rcs-card-title {
  font-size: 16px;
  margin: 0 0 var(--rcs-sp-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--rcs-sp-2);
}

/* ---------- Section toolbar (title + actions above a table) ---------- */
.rcs-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--rcs-sp-3);
  margin-bottom: var(--rcs-sp-3);
}
.rcs-toolbar h2 { font-size: 16px; margin: 0; }

/* ---------- Filter bar ---------- */
.rcs-filter-bar {
  background: var(--rcs-surface);
  border: 1px solid var(--rcs-border);
  border-radius: var(--rcs-radius-md);
  padding: var(--rcs-sp-4);
  margin-bottom: var(--rcs-sp-4);
}
.rcs-filter-row {
  display: flex;
  gap: var(--rcs-sp-4);
  align-items: flex-end;
  flex-wrap: wrap;
}
.rcs-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
}
.rcs-filter-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--rcs-text-secondary);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.rcs-filter-actions {
  display: flex;
  gap: var(--rcs-sp-2);
  margin-left: auto;
}

/* ---------- Forms ---------- */
.rcs-app label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--rcs-text-secondary);
  text-transform: uppercase;
  letter-spacing: .3px;
  margin: var(--rcs-sp-3) 0 4px;
}
.rcs-app label:first-child { margin-top: 0; }
.rcs-app input[type=text],
.rcs-app input[type=number],
.rcs-app input[type=date],
.rcs-app input[type=password],
.rcs-app input[type=email],
.rcs-app select,
.rcs-app textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--rcs-border);
  border-radius: var(--rcs-radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--rcs-text);
  background: var(--rcs-surface);
  min-width: 0;
}
.rcs-app input:focus, .rcs-app select:focus, .rcs-app textarea:focus {
  outline: none;
  border-color: var(--rcs-brand);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, .08);
}
.rcs-app textarea { min-height: 64px; resize: vertical; }
.rcs-app input[type=file] { font-size: 12px; border: none; padding: 4px 0; }
.rcs-mandatory { color: var(--rcs-danger); }
.rcs-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 var(--rcs-sp-3);
}

/* Fixed-width helpers used inside filter bars */
.rcs-input-sm { width: 220px; }
.rcs-select-sm { min-width: 160px; width: auto; }

/* Multi-line search control (input + icon + popover), reused on
   Home and Cancelled */
.rcs-search-wrap { position: relative; display: flex; align-items: center; width: 220px; }
.rcs-search-input { width: 100%; min-width: 0; padding: 9px 34px 9px 11px; }
.rcs-search-icon {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; padding: 4px; cursor: pointer;
  color: var(--rcs-text-muted); border-radius: 4px; display: flex;
}
.rcs-search-icon:hover { color: var(--rcs-text); background: var(--rcs-neutral-bg); }

/* Toggle chips (e.g. All / Needs My Action) */
.rcs-chip-row { display: flex; gap: var(--rcs-sp-2); flex-wrap: wrap; }
.rcs-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--rcs-surface); border: 1px solid var(--rcs-border);
  border-radius: 20px; padding: 6px 14px; font-size: 12px; font-weight: 600;
  color: var(--rcs-text-secondary); cursor: pointer; text-decoration: none;
}
.rcs-chip.active { background: var(--rcs-text); color: #fff; border-color: var(--rcs-text); }

/* ---------- Buttons ---------- */
.rcs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--rcs-radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.rcs-btn:disabled { opacity: .5; cursor: not-allowed; }
.rcs-btn-primary { background: var(--rcs-brand); color: #fff; }
.rcs-btn-primary:hover { background: var(--rcs-brand-hover); }
.rcs-btn-secondary { background: var(--rcs-surface); color: var(--rcs-text); border-color: var(--rcs-border); }
.rcs-btn-secondary:hover { background: var(--rcs-neutral-bg); }
.rcs-btn-success { background: var(--rcs-success); color: #fff; }
.rcs-btn-success:hover { background: #15803d; }
.rcs-btn-danger { background: var(--rcs-danger); color: #fff; }
.rcs-btn-danger:hover { background: #b91c1c; }
.rcs-btn-warning { background: var(--rcs-warning); color: #fff; }
.rcs-btn-sync { background: var(--rcs-text); color: #fff; }
.rcs-btn-sync:hover { background: #000; }
.rcs-btn-sm { padding: 6px 11px; font-size: 12px; }
.rcs-btn-block { display: flex; width: 100%; margin-top: var(--rcs-sp-2); }

/* ---------- Badges / status pills ---------- */
.rcs-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2px;
  background: var(--rcs-neutral-bg);
  color: var(--rcs-neutral-text);
  white-space: nowrap;
}
.rcs-badge.tone-success { background: var(--rcs-success-bg); color: var(--rcs-success-text); }
.rcs-badge.tone-warning { background: var(--rcs-warning-bg); color: var(--rcs-warning-text); }
.rcs-badge.tone-danger  { background: var(--rcs-danger-bg);  color: var(--rcs-danger-text); }
.rcs-badge.tone-info    { background: var(--rcs-info-bg);    color: var(--rcs-info-text); }
.rcs-badge.tone-brand   { background: var(--rcs-brand-bg);   color: var(--rcs-brand); }

/* ---------- Data table ---------- */
.rcs-table-wrap {
  background: var(--rcs-surface);
  border: 1px solid var(--rcs-border);
  border-radius: var(--rcs-radius-md);
  overflow: hidden;
}
.rcs-table-scroll { overflow-x: auto; }
table.rcs-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}
.rcs-table thead th {
  position: sticky;
  top: 0;
  background: #f8f9fb;
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--rcs-text-secondary);
  text-transform: uppercase;
  letter-spacing: .3px;
  border-bottom: 1px solid var(--rcs-border);
  white-space: nowrap;
}
.rcs-table tbody td {
  padding: 11px 14px;
  font-size: 13px;
  color: var(--rcs-text);
  border-bottom: 1px solid var(--rcs-border);
  vertical-align: top;
}
.rcs-table tbody tr:last-child td { border-bottom: none; }
.rcs-table tbody tr:hover td { background: #fafbfc; }
.rcs-table tbody tr.is-clickable { cursor: pointer; }
.rcs-muted { color: var(--rcs-text-muted); }
.rcs-order-link { color: var(--rcs-brand); font-weight: 700; text-decoration: none; }
.rcs-order-link:hover { text-decoration: underline; }

/* Label/value info grid (account page, case detail summary) */
.rcs-info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--rcs-sp-3); }
.rcs-info-item { display: flex; flex-direction: column; }
.rcs-info-label { font-size: 10px; font-weight: 600; color: var(--rcs-text-muted); text-transform: uppercase; letter-spacing: .4px; }
.rcs-info-value { font-size: 14px; font-weight: 500; color: var(--rcs-text); margin-top: 2px; }
.rcs-empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--rcs-text-secondary);
  font-size: 13px;
  background: var(--rcs-surface);
  border: 1px solid var(--rcs-border);
  border-radius: var(--rcs-radius-md);
}

/* ---------- Pagination ---------- */
.rcs-pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: var(--rcs-sp-4);
}

/* ---------- Alerts ---------- */
.rcs-alert {
  padding: 11px 16px;
  border-radius: var(--rcs-radius-sm);
  font-size: 13px;
  margin-bottom: var(--rcs-sp-4);
  border: 1px solid transparent;
}
.rcs-alert-danger { background: var(--rcs-danger-bg); color: var(--rcs-danger-text); border-color: #fecaca; }
.rcs-alert-success { background: var(--rcs-success-bg); color: var(--rcs-success-text); border-color: #bbf7d0; }

/* ---------- Toasts (lightweight inline message under a form) ---------- */
.rcs-msg { padding: 10px 14px; border-radius: var(--rcs-radius-sm); font-size: 13px; margin-top: var(--rcs-sp-2); display: none; }
.rcs-msg.success { background: var(--rcs-success-bg); color: var(--rcs-success-text); display: block; }
.rcs-msg.error { background: var(--rcs-danger-bg); color: var(--rcs-danger-text); display: block; }

/* ---------- Modal ---------- */
.rcs-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 20, 26, .5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.rcs-modal-overlay.open { display: flex; }
.rcs-modal-box {
  background: var(--rcs-surface);
  border: 1px solid var(--rcs-border);
  border-radius: var(--rcs-radius-md);
  padding: var(--rcs-sp-5);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--rcs-shadow-lg);
}
.rcs-modal-box h3 { font-size: 16px; margin: 0 0 var(--rcs-sp-3); }
.rcs-modal-sub { font-size: 12px; color: var(--rcs-text-secondary); margin: -8px 0 var(--rcs-sp-3); line-height: 1.4; }
.rcs-modal-actions { display: flex; justify-content: flex-end; gap: var(--rcs-sp-2); margin-top: var(--rcs-sp-3); }
.rcs-modal-close { float: right; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--rcs-text-muted); line-height: 1; }

/* Popover (attached to a control, e.g. multi-line search) */
.rcs-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 320px;
  background: var(--rcs-surface);
  border: 1px solid var(--rcs-border);
  border-radius: var(--rcs-radius-md);
  box-shadow: var(--rcs-shadow-lg);
  padding: var(--rcs-sp-4);
  z-index: 60;
}
.rcs-popover-hint { font-size: 12px; color: var(--rcs-text-secondary); margin: 0 0 var(--rcs-sp-3); line-height: 1.4; }

/* Audit / edit-history list (used inside a modal) */
.history-body { max-height: 340px; overflow-y: auto; margin-bottom: var(--rcs-sp-4); }
.history-entry { padding: 10px 0; border-bottom: 1px solid var(--rcs-border); font-size: 12px; }
.history-entry:last-child { border-bottom: none; }
.history-entry .h-who { font-weight: 700; color: var(--rcs-text); }
.history-entry .h-when { color: var(--rcs-text-muted); float: right; }
.history-entry .h-what { color: var(--rcs-text-secondary); margin-top: 3px; }
.history-empty { color: var(--rcs-text-secondary); font-size: 13px; text-align: center; padding: 20px 0; }

/* ---------- Top navigation ---------- */
.rcs-navbar { background: var(--rcs-surface); border-bottom: 1px solid var(--rcs-border); position: sticky; top: 0; z-index: 200; }
.rcs-navbar-inner { max-width: 1280px; margin: 0 auto; padding: 0 var(--rcs-sp-5); height: 58px; display: flex; align-items: center; gap: var(--rcs-sp-6); }
.rcs-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.rcs-logo { height: 24px; width: auto; display: block; }
.rcs-brand-text { font-size: 14px; font-weight: 700; color: var(--rcs-text); white-space: nowrap; }
.rcs-nav-links { display: flex; gap: 2px; flex: 1; }
.rcs-nav-link { padding: 8px 14px; border-radius: var(--rcs-radius-sm); font-size: 13px; font-weight: 600; color: var(--rcs-text-secondary); text-decoration: none; transition: background .15s, color .15s; }
.rcs-nav-link:hover { background: var(--rcs-neutral-bg); color: var(--rcs-text); }
.rcs-nav-link.active { background: var(--rcs-brand-bg); color: var(--rcs-brand); }
.rcs-nav-user { position: relative; flex-shrink: 0; }
.rcs-user-pill { display: flex; align-items: center; gap: 8px; background: var(--rcs-bg); border: 1px solid var(--rcs-border); border-radius: 24px; padding: 4px 12px 4px 4px; cursor: pointer; font-family: inherit; }
.rcs-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--rcs-brand); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.rcs-user-name { font-size: 13px; font-weight: 600; color: var(--rcs-text); }
.rcs-role-tag { font-size: 10px; font-weight: 700; color: var(--rcs-warning-text); background: var(--rcs-warning-bg); padding: 2px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: .3px; }
.rcs-user-menu { display: none; position: absolute; right: 0; top: 44px; background: var(--rcs-surface); border: 1px solid var(--rcs-border); border-radius: var(--rcs-radius-md); box-shadow: var(--rcs-shadow-lg); min-width: 150px; overflow: hidden; }
.rcs-user-menu.open { display: block; }
.rcs-user-menu a { display: block; padding: 11px 16px; font-size: 13px; color: var(--rcs-text); text-decoration: none; }
.rcs-user-menu a:hover { background: var(--rcs-bg); }
.rcs-mobile-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--rcs-text); }
.rcs-mobile-nav { display: none; flex-direction: column; background: var(--rcs-surface); border-top: 1px solid var(--rcs-border); padding: var(--rcs-sp-2); }
.rcs-mobile-nav.open { display: flex; }
.rcs-mobile-nav a { padding: 12px 14px; font-size: 14px; font-weight: 600; color: var(--rcs-text); text-decoration: none; border-radius: var(--rcs-radius-sm); }
.rcs-mobile-nav a.active { background: var(--rcs-brand-bg); color: var(--rcs-brand); }

@media (max-width: 760px) {
  .rcs-nav-links { display: none; }
  .rcs-user-name, .rcs-role-tag { display: none; }
  .rcs-mobile-toggle { display: block; }
  .rcs-form-grid { grid-template-columns: 1fr; }
  .rcs-page { padding: var(--rcs-sp-4) var(--rcs-sp-3) 60px; }
}