:root {
  --primary: #0d6e3f;
  --primary-dark: #0a5530;
  --primary-light: #e8f5ee;
  --accent: #f0a500;
  --danger: #c0392b;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f8faf9;
  --card: #ffffff;
  --sidebar: #0d3b24;
  --sidebar-text: #d1e7dd;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navbar */
.navbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.logo {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
}
.logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: .85rem;
}
.nav-links { display: flex; gap: 1.25rem; flex: 1; }
.nav-links a { color: var(--text); font-weight: 500; font-size: .925rem; text-decoration: none; }
.nav-links a:hover, .nav-links a.active { color: var(--primary); }
.nav-auth { display: flex; gap: .75rem; align-items: center; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1.1rem; border-radius: var(--radius); font-weight: 600;
  font-size: .9rem; border: none; cursor: pointer; text-decoration: none;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); text-decoration: none; }
.btn-accent { background: var(--accent); color: #1a1a1a; }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-block { width: 100%; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #0a4d2e 100%);
  color: #fff;
  padding: 3.5rem 1.25rem 4rem;
  text-align: center;
}
.hero h1 { font-size: 2.25rem; font-weight: 800; margin-bottom: .5rem; letter-spacing: -.02em; }
.hero p { opacity: .9; font-size: 1.1rem; margin-bottom: 2rem; }

/* Search box */
.search-box {
  background: var(--card);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 900px;
  margin: -2.5rem auto 2rem;
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
  position: relative;
  z-index: 10;
}
.search-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr auto;
  gap: .75rem;
  align-items: end;
}
@media (max-width: 900px) {
  .search-grid { grid-template-columns: 1fr 1fr; }
  .search-grid .span-2 { grid-column: span 2; }
}
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-group label { font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.form-control {
  padding: .6rem .85rem; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: .925rem; background: #fff; width: 100%;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,110,63,.15); }

/* Stats */
.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem;
  max-width: 900px; margin: 0 auto 2.5rem; padding: 0 1.25rem;
}
@media (max-width: 600px) { .stats-row { grid-template-columns: 1fr 1fr; } }
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 1.25rem; text-align: center;
  box-shadow: var(--shadow);
}
.stat-card .num { font-size: 1.75rem; font-weight: 800; color: var(--primary); }
.stat-card .label { font-size: .8rem; color: var(--muted); text-transform: uppercase; }

