:root {
  --ihu-primary: #0B5FFF;
  --ihu-primary-dark: #0847C7;
  --ihu-accent: #00C2A8;
  --ihu-bg: #F5F7FB;
  --ihu-card: #FFFFFF;
  --ihu-text: #0F172A;
  --ihu-muted: #64748B;
  --ihu-border: #E2E8F0;
  --ihu-danger: #EF4444;
  --ihu-success: #10B981;
  --ihu-radius: 16px;
  --ihu-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  --ihu-chip-bg: #EFF6FF;
  --ihu-input-bg: #FFFFFF;
  --ihu-overlay: rgba(15, 23, 42, .45);
  --nav-h: 56px;
  --bottom-h: 64px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

/* Dark mode — applied when the user (via the header toggle, see theme-toggle.js)
   picks dark explicitly, or automatically on first visit if the device/browser
   prefers dark and the user hasn't chosen "light" explicitly. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ihu-bg: #0B1220;
    --ihu-card: #151E30;
    --ihu-text: #E7ECF5;
    --ihu-muted: #94A3B8;
    --ihu-border: #26324A;
    --ihu-shadow: 0 4px 20px rgba(0, 0, 0, .35);
    --ihu-chip-bg: #1B2C4D;
    --ihu-input-bg: #101a2c;
    --ihu-overlay: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ihu-bg: #0B1220;
  --ihu-card: #151E30;
  --ihu-text: #E7ECF5;
  --ihu-muted: #94A3B8;
  --ihu-border: #26324A;
  --ihu-shadow: 0 4px 20px rgba(0, 0, 0, .35);
  --ihu-chip-bg: #1B2C4D;
  --ihu-input-bg: #101a2c;
  --ihu-overlay: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); background: var(--ihu-bg);
  color: var(--ihu-text); line-height: 1.5; -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px));
}
a { color: var(--ihu-primary); text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }

/* Top bar */
.ihu-top {
  position: sticky; top: 0; z-index: 100; height: var(--nav-h);
  background: color-mix(in srgb, var(--ihu-card) 92%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ihu-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; gap: 10px;
}
.ihu-logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--ihu-text); }
.ihu-logo span { color: var(--ihu-primary); }
.ihu-logo-mark {
  width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, var(--ihu-primary), var(--ihu-accent));
  display: grid; place-items: center; color: #fff; font-size: .85rem; font-weight: 800;
}
.ihu-top-actions { display: flex; align-items: center; gap: 8px; }
.lang-toggle { display: flex; border: 1px solid var(--ihu-border); border-radius: 8px; overflow: hidden; }
.lang-toggle button {
  border: 0; background: var(--ihu-card); padding: 6px 10px; font-size: .72rem; font-weight: 700; cursor: pointer; color: var(--ihu-muted);
}
.lang-toggle button.active { background: var(--ihu-primary); color: #fff; }

/* Theme toggle (light/dark) — injected by /js/theme-toggle.js into .ihu-top-actions */
.theme-toggle-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--ihu-border);
  background: var(--ihu-card); color: var(--ihu-muted); cursor: pointer; flex-shrink: 0;
}
.theme-toggle-btn svg { width: 18px; height: 18px; }
.theme-toggle-btn .sun { display: none; }
:root[data-theme="dark"] .theme-toggle-btn .moon { display: none; }
:root[data-theme="dark"] .theme-toggle-btn .sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle-btn .moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle-btn .sun { display: block; }
}

