/* ───────────────────────────────────────────────
   TruDocs · Karnataka EC — Responsive MWeb CSS
   Mobile-first · Works on desktop + phone browser
   ─────────────────────────────────────────────── */

:root {
  --bg:           #FFFFFF;
  --surface:      #FFFFFF;
  --surface-2:    #F5F5F5;
  --surface-3:    #EEEEEE;

  --sidebar-bg:          #163A2E;
  --sidebar-bg-2:        #1F4D3D;
  --sidebar-text:        #F4F0E7;
  --sidebar-text-strong: #FFFFFF;
  --sidebar-text-muted:  #8FAA9A;
  --sidebar-hover:       rgba(255,255,255,0.08);
  --sidebar-active:      rgba(255,255,255,0.14);

  --primary:       #163A2E;
  --primary-hover: #1F4D3D;
  --primary-soft:  #2D5847;
  --primary-tint:  #E7EEEA;

  --accent:      #C8A85B;
  --accent-soft: #F0EBE0;

  --ready-bg:    #1F8F5C;
  --ready-hover: #167A4C;
  --ready-glow:  rgba(31,143,92,0.45);

  --live-green:  #118817;

  --text:       #0B1714;
  --text-muted: #475651;
  --text-faint: #727E78;

  --border:        #E2E2E2;
  --border-strong: #C8C8C8;

  --info-bg:      #E7EEEA;
  --info-text:    #163A2E;
  --success-bg:   #E1ECDF;
  --success-text: #1F4D3D;
  --danger-bg:    #FBE6E1;
  --danger-text:  #963625;

  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-body:    'DM Sans', system-ui, -apple-system, sans-serif;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(15,30,26,0.04), 0 1px 3px rgba(15,30,26,0.06);
  --shadow:    0 4px 12px rgba(15,30,26,0.06), 0 2px 4px rgba(15,30,26,0.04);
  --shadow-lg: 0 12px 32px rgba(15,30,26,0.08), 0 4px 12px rgba(15,30,26,0.05);

  --bottom-bar-h: 72px;
}

/* Hidden-state fix */
.loader-card[hidden],
.custom-modal[hidden],
.result-actions[hidden],
.pdf-preview[hidden],
.mobile-download-bar[hidden] { display: none !important; }

* { box-sizing: border-box; }

/* Prevent blue text-selection highlight on labels and headings */
.page-title, .page-subtitle, .page-current,
.field label, .radio-option, .preset-hint,
.nav-section-title, .nav-item, .info-panel * {
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input  { font-family: inherit; font-size: inherit; color: inherit; }
input:focus, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

mark { background: var(--accent-soft); color: var(--text); padding: 0 1px; border-radius: 2px; }

/* ═══════════════════════════════════════════════
   MOBILE TOP BAR
   ═══════════════════════════════════════════════ */
.mobile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--sidebar-bg);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}

.mobile-topbar .logo { display: flex; align-items: center; color: #fff; margin-bottom: 0; }
.mobile-topbar .logo-text { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: -0.03em; color: #fff; }

.mobile-topbar-right { display: flex; align-items: center; gap: 10px; }

.mobile-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}

.mobile-status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulseGreen 1.6s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════
   APP SHELL — 3-column on desktop, stacked mobile
   ═══════════════════════════════════════════════ */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Both sidebars hidden on mobile */
.sidebar, .info-panel { display: none; }

/* ═══════════════════════════════════════════════
   MAIN — mobile
   ═══════════════════════════════════════════════ */
.main {
  padding: 20px 16px calc(var(--bottom-bar-h) + 24px);
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.page-current { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.status-pill  { display: none; }

.page-intro { margin-bottom: 20px; }

.page-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 6px 0;
  line-height: 1.2;
}

.title-accent {
  font-style: normal;
  font-weight: 600;
  color: var(--primary);
  position: relative;
  display: inline-block;
}

.title-accent::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 2px;
  height: 5px;
  background: var(--accent);
  opacity: 0.55;
  z-index: -1;
  border-radius: 2px;
}

.page-subtitle { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.4; }

/* ── Search card ─────────────────── */
.search-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 16px 24px;
  position: relative;
}

.search-form { display: flex; flex-direction: column; gap: 20px; }

.field { display: flex; flex-direction: column; gap: 8px; position: relative; }

.field label {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text);
}