/* Container */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem; }
.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.25rem; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .85rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f3f4f6; font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tr:hover td { background: #f9fafb; }
.badge {
  display: inline-block; padding: .2rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
}
.badge-public { background: #dbeafe; color: #1e40af; }
.badge-private { background: #fce7f3; color: #9d174d; }
.badge-mission { background: #fef3c7; color: #92400e; }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-secondary { background: #e0e7ff; color: #3730a3; }

/* Alerts */
.alert {
  padding: .85rem 1.1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* Cards */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.5rem; margin-bottom: 1.25rem;
}
.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }

/* Plan limits banner */
.plan-banner {
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  border: 1px solid #f59e0b;
  border-radius: var(--radius);
  padding: .85rem 1.25rem;
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.25rem; font-size: .9rem;
}

/* Pricing cards */
.pricing-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem;
}
.pricing-card {
  background: var(--card); border-radius: 12px; padding: 1.75rem; box-shadow: var(--shadow);
  border: 2px solid transparent; position: relative;
}
.pricing-card.featured { border-color: var(--primary); }
.pricing-card h3 { font-size: 1.15rem; margin-bottom: .25rem; }
.pricing-card .price { font-size: 2rem; font-weight: 800; color: var(--primary); margin: .5rem 0 1rem; }
.pricing-card .price span { font-size: .9rem; font-weight: 500; color: var(--muted); }
.pricing-card ul { list-style: none; margin-bottom: 1.5rem; }
.pricing-card ul li { padding: .35rem 0; font-size: .9rem; display: flex; gap: .5rem; }
.pricing-card ul li::before { content: '✓'; color: var(--primary); font-weight: 700; }

/* Auth layout */
.auth-page {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, #0d6e3f 0%, #0a3d24 100%);
  padding: 2rem;
}
.auth-card {
  background: #fff; border-radius: 12px; padding: 2.25rem; width: 100%; max-width: 420px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.auth-card h1 { font-size: 1.5rem; margin-bottom: .25rem; }
.auth-card .sub { color: var(--muted); margin-bottom: 1.5rem; font-size: .9rem; }
.auth-card .form-group { margin-bottom: 1rem; }
.auth-footer { text-align: center; margin-top: 1.25rem; font-size: .9rem; color: var(--muted); }

/* Customer / Admin layout */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: var(--sidebar); color: var(--sidebar-text);
  flex-shrink: 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  padding: 1.25rem; font-weight: 700; font-size: 1rem; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: .5rem;
}
.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: .65rem; padding: .6rem 1.25rem;
  color: var(--sidebar-text); font-size: .875rem; text-decoration: none; transition: background .1s;
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-nav .section-label {
  padding: .75rem 1.25rem .35rem; font-size: .7rem; text-transform: uppercase;
  letter-spacing: .06em; color: rgba(255,255,255,.4); font-weight: 600;
}
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem; display: flex; justify-content: space-between; align-items: center;
}
.topbar-user { font-size: .9rem; color: var(--muted); }
.content-area { padding: 1.5rem; flex: 1; }

/* Footer */
.footer {
  background: #0a3d24; color: rgba(255,255,255,.7); padding: 2rem 1.25rem; margin-top: 3rem;
  text-align: center; font-size: .85rem;
}
.footer a { color: #fff; }

/* Pagination */
.pagination { display: flex; gap: .4rem; margin-top: 1.25rem; justify-content: center; }
.pagination a, .pagination span {
  padding: .4rem .75rem; border-radius: var(--radius); border: 1px solid var(--border);
  font-size: .85rem; background: var(--card); color: var(--text); text-decoration: none;
}
.pagination a:hover { background: var(--primary-light); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Empty state */
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty svg { opacity: .4; margin-bottom: 1rem; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .nav-links { display: none; }
}

/* ── Advanced UI ─────────────────────────────────────────── */
.logo-img { height: 36px; width: auto; display: block; }
.logo-text { font-weight: 700; }
.nav-toggle { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; }

.hero-advanced {
  padding: 4rem 1.25rem 5rem;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(255,255,255,.12), transparent 50%),
    linear-gradient(135deg, #0d6e3f 0%, #0a4d2e 55%, #063820 100%);
}
.hero-inner { max-width: 720px; margin: 0 auto; text-align: center; }
.hero-badge {
  display: inline-block; background: rgba(255,255,255,.15); color: #fff;
  padding: .3rem .75rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
  margin-bottom: 1rem; letter-spacing: .02em;
}
.hero-sub { opacity: .92; font-size: 1.1rem; margin: .75rem 0 1.5rem; line-height: 1.55; }
.hero-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }
.btn-ghost {
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35);
}
.btn-ghost:hover { background: rgba(255,255,255,.22); color: #fff; text-decoration: none; }
.btn-lg { padding: .7rem 1.35rem; font-size: 1rem; }
.form-control-lg { padding: .85rem 1rem; font-size: 1.05rem; }

.search-box-lg { max-width: 960px; padding: 1.75rem; }
.search-box-header { margin-bottom: 1.15rem; }
.search-box-header h2 { font-size: 1.2rem; margin-bottom: .2rem; }
.search-box-header p { color: var(--muted); font-size: .9rem; }
.search-grid-advanced {
  grid-template-columns: repeat(3, 1fr);
}
.search-grid-advanced .span-full { grid-column: 1 / -1; }
@media (max-width: 800px) {
  .search-grid-advanced { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .search-grid-advanced { grid-template-columns: 1fr; }
}

.feature-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.15rem;
  margin-bottom: 2rem;
}
.feature-card {
  background: var(--card); border-radius: 12px; padding: 1.35rem; box-shadow: var(--shadow);
  text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s;
  border: 1px solid transparent;
}
.feature-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.1); border-color: var(--primary-light); text-decoration: none; }
.feature-icon { font-size: 1.75rem; margin-bottom: .5rem; }
.feature-card h3 { font-size: 1.05rem; margin-bottom: .35rem; }
.feature-card p { color: var(--muted); font-size: .88rem; line-height: 1.45; }

