/* ============================================================
   FutureGate Bento — Design System
   Single source of truth for QSTP apps.

   To reuse in another app:
     1. Copy this file in, then add one <link> in <head>:
          <link rel="stylesheet" href="styles/futuregatebento.css">
     2. Use the same class names (.header, .nav-buttons button,
        .btn-primary, .content-card, .companies-table, .step-item,
        .status-badge.status-*, .modal-content, .filters, etc.).
   The brand font (Plus Jakarta Sans) is imported below, so no
   separate Google Fonts link is required.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ===== 1. TOKENS ===== */
:root {
  /* Brand — from FutureGate logo */
  --fg-blue:#1C6FB3; --fg-blue-deep:#15497E; --fg-blue-azure:#2BA0E0; --fg-blue-tint:#E8F1F9;
  --grad-brand:linear-gradient(135deg,#2BA0E0 0%,#15497E 100%);
  --ink:#16191D; --ink-soft:#2B3038; --muted:#5C6672;
  --canvas:#EEF1F5; --surface:#FFFFFF; --inset:#F4F6F9; --hairline:#E4E8EE;
  /* Semantic */
  --ok:#16A34A; --ok-bg:#E7F6EC; --warn:#D97706; --warn-bg:#FCEFD9;
  --bad:#DC2626; --bad-bg:#FBE9E9; --info:#1C6FB3; --info-bg:#E8F1F9;
  /* Shape & motion */
  --r-card:22px; --r-md:14px; --r-pill:999px; --r-sm:10px;
  --shadow-card:0 4px 18px rgba(20,40,80,.06);
  --shadow-pop:0 12px 30px rgba(20,40,80,.10);
  --ring:0 0 0 3px rgba(43,160,224,.40);
  --ease:.18s cubic-bezier(.4,0,.2,1);
  /* Glassmorphism — modal tokens (shared) */
  --glass-bg:rgba(255,255,255,.65); --glass-border:rgba(255,255,255,.65);
  --glass-blur:saturate(1.25) blur(14px);
  --glass-shadow:0 8px 30px rgba(20,40,80,.10);
  /* Glass — form-scoped (white-dominant frost so labels stay AA) */
  --glass-form-bg:linear-gradient(160deg, rgba(255,255,255,.85), rgba(255,255,255,.78));
  --glass-form-blur:saturate(1.3) blur(14px);
  --glass-form-border:rgba(255,255,255,.85);
  --glass-form-hi:inset 0 1px 0 rgba(255,255,255,.9);
  /* Neutral light "stage" behind the form glass (no blue) */
  --glass-stage:linear-gradient(160deg,#FCFCFD 0%, #F1F2F4 55%, #E9EBEE 100%);
}

/* ===== 2. BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.arabic-text {
  direction: rtl;
  text-align: right;
  font-family: 'Segoe UI', 'Traditional Arabic', 'Arial', sans-serif;
}

a { color: var(--fg-blue-deep); }

.main-content { display: none; }
.main-content.authenticated { display: block; }

/* ===== 3. LOGIN ===== */
.login-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(43,160,224,.18), transparent 60%),
    radial-gradient(900px 600px at 100% 100%, rgba(21,73,126,.20), transparent 55%),
    var(--canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.login-box {
  background: var(--surface);
  padding: 40px;
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pop);
  border: 1px solid var(--hairline);
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.login-logo { margin-bottom: 20px; }
.login-logo img { height: 56px; }

.login-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.3px;
  color: var(--ink);
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--muted);
  margin-bottom: 28px;
  font-size: 14px;
}

.login-input {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  font-size: 15px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  margin-bottom: 16px;
  transition: all var(--ease);
}

.login-input:focus {
  outline: none;
  border-color: var(--fg-blue);
  box-shadow: var(--ring);
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

/* Keep the input's value from sliding under the eye toggle */
.password-input-wrapper input {
  width: 100%;
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--ease);
}

.password-toggle:hover {
  color: var(--fg-blue);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

.login-button {
  width: 100%;
  padding: 14px;
  background: var(--grad-brand);
  color: white;
  border: none;
  border-radius: var(--r-md);
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--ease);
  box-shadow: 0 6px 16px rgba(21,73,126,.22);
}

.login-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-pop);
}

.login-error {
  color: var(--bad);
  margin-top: 15px;
  font-size: 14px;
  display: none;
}

