/* ═══════════════════════════════════════════════════════════════════════════
   SY Holdings Client Portal — Design System
   Dark theme, professional, mobile-first
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg: #0a1628;
  --bg-card: #111d32;
  --bg-hover: #162544;
  --border: #1e3355;
  --text: #e2e8f0;
  --text-muted: #8899aa;
  --primary: #e8712a;
  --primary-hover: #d06520;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --accent: #e8913a;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,.3);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:var(--font); background:var(--bg); color:var(--text); min-height:100vh; }
.hidden { display:none !important; }

/* ── Auth Screen ──────────────────────────────────────────────────────────── */
.auth-screen {
  display:flex; align-items:center; justify-content:center;
  min-height:100vh; padding:24px;
  background: linear-gradient(135deg, #0a1628 0%, #152238 50%, #1a2d4d 100%);
}
.auth-card {
  text-align:center; padding:48px 40px; max-width:400px; width:100%;
  background:var(--bg-card); border-radius:16px; border:1px solid var(--border);
  box-shadow: var(--shadow);
}
.auth-logo-icon {
  width:72px; height:72px; border-radius:50%; margin:0 auto 20px;
  background: linear-gradient(135deg, #e8712a, #f0a050);
  display:flex; align-items:center; justify-content:center;
  font-size:28px; font-weight:800; color:#fff; letter-spacing:2px;
}
.auth-card h1 { font-size:1.5rem; font-weight:700; margin-bottom:6px; }
.auth-card p { color:var(--text-muted); font-size:.9rem; margin-bottom:28px; }
.auth-footer { margin-top:20px; font-size:.75rem; color:var(--text-muted); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  padding:10px 20px; border-radius:8px; border:none; cursor:pointer;
  font-family:var(--font); font-size:.9rem; font-weight:600;
  transition: all .15s ease;
}
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover { background:var(--primary-hover); }
.btn-lg { padding:14px 32px; font-size:1rem; }
.btn-sm { padding:6px 14px; font-size:.8rem; }
.btn-ghost { background:transparent; color:var(--text-muted); border:1px solid var(--border); }
.btn-ghost:hover { color:var(--text); border-color:var(--text-muted); }
.btn-success { background:var(--success); color:#fff; }
.btn-danger { background:var(--danger); color:#fff; }

/* ── Header ───────────────────────────────────────────────────────────────── */
.portal-header {
  display:flex; align-items:center; gap:20px;
  padding:0 24px; height:60px;
  background:var(--bg-card); border-bottom:1px solid var(--border);
  position:sticky; top:0; z-index:100;
}
.header-left { display:flex; align-items:center; gap:10px; }
.header-logo {
  width:36px; height:36px; border-radius:8px;
  background: linear-gradient(135deg, #e8712a, #f0a050);
  display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:14px; color:#fff;
}
.header-title { font-weight:700; font-size:1.05rem; white-space:nowrap; }
.header-nav { display:flex; gap:4px; margin-left:24px; flex:1; }
.nav-link {
  padding:8px 16px; border-radius:8px; text-decoration:none;
  color:var(--text-muted); font-size:.85rem; font-weight:500;
  transition: all .15s ease;
}
.nav-link:hover, .nav-link.active { color:var(--text); background:var(--bg-hover); }
.header-right { display:flex; align-items:center; gap:12px; margin-left:auto; }
.user-name { font-size:.85rem; color:var(--text-muted); }
.hamburger {
  display:none; background:none; border:none; color:var(--text);
  font-size:1.4rem; cursor:pointer; margin-left:auto;
}

/* ── Mobile nav ───────────────────────────────────────────────────────────── */
.mobile-nav {
  position:fixed; top:60px; left:0; right:0; bottom:0;
  background:var(--bg-card); z-index:99; padding:16px;
  display:flex; flex-direction:column; gap:4px;
}
.mobile-nav .nav-link { display:block; padding:14px 16px; font-size:1rem; }

/* ── Content ──────────────────────────────────────────────────────────────── */
.portal-content {
  max-width:1100px; margin:0 auto; padding:24px;
  min-height:calc(100vh - 120px);
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background:var(--bg-card); border-radius:var(--radius);
  border:1px solid var(--border); overflow:hidden;
  margin-bottom:16px;
}
.card-header {
  padding:16px 20px; border-bottom:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between;
}
.card-header h3 { font-size:1rem; font-weight:600; }
.card-body { padding:20px; }

/* ── Summary cards grid ───────────────────────────────────────────────────── */
.summary-grid {
  display:grid; grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); gap:16px;
  margin-bottom:24px;
}
.summary-card {
  background:var(--bg-card); border:1px solid var(--border);
  border-radius:var(--radius); padding:20px; text-align:center;
}
.summary-value { font-size:1.8rem; font-weight:700; margin-bottom:4px; }
.summary-label { font-size:.8rem; color:var(--text-muted); text-transform:uppercase; letter-spacing:.5px; }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.data-table { width:100%; border-collapse:collapse; font-size:.85rem; }
.data-table th {
  text-align:left; padding:10px 14px; font-weight:600;
  color:var(--text-muted); font-size:.75rem; text-transform:uppercase;
  letter-spacing:.5px; border-bottom:1px solid var(--border);
}
.data-table td { padding:12px 14px; border-bottom:1px solid var(--border); }
.data-table tr:hover td { background:var(--bg-hover); }
.data-table tr:last-child td { border-bottom:none; }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  display:inline-block; padding:3px 10px; border-radius:20px;
  font-size:.75rem; font-weight:600;
}
.badge-active { background:rgba(16,185,129,.15); color:var(--success); }
.badge-pending { background:rgba(245,158,11,.15); color:var(--warning); }
.badge-completed { background:rgba(59,130,246,.15); color:var(--primary); }
.badge-overdue { background:rgba(239,68,68,.15); color:var(--danger); }
.badge-disbursed { background:rgba(232,113,42,.15); color:var(--accent); }

/* ── Timeline ──────────────────────────────────────────────────────────────── */
.timeline-item {
  display:flex; gap:12px; padding:12px 0;
  border-bottom:1px solid var(--border);
}
.timeline-item:last-child { border-bottom:none; }
.timeline-icon { font-size:1.2rem; flex-shrink:0; }
.timeline-content { flex:1; }
.timeline-title { font-size:.9rem; font-weight:500; }
.timeline-date { font-size:.75rem; color:var(--text-muted); margin-top:2px; }

/* ── Progress bar ──────────────────────────────────────────────────────────── */
.progress-bar { height:8px; background:var(--border); border-radius:4px; overflow:hidden; }
.progress-fill { height:100%; border-radius:4px; transition:width .3s ease; }

/* ── Deal detail ───────────────────────────────────────────────────────────── */
.deal-header { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; margin-bottom:24px; }
.deal-title { font-size:1.3rem; font-weight:700; }
.deal-meta { display:flex; gap:8px; margin-top:8px; flex-wrap:wrap; }
.detail-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(180px, 1fr)); gap:16px; }
.detail-item label { display:block; font-size:.75rem; color:var(--text-muted); text-transform:uppercase; margin-bottom:4px; }
.detail-item .value { font-size:1rem; font-weight:600; }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state { text-align:center; padding:48px 24px; }
.empty-state .icon { font-size:3rem; margin-bottom:12px; }
.empty-state h3 { margin-bottom:8px; }
.empty-state p { color:var(--text-muted); }

/* ── Loading ───────────────────────────────────────────────────────────────── */
.loading { display:flex; justify-content:center; padding:48px; }
.spinner {
  width:32px; height:32px; border:3px solid var(--border);
  border-top-color:var(--primary); border-radius:50%;
  animation:spin .6s linear infinite;
}
@keyframes spin { to { transform:rotate(360deg); } }

/* ── Footer ────────────────────────────────────────────────────────────────── */
.portal-footer {
  text-align:center; padding:20px; font-size:.75rem;
  color:var(--text-muted); border-top:1px solid var(--border);
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width:768px) {
  .header-nav, .header-right .user-name { display:none; }
  .hamburger { display:block; }
  .portal-content { padding:16px; }
  .summary-grid { grid-template-columns:repeat(2, 1fr); }
  .summary-value { font-size:1.3rem; }
  .data-table { font-size:.8rem; }
  .data-table th, .data-table td { padding:8px 10px; }
  .deal-header { flex-direction:column; }
}

@media (max-width:480px) {
  .summary-grid { grid-template-columns:1fr 1fr; gap:10px; }
  .summary-card { padding:14px; }
}

/* ── Compliance workspace, mobile rules (checks upgrade, 2 Oct 2026) ─────────
   One column, 16px side gutter, cards below 640px, 44px tap targets, a sticky
   bottom action bar that clears the tab bar. Component styles: checks.css. */
@media (max-width:767.98px) {
  .cw-wrap { padding:16px 16px 24px !important; max-width:100%; }
  #module-view { padding:0 0 24px !important; }
  .mod-head { gap:10px; }
  .mod-head h2 { font-size:20px; }
  .panel { padding:16px; border-radius:14px; }
  .btn { min-height:44px; }
  .inp { min-height:44px; font-size:16px; }          /* 16px stops iOS zooming into fields */
  textarea.inp { min-height:88px; }
  .cp-form-grid { grid-template-columns:1fr; }
  .att-row .btn { min-height:44px; }
  .app-header { padding:10px 16px; }
}
@media (max-width:640px) {
  .proj-grid, .cw-grid { grid-template-columns:1fr !important; }
  .res-stats { gap:12px; }
  /* tables that opt in become one card per row */
  table.cardify, table.cardify tbody, table.cardify tr, table.cardify td { display:block; width:100%; }
  table.cardify thead { display:none; }
  table.cardify tr { border:1px solid var(--border); border-radius:12px; padding:8px 12px; margin-bottom:10px; background:var(--bg-card); }
  table.cardify td { border:0; padding:4px 0; }
  table.cardify td[data-label]::before { content:attr(data-label); display:block; font-size:11px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.4px; }
}
.sticky-actions { position:sticky; bottom:0; z-index:30; padding:12px 0; background:linear-gradient(to top, var(--bg) 70%, transparent); }
@media (max-width:767.98px) { .sticky-actions { bottom:calc(60px + env(safe-area-inset-bottom)); } }