.footer-grid {
  max-width: 1200px; margin: 0 auto 1.25rem; display: grid;
  grid-template-columns: 2fr 1fr; gap: 1.5rem; text-align: left; padding: 0 1.25rem;
}
.footer-grid a { display: block; color: #fff; margin: .35rem 0; opacity: .85; }
.footer-copy { opacity: .6; }

/* Downloads */
.downloads-layout {
  display: grid; grid-template-columns: 240px 1fr; gap: 1.25rem; align-items: start;
}
@media (max-width: 800px) {
  .downloads-layout { grid-template-columns: 1fr; }
}
.folder-tree .tree { list-style: none; }
.folder-tree .tree a {
  display: block; padding: .4rem .5rem; border-radius: 6px; color: var(--text);
  text-decoration: none; font-size: .9rem;
}
.folder-tree .tree a:hover, .folder-tree .tree a.active {
  background: var(--primary-light); color: var(--primary-dark);
}
.folder-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .85rem;
  margin-bottom: 1.5rem;
}
.folder-card {
  display: flex; align-items: center; gap: .75rem; padding: 1rem;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: inherit; border: 1px solid var(--border);
}
.folder-card:hover { border-color: var(--primary); text-decoration: none; }
.folder-card-admin { justify-content: space-between; }
.folder-icon { font-size: 1.5rem; }
.file-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .85rem;
}
.file-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; display: flex; flex-direction: column; gap: .65rem; box-shadow: var(--shadow);
}
.file-icon { font-size: 1.75rem; }
.file-actions { display: flex; gap: .4rem; margin-top: auto; }
.section-label {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  font-weight: 700; margin: 1.25rem 0 .65rem;
}
.breadcrumbs { font-size: .85rem; color: var(--muted); margin-bottom: .5rem; }
.breadcrumbs a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.page-header-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }

.preview-header { margin-bottom: 1rem; }
.preview-title-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.file-icon-lg { font-size: 2.5rem; }
.preview-frame {
  width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: 8px; background: #f9fafb;
}
.preview-image-wrap { text-align: center; }
.preview-image-wrap img { max-width: 100%; max-height: 75vh; border-radius: 8px; }
.preview-text {
  background: #1e1e1e; color: #d4d4d4; padding: 1rem; border-radius: 8px;
  overflow: auto; max-height: 70vh; font-size: .85rem; white-space: pre-wrap;
}

.admin-media-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem;
}
@media (max-width: 700px) {
  .admin-media-grid { grid-template-columns: 1fr; }
}
.check { display: flex; align-items: center; gap: .4rem; font-size: .9rem; cursor: pointer; }

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links { display: none; width: 100%; flex-direction: column; }
  .nav-links.open { display: flex; }
  .navbar-inner { flex-wrap: wrap; }
}

/* Navbar responsive polish */
.navbar-inner {
  max-width: 1280px;
  flex-wrap: nowrap;
  gap: 1rem;
}
.logo-text {
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: .95rem;
}
.nav-links {
  flex-wrap: wrap;
  gap: .65rem 1rem;
  justify-content: center;
}
.nav-links a {
  font-size: .875rem;
  white-space: nowrap;
}
.nav-auth { flex-shrink: 0; }

@media (max-width: 1100px) {
  .nav-links { gap: .5rem .75rem; }
  .logo-text { max-width: 120px; }
}
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .nav-links {
    display: none;
    width: 100%;
    order: 4;
    flex-direction: column;
    padding: .5rem 0 1rem;
    border-top: 1px solid var(--border);
    margin-top: .5rem;
  }
  .nav-links.open { display: flex; }
  .nav-auth { order: 3; }
  .navbar-inner { flex-wrap: wrap; }
}