.logout-btn {
  background: var(--bad-bg) !important;
  color: var(--bad) !important;
  border-color: transparent !important;
  margin-left: 6px;
}

.logout-btn:hover {
  background: var(--bad) !important;
  color: #fff !important;
}

/* ===== 4. HEADER & NAVIGATION ===== */
.header {
  background: var(--surface);
  color: var(--ink);
  padding: 14px 28px;
  box-shadow: var(--shadow-card);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-container {
  background: transparent;
  padding: 0;
  border-radius: 0;
  display: flex;
  align-items: center;
}

.logo-container img { height: 42px; width: auto; }

.header-title h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.3px;
  margin-bottom: 1px;
  color: var(--ink);
}

.header-title p {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}

.nav-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.nav-buttons button {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid transparent;
  padding: 8px 15px;
  border-radius: var(--r-pill);
  cursor: pointer;
  font-size: 13.5px;
  transition: all var(--ease);
  font-weight: 600;
  font-family: inherit;
}

.nav-buttons button:hover {
  background: var(--inset);
  color: var(--ink);
}

.nav-buttons button.active {
  background: var(--ink);
  color: #fff;
}

.nav-buttons button.active:hover {
  background: var(--ink);
  color: #fff;
}

.nav-buttons button.secondary {
  color: var(--muted);
}

.nav-buttons button.secondary:hover {
  background: var(--inset);
  color: var(--ink-soft);
}

.nav-badge {
  background: var(--bad);
  color: #fff;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 11px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ===== 5. BUTTONS ===== */
.btn-primary {
  background: var(--grad-brand);
  color: white;
  border: none;
  padding: 11px 22px;
  border-radius: var(--r-pill);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--ease);
  box-shadow: 0 4px 12px rgba(21,73,126,.18);
}

.btn-primary:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
  box-shadow: var(--shadow-pop);
}

.btn-secondary {
  background: var(--inset);
  color: var(--ink);
  border: 1px solid var(--hairline);
  padding: 11px 22px;
  border-radius: var(--r-pill);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--ease);
}

.btn-secondary:hover {
  background: var(--fg-blue-tint);
  color: var(--fg-blue-deep);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--bad);
  color: white;
  border: none;
  padding: 11px 22px;
  border-radius: var(--r-pill);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--ease);
}

.btn-danger:hover {
  filter: brightness(.95);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.export-btn {
  background: var(--ok);
  color: white;
  border: none;
  padding: 11px 22px;
  border-radius: var(--r-pill);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--ease);
}

.export-btn:hover {
  filter: brightness(.95);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.back-button {
  background: var(--inset);
  color: var(--ink);
  border: 1px solid var(--hairline);
  padding: 10px 20px;
  border-radius: var(--r-pill);
  cursor: pointer;
  margin-bottom: 20px;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--ease);
}

.back-button:hover {
  background: var(--fg-blue-tint);
  color: var(--fg-blue-deep);
  transform: translateY(-1px);
}

.step-edit-btn {
  background: var(--fg-blue);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--ease);
}

.step-edit-btn:hover {
  background: var(--fg-blue-deep);
  transform: translateY(-1px);
}

.step-edit-btn:disabled {
  background: var(--hairline);
  color: var(--muted);
  cursor: not-allowed;
  transform: none;
}