.req { color: var(--danger-text); font-weight: 700; margin-left: 2px; }

.field input[type="text"] {
  width: 100%;
  padding: 13px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  min-height: 48px;
}

.field input[type="text"]:hover  { border-color: var(--border-strong); }
.field input[type="text"]:focus  { outline: none; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px var(--primary-tint); }
.field input::placeholder { color: var(--text-faint); }

/* ── Typeahead ─────────────────── */
.typeahead { position: relative; }

.typeahead-clear {
  position: absolute; top: 50%; right: 12px;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); border-radius: 50%;
  transition: background 0.15s, color 0.15s;
  z-index: 10;
}
.typeahead-clear:hover { background: var(--surface-3); color: var(--text); }

.typeahead-results {
  position: absolute;
  top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 300px;
  overflow-y: auto;
  z-index: 50;
  -webkit-overflow-scrolling: touch;
}

.typeahead-item {
  padding: 12px 14px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  min-height: 52px;
  justify-content: center;
}
.typeahead-item:last-child { border-bottom: none; }
.typeahead-item.highlighted { background: var(--primary-tint); }
.typeahead-item-name { font-weight: 600; font-size: 14px; }
.typeahead-item-meta { font-size: 12px; color: var(--text-muted); }
.typeahead-empty { padding: 16px; text-align: center; font-size: 13px; color: var(--text-muted); }
.typeahead-hint  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Radio — plain style (mobile + desktop) ── */
.radio-group { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }

.radio-option {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
  font-size: 15px; font-weight: 400; color: var(--text);
  padding: 4px 0;
  background: transparent;
  border: none;
  border-radius: 0;
  user-select: none;
  transition: color 0.15s;
  min-height: unset;
}
.radio-option input[type="radio"] { display: none; }

.radio-circle {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s;
}
.radio-circle::after {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); opacity: 0;
  transition: opacity 0.15s;
}
.radio-option input[type="radio"]:checked + .radio-circle { border-color: var(--primary); }
.radio-option input[type="radio"]:checked + .radio-circle::after { opacity: 1; }
.radio-option:has(input[type="radio"]:checked) {
  background: transparent;
  border: none;
  color: var(--text);
  font-weight: 500;
}
.radio-option:hover { color: var(--primary); }

/* ── More Options select ─────────── */
.more-options-select {
  padding: 6px 32px 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body); font-size: 15px; font-weight: 400;
  color: var(--text-muted);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23727E78' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  height: 36px;
  min-width: 130px;
  max-width: 160px;
  transition: border-color 0.15s;
}
.more-options-select:hover { border-color: var(--border-strong); color: var(--text); }
.more-options-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.more-options-select option { background: var(--surface); color: var(--text); }

