/* ══════════════════════════════════════════════════════════════
   OCIP — Complete Responsive Stylesheet
   Mobile-first, tested 320px → 4K
   ══════════════════════════════════════════════════════════════ */

/* ── CSS VARIABLES ─────────────────────────────────────────────── */
:root {
  --primary:      #1A1A2E;
  --secondary:    #C0392B;
  --accent:       #0F6E56;
  --text:         #1f2937;
  --text-light:   #6b7280;
  --text-lighter: #9ca3af;
  --bg:           #ffffff;
  --bg-light:     #f4f6f9;
  --border:       #e5e7eb;
  --success:      #22c55e;
  --warning:      #f59e0b;
  --error:        #ef4444;
  --info:         #3b82f6;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow:       0 1px 4px rgba(0,0,0,.08);
  --shadow-lg:    0 4px 20px rgba(0,0,0,.12);
  --transition:   all .2s ease;
  --font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --container:    1200px;
  --nav-h:        64px;
}

/* ── RESET ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; min-width: 320px; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--secondary); }
ul, ol { list-style: none; }
button { font-family: var(--font); cursor: pointer; }
input, textarea, select { font-family: var(--font); }

/* ── CONTAINER ─────────────────────────────────────────────────── */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px)  { .container { padding: 0 1.5rem; } }
@media (min-width: 1024px) { .container { padding: 0 2rem; } }

/* ── TYPOGRAPHY ────────────────────────────────────────────────── */
h1 { font-size: clamp(1.5rem, 4vw, 2.5rem); font-weight: 800; line-height: 1.2; }
h2 { font-size: clamp(1.25rem, 3vw, 2rem);  font-weight: 700; line-height: 1.3; }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.5rem); font-weight: 700; }
h4 { font-size: 1rem; font-weight: 700; }
p  { margin-bottom: .75rem; }
p:last-child { margin-bottom: 0; }