.claim-btn {
  margin-left: auto;
  background: #4f46e5;
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.claim-btn:hover { background: #4338ca; }
.claim-btn.release { background: #64748b; }
.claim-btn.release:hover { background: #475569; }

/* ===== 6. MODALS ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(20,30,50,0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal-content {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--r-card);
  padding: 30px;
  position: relative;
  box-shadow: var(--shadow-pop);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--hairline);
}

.modal-header h2 {
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.3px;
}

.modal-close {
  background: var(--inset);
  color: var(--muted);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--ease);
}

.modal-close:hover {
  background: var(--bad);
  color: #fff;
  transform: rotate(90deg);
}

.modal-body { display: grid; gap: 20px; }

.modal-section {
  background: var(--inset);
  padding: 20px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
}

.modal-section h3 {
  color: var(--ink);
  margin-bottom: 15px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-section h3::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 999px;
  background: var(--grad-brand);
  flex: none;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-field label {
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 13px;
}

.modal-field input,
.modal-field select,
.modal-field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  font-size: 14px;
  transition: all var(--ease);
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
}

.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
  outline: none;
  border-color: var(--fg-blue);
  box-shadow: var(--ring);
}

.modal-field textarea {
  resize: vertical;
  min-height: 80px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
}

/* ===== 7. CARDS & PANELS ===== */
.container {
  max-width: 1400px;
  margin: 30px auto;
  padding: 0 40px;
}

.content-card {
  background: var(--surface);
  border-radius: var(--r-card);
  padding: 28px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--hairline);
  margin-bottom: 20px;
}

/* List-view panels */
.lv-panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: 22px;
  margin-bottom: 18px;
}

.lv-panel > .filters { margin-bottom: 0; }
.lv-panel > .export-btn { margin-top: 16px; }

/* table self-cards; wrapper is a passthrough */
.lv-table-panel { padding: 0; background: transparent; border: none; box-shadow: none; overflow: visible; }

.lv-panel > h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}

.lv-panel > h3::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 999px;
  background: var(--grad-brand);
  flex: none;
}

.hm-panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
}

/* Worked-by banner */
.worked-by-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #3730a3;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.worked-by-banner.owner-self { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.worked-by-banner.owned-other { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.worked-by-banner.unclaimed { background: #f8fafc; border-color: #e2e8f0; color: #475569; }

.company-owner-badge { font-size: 12px; color: #4f46e5; white-space: nowrap; }
.company-owner-badge.unclaimed { color: #94a3b8; }

/* Per-coordinator colored pill — background/color are set inline per username */
.coord-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

/* Company details grid */
.company-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.detail-item { padding: 16px 18px; }

/* Inline-editable detail cards */
.detail-item.is-editable { position: relative; }
.detail-edit-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: all var(--ease);
}
.detail-item.is-editable:hover .detail-edit-btn,
.detail-item.is-editable:focus-within .detail-edit-btn { opacity: 1; }
.detail-edit-btn:hover {
  color: var(--fg-blue);
  border-color: var(--fg-blue);
  background: var(--fg-blue-tint);
  transform: translateY(-1px);
}
.detail-item.is-editing {
  box-shadow: var(--ring);
  border: 1px solid var(--fg-blue);
}
.detail-edit-field {
  width: 100%;
  margin-top: 2px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  transition: border-color var(--ease), box-shadow var(--ease);
  box-sizing: border-box;
}
.detail-edit-field:focus {
  outline: none;
  border-color: var(--fg-blue);
  box-shadow: var(--ring);
}
textarea.detail-edit-field { resize: vertical; min-height: 70px; line-height: 1.5; }
.detail-edit-field[dir="rtl"] { text-align: right; }
.detail-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.detail-edit-actions button {
  border: none;
  border-radius: var(--r-pill);
  padding: 7px 18px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--ease);
}
.detail-edit-save {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 4px 12px rgba(21, 73, 126, .18);
}
.detail-edit-save:hover { filter: brightness(1.06); transform: translateY(-1px); }
.detail-edit-cancel { background: var(--inset); color: var(--muted); }
.detail-edit-cancel:hover { background: var(--hairline); color: var(--ink); }

/* Owners multi-row editor */
.owners-editor { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.owner-row { display: grid; grid-template-columns: 1fr 84px 34px; gap: 8px; align-items: center; }
.owner-row .detail-edit-field { margin-top: 0; }
.owner-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all var(--ease);
}
.owner-remove-btn:hover { color: var(--bad); border-color: var(--bad); background: rgba(213, 66, 62, .08); }
.owners-add-btn {
  align-self: flex-start;
  margin-top: 10px;
  border: 1px dashed var(--hairline);
  background: var(--inset);
  color: var(--fg-blue);
  border-radius: var(--r-pill);
  padding: 6px 15px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--ease);
}
.owners-add-btn:hover { border-color: var(--fg-blue); background: var(--fg-blue-tint); border-style: solid; }

.detail-item strong {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

.detail-item-value {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  word-wrap: break-word;
}

.action-buttons {
  display: flex;
  gap: 10px;
  margin: 20px 0;
  flex-wrap: wrap;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: #999;
  font-size: 16px;
}

.loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* Import section */
.import-section {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--r-card);
  margin-bottom: 18px;
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-card);
}