.preset-hint { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Form actions ─────────────────── */
.form-actions { display: flex; gap: 10px; margin-top: 4px; }

.reset-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 0 16px; height: 48px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.reset-btn:hover { background: var(--surface-3); border-color: var(--border-strong); color: var(--text); }

.submit-btn {
  flex: 1; height: 48px; padding: 0 18px;
  background: var(--primary); color: #FFFFFF;
  border-radius: var(--radius);
  font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s, transform 0.05s;
}
.submit-btn:hover:not(:disabled)  { background: var(--primary-hover); }
.submit-btn:active:not(:disabled) { transform: translateY(1px); }
.submit-btn:disabled               { opacity: 0.7; cursor: not-allowed; }
.submit-btn.loading i              { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Status messages ──────────────── */
.status-area { margin-top: 20px; }

.status-msg {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px; border-radius: var(--radius);
  font-size: 14px; line-height: 1.45;
}
.status-msg.info    { background: var(--info-bg);    color: var(--info-text);    border: 1px solid var(--primary-tint); }
.status-msg.success { background: var(--success-bg); color: var(--success-text); border: 1px solid #C5D9C2; }
.status-msg.error   { background: var(--danger-bg);  color: var(--danger-text);  border: 1px solid #F2C6BC; }
.status-msg i { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

/* ── Result actions ───────────────── */
.result-actions {
  margin-top: 18px; padding: 22px;
  background: #e8f5ee; border: 2px solid #a8d5b8;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  gap: 16px; flex-wrap: wrap;
  animation: resultPop 0.45s cubic-bezier(0.34,1.56,0.64,1);
}
.result-meta { display: none; }
@keyframes resultPop { 0% { transform:scale(0.96); opacity:0; } 60% { transform:scale(1.02); opacity:1; } 100% { transform:scale(1); opacity:1; } }
.result-actions.result-downloaded { background: #f0f7f2; border-color: #c5d9c2; }

.download-btn {
  position: relative; padding: 14px 28px;
  background: var(--ready-bg); color: #FFFFFF;
  border-radius: var(--radius);
  font-size: 15px; font-weight: 700; letter-spacing: 0.01em;
  display: inline-flex; align-items: center; gap: 10px;
  transition: background 0.15s, transform 0.08s, box-shadow 0.15s;
  box-shadow: 0 4px 14px var(--ready-glow);
}
.download-btn i { font-size: 19px; }
.download-btn:hover { background: var(--ready-hover); color: #FFFFFF; transform: translateY(-1px); box-shadow: 0 6px 18px var(--ready-glow); }
.download-btn:active { transform: translateY(0); }
.result-actions.result-ready .download-btn { animation: readyPulse 1.6s ease-in-out infinite; }
@keyframes readyPulse { 0%,100% { box-shadow: 0 4px 14px var(--ready-glow), 0 0 0 0 var(--ready-glow); } 50% { box-shadow: 0 4px 14px var(--ready-glow), 0 0 0 12px rgba(31,143,92,0); } }
.result-actions.result-downloaded .download-btn { animation: none; background: var(--primary); box-shadow: var(--shadow-sm); }

/* ── Mobile sticky download bar ───── */
.mobile-download-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px;
  animation: slideUp 0.3s cubic-bezier(0.34,1.2,0.64,1);
}
@keyframes slideUp { from { transform: translateY(100%); opacity:0; } to { transform: translateY(0); opacity:1; } }
.mobile-download-bar .download-btn { flex: 1; justify-content: center; padding: 14px 20px; font-size: 15px; }

.mobile-open-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; flex-shrink: 0;
  transition: background 0.15s;
}
.mobile-open-btn:hover { background: var(--surface-3); }

@media (max-width: 767px) {
  /* PDF preview hidden on mobile — use the sticky download bar instead */
  .pdf-preview { display: none !important; }

  /* result-actions: show as a compact confirmation strip on mobile.
     EC's internal download button is hidden — the sticky mobile-download-bar handles it.
     Title Search (#ts-result-actions) keeps its button since it has no sticky bar. */
  .result-actions {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 14px;
    margin-top: 12px;
    border-radius: var(--radius-sm);
    animation: resultPop 0.45s cubic-bezier(0.34,1.56,0.64,1);
  }
  #result-actions .download-btn { display: none !important; }
  .result-meta {
    display: block !important;
    font-size: 12px;
    color: var(--success-text, #1F4D3D);
    font-weight: 600;
    text-align: center;
    line-height: 1.4;
  }
}

/* ── PDF preview ──────────────────── */
.pdf-preview { margin-top: 16px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.pdf-preview iframe { display: block; width: 100%; height: 600px; border: none; }

/* ── Loader modal ─────────────────── */
.loader-card {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(11,23,20,0.55);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.loader-card-inner {
  background: var(--surface); border: 1px solid var(--primary-tint);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 36px 24px 28px; max-width: 420px; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  animation: popIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes popIn { from { transform:scale(0.92); opacity:0; } to { transform:scale(1); opacity:1; } }

.loader-doc { width:72px; height:88px; color:var(--primary); animation: docFloat 2.4s ease-in-out infinite; }
@keyframes docFloat { 0%,100% { transform:translateY(0); opacity:0.95; } 50% { transform:translateY(-3px); opacity:1; } }
.ln { stroke-dasharray:80; stroke-dashoffset:80; opacity:0.9; animation: drawLine 4s ease-in-out infinite; }
.ln-1 { animation-delay:0s; } .ln-2 { animation-delay:0.4s; } .ln-3 { animation-delay:0.8s; } .ln-4 { animation-delay:1.2s; } .ln-5 { animation-delay:1.6s; }
@keyframes drawLine { 0%,5% { stroke-dashoffset:80; } 35% { stroke-dashoffset:0; } 82% { stroke-dashoffset:0; } 100% { stroke-dashoffset:80; } }

.loader-wait { font-size:14px; font-weight:600; color:var(--text); margin:8px 0 0 0; text-align:center; max-width:340px; line-height:1.45; }
.loader-tip  { font-size:13px; color:var(--text-muted); font-style:italic; margin:0; text-align:center; min-height:42px; max-width:320px; transition:opacity 0.25s ease; line-height:1.5; }

/* ── Custom date modal ────────────── */
.custom-modal {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(11,23,20,0.55);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0; animation: fadeIn 0.18s ease-out;
}
.custom-modal-inner {
  position: relative; background: var(--surface);
  border: 1px solid var(--primary-tint);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  padding: 28px 20px calc(20px + env(safe-area-inset-bottom));
  width: 100%; max-width: 100%;
  display: flex; flex-direction: column; gap: 16px;
  animation: slideUp 0.28s cubic-bezier(0.34,1.2,0.64,1);
}
.custom-modal-inner::before {
  content: ''; position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong);
}
.custom-modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.custom-modal-close i { font-size: 18px; }
.custom-modal-close:hover { background: var(--surface-3); color: var(--text); }
.custom-modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); margin: 8px 0 0 0; padding-right: 32px; }
.custom-modal-subtitle { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.45; }
.custom-modal-fields { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.date-field { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.date-field label { font-family: var(--font-display); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.date-field input[type="date"] {
  width: 100%; padding: 13px 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 15px; color: var(--text);
  font-family: inherit; min-height: 48px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.date-field input[type="date"]:hover { border-color: var(--border-strong); }
.date-field input[type="date"]:focus { outline:none; border-color:var(--primary); background:var(--surface); box-shadow:0 0 0 3px var(--primary-tint); }
.custom-modal-error { font-size:13px; color:var(--danger-text); background:var(--danger-bg); border:1px solid #F2C6BC; padding:10px 12px; border-radius:var(--radius-sm); }
.custom-modal-error[hidden] { display:none; }
.custom-modal-actions { display:flex; flex-direction:column-reverse; gap:8px; margin-top:4px; }
.custom-cancel-btn, .custom-apply-btn { width:100%; padding:14px 22px; border-radius:var(--radius); font-size:15px; font-weight:600; min-height:48px; transition:background 0.15s, transform 0.05s, color 0.15s, border-color 0.15s; }
.custom-cancel-btn { background:var(--surface-2); color:var(--text); border:1px solid var(--border); }
.custom-cancel-btn:hover { background:var(--surface-3); border-color:var(--border-strong); }
.custom-apply-btn { background:var(--primary); color:#FFFFFF; }
.custom-apply-btn:hover { background:var(--primary-hover); color:#FFFFFF; }
.custom-apply-btn:active { transform:translateY(1px); }

/* ── Select field ─────────────────── */
.field select {
  width: 100%; padding: 13px 38px 13px 16px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); font-family: var(--font-body); font-size: 15px; color: var(--text);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23727E78' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  cursor: pointer; min-height: 48px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.field select:hover { border-color: var(--border-strong); }
.field select:focus { outline:none; border-color:var(--primary); background-color:var(--surface); box-shadow:0 0 0 3px var(--primary-tint); }
.field select option { background: var(--surface); color: var(--text); }

/* ── Animations ───────────────────── */
@keyframes pulseGreen { 0%,100% { opacity:1; box-shadow:0 0 0 3px rgba(74,222,128,0.25); } 50% { opacity:0.7; box-shadow:0 0 0 3px rgba(74,222,128,0.08); } }

/* ═══════════════════════════════════════════════
   INFO PANEL (right sidebar) — white bg
   ═══════════════════════════════════════════════ */
.info-panel {
  background: var(--surface);
  color: var(--text);
  border-left: 1px solid var(--border);
  padding: 24px 16px;
  overflow-y: auto;
}

.info-section { margin-bottom: 24px; }
.info-section:last-child { margin-bottom: 0; }

.info-section-title {
  font-family: var(--font-display);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-faint);
  margin: 0 0 12px 0;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.info-card:last-child { margin-bottom: 0; }

.info-card-title {
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700;
  color: var(--primary);
  margin: 0 0 5px 0;
  display: flex; align-items: center; gap: 7px;
}
.info-card-title i { font-size: 13px; color: var(--primary); flex-shrink: 0; }

.info-card-body {
  font-size: 12px; color: var(--text);
  line-height: 1.65; margin: 0;
}

.info-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  background: var(--primary-tint);
  border: 1px solid rgba(22,58,46,0.18);
  border-radius: 999px;
  font-size: 11px; font-weight: 700; color: var(--primary);
  margin-bottom: 12px;
}
.info-badge i { font-size: 12px; }

.info-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.info-source-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.info-source-item:last-child { border-bottom: none; }

.info-source-icon {
  width: 28px; height: 28px; flex-shrink: 0;
  background: var(--primary-tint);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.info-source-icon i { font-size: 14px; color: var(--primary); }

.info-source-name { font-size: 12px; font-weight: 700; color: var(--primary); margin: 0 0 2px 0; }
.info-source-desc { font-size: 11px; color: var(--text-muted); margin: 0; line-height: 1.5; }

.info-tip {
  background: var(--primary-tint);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 12px;
  margin-top: 14px;
}
.info-tip p { font-size: 11px; color: var(--text); margin: 0; line-height: 1.6; }
.info-tip strong { color: var(--primary); font-weight: 700; }

/* ═══════════════════════════════════════════════
   DESKTOP OVERRIDES (1024px+)
   ═══════════════════════════════════════════════ */
@media (min-width: 1024px) {
  .mobile-topbar       { display: none; }
  .mobile-download-bar { display: none !important; }

  /* Lock the whole page — no document scroll */
  html, body {
    height: 100%;
    overflow: hidden;
  }

  /* 3-column grid fills exactly the viewport */
  .app {
    display: grid;
    grid-template-columns: 290px 1fr 240px;
    grid-template-rows: 100vh;
    height: 100vh;
    overflow: hidden;
    flex-direction: unset;
  }

  /* Left sidebar — fixed, no scroll, no scrollbar */
  .sidebar {
    display: block;
    grid-column: 1;
    grid-row: 1;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    border-right: 1px solid var(--sidebar-bg-2);
    padding: 28px 22px;
    height: 100vh;
    overflow: hidden;
    position: static;
  }

  /* Right info panel — fixed height, scrolls internally */
  .info-panel {
    display: block;
    grid-column: 3;
    grid-row: 1;
    height: 100vh;
    overflow-y: auto;
    position: static;
  }

  /* Main content — scrolls but scrollbar hidden */
  .main {
    grid-column: 2;
    grid-row: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 28px 40px 36px;
    max-width: 100%;
    scrollbar-width: none;
  }
  .main::-webkit-scrollbar { display: none; }

  .page-header { margin-bottom: 28px; }
  .page-current { font-size: 13px; font-weight: 600; color: var(--text); }

  .status-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 999px;
    font-size: 12px; font-weight: 600; color: var(--live-green);
  }
  .status-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--live-green);
    box-shadow: 0 0 0 3px rgba(17,136,23,0.18);
    animation: pulseGreenDesktop 1.6s ease-in-out infinite;
  }
  @keyframes pulseGreenDesktop { 0%,100% { opacity:1; box-shadow:0 0 0 3px rgba(17,136,23,0.18); } 50% { opacity:0.6; box-shadow:0 0 0 3px rgba(17,136,23,0.06); } }

  .page-intro { margin-bottom: 28px; }
  .page-title { font-size: 32px; margin-bottom: 8px; }
  .page-subtitle { font-size: 14px; }

  .search-card { padding: 28px 28px 32px; }

  /* Sidebar nav styles */
  .logo { display:flex; align-items:center; margin-bottom:36px; }
  .logo-text { font-family:var(--font-display); font-weight:700; font-size:28px; letter-spacing:-0.03em; color:#FFFFFF; }
  .nav-section + .nav-section { margin-top:24px; }
  .nav-section-title { font-family:var(--font-display); font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:0.12em; color:var(--sidebar-text-muted); margin:0 0 10px 4px; }
  .nav-list { list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:2px; }
  .nav-item { display:flex; align-items:center; justify-content:space-between; padding:10px 12px; border-radius:var(--radius-sm); font-weight:500; font-size:14px; color:var(--sidebar-text); cursor:pointer; transition:background 0.15s; }
  .nav-item:hover:not(.disabled) { background:var(--sidebar-hover); color:var(--sidebar-text-strong); }
  .nav-item.active { background:var(--sidebar-active); color:var(--sidebar-text-strong); font-weight:600; }
  .nav-item-sub { font-size:13px; padding-left:14px; justify-content:flex-start; }
  .nav-item-sub .dot { width:6px; height:6px; border-radius:50%; background:var(--sidebar-text-muted); margin-right:10px; display:inline-block; flex-shrink:0; }
  .nav-item-sub.active-sub { color:var(--sidebar-text-strong); background:var(--sidebar-active); font-weight:600; }
  .nav-item-sub.active-sub .dot { background:var(--accent); }
  .badge { font-size:10px; font-weight:700; letter-spacing:0.06em; text-transform:uppercase; padding:3px 8px; border-radius:999px; }
  .badge-active { background:var(--accent); color:var(--sidebar-bg); }

  /* Radio: already plain in base styles, just fix gap */
  .radio-group { gap: 6px 18px; }

  /* Form actions desktop */
  .form-actions { justify-content: flex-end; }
  .submit-btn { flex:none; width:auto; height:auto; padding:9px 18px; font-size:13px; }
  .reset-btn  { height:auto; padding:9px 16px; font-size:13px; }

  /* Result actions and PDF — show on desktop */
  .result-actions { display: flex !important; }
  .pdf-preview    { display: block !important; }

  /* Custom modal centered on desktop */
  .custom-modal { align-items:center; padding:20px; }
  .custom-modal-inner { border-radius:var(--radius-lg); padding:32px 28px 26px; max-width:460px; }
  .custom-modal-inner::before { display:none; }
  .custom-modal-fields { flex-direction:row; gap:12px; }
  .custom-modal-actions { flex-direction:row; justify-content:flex-end; }
  .custom-cancel-btn, .custom-apply-btn { width:auto; padding:11px 22px; font-size:14px; min-height:unset; }
  .loader-card-inner { padding:44px 36px 36px; }
  .loader-doc { width:88px; height:108px; }

  /* Date fields desktop */
  .date-field input[type="date"] { min-height: unset; }
}

/* Mid breakpoint: tablet gets 2 columns (no right panel) */
@media (min-width: 768px) and (max-width: 1023px) {
  .mobile-topbar       { display: none; }
  .mobile-download-bar { display: none !important; }
  .info-panel          { display: none; }

  html, body { height: 100%; overflow: hidden; }

  .app {
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: 100vh;
    height: 100vh;
    overflow: hidden;
    flex-direction: unset;
  }

  .sidebar {
    display: block;
    background: var(--sidebar-bg); color: var(--sidebar-text);
    border-right: 1px solid var(--sidebar-bg-2);
    padding: 28px 22px;
    height: 100vh;
    overflow-y: auto;
    position: static;
  }

  /* same sidebar internals */
  .logo { display:flex; align-items:center; margin-bottom:36px; }
  .logo-text { font-family:var(--font-display); font-weight:700; font-size:28px; letter-spacing:-0.03em; color:#FFFFFF; }
  .nav-section + .nav-section { margin-top:24px; }
  .nav-section-title { font-family:var(--font-display); font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:0.12em; color:var(--sidebar-text-muted); margin:0 0 10px 4px; }
  .nav-list { list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:2px; }
  .nav-item { display:flex; align-items:center; justify-content:space-between; padding:10px 12px; border-radius:var(--radius-sm); font-weight:500; font-size:14px; color:var(--sidebar-text); cursor:pointer; transition:background 0.15s; }
  .nav-item:hover { background:var(--sidebar-hover); color:var(--sidebar-text-strong); }
  .nav-item.active { background:var(--sidebar-active); color:var(--sidebar-text-strong); font-weight:600; }
  .nav-item-sub { font-size:13px; padding-left:14px; justify-content:flex-start; }
  .nav-item-sub .dot { width:6px; height:6px; border-radius:50%; background:var(--sidebar-text-muted); margin-right:10px; display:inline-block; flex-shrink:0; }
  .nav-item-sub.active-sub { color:var(--sidebar-text-strong); background:var(--sidebar-active); font-weight:600; }
  .nav-item-sub.active-sub .dot { background:var(--accent); }
  .badge { font-size:10px; font-weight:700; letter-spacing:0.06em; text-transform:uppercase; padding:3px 8px; border-radius:999px; }
  .badge-active { background:var(--accent); color:var(--sidebar-bg); }

  .main { height: 100vh; overflow-y: auto; padding: 24px 32px 36px; }
  .page-header { margin-bottom: 24px; }
  .page-current { font-size: 13px; font-weight: 600; color: var(--text); }
  .status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--live-green); }
  .status-dot { width:7px; height:7px; border-radius:50%; background:var(--live-green); box-shadow:0 0 0 3px rgba(17,136,23,0.18); animation:pulseGreenDesktop 1.6s ease-in-out infinite; }
  .page-title { font-size: 28px; margin-bottom: 8px; }
  .page-subtitle { font-size: 14px; }
  .search-card { padding: 24px 24px 28px; }
  .radio-group { gap: 6px 18px; }
  .form-actions { justify-content:flex-end; }
  .submit-btn { flex:none; width:auto; height:auto; padding:9px 18px; font-size:13px; }
  .reset-btn  { height:auto; padding:9px 16px; font-size:13px; }
  .result-actions { display: flex !important; }
  .pdf-preview    { display: block !important; }
  .custom-modal { align-items:center; padding:20px; }
  .custom-modal-inner { border-radius:var(--radius-lg); padding:32px 28px 26px; max-width:460px; }
  .custom-modal-inner::before { display:none; }
  .custom-modal-fields { flex-direction:row; gap:12px; }
  .custom-modal-actions { flex-direction:row; justify-content:flex-end; }
  .custom-cancel-btn, .custom-apply-btn { width:auto; padding:11px 22px; font-size:14px; min-height:unset; }
  .date-field input[type="date"] { min-height: unset; }
}
/* ═══════════════════════════════════════════════
   MOBILE EC FORM — compact layout so form fits on one screen
   ═══════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* Tighter page intro */
  .page-intro { margin-bottom: 10px; }
  .page-title  { font-size: 20px; margin-bottom: 2px; }

  /* Compact search card */
  .search-card { padding: 14px 14px 16px; border-radius: 12px; }
  .search-form .field { margin-bottom: 10px; }
  .search-form .field:last-of-type { margin-bottom: 0; }

  /* Smaller labels */
  .search-form label {
    font-size: 12px;
    margin-bottom: 5px;
  }

  /* Compact text inputs */
  .search-form input[type="text"],
  .search-form input[type="number"] {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 13.5px;
  }

  /* Compact radio options — tighter gap */
  .radio-group {
    gap: 6px;
    flex-wrap: wrap;
  }
  .radio-option {
    font-size: 13px;
    padding: 5px 10px;
    min-height: 34px;
  }

  /* More options select */
  .more-options-select {
    min-height: 34px;
    padding: 5px 12px;
    font-size: 13px;
  }

  /* Compact preset hint */
  .preset-hint { font-size: 11px; margin-top: 4px; }

  /* Compact form actions */
  .form-actions { margin-top: 12px; gap: 8px; }
  .reset-btn, .submit-btn {
    min-height: 40px;
    padding: 10px 16px;
    font-size: 14px;
  }

  /* Page breadcrumb smaller */
  .page-header { margin-bottom: 6px; }
  .page-current { font-size: 11px; }

  /* ── Chip-style radios for Search-by and Duration ───────────── */
  /* Turns the flat radio list into a compact 2-column chip grid  */
  #search-by-group,
  #duration-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-top: 2px;
  }

  #search-by-group .radio-option,
  #duration-group .radio-option {
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    min-height: 40px;          /* ≥44px tap area with label text */
    background: var(--surface-2);
    font-size: 13px;
    font-weight: 500;
    gap: 7px;
    justify-content: flex-start;
    transition: border-color 0.15s, background 0.15s;
  }

  /* Selected chip */
  #search-by-group .radio-option:has(input[type="radio"]:checked),
  #duration-group  .radio-option:has(input[type="radio"]:checked) {
    background: var(--primary-tint);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
  }

  /* More Options select spans the full row */
  #search-by-group .more-options-select {
    grid-column: 1 / -1;
    max-width: 100%;
    min-width: unset;
    width: 100%;
    margin-top: 2px;
    height: 40px;
    font-size: 13px;
  }

  /* Property type chips — same treatment */
  #property-type-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }

  #property-type-group .radio-option {
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    min-height: 40px;
    background: var(--surface-2);
    font-size: 13px;
    font-weight: 500;
    gap: 7px;
    transition: border-color 0.15s, background 0.15s;
  }

  #property-type-group .radio-option:has(input[type="radio"]:checked) {
    background: var(--primary-tint);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
  }
}