/* Karatbars responsive layout safeguards. Loaded after the main design stylesheet. */
@media (max-width: 900px) {
  html, body { width:100%; max-width:100%; overflow-x:hidden; }
  *, *::before, *::after { box-sizing:border-box; }
  img, video, iframe, canvas, svg { max-width:100%; }
  .wrap { width: min(100% - 32px, 100%); margin-left:auto; margin-right:auto; }
  main, section, article, .kb-client-main { min-width:0; max-width:100%; }
  .site-header { position:relative; display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:64px; padding:12px 16px; flex-wrap:nowrap; }
  .site-header .brand { flex:0 1 auto; min-width:0; white-space:nowrap; }
  .site-header .header-actions { margin-left:auto; flex:0 0 auto; }
  .site-header .menu-toggle { display:inline-flex !important; align-items:center; justify-content:center; min-width:44px; min-height:44px; border:1px solid rgba(213,177,91,.55); border-radius:10px; background:#101010; color:#e4c16d; font-size:25px; line-height:1; cursor:pointer; }
  .site-header .main-nav { display:none !important; position:absolute; z-index:10000; top:calc(100% + 6px); left:12px; right:12px; max-height:calc(100svh - 90px); overflow-y:auto; flex-direction:column; align-items:stretch; gap:4px; padding:14px; border:1px solid rgba(213,177,91,.45); border-radius:14px; background:#080808; box-shadow:0 18px 48px rgba(0,0,0,.55); }
  .site-header .main-nav.open { display:flex !important; }
  .site-header .main-nav > a, .site-header .main-nav .nav-auth-links > a { display:flex; align-items:center; justify-content:flex-start; width:100%; min-height:44px; padding:10px 12px; border-radius:8px; }
  .site-header .main-nav .nav-auth-links { display:flex; flex-direction:column; gap:6px; width:100%; margin-top:8px; }
  .kb-sticky-shell { position:relative; }
  .kb-market-ticker, .kb-live-market-ticker, .kb-client-ticker { max-width:100%; overflow:hidden; }
  .kb-ticker-updated, .kb-price-updated { white-space:normal; }
  .hero, .hero-gold-background { display:grid; grid-template-columns:minmax(0,1fr); gap:20px; padding-top:24px; padding-bottom:24px; }
  .hero > *, .section > *, .kb-approach-section > * { min-width:0; max-width:100%; }
  .hero h1, h1 { font-size:clamp(1.8rem, 8vw, 2.7rem); line-height:1.12; overflow-wrap:anywhere; }
  h2 { font-size:clamp(1.35rem, 6vw, 2rem); line-height:1.2; }
  p, li { overflow-wrap:anywhere; }
  .grid, .cards, .commodity-grid, .market-grid, .feature-grid, .kb-summary-grid, .kb-dashboard-lower { display:grid !important; grid-template-columns:minmax(0,1fr) !important; gap:14px; }
  .commodity-card, .kb-commodity-card, .kb-summary-card, .kb-balance-card, .kb-verification-card, .kb-holdings-chart-card { min-width:0; width:100%; }
  .kb-client-shell, .kb-client-dashboard { display:block; width:100%; max-width:100%; min-width:0; }
  .kb-client-main { width:100%; max-width:100%; margin:0; padding:16px; padding-bottom:calc(100px + env(safe-area-inset-bottom)); }
  .kb-client-header { display:flex; align-items:center; justify-content:space-between; gap:10px; width:100%; padding:10px 14px; }
  .kb-client-header-actions { display:flex; align-items:center; gap:8px; min-width:0; }
  .kb-dashboard-greeting { min-width:0; }
  .kb-dashboard-greeting h1, .kb-dashboard-greeting h2 { overflow-wrap:anywhere; }
  .kb-bottom-nav { position:fixed; z-index:9000; left:0; right:0; bottom:0; display:flex; justify-content:space-around; align-items:center; width:100%; padding:8px 6px calc(8px + env(safe-area-inset-bottom)); background:rgba(8,8,8,.97); border-top:1px solid rgba(213,177,91,.28); }
  .kb-bottom-nav > * { flex:1 1 0; min-width:0; }
  .kb-client-menu-panel { width:min(50vw,340px); max-width:calc(100vw - 24px); }
  .kb-quick-access-panel { max-width:calc(100vw - 24px); }
  .kb-notification-popover, .kb-profile-popover { width:min(92vw,380px); max-width:calc(100vw - 24px); }
  form, fieldset, input, select, textarea, button { max-width:100%; }
  input, select, textarea { min-width:0; }
  table { display:block; max-width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .kb-chat-float { right:14px; bottom:calc(82px + env(safe-area-inset-bottom)); }
  iframe { width:100%; }
}
@media (max-width: 480px) {
  .wrap { width:calc(100% - 28px); }
  .site-header { padding:10px 12px; }
  .brand { max-width:calc(100vw - 88px); font-size:15px; }
  .kb-client-main { padding:12px; padding-bottom:calc(100px + env(safe-area-inset-bottom)); }
  .kb-bottom-nav { gap:2px; }
  .kb-bottom-nav a, .kb-bottom-nav button { min-width:0; padding-left:3px; padding-right:3px; }
  .kb-market-ticker { font-size:12px; }
  .kb-ticker-item { flex:0 0 auto; }
  .kb-menu-button, .kb-flash-button, .kb-icon-button { min-width:42px; min-height:42px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior:auto !important; animation-duration:.01ms !important; transition-duration:.01ms !important; }
}

/* Karatbars mobile sign-in and recovery layout */
.auth-body { min-height:100vh; overflow-x:hidden; }
.auth-wrap { width:min(1120px, calc(100% - 40px)); max-width:100%; margin:clamp(24px,5vh,64px) auto; display:grid; grid-template-columns:minmax(0,1fr) minmax(320px,520px); gap:clamp(20px,4vw,64px); align-items:center; }
.auth-aside,.auth-card { min-width:0; max-width:100%; }
.auth-card { width:100%; }
.auth-card input,.auth-card select,.auth-card button { max-width:100%; }
.kb-forgot-row { display:flex; justify-content:flex-end; margin:-4px 0 16px; }
.kb-forgot-link { color:#d9b65e; text-decoration:underline; text-underline-offset:3px; font-size:14px; font-weight:600; }
.kb-recovery-success { margin:12px 0; padding:12px 14px; border:1px solid rgba(94,170,119,.4); border-radius:10px; color:#b9e5c7; background:rgba(35,110,61,.12); line-height:1.5; }
@media(max-width:900px) {
 .auth-wrap { display:grid; grid-template-columns:minmax(0,1fr); width:min(100% - 32px,560px); margin:20px auto 36px; gap:0; }
 .auth-aside { display:none !important; }
 .auth-card { width:100%; padding:clamp(20px,5vw,30px); }
 .auth-card form { width:100%; }
 .auth-card label { display:block; width:100%; }
 .auth-card input:not([type=checkbox]),.auth-card select { width:100%; min-width:0; min-height:48px; font-size:16px; }
 .auth-card .field-row { display:grid; grid-template-columns:minmax(0,1fr); gap:0; }
 .auth-card .btn-full { width:100%; min-height:50px; }
 .auth-card h2 { font-size:clamp(26px,7vw,34px); }
 .auth-legal { font-size:12px; line-height:1.55; }
}
@media(max-width:480px) {
 .auth-wrap { width:calc(100% - 24px); margin:12px auto 28px; }
 .auth-card { padding:20px 16px; border-radius:16px; }
 .auth-body .site-header { min-height:58px; }
}
