/* ============================================================
   BRIDGE Community — Main Stylesheet
   Font: Playfair Display (headings) + DM Sans (body)
   Palette: Warm ivory · Deep charcoal · Orange #e8570a
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg:      #f5f0eb;
  --surface: #ffffff;
  --border:  #e0d8cf;
  --text:    #1a1a1a;
  --muted:   #6b6560;
  --orange:  #e8570a;
  --orange2: #bf460a;
  --premium: #5b3fd6;
  --nav-bg:  #1a1a1a;
  --nav-w:   230px;
  --radius:  8px;
  --shadow:  0 2px 12px rgba(0,0,0,.08);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
h1,h2,h3,h4 { font-family: 'Playfair Display', serif; line-height: 1.2; }
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── App Layout ── */
.app-layout { display: flex; min-height: 100vh; }

/* ── Side Nav (desktop) ── */
.side-nav {
  width: var(--nav-w);
  background: var(--nav-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  transition: transform .25s ease;
}
.nav-logo { padding: 20px 16px; border-bottom: 1px solid #333; }
.nav-logo img { max-width: 140px; filter: brightness(0) invert(1); }
.side-nav ul { list-style: none; padding: 12px 0; flex: 1; }
.side-nav ul li a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; color: #ccc; font-size: .9rem; font-weight: 500;
  transition: background .15s, color .15s;
}
.side-nav ul li a:hover,
.side-nav ul li.active a {
  background: rgba(255,255,255,.08); color: #fff; text-decoration: none;
}
.side-nav ul li.active a { border-left: 3px solid var(--orange); }
.nav-footer { padding: 16px 20px; border-top: 1px solid #333; }
.logout-link { color: #999; font-size: .85rem; }
.logout-link:hover { color: #fff; }
.badge { background: var(--orange); color: #fff; font-size: .7rem; padding: 2px 7px; border-radius: 99px; margin-left: auto; }

/* ── Mobile nav toggle button ── */
.nav-toggle {
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 200;
  background: var(--orange);
  border: none;
  border-radius: 8px;
  width: 42px; height: 42px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.nav-toggle span {
  display: block;
  width: 20px; height: 2px;
  background: #fff;
  border-radius: 2px;
}

/* ── Dark overlay behind open nav ── */
.nav-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 99;
}
.nav-overlay.open { display: block; }

/* ── Main Content Area ── */
.app-main {
  margin-left: var(--nav-w);
  flex: 1;
  padding: 32px;
  min-width: 0;
}

/* ── Page Hero (Dashboard) ── */
.page-hero {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}
.page-hero h1 { font-size: 1.6rem; margin-bottom: 6px; }
.page-hero p { color: var(--muted); font-size: .92rem; }
.hero-actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.link-upgrade { color: var(--orange); font-size: .88rem; }

/* ── Dash Grid ── */
.dash-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 24px; }
.dash-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px 20px; text-align: center; color: var(--text);
  transition: box-shadow .2s; text-decoration: none; display: block;
}
.dash-card:hover { box-shadow: var(--shadow); text-decoration: none; }
.dash-icon { font-size: 1.8rem; margin-bottom: 8px; }
.dash-card h3 { font-size: 1rem; margin-bottom: 4px; }
.dash-card p { color: var(--muted); font-size: .85rem; margin-bottom: 12px; }

/* ── Buttons ── */
.btn-primary, .btn-outline, .btn-full, .btn-hero, .btn-sm {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 20px; border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: .9rem;
  cursor: pointer; border: 2px solid transparent; transition: all .15s;
  text-decoration: none;
}
.btn-primary { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-primary:hover { background: var(--orange2); border-color: var(--orange2); color: #fff; text-decoration: none; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--text); text-decoration: none; }
.btn-hero { background: var(--orange); color: #fff; padding: 14px 32px; font-size: 1rem; }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-premium { background: var(--premium); color: #fff; border-color: var(--premium); }
.btn-xs { padding: 4px 10px; font-size: .78rem; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); cursor: pointer; color: var(--text); }
.btn-xs:hover { background: var(--bg); }
.btn-xs.btn-danger { border-color: #dc3545; color: #dc3545; }
.btn-xs.btn-danger:hover { background: #dc3545; color: #fff; }
.btn-xs.btn-msg { border-color: var(--orange); color: var(--orange); }
.btn-danger { border-color: #dc3545; color: #dc3545; background: transparent; }
.btn-danger:hover { background: #dc3545; color: #fff; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: .9rem; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeaa7; }

/* ── Filter Bar ── */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-bar a {
  padding: 6px 16px; border-radius: 99px; background: var(--surface);
  border: 1px solid var(--border); color: var(--muted); font-size: .85rem;
}
.filter-bar a.active, .filter-bar a:hover { background: var(--orange); color: #fff; border-color: var(--orange); text-decoration: none; }

/* ── Content Grid ── */
.content-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 16px; }
.content-card { background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); text-decoration: none; color: var(--text); transition: box-shadow .2s; display: block; }
.content-card:hover { box-shadow: var(--shadow); text-decoration: none; }
.content-thumb { height: 120px; background: var(--bg) center/cover no-repeat; display: flex; align-items: center; justify-content: center; font-size: 2.2rem; position: relative; }
.content-thumb--video { background-color: #111; }
.play-btn { color: #fff; font-size: 1.8rem; opacity: .9; }
.lock-badge { position: absolute; top: 8px; right: 8px; font-size: 1rem; }
.content-info { padding: 10px 12px; }
.content-info h4 { font-size: .88rem; margin: 4px 0 2px; font-family: 'DM Sans', sans-serif; font-weight: 600; line-height: 1.3; }
.content-info small { color: var(--muted); font-size: .76rem; }
.content-type { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.badge-premium { background: var(--premium); color: #fff; font-size: .68rem; padding: 2px 7px; border-radius: 99px; }
.badge-new { background: var(--orange); color: #fff; font-size: .68rem; padding: 2px 8px; border-radius: 99px; }

/* ── Resource List ── */
.resource-list { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.resource-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); transition: background .15s; }
.resource-row:last-child { border-bottom: none; }
.resource-row:hover { background: var(--bg); text-decoration: none; }
.resource-icon { font-size: 1.5rem; flex-shrink: 0; }
.resource-info { flex: 1; min-width: 0; }
.resource-info strong { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resource-info small { color: var(--muted); font-size: .8rem; }
.resource-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.type-badge { font-size: .72rem; color: var(--muted); background: var(--bg); padding: 2px 8px; border-radius: 4px; border: 1px solid var(--border); }

/* ── Upgrade Bar ── */
.upgrade-bar { display: block; background: linear-gradient(135deg,#5b3fd6,#8b6ef0); color: #fff; padding: 10px 18px; border-radius: var(--radius); font-size: .88rem; margin-bottom: 16px; }
.upgrade-bar:hover { text-decoration: none; opacity: .92; color: #fff; }

/* ── Forum ── */
.forum-list { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); }
.forum-topic-row { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.forum-topic-row:last-child { border-bottom: none; }
.forum-topic-row:hover { background: var(--bg); text-decoration: none; }
.forum-topic-row.pinned { background: #fffbf5; }
.topic-main { flex: 1; min-width: 0; }
.topic-main h3 { font-size: .95rem; font-family: 'DM Sans', sans-serif; font-weight: 600; margin-bottom: 2px; }
.topic-main small { color: var(--muted); font-size: .8rem; }
.topic-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.lock-tag { font-size: .8rem; }
.forum-header { margin-bottom: 20px; }
.forum-header h1 { font-size: 1.6rem; }
.topic-meta { color: var(--muted); font-size: .88rem; margin-top: 4px; }
.back-link { color: var(--muted); font-size: .88rem; display: inline-block; margin-bottom: 12px; }
.forum-thread { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 24px; }
.reply-item { padding: 20px 24px; border-bottom: 1px solid var(--border); }
.reply-item:last-child { border-bottom: none; }
.reply-op { background: #fffbf5; }
.reply-author { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.reply-author strong { font-size: .9rem; }
.reply-author small { color: var(--muted); font-size: .8rem; }
.role-badge { background: var(--orange); color: #fff; font-size: .7rem; padding: 1px 7px; border-radius: 99px; }
.reply-body { font-size: .92rem; line-height: 1.7; }
.reply-form { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 24px; }
.reply-form h3 { margin-bottom: 14px; font-size: 1rem; }
.locked-notice { color: var(--muted); font-style: italic; padding: 16px 0; }

/* ── Messages ── */
.msg-layout { display: grid; grid-template-columns: 260px 1fr; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); height: calc(100vh - 160px); min-height: 400px; overflow: hidden; }
.msg-sidebar { border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.msg-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.msg-tabs a { flex: 1; padding: 12px; text-align: center; font-size: .85rem; color: var(--muted); border-bottom: 2px solid transparent; }
.msg-tabs a.active { color: var(--orange); border-bottom-color: var(--orange); }
.msg-list { flex: 1; overflow-y: auto; }
.msg-row { display: block; padding: 12px 14px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.msg-row:hover { background: var(--bg); }
.msg-row.active { background: #fff5f0; }
.msg-row.unread .msg-row-from { font-weight: 700; }
.msg-row-from { font-size: .85rem; font-weight: 500; }
.msg-row-subj { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-row-date { font-size: .75rem; color: var(--muted); }
.msg-body { display: flex; flex-direction: column; padding: 24px; overflow-y: auto; }
.msg-view h2 { font-size: 1.2rem; margin-bottom: 6px; }
.msg-view-meta { color: var(--muted); font-size: .85rem; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.msg-view-body { font-size: .92rem; line-height: 1.8; }
.msg-placeholder { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .9rem; }
.empty-small { padding: 20px; color: var(--muted); font-size: .88rem; text-align: center; }

/* ── Forms ── */
label { display: block; font-size: .85rem; font-weight: 600; margin: 14px 0 5px; color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=tel], select, textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-family: 'DM Sans', sans-serif; font-size: .9rem;
  background: var(--surface); color: var(--text); transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); }
input.input-disabled { background: var(--bg); cursor: not-allowed; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
textarea { resize: vertical; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 32px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-lg { max-width: 680px; }
.modal h2 { margin-bottom: 20px; font-size: 1.3rem; }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--muted); }

/* ── Auth Pages ── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.auth-card { background: var(--surface); border-radius: 12px; padding: 40px; width: 100%; max-width: 420px; box-shadow: 0 4px 32px rgba(0,0,0,.1); }
.auth-logo { max-width: 130px; margin-bottom: 24px; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 4px; }
.auth-sub { color: var(--muted); margin-bottom: 24px; font-size: .9rem; }
.auth-links { display: flex; justify-content: space-between; margin-top: 18px; font-size: .85rem; }
.success-card { text-align: center; }
.success-icon { font-size: 3rem; margin-bottom: 16px; }

/* ── Tables ── */
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th { text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--border); color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.data-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }
td.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.table-wrap { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow: auto; }

/* ── Page Header ── */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 1.8rem; margin-bottom: 4px; }
.page-header p { color: var(--muted); }

/* ── Sections ── */
.dash-section { margin-bottom: 28px; }
.dash-section h2 { font-size: 1.05rem; margin-bottom: 14px; font-family: 'DM Sans', sans-serif; font-weight: 600; }
.topic-list { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.topic-row { display: flex; justify-content: space-between; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.topic-row:last-child { border-bottom: none; }
.topic-row:hover { background: var(--bg); }
.topic-title { font-size: .9rem; font-weight: 500; }
.topic-meta { font-size: .78rem; color: var(--muted); }

/* ── Status badges ── */
.status-paid, .status-active { color: #155724; background: #d4edda; padding: 2px 8px; border-radius: 99px; font-size: .78rem; }
.status-failed, .status-canceled { color: #721c24; background: #f8d7da; padding: 2px 8px; border-radius: 99px; font-size: .78rem; }
.status-pending, .status-past_due { color: #856404; background: #fff3cd; padding: 2px 8px; border-radius: 99px; font-size: .78rem; }
.plan-premium { color: var(--premium); font-weight: 600; }
.plan-free { color: var(--muted); }
.access-premium { color: var(--premium); font-weight: 600; font-size: .82rem; }
.access-free { color: #155724; font-size: .82rem; }

/* ── Membership ── */
.membership-page { max-width: 700px; }
.plan-status { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 28px; margin-bottom: 24px; }
.plan-status.active { border-color: #c3e6cb; background: #f0fff4; }
.plan-icon { font-size: 2rem; margin-bottom: 8px; }
.plan-price { font-size: 1.8rem; font-weight: 700; color: var(--orange); margin: 8px 0; }
.pricing-card { background: var(--surface); border-radius: var(--radius); border: 2px solid var(--orange); padding: 32px; text-align: center; max-width: 360px; }
.plan-badge { display: inline-block; background: var(--orange); color: #fff; padding: 4px 16px; border-radius: 99px; font-size: .82rem; font-weight: 600; margin-bottom: 16px; }
.plan-price sup { font-size: 1.3rem; vertical-align: top; padding-top: 10px; }
.plan-price span { font-size: 1rem; color: var(--muted); font-weight: 400; }
.features { list-style: none; text-align: left; margin: 18px 0; }
.features li { padding: 6px 0; font-size: .9rem; border-bottom: 1px solid var(--border); }
.features li:last-child { border-bottom: none; }
.stripe-msg { color: #dc3545; font-size: .85rem; margin-top: 8px; }
.stripe-not-configured { color: var(--muted); font-size: .85rem; font-style: italic; }
.orders-section { margin-top: 32px; }
.orders-section h2 { font-size: 1.1rem; margin-bottom: 14px; }
.upgrade-section { margin-bottom: 28px; }
.free-note { text-align: center; color: var(--muted); font-size: .88rem; margin-top: 14px; }

/* ── Video player ── */
.video-wrap { width: 100%; background: #000; border-radius: var(--radius); overflow: hidden; line-height: 0; }
.video-wrap video { width: 100%; height: auto; display: block; max-height: 70vh; }

/* ── Content Viewer ── */
.content-viewer { max-width: 900px; }
.viewer-header { color: var(--muted); font-size: .85rem; margin-bottom: 8px; }
.viewer-header a { color: var(--muted); }
.content-viewer h1 { font-size: 1.8rem; margin-bottom: 12px; }
.content-desc { color: var(--muted); margin-bottom: 24px; line-height: 1.7; }
.content-image { max-width: 100%; border-radius: var(--radius); }
.audio-player { width: 100%; }
.link-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.locked-msg { text-align: center; padding: 60px 20px; }
.lock-icon { font-size: 3rem; margin-bottom: 16px; }
.center-page { display: flex; align-items: center; justify-content: center; }

/* ── Account ── */
.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.account-section { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 28px; }
.account-section h2 { font-size: 1.1rem; margin-bottom: 18px; }
.avatar-upload { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.avatar-preview, .avatar-placeholder { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-placeholder { background: var(--orange); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 700; }
.status-info p { margin-bottom: 8px; font-size: .9rem; }
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Help ── */
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 20px; margin-bottom: 32px; }
.help-cat { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 20px; }
.help-cat h2 { font-size: 1rem; margin-bottom: 12px; font-family: 'DM Sans', sans-serif; }
.help-cat ul { list-style: none; }
.help-cat ul li { padding: 5px 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.help-cat ul li:last-child { border-bottom: none; }
.help-contact { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 28px; max-width: 600px; }
.help-contact h2 { margin-bottom: 8px; }
.contact-form { margin-top: 18px; }
.help-article { max-width: 760px; }
.help-article h1 { margin: 16px 0; }
.article-body { line-height: 1.9; font-size: .95rem; }

/* ── Welcome Popup ── */
.popup-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.popup { background: var(--surface); border-radius: 12px; max-width: 600px; width: 100%; padding: 40px; position: relative; max-height: 90vh; overflow-y: auto; }
.popup-close { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--muted); }
.popup-logo { max-width: 120px; margin-bottom: 20px; }
.popup h2 { font-size: 1.6rem; margin-bottom: 4px; }
.popup-tagline { color: var(--orange); font-style: italic; margin-bottom: 4px; }
.popup-body { margin: 16px 0 20px; font-size: .92rem; line-height: 1.8; }
.popup-sig { font-style: italic; color: var(--muted); margin-top: 12px; }

/* ── Empty state ── */
.empty-state { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--muted); }

/* ============================================================
   MOBILE — max-width 768px
   Nav hidden by default, slides in from left on toggle
   ============================================================ */
@media (max-width: 768px) {

  /* Show hamburger button */
  .nav-toggle { display: flex; }

  /* Nav hidden off-screen by default */
  .side-nav {
    transform: translateX(-100%);
    width: 240px;
    z-index: 100;
  }
  /* Nav slides in when .open added by JS */
  .side-nav.open { transform: translateX(0); }

  /* Always show labels inside the open nav */
  .side-nav ul li a span { display: inline !important; }
  .nav-logo img { display: block !important; max-width: 120px; }

  /* Content takes full width, top padding clears the hamburger button */
  .app-main {
    margin-left: 0 !important;
    padding: 70px 14px 28px;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Dashboard hero */
  .page-hero { padding: 18px; }
  .page-hero h1 { font-size: 1.2rem; }
  .hero-actions { gap: 8px; }
  .hero-actions .btn-primary,
  .hero-actions .btn-outline { padding: 9px 16px; font-size: .85rem; }

  /* Stack dash cards vertically */
  .dash-grid { grid-template-columns: 1fr; gap: 10px; margin-bottom: 18px; }
  .dash-card { padding: 18px 16px; display: flex; align-items: center; gap: 16px; text-align: left; }
  .dash-icon { font-size: 1.6rem; margin-bottom: 0; flex-shrink: 0; }
  .dash-card h3 { font-size: .95rem; margin-bottom: 2px; }
  .dash-card p { margin-bottom: 0; font-size: .82rem; }
  .btn-sm { display: none; } /* hide action btn inside card on mobile */

  /* Content grid: 2 cols on mobile */
  .content-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .content-thumb { height: 100px; }

  /* Account stacked */
  .account-grid { grid-template-columns: 1fr; gap: 16px; }

  /* Fields stacked */
  .field-row { grid-template-columns: 1fr; gap: 0; }

  /* Messages stacked */
  .msg-layout { grid-template-columns: 1fr; height: auto; min-height: unset; }
  .msg-sidebar { border-right: none; border-bottom: 1px solid var(--border); max-height: 260px; }
  .msg-body { padding: 16px; min-height: 260px; }

  /* Forum hide stats col */
  .topic-stats { display: none; }

  /* Filter bar horizontal scroll */
  .filter-bar { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
  .filter-bar::-webkit-scrollbar { height: 3px; }
  .filter-bar a { white-space: nowrap; flex-shrink: 0; }

  /* Modals slide up from bottom */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { border-radius: 16px 16px 0 0; max-height: 92vh; max-width: 100%; padding: 24px 20px; }

  /* Popup slide up */
  .popup-overlay { align-items: flex-end; padding: 0; }
  .popup { border-radius: 16px 16px 0 0; padding: 28px 20px; max-height: 92vh; }

  /* Content viewer */
  .content-viewer h1 { font-size: 1.2rem; }
  .video-wrap video { max-height: 56vw; }

  /* Page headers */
  .page-header h1 { font-size: 1.3rem; }
  .page-header { margin-bottom: 16px; }

  /* Resource rows */
  .resource-row { padding: 12px 14px; gap: 10px; }
  .resource-meta { flex-direction: column; align-items: flex-start; gap: 4px; }

  /* Forum replies */
  .reply-item { padding: 16px; }

  /* Section headers */
  .dash-section h2 { font-size: .95rem; }
}

/* Very small phones */
@media (max-width: 380px) {
  .content-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 24px 16px; }
  .page-hero h1 { font-size: 1.1rem; }
}