/* Sidebar scroll + width */
.sidebar {
  width: 250px;
  overflow-y: auto;
}
.sidebar-admin { background: #111827 !important; }
.sidebar-nav a {
  border-radius: 6px;
  margin: 0 .5rem;
  padding: .55rem 0.85rem;
}
.sidebar-nav a.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}

/* Downloads missing-table banner */
.migrate-hint {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: .92rem;
  line-height: 1.5;
}
.migrate-hint code {
  background: #ffedd5;
  padding: .1rem .35rem;
  border-radius: 4px;
  font-size: .85em;
}

/* Search form tighter on home */
.search-grid-advanced {
  align-items: end;
}
.form-group-btn .btn { width: 100%; }

/* Hero CTA ghost on green */
.btn-ghost {
  background: rgba(255,255,255,.12);
  color: #fff !important;
  border: 1px solid rgba(255,255,255,.4);
}
.btn-ghost:hover {
  background: rgba(255,255,255,.22);
  text-decoration: none;
}

/* Auth split layout */
.auth-body { min-height: 100vh; margin: 0; background: #f0f4f1; }
.auth-split {
  display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh;
}
.auth-panel-brand {
  background: linear-gradient(160deg, #0d6e3f, #0a3d24);
  color: #fff; padding: 3rem 2.5rem; display: flex; flex-direction: column; justify-content: center;
}
.auth-panel-brand h2 { font-size: 1.75rem; margin: 2rem 0 1rem; line-height: 1.3; }
.auth-panel-brand ul { list-style: none; line-height: 1.9; opacity: .92; font-size: .95rem; }
.auth-panel-brand ul li::before { content: '✓ '; font-weight: 700; }
.auth-panel-form {
  padding: 2.5rem; max-width: 460px; margin: auto; width: 100%;
}
.auth-panel-form h1 { font-size: 1.5rem; margin-bottom: .25rem; }
.auth-panel-form .sub { color: var(--muted); margin-bottom: 1.25rem; font-size: .9rem; }
.reg-steps {
  display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.25rem; font-size: .78rem; font-weight: 600;
}
.reg-steps span {
  padding: .35rem .65rem; border-radius: 999px; background: #e5e7eb; color: #6b7280;
}
.reg-steps span.on { background: var(--primary-light); color: var(--primary-dark); }
.portal-hero { margin-bottom: 1.25rem; background: linear-gradient(90deg, #e8f5ee, #fff); }
@media (max-width: 800px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-panel-brand { padding: 1.75rem; min-height: auto; }
  .auth-panel-brand h2 { font-size: 1.25rem; margin: 1rem 0 .5rem; }
}

.navbar { position: sticky; top: 0; z-index: 200; }
.topbar-sticky { position: sticky; top: 0; z-index: 50; background: var(--card); }
.wa-float {
  position: fixed; right: 18px; bottom: 18px; z-index: 999;
  width: 56px; height: 56px; border-radius: 50%;
  background: #25d366; color: #fff; display: grid; place-items: center;
  font-size: 1.5rem; text-decoration: none;
  box-shadow: 0 6px 20px rgba(37,211,102,.45);
}
.wa-float:hover { transform: scale(1.05); color: #fff; text-decoration: none; }
.pay-methods { display: grid; gap: 1rem; }
.pay-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 1.15rem;
  background: #fafafa;
}
.pay-card h3 { margin: 0 0 .35rem; font-size: 1.05rem; }

/* Live search */
.live-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,.12); z-index: 50; max-height: 320px; overflow: auto;
}
.form-group { position: relative; }
.live-item {
  display: block; padding: .65rem .9rem; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
}
.live-item:hover { background: var(--primary-light); }
.live-item span { display: block; font-size: .8rem; color: var(--muted); }
.live-empty, .live-more { padding: .75rem; font-size: .85rem; color: var(--muted); }

/* Pagination First/Prev/Next/Last */
.pagination { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: 1.25rem 0; }
.pagination a, .pagination span {
  min-width: 2.25rem; height: 2.25rem; padding: 0 .55rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--border); font-size: .875rem; text-decoration: none; color: var(--text);
}
.pagination a:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.pagination .disabled { opacity: .4; cursor: not-allowed; }
.pagination .ellipsis { border: none; min-width: auto; }

/* Ads */
.ad-slot { margin: 1rem 0; text-align: center; min-height: 0; }
.ad-slot-header, .ad-slot-footer { padding: .5rem 0; }

/* Download lock */
.download-lock { background: #fff7ed; border: 1px solid #fdba74; margin-bottom: 1rem; }
.preview-fade {
  position: absolute; left: 0; right: 0; bottom: 0; height: 120px;
  background: linear-gradient(transparent, #fff); pointer-events: none;
}

/* Responsive polish */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.75rem; }
  .search-grid, .search-grid-advanced { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .downloads-layout { grid-template-columns: 1fr; }
  .folder-tree { position: static; max-height: none; }
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; position: relative; height: auto; max-height: none; }
  .pay-methods { grid-template-columns: 1fr; }
  .admin-media-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .navbar-inner { padding: .65rem 0; }
  .btn { width: auto; }
}

.hero-portal {
  background: linear-gradient(145deg, #064e2d 0%, #0d6e3f 45%, #0a4d2e 100%);
  padding: 3.5rem 1rem 4.5rem;
}
.hero-portal .hero-inner { max-width: 820px; margin: 0 auto; text-align: center; }
.hero-portal h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); line-height: 1.15; margin: .75rem 0; }
.section-heading { font-size: 1.35rem; margin: 0 0 1rem; font-weight: 700; }
.portal-about { margin: 2rem auto; }
.about-grid {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 2rem; align-items: start;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 1.75rem;
}
.about-list { list-style: none; line-height: 1.85; }
.about-list li { padding: .35rem 0; border-bottom: 1px solid var(--border); }
.about-list li:last-child { border-bottom: none; }
.cta-band { margin: 2.5rem auto 3rem; }
.cta-band-inner {
  display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; justify-content: space-between;
  background: linear-gradient(90deg, #0d6e3f, #0a4d2e); color: #fff;
  border-radius: 16px; padding: 1.75rem 1.5rem;
}
.cta-band-inner h2 { margin: 0 0 .35rem; font-size: 1.35rem; }
.cta-band-inner p { margin: 0; opacity: .9; }
.live-badge {
  display: inline-block; font-style: normal; font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; padding: .15rem .4rem; border-radius: 4px;
  margin-right: .4rem; vertical-align: middle;
}
.live-badge.school { background: #e8f5ee; color: #0d6e3f; }
.live-badge.file { background: #fff7ed; color: #9a3412; }
@media (max-width: 768px) {
  .about-grid { grid-template-columns: 1fr; }
  .hero-portal { padding: 2.5rem 1rem 3.25rem; }
}

/* Decorative landing */
.hero-portal {
  position: relative;
  overflow: hidden;
}
.hero-portal::before,
.hero-portal::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: .35;
  pointer-events: none;
}
.hero-portal::before {
  width: 280px; height: 280px; background: #f0a500;
  top: -80px; right: 10%;
}
.hero-portal::after {
  width: 220px; height: 220px; background: #34d399;
  bottom: -60px; left: 5%;
}
.hero-portal .hero-inner { position: relative; z-index: 1; }
.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  padding: .35rem .85rem;
  border-radius: 999px;
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.search-box-lg {
  margin-top: -2.25rem;
  position: relative;
  z-index: 2;
  box-shadow: 0 20px 50px rgba(13,110,63,.15);
  border-radius: 16px;
}
.portal-about .about-grid {
  box-shadow: 0 8px 30px rgba(0,0,0,.04);
}
.feature-card {
  transition: transform .15s ease, box-shadow .15s ease;
}
.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0,0,0,.08);
  text-decoration: none;
}