.import-section > h3 {
  color: var(--ink);
  margin-bottom: 15px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.import-section > h3::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 999px;
  background: var(--grad-brand);
  flex: none;
}

.file-upload-area {
  background: var(--surface);
  padding: 40px;
  border-radius: var(--r-md);
  border: 2px dashed var(--fg-blue);
  text-align: center;
  cursor: pointer;
  transition: all var(--ease);
  margin: 20px 0;
}

.file-upload-area:hover {
  border-color: var(--fg-blue-deep);
  background: var(--fg-blue-tint);
}

.file-upload-area.dragover {
  background: var(--fg-blue-tint);
  border-color: var(--fg-blue-deep);
}

.upload-icon {
  font-size: 48px;
  color: var(--fg-blue);
  margin-bottom: 15px;
}

.import-instructions {
  background: var(--warn-bg);
  padding: 20px;
  border-radius: var(--r-md);
  border-left: 4px solid var(--warn);
  margin-top: 20px;
}

.import-instructions ul { margin-left: 20px; margin-top: 10px; }
.import-instructions li { margin: 8px 0; color: #B45309; }

.import-preview {
  background: var(--surface);
  padding: 20px;
  border-radius: var(--r-card);
  border: 1px solid var(--hairline);
  margin-top: 20px;
  max-height: 400px;
  overflow-y: auto;
}

.import-preview table { width: 100%; border-collapse: collapse; font-size: 13px; }

.import-preview th {
  background: var(--inset);
  padding: 11px 10px;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
  font-weight: 700;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.import-preview td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink);
}

.import-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin: 20px 0;
}

.import-stat-item {
  background: var(--surface);
  padding: 20px;
  border-radius: var(--r-md);
  text-align: center;
  border: 1px solid var(--hairline);
  border-left: 4px solid var(--ok);
  box-shadow: var(--shadow-card);
}

.import-stat-number {
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 5px;
}

.import-stat-label { font-size: 13px; color: var(--muted); }

/* ===== 8. STATUS BADGES ===== */
.status-badge {
  padding: 5px 13px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  display: inline-block;
  white-space: nowrap;
}

.status-draft { background: var(--inset); color: var(--muted); }
.status-not-started { background: var(--inset); color: var(--muted); }
.status-in-progress { background: var(--fg-blue-tint); color: var(--fg-blue-deep); }
.status-in-progress---pre-cr { background: var(--fg-blue-tint); color: var(--fg-blue-deep); }
.status-in-progress---post-cr { background: #D4E6F6; color: #103E69; }
.status-on-hold { background: var(--warn-bg); color: var(--warn); }
.status-approved { background: var(--ok-bg); color: #157A38; }
.status-completed { background: var(--ok-bg); color: #157A38; }
.status-closed { background: var(--inset); color: var(--muted); }

/* Step status pills */
.step-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 700;
}

.status-pending { background: var(--warn-bg); color: var(--warn); }
.status-done { background: var(--ok-bg); color: #157A38; }
.status-blocked { background: var(--inset); color: var(--muted); }
.status-warning { background: var(--warn-bg); color: #B45309; }

/* ===== 9. FORMS & FILTERS ===== */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.filter-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 13px;
}

.filter-group input,
.filter-group select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  transition: all var(--ease);
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: var(--fg-blue);
  box-shadow: var(--ring);
}

.filter-group textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  resize: vertical;
  transition: all var(--ease);
}

.filter-group textarea:focus {
  outline: none;
  border-color: var(--fg-blue);
  box-shadow: var(--ring);
}

/* Form sections (glassmorphism) */
.form-section {
  background: var(--glass-form-bg);
  -webkit-backdrop-filter: var(--glass-form-blur);
  backdrop-filter: var(--glass-form-blur);
  border: 1px solid var(--glass-form-border);
  padding: 24px;
  border-radius: var(--r-card);
  margin-bottom: 22px;
  box-shadow: var(--glass-shadow), var(--glass-form-hi);
}

.form-section h3 {
  color: var(--ink);
  margin-bottom: 20px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-section h3::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 999px;
  background: var(--grad-brand);
  flex: none;
}

/* Tables */
.companies-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0;
}

.companies-table thead { background: var(--inset); color: var(--muted); }