/* ── BUTTONS ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1.25rem; font-size: .9rem; font-weight: 600;
  border: 2px solid transparent; border-radius: var(--radius);
  cursor: pointer; transition: var(--transition); text-decoration: none;
  white-space: nowrap; line-height: 1.4; min-height: 40px;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary   { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.btn-primary:hover { background: #a93226; border-color: #a93226; color: #fff; }
.btn-outline   { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-success   { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-danger    { background: var(--error); color: #fff; border-color: var(--error); }
.btn-danger:hover  { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-ghost     { background: transparent; color: var(--text-light); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-light); color: var(--text); }
.btn-sm  { padding: .4rem .875rem; font-size: .8rem; min-height: 34px; }
.btn-lg  { padding: .875rem 1.75rem; font-size: 1rem; min-height: 48px; }
.btn-block { width: 100%; }
@media (max-width: 480px) { .btn { min-height: 44px; touch-action: manipulation; } }

/* ── NAVBAR ────────────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 1000;
  background: var(--bg); box-shadow: var(--shadow);
  height: var(--nav-h);
}
.navbar .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%; gap: 1rem;
}
.navbar-brand a {
  display: flex; align-items: center; gap: .5rem;
  font-size: 1.4rem; font-weight: 800; color: var(--primary);
}
.navbar-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; padding: .5rem;
  cursor: pointer; z-index: 1100;
  min-width: 44px; min-height: 44px;
  justify-content: center; align-items: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.navbar-toggle span {
  display: block; width: 24px; height: 2px;
  background: var(--primary); border-radius: 2px; transition: var(--transition);
}
.navbar-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar-toggle.open span:nth-child(2) { opacity: 0; }
.navbar-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.navbar-menu { display: flex; align-items: center; gap: 2rem; }
.navbar-nav  { display: flex; gap: 1.5rem; }
.nav-link    { font-weight: 500; color: var(--text); font-size: .9rem; padding: .25rem 0; position: relative; }
.nav-link::after { content:''; position:absolute; bottom:-2px; left:0; width:0; height:2px; background:var(--secondary); transition:width .2s; }
.nav-link:hover::after, .nav-link.active::after { width: 100%; }
.nav-link:hover, .nav-link.active { color: var(--secondary); }
/* Highlighted CTA nav item */
.nav-cta {
  background: var(--secondary) !important;
  color: #fff !important;
  padding: .3rem .875rem !important;
  border-radius: 20px !important;
  font-weight: 700 !important;
}
.nav-cta:hover { background: #a93226 !important; color: #fff !important; }
.nav-cta::after { display: none !important; }
.navbar-auth { display: flex; gap: .75rem; align-items: center; }

@media (max-width: 768px) {
  .navbar-toggle { display: flex; }
  .navbar-menu {
    display: none; position: fixed; inset: 0; top: var(--nav-h);
    background: var(--bg); flex-direction: column; align-items: stretch;
    padding: 1.5rem; gap: 0; overflow-y: auto; z-index: 999;
    box-shadow: var(--shadow-lg);
  }
  .navbar-menu.active { display: flex; }
  .navbar-nav { flex-direction: column; gap: 0; }
  .nav-link { display: block; padding: .875rem 0; font-size: 1rem; border-bottom: 1px solid var(--border); }
  .nav-link::after { display: none; }
  .navbar-auth { flex-direction: column; margin-top: 1.5rem; gap: .75rem; }
  .navbar-auth .btn { width: 100%; justify-content: center; }
}

/* ── FLASH MESSAGES ────────────────────────────────────────────── */
.flash-message {
  padding: .875rem 1rem; border-radius: var(--radius);
  display: flex; align-items: center; gap: .75rem;
  font-size: .9rem; margin: .5rem 0;
}
.flash-message .container { display: flex; align-items: center; gap: .75rem; width: 100%; }
.flash-close { background: none; border: none; font-size: 1.25rem; cursor: pointer; color: inherit; margin-left: auto; opacity: .7; }
.flash-close:hover { opacity: 1; }
.flash-success { background: #f0fdf4; color: #14532d; border: 1px solid #bbf7d0; }
.flash-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-warning { background: #fffbeb; color: #78350f; border: 1px solid #fde68a; }
.flash-info    { background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe; }

/* ── FORMS ─────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-weight: 600; font-size: .875rem; color: var(--text); margin-bottom: .4rem; }
.form-control {
  width: 100%; padding: .65rem .875rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .95rem; font-family: var(--font); color: var(--text);
  background: var(--bg); transition: var(--transition);
  -webkit-appearance: none; appearance: none;
}
.form-control:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(192,57,43,.1); }
.form-control::placeholder { color: var(--text-lighter); }
.form-control.error { border-color: var(--error); box-shadow: 0 0 0 3px rgba(239,68,68,.1); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { 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 fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2.5rem; }
.form-text { font-size: .8rem; color: var(--text-light); margin-top: .3rem; }
.form-check { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.form-check input { width: 18px; height: 18px; accent-color: var(--secondary); cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .form-control { font-size: 16px; min-height: 44px; } }

/* ── CARDS ─────────────────────────────────────────────────────── */
.card {
  background: var(--bg); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 1.5rem;
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: .5rem; }
.card-content { color: var(--text-light); font-size: .9rem; }
.card-footer { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
@media (max-width: 480px) { .card { padding: 1.1rem; } .card-grid { grid-template-columns: 1fr; } }

/* ── TABLES ────────────────────────────────────────────────────── */
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; min-width: 500px; }
.table th, .table td { padding: .875rem 1rem; text-align: left; border-bottom: 1px solid var(--border); font-size: .875rem; }
.table th { background: var(--bg-light); font-weight: 700; color: var(--primary); white-space: nowrap; }
.table tbody tr:hover { background: var(--bg-light); }
.table tbody tr:last-child td { border-bottom: none; }
@media (max-width: 640px) { .table th, .table td { padding: .65rem .75rem; font-size: .8rem; } }

/* ── BADGES ────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .2rem .65rem; border-radius: 20px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-success, .badge-active, .badge-signed, .badge-completed { background: #dcfce7; color: #14532d; }
.badge-warning, .badge-pending, .badge-ready, .badge-in_progress { background: #fef9c3; color: #713f12; }
.badge-error, .badge-danger, .badge-failed, .badge-expired { background: #fee2e2; color: #7f1d1d; }
.badge-info, .badge-open, .badge-draft { background: #dbeafe; color: #1e3a8a; }
.badge-secondary, .badge-closed, .badge-archived { background: #f3f4f6; color: #374151; }
.badge-purple, .badge-invoiced, .badge-enterprise { background: #ede9fe; color: #4c1d95; }
.badge-free { background: #fef3c7; color: #92400e; }
.badge-premium { background: #dcfce7; color: #065f46; }

/* ── HERO SLIDER ───────────────────────────────────────────────── */
.hero-slider {
  position: relative; overflow: hidden;
  min-height: clamp(480px, 70vh, 680px);
  display: flex; align-items: stretch;
}

/* Individual slides — stacked, crossfade */
.hero-slide {
  position: absolute; inset: 0;
  display: flex; align-items: center;
  opacity: 0; transition: opacity .9s ease;
  pointer-events: none;
}
.hero-slide.active {
  opacity: 1; pointer-events: auto;
  position: relative; /* takes up space when active */
  min-height: clamp(480px, 70vh, 680px);
}

/* Dark overlay for readability */
.hero-slide-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.35);
  pointer-events: none;
}
.hero-slide-overlay--pattern {
  background-image:
    radial-gradient(circle at 20% 50%, rgba(192,57,43,.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(15,110,86,.12) 0%, transparent 40%),
    rgba(0,0,0,.4);
}

/* Slide content */
.hero-slide-content {
  position: relative; z-index: 2;
  color: #fff; text-align: center;
  padding: clamp(3rem, 8vw, 6rem) 0;
  animation: heroFadeUp .8s ease both;
}
.hero-slide:not(.active) .hero-slide-content { animation: none; }

@keyframes heroFadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero-slide-tag {
  display: inline-block;
  background: rgba(192,57,43,.85);
  color: #fff; font-size: .75rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  padding: .3rem .9rem; border-radius: 20px;
  margin-bottom: 1.1rem;
}
.hero-slide-content h1 {
  color: #fff; margin-bottom: 1rem;
  text-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.hero-slide-content p {
  font-size: clamp(.95rem, 2vw, 1.2rem);
  opacity: .92; max-width: 680px;
  margin: 0 auto 1.75rem;
  text-shadow: 0 1px 6px rgba(0,0,0,.3);
}

/* Outline white button variant */
.btn-outline-white {
  background: transparent; color: #fff;
  border: 2px solid rgba(255,255,255,.75);
}
.btn-outline-white:hover {
  background: rgba(255,255,255,.15);
  border-color: #fff; color: #fff;
}

/* Arrows */
.hero-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 10; background: rgba(255,255,255,.15);
  border: 2px solid rgba(255,255,255,.4);
  color: #fff; width: 46px; height: 46px;
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: background .2s, border-color .2s;
  backdrop-filter: blur(4px);
}
.hero-arrow:hover { background: rgba(255,255,255,.3); border-color: #fff; }
.hero-arrow--prev { left: 1.25rem; }
.hero-arrow--next { right: 1.25rem; }

/* Dots */
.hero-dots {
  position: absolute; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  z-index: 10; display: flex; gap: .5rem;
}
.hero-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,.45); border: none; cursor: pointer;
  transition: background .25s, transform .25s; padding: 0;
}
.hero-dot.active { background: #fff; transform: scale(1.3); }
.hero-dot:hover  { background: rgba(255,255,255,.8); }

/* Progress bar */
.hero-progress {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px; background: rgba(255,255,255,.2); z-index: 10;
}
.hero-progress-bar {
  height: 100%; width: 0%;
  background: var(--secondary);
}

/* Stats bar below slider */
.hero-stats-bar {
  background: var(--primary);
  padding: 1.75rem 0;
  border-bottom: 3px solid var(--secondary);
}
.hero-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.5rem; text-align: center;
}
.hero-stat { color: #fff; }
.hero-stat-number { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 800; color: var(--secondary); }
.hero-stat-label  { font-size: .875rem; opacity: .8; }

/* Responsive */
@media (max-width: 640px) {
  .hero-arrow { width: 38px; height: 38px; font-size: .85rem; }
  .hero-arrow--prev { left: .6rem; }
  .hero-arrow--next { right: .6rem; }
  .hero-slide-content .hero-buttons { flex-direction: column; align-items: stretch; }
  .hero-slide-content .hero-buttons .btn { width: 100%; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
}

/* Legacy .hero class kept for any other pages that use it */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #2c3e50 100%);
  color: #fff; padding: clamp(3rem, 8vw, 6rem) 0; text-align: center;
}
.hero h1 { color: #fff; margin-bottom: 1rem; }
.hero p  { font-size: clamp(.95rem, 2vw, 1.2rem); opacity: .9; max-width: 700px; margin: 0 auto 1.5rem; }
.hero-buttons { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* ── SECTIONS ──────────────────────────────────────────────────── */
.section       { padding: clamp(2.5rem, 6vw, 5rem) 0; }
.section-light { background: var(--bg-light); }
.section-dark  { background: var(--primary); color: #fff; }
.section-dark .section-header h2 { color: #fff; }
.section-dark .section-header p  { color: rgba(255,255,255,.8); }
.section-header { text-align: center; margin-bottom: clamp(1.5rem, 4vw, 3rem); }
.section-header h2 { color: var(--primary); margin-bottom: .75rem; }
.section-header p  { color: var(--text-light); font-size: clamp(.9rem, 2vw, 1.1rem); max-width: 650px; margin: 0 auto; }

/* ── EPISODE CARDS ─────────────────────────────────────────────── */
.episode-card { display: flex; flex-direction: column; height: 100%; }
.episode-number { display: inline-block; background: var(--secondary); color: #fff; padding: .2rem .75rem; border-radius: 20px; font-size: .8rem; font-weight: 700; margin-bottom: .5rem; }
.episode-sector { color: var(--text-lighter); font-size: .8rem; margin-bottom: .5rem; }
.episode-excerpt { color: var(--text-light); flex-grow: 1; font-size: .9rem; }
.episode-meta { display: flex; justify-content: space-between; align-items: center; padding-top: .875rem; border-top: 1px solid var(--border); color: var(--text-lighter); font-size: .8rem; flex-wrap: wrap; gap: .5rem; }

/* ── PRICING CARDS ─────────────────────────────────────────────── */
.pricing-card { text-align: center; position: relative; }
.pricing-card.popular { border: 2px solid var(--secondary); }
.pricing-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--secondary); color: #fff; padding: .2rem 1rem; border-radius: 20px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.pricing-price { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; color: var(--primary); margin: 1rem 0; }
.pricing-price span { font-size: .9rem; font-weight: 400; color: var(--text-light); }
.pricing-features { list-style: none; margin: 1rem 0 1.5rem; text-align: left; }
.pricing-features li { padding: .4rem 0; display: flex; align-items: center; gap: .5rem; font-size: .875rem; }
.pricing-features li i { color: var(--success); flex-shrink: 0; }

/* ── FOOTER ────────────────────────────────────────────────────── */
.footer {
  background: #0d1117;
  color: #fff;
  padding: clamp(2.5rem, 6vw, 4rem) 0 1.5rem;
  border-top: 5px solid #c0392b;
  position: relative;
  z-index: 10;
  display: block !important;
  visibility: visible !important;
  margin-top: 0;
}
/* Extra bottom padding when sticky CTA bar is visible */
body.has-sticky-bar .footer { padding-bottom: 5rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; margin-bottom: 2.5rem; }
.footer-brand h3 { font-size: 1.4rem; font-weight: 800; margin-bottom: .25rem; }
.footer-brand p  { opacity: .7; font-size: .875rem; }
.footer-description { opacity: .75; font-size: .875rem; margin: .875rem 0; line-height: 1.7; }
.footer-social { display: flex; gap: .875rem; }
.footer-social a { color: rgba(255,255,255,.7); font-size: 1.1rem; transition: var(--transition); }
.footer-social a:hover { color: #fff; }
.footer-section h4 { font-size: .95rem; font-weight: 700; margin-bottom: 1rem; }
.footer-links, .footer-contact { list-style: none; }
.footer-links li, .footer-contact li { margin-bottom: .5rem; }
.footer-links a, .footer-contact a { color: rgba(255,255,255,.7); font-size: .875rem; transition: var(--transition); }
.footer-links a:hover, .footer-contact a:hover { color: #fff; }
.footer-contact li { display: flex; align-items: flex-start; gap: .75rem; font-size: .875rem; color: rgba(255,255,255,.7); }
.footer-contact i { color: var(--secondary); margin-top: .2rem; flex-shrink: 0; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 1.25rem; }
.footer-bottom-content { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; opacity: .7; flex-wrap: wrap; gap: .75rem; }
.footer-bottom-links { display: flex; gap: 1rem; }
.footer-bottom-links a { color: rgba(255,255,255,.7); font-size: .8rem; }
.footer-bottom-links a:hover { color: #fff; }
@media (max-width: 640px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-bottom-content { flex-direction: column; text-align: center; }
}
@media (max-width: 400px) { .footer-grid { grid-template-columns: 1fr; } }

/* ── PAGINATION ────────────────────────────────────────────────── */
.pagination { display: flex; justify-content: center; gap: .4rem; margin: 1.5rem 0; flex-wrap: wrap; }
.pagination-link, .pagination-current {
  padding: .45rem .875rem; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: .875rem; min-width: 38px; text-align: center;
}
.pagination-current { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }
.pagination-link:hover { background: var(--bg-light); }

/* ── STAT CARDS ────────────────────────────────────────────────── */
.stat-card { background: var(--bg); border-radius: var(--radius-lg); padding: 1.25rem 1.5rem; box-shadow: var(--shadow); border-left: 4px solid var(--primary); }
.stat-label { font-size: .75rem; color: var(--text-light); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .4rem; }
.stat-value { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; color: var(--primary); }
.stat-card.green  { border-left-color: var(--success); }
.stat-card.red    { border-left-color: var(--error); }
.stat-card.orange { border-left-color: var(--warning); }
.stat-card.blue   { border-left-color: var(--info); }
.stat-card.purple { border-left-color: #8b5cf6; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
@media (max-width: 480px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 360px) { .stats-grid { grid-template-columns: 1fr; } }

/* ── PORTAL NAV (user/admin shared) ───────────────────────────── */
.portal-nav {
  background: var(--bg); box-shadow: var(--shadow);
  padding: 0 1.5rem; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 1000; gap: 1rem;
}
.portal-nav .brand { font-size: 1.25rem; font-weight: 800; color: var(--primary); text-decoration: none; flex-shrink: 0; }
.portal-nav .nav-links { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.portal-nav .nav-links a { color: var(--text); font-size: .875rem; font-weight: 500; white-space: nowrap; }
.portal-nav .nav-links a:hover { color: var(--secondary); }
.portal-nav .nav-toggle { display: none; background: none; border: none; padding: .5rem; cursor: pointer; flex-direction: column; gap: 5px; }
.portal-nav .nav-toggle span { display: block; width: 22px; height: 2px; background: var(--primary); border-radius: 2px; transition: var(--transition); }
@media (max-width: 768px) {
  .portal-nav .nav-toggle { display: flex; }
  .portal-nav .nav-links {
    display: none; position: fixed; top: var(--nav-h); left: 0; right: 0; bottom: 0;
    background: var(--bg); flex-direction: column; align-items: stretch;
    padding: 1.5rem; gap: 0; overflow-y: auto; z-index: 999; box-shadow: var(--shadow-lg);
  }
  .portal-nav .nav-links.open { display: flex; }
  .portal-nav .nav-links a { padding: .875rem 0; border-bottom: 1px solid var(--border); font-size: 1rem; }
}

/* ── ADMIN NAV ─────────────────────────────────────────────────── */
.admin-nav { background: var(--primary); }
.admin-nav .nav-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; height: var(--nav-h); gap: 1rem;
}
.admin-nav .brand { color: #fff; font-size: 1.1rem; font-weight: 800; text-decoration: none; flex-shrink: 0; white-space: nowrap; }
.admin-nav .nav-links { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.admin-nav .nav-links a { color: rgba(255,255,255,.8); font-size: .85rem; font-weight: 500; white-space: nowrap; }
.admin-nav .nav-links a:hover { color: #fff; }
.admin-nav .nav-toggle { display: none; background: none; border: none; padding: .5rem; cursor: pointer; flex-direction: column; gap: 5px; }
.admin-nav .nav-toggle span { display: block; width: 22px; height: 2px; background: #fff; border-radius: 2px; }
@media (max-width: 900px) {
  .admin-nav .nav-toggle { display: flex; }
  .admin-nav .nav-links {
    display: none; position: fixed; top: var(--nav-h); left: 0; right: 0; bottom: 0;
    background: var(--primary); flex-direction: column; align-items: stretch;
    padding: 1.5rem; gap: 0; overflow-y: auto; z-index: 999;
  }
  .admin-nav .nav-links.open { display: flex; }
  .admin-nav .nav-links a { padding: .875rem 0; border-bottom: 1px solid rgba(255,255,255,.1); font-size: 1rem; color: rgba(255,255,255,.9); }
}

/* ── PORTAL WRAP ───────────────────────────────────────────────── */
.portal-wrap  { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem; }
.admin-wrap   { max-width: 1400px; margin: 0 auto; padding: 1.5rem 1rem; }
@media (min-width: 640px)  { .portal-wrap, .admin-wrap { padding: 2rem 1.5rem; } }
@media (min-width: 1024px) { .portal-wrap, .admin-wrap { padding: 2rem 2rem; } }

/* ── SECTION CARDS (admin/portal) ─────────────────────────────── */
.section-card { background: var(--bg); border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.section-card h2 { font-size: 1rem; font-weight: 700; color: var(--primary); border-bottom: 1px solid var(--border); padding-bottom: .75rem; margin-bottom: 1.1rem; display: flex; align-items: center; gap: .5rem; }
@media (max-width: 480px) { .section-card { padding: 1rem; } }

/* ── TWO-COLUMN LAYOUT ─────────────────────────────────────────── */
.layout-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.layout-sidebar { display: grid; grid-template-columns: 300px 1fr; gap: 1.5rem; }
.layout-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
@media (max-width: 900px) { .layout-sidebar { grid-template-columns: 1fr; } }
@media (max-width: 768px) { .layout-2col, .layout-3col { grid-template-columns: 1fr; } }

/* ── QUICK LINKS GRID ──────────────────────────────────────────── */
.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.ql-card {
  background: var(--bg); border-radius: var(--radius-lg); padding: 1.25rem;
  box-shadow: var(--shadow); text-decoration: none; color: var(--text);
  transition: var(--transition); border: 1px solid transparent;
  display: flex; flex-direction: column; align-items: flex-start; gap: .4rem;
}
.ql-card:hover { border-color: var(--secondary); transform: translateY(-2px); box-shadow: var(--shadow-lg); color: var(--text); }
.ql-card i { font-size: 1.4rem; color: var(--secondary); }
.ql-card h4 { font-size: .875rem; font-weight: 700; }
.ql-card p  { font-size: .775rem; color: var(--text-light); margin: 0; }
@media (max-width: 480px) { .quick-links { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 360px) { .quick-links { grid-template-columns: 1fr; } }

/* ── TABS ──────────────────────────────────────────────────────── */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tab-btn {
  padding: .75rem 1.1rem; background: none; border: none; cursor: pointer;
  font-size: .875rem; font-weight: 600; color: var(--text-light);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  white-space: nowrap; transition: var(--transition);
}
.tab-btn.active { color: var(--secondary); border-bottom-color: var(--secondary); }
.tab-btn:hover  { color: var(--text); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── ALERTS ────────────────────────────────────────────────────── */
.alert { padding: .875rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; display: flex; align-items: flex-start; gap: .75rem; font-size: .875rem; }
.alert-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: .1rem; }
.alert-content { flex: 1; }
.alert-title { font-weight: 700; margin-bottom: .2rem; }
.alert-high    { background: #fef2f2; border: 1px solid #fecaca; }
.alert-high .alert-icon { color: var(--error); }
.alert-medium  { background: #fffbeb; border: 1px solid #fde68a; }
.alert-medium .alert-icon { color: var(--warning); }
.alert-low     { background: #eff6ff; border: 1px solid #bfdbfe; }
.alert-low .alert-icon { color: var(--info); }

/* ── UTILITIES ─────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }
.d-none   { display: none !important; }
.d-flex   { display: flex; }
.d-grid   { display: grid; }
.d-block  { display: block; }
.w-100    { width: 100%; }
.mt-1 { margin-top: .5rem; }  .mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; }  .mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; } .mb-4 { margin-bottom: 2rem; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; } .gap-3 { gap: 1.5rem; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── AUTH PAGES ────────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-light); padding: 1.5rem 1rem; }
.auth-card { background: var(--bg); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 2.5rem; width: 100%; max-width: 460px; }
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-logo a { font-size: 2rem; font-weight: 800; color: var(--primary); }
.auth-title { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; color: var(--primary); }
.auth-sub   { color: var(--text-light); margin-bottom: 1.5rem; font-size: .9rem; }
.divider { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.divider span { color: var(--text-lighter); font-size: .8rem; }
@media (max-width: 480px) { .auth-card { padding: 1.5rem 1.25rem; } }

/* ── PAGE HEADER ───────────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: clamp(1.25rem, 3vw, 1.75rem); font-weight: 800; color: var(--primary); }
.page-header p  { color: var(--text-light); margin-top: .25rem; font-size: .9rem; }
.page-header-row { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }

/* ── COST TABLE ────────────────────────────────────────────────── */
.cost-table { width: 100%; border-collapse: collapse; }
.cost-table th, .cost-table td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); font-size: .875rem; }
.cost-table th { background: var(--bg-light); font-weight: 700; color: var(--primary); }
.cost-table input { width: 100%; padding: .45rem .65rem; border: 1px solid var(--border); border-radius: 6px; font-size: .875rem; }
.cost-table input:focus { outline: none; border-color: var(--secondary); }
@media (max-width: 600px) { .cost-table th, .cost-table td { padding: .5rem .6rem; font-size: .8rem; } }

/* ── CATEGORY CARDS ────────────────────────────────────────────── */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.1rem; }
.cat-card { background: var(--bg); border-radius: var(--radius-lg); padding: 1.25rem; box-shadow: var(--shadow); }
.cat-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: .75rem; display: flex; align-items: center; gap: .5rem; }
.cat-bar { height: 8px; background: var(--bg-light); border-radius: 4px; overflow: hidden; margin: .5rem 0; }
.cat-bar-fill { height: 100%; background: var(--secondary); border-radius: 4px; transition: width .5s ease; }
@media (max-width: 480px) { .cat-grid { grid-template-columns: 1fr; } }

/* ── MEDIA GRID ────────────────────────────────────────────────── */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.media-card { background: var(--bg); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.media-thumb { width: 100%; height: 110px; object-fit: cover; background: var(--bg-light); display: flex; align-items: center; justify-content: center; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-thumb .icon { font-size: 2rem; color: var(--text-lighter); }
.media-info { padding: .65rem .75rem; }
.media-name { font-size: .75rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-size { font-size: .7rem; color: var(--text-light); }
@media (max-width: 480px) { .media-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── PAYWALL ───────────────────────────────────────────────────── */
.paywall { background: linear-gradient(135deg, var(--primary), #2c3e50); color: #fff; border-radius: var(--radius-lg); padding: clamp(1.5rem, 4vw, 2.5rem); text-align: center; margin-top: 2rem; }
.paywall h2 { color: #fff; margin-bottom: .75rem; }
.paywall p  { opacity: .85; margin-bottom: 1.5rem; }
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.pkg-card { background: rgba(255,255,255,.1); border-radius: var(--radius-lg); padding: 1.5rem; border: 1px solid rgba(255,255,255,.2); }
.pkg-card.highlight { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.5); }
.pkg-price { font-size: 1.75rem; font-weight: 800; margin: .5rem 0; }
.pkg-features { list-style: none; padding: 0; margin: .75rem 0 1.25rem; font-size: .85rem; opacity: .9; }
.pkg-features li { padding: .25rem 0; }
.pkg-features li::before { content: '✓ '; }
@media (max-width: 480px) { .pkg-grid { grid-template-columns: 1fr; } }

/* ── PRINT STYLES ──────────────────────────────────────────────── */
@media print {
  .navbar, .portal-nav, .admin-nav, .footer, .btn, .flash-message, .no-print { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .card, .section-card { box-shadow: none; border: 1px solid #ddd; }
  a { color: #000; text-decoration: underline; }
  .container, .portal-wrap, .admin-wrap { max-width: 100%; padding: 0; }
}

/* ── RESPONSIVE BREAKPOINT HELPERS ────────────────────────────── */
@media (max-width: 1024px) { .hide-lg { display: none !important; } }
@media (max-width: 768px)  { .hide-md { display: none !important; } }
@media (max-width: 480px)  { .hide-sm { display: none !important; } }
@media (min-width: 769px)  { .show-mobile { display: none !important; } }

/* ── SCROLLBAR ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-light); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── FOCUS VISIBLE ─────────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--secondary); outline-offset: 2px; }

/* ── SELECTION ─────────────────────────────────────────────────── */
::selection { background: rgba(192,57,43,.15); color: var(--text); }