/* Bar charts */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  height: 160px;
  padding: .5rem .25rem 0;
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}
.bar {
  width: 100%;
  max-width: 36px;
  background: linear-gradient(180deg, var(--primary), #0a4d2e);
  border-radius: 6px 6px 2px 2px;
  min-height: 4px;
}
.bar-chart-alt .bar { background: linear-gradient(180deg, var(--accent), #c47f00); }
.bar-val { font-size: .7rem; color: var(--muted); margin-bottom: .25rem; }
.bar-lab { font-size: .7rem; color: var(--muted); margin-top: .35rem; text-align: center; }

/* Profile */
.profile-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.25rem;
}
.profile-side { text-align: center; }
.avatar-fallback {
  width: 88px; height: 88px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 2rem; font-weight: 700;
  margin: 0 auto .75rem;
}
.profile-avatar img {
  width: 88px; height: 88px; border-radius: 50%; object-fit: cover; margin-bottom: .75rem;
}
.badge {
  display: inline-block; background: var(--primary-light); color: var(--primary-dark);
  padding: .25rem .55rem; border-radius: 6px; font-size: .8rem; font-weight: 600;
}
.admin-data-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 900px) {
  .profile-layout, .admin-data-layout { grid-template-columns: 1fr; }
}
.announcement-bar {
  background: var(--accent); color: #111; text-align: center;
  padding: .5rem 1rem; font-size: .875rem; font-weight: 500;
}
.preview-lock-msg {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: rgba(15,23,42,.88); color: #fff;
  text-align: center; padding: .75rem; font-size: .9rem; z-index: 2;
}
.preview-lock-msg a { color: #fbbf24; }

/* Payment waiting */
.payment-wait { padding: 2rem 1.5rem; }
.wait-ring {
  width: 96px; height: 96px; margin: 0 auto;
  border-radius: 50%;
  border: 6px solid #e5e7eb;
  border-top-color: var(--primary);
  display: grid; place-items: center;
  font-size: 1.5rem; font-weight: 700; color: var(--primary);
  animation: spin 1s linear infinite;
}
.wait-ring.ok { animation: none; border-color: #16a34a; color: #16a34a; }
.wait-ring.fail { animation: none; border-color: #dc2626; color: #dc2626; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Preview protect */
.preview-frame.no-print-save {
  user-select: none;
  -webkit-user-select: none;
}
.preview-shield {
  position: absolute; inset: 48px 0 40px 0;
  z-index: 1; background: transparent;
}
.preview-lock-msg.soft {
  background: rgba(15,23,42,.72);
  font-size: .82rem;
}
@media print {
  .preview-page, .preview-frame, .preview-iframe, .navbar, .footer { display: none !important; }
  body::after { content: 'Printing preview is disabled. Please upgrade to download.'; }
}

/* UI polish */
.content-area h1.page-title { letter-spacing: -0.02em; }
.card { transition: box-shadow .15s ease; }
.card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.05); }
.btn { transition: transform .1s ease, box-shadow .1s ease; }
.btn:active { transform: translateY(1px); }
.sidebar-nav a { transition: background .12s ease; }
.table-wrap table tr:hover td { background: rgba(13,110,63,.04); }
.folder-card-admin { display: flex; align-items: center; gap: .5rem; }
.stat-card .num { background: linear-gradient(135deg, var(--primary), #0a4d2e); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.topbar-sticky { backdrop-filter: blur(8px); background: rgba(255,255,255,.92); }

.folder-list {
  display: flex; flex-direction: column; gap: .5rem;
}
.folder-list .folder-card-admin {
  border: 1px solid var(--border); border-radius: 10px; padding: .65rem .85rem;
  background: var(--card);
}
.view-toggle { display: inline-flex; gap: .35rem; }

/* Soft UI elevation */
.portal-hero {
  background: linear-gradient(135deg, #e8f5ee, #fff);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}
.btn-primary {
  box-shadow: 0 4px 14px rgba(13,110,63,.25);
}
.navbar {
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
}