.companies-table th {
  padding: 13px 15px;
  text-align: left;
  font-weight: 700;
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--hairline);
}

.companies-table td {
  padding: 14px 15px;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink);
}

.companies-table tbody tr { cursor: pointer; transition: background var(--ease); }
.companies-table tbody tr:hover { background: var(--fg-blue-tint); }

.detailed-report-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  font-size: 14px;
}

.detailed-report-table thead { background: var(--inset); color: var(--muted); }

.detailed-report-table th {
  padding: 13px 12px;
  text-align: left;
  font-weight: 700;
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

.detailed-report-table th:last-child { border-right: none; }

.detailed-report-table tbody tr {
  border-bottom: 1px solid var(--hairline);
  transition: background-color var(--ease);
}

.detailed-report-table tbody tr:hover {
  background-color: var(--fg-blue-tint);
  cursor: pointer;
}

.detailed-report-table td { padding: 14px 12px; vertical-align: top; }
.detailed-report-table td.company-name { font-weight: 700; color: var(--ink); }
.detailed-report-table td.arabic-name { direction: rtl; text-align: right; color: var(--muted); }

.days-elapsed {
  display: inline-block;
  padding: 8px 14px;
  background: var(--grad-brand);
  color: white;
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: 16px;
  text-align: center;
}

.detailed-report-notes {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-wrap: break-word;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.detailed-report-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 18px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
}

.detailed-report-filters .filter-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 13px;
}

.detailed-report-filters .filter-group select,
.detailed-report-filters .filter-group input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  font-size: 14px;
  font-family: inherit;
  transition: all var(--ease);
  background: var(--surface);
  color: var(--ink);
}

.detailed-report-filters .filter-group select:focus,
.detailed-report-filters .filter-group input:focus {
  outline: none;
  border-color: var(--fg-blue);
  box-shadow: var(--ring);
}

/* ===== 10. WORKFLOW STEPS ===== */
.steps-timeline { position: relative; padding-left: 0; }

.step-item {
  position: relative;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  margin-bottom: 18px;
  transition: all var(--ease);
}

.step-item:hover { box-shadow: var(--shadow-pop); transform: translateX(4px); }

.step-item.completed {
  border-color: #BCE6CB;
  background: linear-gradient(135deg, #F4FBF6 0%, var(--ok-bg) 100%);
}

.step-item.active {
  border-color: #BBD9F1;
  background: linear-gradient(135deg, #F4F9FE 0%, var(--fg-blue-tint) 100%);
  box-shadow: 0 4px 15px rgba(28,111,179,.14);
}

.step-item.blocked { opacity: 0.6; background: var(--inset); }

.step-item.warning {
  border-color: #F3D9AE;
  background: linear-gradient(135deg, #FFFBF4 0%, var(--warn-bg) 100%);
}

.step-header { display: flex; align-items: flex-start; gap: 15px; margin-bottom: 15px; }

.step-number {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(28,111,179,.28);
}

.step-item.completed .step-number {
  background: linear-gradient(135deg, #22B364 0%, #15803D 100%);
  box-shadow: 0 4px 12px rgba(22,163,74,.28);
}

.step-item.blocked .step-number { background: var(--muted); box-shadow: none; }

.step-item.warning .step-number {
  background: linear-gradient(135deg, #F59E0B 0%, #C2700A 100%);
  box-shadow: 0 4px 12px rgba(217,119,6,.28);
}

.step-content { flex: 1; }

.step-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-icon { font-size: 20px; }

.step-description {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 15px;
}

.step-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.step-checkbox:disabled,
.step-edit-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.step-checkbox {
  width: 28px;
  height: 28px;
  cursor: pointer;
  accent-color: var(--ok);
}

.step-checkbox:disabled { cursor: not-allowed; opacity: 0.4; }

.step-meta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
  color: var(--muted);
}

.step-meta-item { display: flex; align-items: center; gap: 6px; }
.step-meta-icon { font-size: 16px; }

.step-notes-display {
  background: var(--inset);
  padding: 12px;
  border-radius: 6px;
  margin-top: 10px;
  font-size: 13px;
  white-space: pre-wrap;
  max-height: 150px;
  overflow-y: auto;
}

.step-checklist {
  background: var(--inset);
  padding: 20px;
  border-radius: var(--r-md);
  margin-top: 15px;
}

.checklist-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--fg-blue);
}

.checklist-note {
  margin-top: 12px;
  padding: 10px;
  background: #fff3cd;
  border-left: 3px solid #ffc107;
  border-radius: 4px;
  font-size: 13px;
  color: #856404;
}

/* ===== 11. DOCUMENTS ===== */
.documents-section {
  margin-top: 30px;
  padding: 24px;
  background: var(--inset);
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
}

.documents-section h3 {
  margin-bottom: 20px;
  color: var(--ink);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.documents-upload-area {
  background: var(--surface);
  border: 2px dashed var(--fg-blue);
  border-radius: var(--r-md);
  padding: 30px;
  text-align: center;
  margin-bottom: 20px;
  transition: all var(--ease);
  cursor: pointer;
}

.documents-upload-area:hover {
  border-color: var(--fg-blue-deep);
  background: var(--fg-blue-tint);
}

.documents-upload-area.dragover {
  border-color: var(--ok);
  background: var(--ok-bg);
}

.documents-upload-area input[type="file"] { display: none; }

.upload-text { color: var(--muted); margin-bottom: 10px; }
.upload-text strong { color: var(--fg-blue); cursor: pointer; }

.upload-form {
  display: none;
  background: var(--surface);
  padding: 20px;
  border-radius: var(--r-md);
  margin-bottom: 20px;
  border: 1px solid var(--hairline);
}

.upload-form.active { display: block; }

.upload-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}

.upload-form label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.upload-form input,
.upload-form select,
.upload-form textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
}

.upload-form textarea { resize: vertical; min-height: 60px; }

.upload-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 15px;
}