/* Bottom nav */
.ihu-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px));
  padding: 6px 10px env(safe-area-inset-bottom, 0px); box-sizing:border-box;
  background: rgba(255,255,255,.94); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--ihu-border); display:flex; justify-content:center; align-items:center; gap:6px;
}
.ihu-bottom a {
  flex:1; max-width:150px; min-height:50px; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:3px; color:var(--ihu-muted); font-size:.68rem; font-weight:700; padding:6px 4px; text-decoration:none; border-radius:16px;
  transition:transform .16s ease, color .16s ease, background .16s ease;
}
.ihu-bottom a.active { color:var(--ihu-primary); background:rgba(11,95,255,.07); }
.ihu-bottom svg { width:21px; height:21px; }
.ihu-bottom a { position:relative; }
.ihu-nav-badge {
  position:absolute; top:2px; right:calc(50% - 20px); min-width:16px; height:16px; padding:0 4px;
  border-radius:999px; background:#DC2626; color:#fff; font-size:.6rem; font-weight:800; line-height:16px;
  text-align:center; box-shadow:0 0 0 2px var(--ihu-bg,#fff);
}
[data-theme="dark"] .ihu-nav-badge { box-shadow:0 0 0 2px #0F172A; }
.ihu-bottom .ihu-cta { margin-top:-18px; max-width:112px; color:#fff; background:linear-gradient(145deg,#0B5FFF,#00A894); border:4px solid var(--ihu-bg); border-radius:22px; box-shadow:0 8px 22px rgba(11,95,255,.24); }
.ihu-bottom .ihu-cta.active { color:#fff; background:linear-gradient(145deg,#0847C7,#008f7e); }
.ihu-bottom .ihu-cta-ico { width:38px; height:38px; display:flex; align-items:center; justify-content:center; border-radius:13px; background:rgba(255,255,255,.16); }
.ihu-bottom .ihu-cta-label { font-size:.64rem; }
@media (max-width:360px){.ihu-bottom{padding-left:5px;padding-right:5px}.ihu-bottom a{font-size:.62rem}.ihu-bottom .ihu-cta{max-width:102px;}}
[data-theme="dark"] .ihu-bottom { background:rgba(15,23,42,.94); }
[data-theme="dark"] .ihu-bottom .ihu-cta { border-color:#0F172A; }

/* Layout */
.ihu-wrap { max-width: 720px; margin: 0 auto; padding: 16px 14px 24px; }
.ihu-wrap-wide { max-width: 960px; margin: 0 auto; padding: 16px 14px 24px; }

/* Hero */
.ihu-hero {
  background: linear-gradient(145deg, #0B5FFF 0%, #0847C7 55%, #00A894 100%);
  color: #fff; border-radius: 20px; padding: 28px 20px; margin-bottom: 20px;
  box-shadow: 0 12px 40px rgba(11, 95, 255, .25);
}
.ihu-hero h1 { margin: 0 0 8px; font-size: clamp(1.35rem, 5vw, 1.85rem); letter-spacing: -.02em; }
.ihu-hero p { margin: 0 0 16px; opacity: .95; font-size: .95rem; max-width: 36ch; }
.ihu-hero-search {
  display: flex; gap: 8px; background: var(--ihu-card); border-radius: 12px; padding: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.ihu-hero-search input {
  flex: 1; border: 0; padding: 10px 12px; outline: none; color: var(--ihu-text); background: transparent;
}
.ihu-hero-search button {
  border: 0; background: var(--ihu-primary); color: #fff; border-radius: 10px;
  padding: 10px 16px; font-weight: 700; cursor: pointer;
}

/* Section cards grid */
.section-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px;
}
@media (min-width: 640px) {
  .section-grid { grid-template-columns: repeat(3, 1fr); }
}
.section-card {
  background: var(--ihu-card); border: 1px solid var(--ihu-border); border-radius: var(--ihu-radius);
  padding: 16px 14px; box-shadow: var(--ihu-shadow); display: flex; flex-direction: column; gap: 8px;
  transition: transform .15s ease, box-shadow .15s ease; min-height: 140px;
}
.section-card:active { transform: scale(.98); }
.section-card .icon {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--ihu-chip-bg); color: var(--ihu-primary); font-size: 1.25rem;
}
.section-card h3 { margin: 0; font-size: .95rem; font-weight: 700; color: var(--ihu-text); }
.section-card p { margin: 0; font-size: .78rem; color: var(--ihu-muted); line-height: 1.4; flex: 1; }
.section-card .go { font-size: .75rem; font-weight: 700; color: var(--ihu-primary); }

/* Cards */
.card {
  background: var(--ihu-card); border: 1px solid var(--ihu-border); border-radius: var(--ihu-radius);
  padding: 16px; box-shadow: var(--ihu-shadow); margin-bottom: 12px;
}
.card h2, .card h3 { margin: 0 0 8px; }
.text-muted { color: var(--ihu-muted); }
.chip {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 600; background: var(--ihu-chip-bg); color: var(--ihu-primary);
}
.chip.verified { background: #ECFDF5; color: #047857; }
.chip.warn { background: #FFFBEB; color: #B45309; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 16px; border-radius: 12px; border: none;
  font-weight: 600; font-size: .9rem; cursor: pointer; font-family: inherit;
}
.btn-primary { background: var(--ihu-primary); color: #fff; }
.btn-primary:active { background: var(--ihu-primary-dark); }
.btn-secondary { background: var(--ihu-card); color: var(--ihu-primary); border: 1.5px solid var(--ihu-border); }
.btn-accent { background: var(--ihu-accent); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .82rem; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 6px; color: #334155; }
.form-control {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--ihu-border); border-radius: 12px;
  background: var(--ihu-input-bg); color: var(--ihu-text);
}
.form-control:focus { outline: none; border-color: var(--ihu-primary); box-shadow: 0 0 0 3px rgba(11,95,255,.15); }

/* Provider / list cards */
.provider-card {
  display: flex; gap: 12px; align-items: flex-start; background: var(--ihu-card);
  border: 1px solid var(--ihu-border); border-radius: 14px; padding: 14px; margin-bottom: 10px;
}
.provider-avatar {
  width: 52px; height: 52px; border-radius: 14px; background: var(--ihu-chip-bg); color: var(--ihu-primary);
  display: grid; place-items: center; font-weight: 800; flex-shrink: 0; overflow: hidden;
}
.provider-avatar img { width: 100%; height: 100%; object-fit: cover; }
.provider-body { flex: 1; min-width: 0; }
.provider-body h3 { margin: 0 0 4px; font-size: .95rem; }
.provider-meta { font-size: .78rem; color: var(--ihu-muted); }
.provider-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Empty / loading */
.empty {
  text-align: center; padding: 36px 16px; color: var(--ihu-muted);
  background: var(--ihu-card); border: 1px dashed var(--ihu-border); border-radius: 16px;
}
.mk-loading { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px; color: var(--ihu-muted); }
.mk-spinner {
  width: 32px; height: 32px; border: 3px solid #E2E8F0; border-top-color: var(--ihu-primary);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .mk-spinner { animation: none; }
}

/* Safety banner */
.safety-banner {
  background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E;
  border-radius: 12px; padding: 12px 14px; font-size: .85rem; margin-bottom: 14px;
}

/* Footer note */
.ihu-foot {
  text-align: center; font-size: .75rem; color: var(--ihu-muted); padding: 20px 12px 8px;
}

/* Search bar alignment */
.ihu-hero-search{display:flex;gap:8px;align-items:stretch;width:100%;max-width:520px;margin:12px auto 0;}
.ihu-hero-search input{flex:1;min-width:0;border-radius:12px;border:1px solid var(--ihu-border);padding:12px 14px;font-size:1rem;background:var(--ihu-card);color:var(--ihu-text);}
.ihu-hero-search button{flex:0 0 auto;border-radius:12px;padding:12px 16px;font-weight:700;white-space:nowrap;min-height:48px;}
@media(max-width:380px){
  .ihu-hero-search{flex-direction:column;}
  .ihu-hero-search button{width:100%;}
}


/* Ihuze brand logo */
.ihu-logo{display:flex;align-items:center;gap:8px;text-decoration:none;color:inherit;font-weight:800;}
.ihu-logo img.brand-logo{height:36px;width:auto;display:block;object-fit:contain;}
.ihu-logo .ihu-logo-mark{display:none;} /* prefer real logo when img present */
.auth-logo img.brand-logo,.auth-logo img{height:64px;width:auto;display:block;margin:0 auto 12px;object-fit:contain;}
.footer-logo img{height:40px;width:auto;}
@media(min-width:768px){
  .ihu-logo img.brand-logo{height:40px;}
}

/* Dark-mode-aware transition so the theme switch doesn't feel jarring */
body, .card, .section-card, .provider-card, .ihu-top, .ihu-bottom, .form-control, .chip, .btn-secondary {
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