.documents-list {
  background: var(--surface);
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--hairline);
}

.documents-list-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 120px;
  padding: 13px 20px;
  background: var(--inset);
  color: var(--muted);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .4px;
  border-bottom: 1px solid var(--hairline);
}

.document-item {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 120px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--hairline);
  align-items: center;
  transition: background var(--ease);
}

.document-item:hover { background: var(--fg-blue-tint); }
.document-item:last-child { border-bottom: none; }

.document-name { display: flex; align-items: center; gap: 10px; }
.document-icon { font-size: 24px; }

.document-name-text { font-weight: 500; color: var(--ink); }
.document-name-text small { display: block; color: #999; font-weight: normal; font-size: 11px; }

.document-actions { display: flex; gap: 8px; }

.document-actions button {
  padding: 6px 12px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.btn-view { background: var(--fg-blue); color: white; }
.btn-view:hover { background: var(--fg-blue-deep); }
.btn-download { background: var(--ok); color: white; }
.btn-download:hover { filter: brightness(.95); }
.btn-delete-doc { background: var(--bad); color: white; }
.btn-delete-doc:hover { filter: brightness(.95); }

.no-documents { padding: 40px; text-align: center; color: #999; }
.no-documents-icon { font-size: 48px; margin-bottom: 10px; }

.upload-progress { display: none; margin: 20px 0; }
.upload-progress.active { display: block; }

.doc-progress-bar { height: 20px; background: #e0e0e0; border-radius: 10px; overflow: hidden; }

.doc-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--fg-blue), var(--ok));
  width: 0%;
  transition: width 0.3s;
}

.doc-progress-text { text-align: center; margin-top: 10px; color: #666; font-size: 14px; }

/* ===== 12. REPORTS ===== */
.report-summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.report-summary-stat {
  padding: 20px;
  background: var(--surface);
  border-radius: var(--r-md);
  border-left: 4px solid var(--fg-blue);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--hairline);
  transition: transform var(--ease);
}

.report-summary-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); }

.report-summary-stat-number {
  font-size: 34px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 5px;
}

.report-summary-stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  font-weight: 700;
}

.report-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 25px;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 10px;
}

.report-tab {
  padding: 9px 18px;
  background: var(--surface);
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border-radius: var(--r-pill);
  transition: all var(--ease);
}

.report-tab.active { background: var(--ink); color: white; }
.report-tab:hover:not(.active) { background: var(--fg-blue-tint); color: var(--fg-blue-deep); }
.report-tab-content { display: none; }
.report-tab-content.active { display: block; }

/* Stat tiles (Overview report) */
.stat-tile {
  padding: 24px;
  border-radius: var(--r-md);
  color: #fff;
  box-shadow: var(--shadow-card);
}

.stat-tile .stat-number { font-size: 32px; font-weight: 800; display: block; margin-bottom: 4px; line-height: 1; }
.stat-tile .stat-label { font-size: 13px; opacity: .92; font-weight: 600; }
.stat-tile--total    { background: var(--grad-brand); }
.stat-tile--ok       { background: linear-gradient(135deg,#22B364 0%,#15803D 100%); }
.stat-tile--progress { background: linear-gradient(135deg,#3AA0E0 0%,#1C6FB3 100%); }
.stat-tile--hold     { background: linear-gradient(135deg,#F59E0B 0%,#C2700A 100%); }

/* Dashboard recent-activity tabs */
.hm-recent-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 14px;
}

.hm-recent-tabs button {
  background: none;
  border: none;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 700;
  transition: all var(--ease);
  font-family: inherit;
}

.hm-recent-tabs button.active { color: var(--fg-blue-deep); border-bottom-color: var(--fg-blue); }

/* ===== 13. RESPONSIVE ===== */
@media (max-width: 768px) {
  .header { padding: 15px 20px; }
  .logo-container img { height: 35px; }
  .header-title h1 { font-size: 18px; }
  .container { padding: 0 20px; }
  .content-card { padding: 20px; }
  .filters { grid-template-columns: 1fr; }
  .companies-table { font-size: 12px; }
  .companies-table th,
  .companies-table td { padding: 10px 8px; }
  .step-item { padding: 20px 15px; }
  .step-number { width: 40px; height: 40px; font-size: 16px; }
  .step-title { font-size: 16px; }
  .modal-content { padding: 20px; }
  .modal-grid { grid-template-columns: 1fr; }
  .detailed-report-table { font-size: 12px; }
  .detailed-report-table th,
  .detailed-report-table td { padding: 10px 8px; }
  .detailed-report-filters { grid-template-columns: 1fr; }
  .report-tabs { flex-direction: column; }
  .report-tab { width: 100%; }
  .documents-list-header,
  .document-item { grid-template-columns: 1fr; gap: 10px; }
  .documents-list-header { display: none; }
  .document-item { padding: 15px; }
  .document-actions { justify-content: flex-start; }
  .upload-form .form-row { grid-template-columns: 1fr; }
}

/* ===== 14. COHESION LAYER ===== */
::selection { background: rgba(43,160,224,.25); }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-sm);
}

.nav-buttons button:focus-visible,
.btn-primary:focus-visible, .btn-secondary:focus-visible, .btn-danger:focus-visible,
.export-btn:focus-visible, .back-button:focus-visible, .report-tab:focus-visible,
.step-edit-btn:focus-visible, .login-button:focus-visible {
  box-shadow: var(--ring);
}

/* Slim branded scrollbar */
* { scrollbar-width: thin; scrollbar-color: #C5CEDA transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #C5CEDA; border-radius: 999px; border: 2px solid var(--canvas); }
*::-webkit-scrollbar-thumb:hover { background: #A9B6C6; }

/* Default data-table UI — canonical version (self-carding) */
.companies-table, .detailed-report-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-top: 14px;
}

.companies-table thead, .detailed-report-table thead { background: var(--inset); }

.companies-table th, .detailed-report-table th {
  padding: 13px 14px; text-align: left;
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 1px solid var(--hairline); border-right: none;
}

.companies-table td, .detailed-report-table td {
  padding: 14px; border-bottom: 1px solid var(--hairline); border-right: none;
  color: var(--ink); vertical-align: middle;
}

.companies-table tbody tr:last-child td,
.detailed-report-table tbody tr:last-child td { border-bottom: none; }

.companies-table tbody tr, .detailed-report-table tbody tr { cursor: pointer; transition: background var(--ease); }
.companies-table tbody tr:hover, .detailed-report-table tbody tr:hover { background: var(--fg-blue-tint); }

/* Default data-tile UI — clean white card (single source of truth) */
.detail-item, .report-summary-stat, .import-stat-item {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
}

@media print {
  .detail-item, .report-summary-stat, .import-stat-item { box-shadow: none; border: 1px solid var(--hairline); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Frosted-glass fallback for browsers without backdrop-filter */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .form-section, .modal-content { background: var(--surface); }
}
