:root {
  --primary: #5b5cf0;
  --primary2: #8b5cf6;
  --primary-dark: #3f3fb7;
  --accent: #0ea5a4;
  --ink: #172033;
  --muted: #68728a;
  --line: #e6e9f2;
  --surface: rgba(255,255,255,.92);
  --shadow: 0 20px 55px rgba(35,43,85,.10);
  --shadow-hover: 0 28px 72px rgba(35,43,85,.16);
  --radius: 20px;
}

html { background: #f5f7fb; }
body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 7%,rgba(91,92,240,.10),transparent 27rem),
    radial-gradient(circle at 92% 18%,rgba(14,165,164,.08),transparent 25rem),
    linear-gradient(180deg,#fbfcff 0,#f5f7fb 44%,#f3f5fa 100%);
  color: var(--ink);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  opacity: .3;
  background-image: radial-gradient(rgba(91,92,240,.22) .65px,transparent .65px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom,#000,transparent 68%);
  content: "";
  pointer-events: none;
}

.container { width: min(1200px,calc(100% - 40px)); }
.site-header {
  border-bottom: 1px solid rgba(222,226,238,.72);
  background: rgba(255,255,255,.78);
  box-shadow: 0 8px 32px rgba(33,41,75,.045);
  backdrop-filter: blur(22px) saturate(150%);
}
.nav-wrap { min-height: 76px; }
.brand { letter-spacing: -.03em; }
.brand-with-logo { max-width: min(360px,35vw); }
.brand-logo-replaces-name .brand-logo {
  width: min(var(--brand-logo-width,180px),100%);
  height: min(var(--brand-logo-height,52px),58px);
  border-radius: 0;
  object-fit: contain;
}
.public-nav { gap: 7px; }
.public-nav > a {
  padding: 9px 11px;
  border-radius: 11px;
  color: #48536a;
  font-size: 13px;
  transition: color .2s ease,background .2s ease,transform .2s ease;
}
.public-nav > a:hover { background: #f0f1fb; color: var(--primary-dark); text-decoration: none; transform: translateY(-1px); }
.public-nav .nav-contribute { background: linear-gradient(135deg,#4f52d9,#7768ec); box-shadow: 0 10px 24px rgba(79,82,217,.22); }

.btn {
  min-height: 42px;
  border-radius: 12px;
  transition: transform .18s ease,box-shadow .18s ease,filter .18s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(44,52,92,.12); }
.btn-primary { background: linear-gradient(135deg,#5154d9,#7a62eb); box-shadow: 0 12px 26px rgba(81,84,217,.23); }
.btn-danger { background: linear-gradient(135deg,#d14343,#e45f65); }
.btn-success { background: linear-gradient(135deg,#108c6d,#10a980); }
.input,.select,.textarea {
  border-color: #dfe3ed;
  border-radius: 13px;
  background: rgba(255,255,255,.95);
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset;
  transition: border-color .18s ease,box-shadow .18s ease,background .18s ease;
}
.input:hover,.select:hover,.textarea:hover { border-color: #cbd1df; }
.input:focus,.select:focus,.textarea:focus { border-color: #7d79e7; box-shadow: 0 0 0 4px rgba(91,92,240,.10),0 8px 24px rgba(44,52,92,.06); }

.home-modern {
  position: relative;
  min-height: calc(100svh - 76px);
  background:
    radial-gradient(circle at calc(50% + var(--pointer-x,0px)) calc(30% + var(--pointer-y,0px)),rgba(96,91,238,.11),transparent 28rem),
    linear-gradient(180deg,rgba(252,253,255,.76),rgba(246,248,253,.85));
}
.home-modern::before,.home-modern::after {
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
  content: "";
  pointer-events: none;
}
.home-modern::before { top: 12%; left: 8%; width: 130px; height: 130px; border: 1px solid rgba(91,92,240,.14); box-shadow: 0 0 0 28px rgba(91,92,240,.035),0 0 0 58px rgba(91,92,240,.022); }
.home-modern::after { right: 7%; bottom: 20%; width: 90px; height: 90px; background: linear-gradient(135deg,rgba(14,165,164,.10),rgba(91,92,240,.08)); }
.home-search-stage { position: relative; z-index: 2; width: min(900px,calc(100% - 36px)); }
.home-modern:not(.home-has-query) .home-search-stage { min-height: calc(100svh - 76px); padding-top: 56px; padding-bottom: 100px; }
.home-brand-lockup { margin-bottom: 38px; }
.home-brand-lockup > .home-brand-text {
  max-width: 820px;
  margin: auto;
  background: linear-gradient(110deg,#20294a 0,#575bd8 48%,#0e8f91 100%);
  background-clip: text;
  color: transparent;
  font-size: clamp(52px,8vw,88px);
  font-weight: 850;
  letter-spacing: -.065em;
}
.home-brand-image { width: min(var(--home-logo-width,360px),82vw); max-width: none; height: min(var(--home-logo-height,112px),24vw); max-height: 180px; }
.home-search-shell {
  min-height: 68px;
  border-color: rgba(204,210,225,.88);
  background: rgba(255,255,255,.92);
  box-shadow: 0 18px 50px rgba(45,54,96,.13),0 1px 0 rgba(255,255,255,.9) inset;
  backdrop-filter: blur(18px);
}
.home-search-shell:hover,.home-search-shell:focus-within { border-color: #abaee6; box-shadow: 0 24px 68px rgba(45,54,96,.17),0 0 0 5px rgba(91,92,240,.055); }
.home-search-button { min-height: 52px; background: linear-gradient(135deg,#5256dc,#7465ea); box-shadow: 0 9px 22px rgba(82,86,220,.22); }
.home-public-count { box-shadow: 0 10px 30px rgba(44,52,92,.06); }
.home-result-list .doc-card { border-color: rgba(222,226,237,.9); background: rgba(255,255,255,.91); box-shadow: 0 14px 38px rgba(36,46,83,.065); backdrop-filter: blur(16px); }
.home-result-list .doc-card:hover { border-color: rgba(117,113,223,.45); box-shadow: var(--shadow-hover); transform: translateY(-3px); }

.legal-card,.admin-card,.doc-card,.document-results-card {
  border-color: rgba(221,225,236,.92);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.doc-card { transition: border-color .2s ease,transform .2s ease,box-shadow .2s ease; }


.account-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.account-profile-page { padding: 24px 0 70px; }
.account-profile-grid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(280px,.85fr); gap: 18px; margin-top: 18px; }
.account-profile-card { padding: clamp(22px,3vw,30px); }
.account-profile-sidecard,.account-password-card { min-height: 100%; }
.account-section-head { margin-bottom: 16px; }
.account-section-head h2 { margin: 4px 0 0; font-size: clamp(22px,3vw,30px); line-height: 1.15; letter-spacing: -.03em; }
.account-form-grid { gap: 14px 16px; }
.account-profile-meta { display: grid; gap: 12px; margin: 0; }
.account-profile-meta div { padding: 13px 14px; border: 1px solid #e4e8f1; border-radius: 14px; background: rgba(249,250,253,.92); }
.account-profile-meta dt { margin: 0 0 6px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.account-profile-meta dd { margin: 0; color: var(--ink); font-size: 15px; font-weight: 700; }
.account-side-links { display: grid; gap: 10px; margin-top: 18px; }
.account-side-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid #e2e6ef; border-radius: 12px; background: #fff; color: #364056; font-weight: 700; }
.account-side-links a:hover { border-color: #cfd6e3; color: #353cc0; text-decoration: none; }
.metadata-editor-page { padding: 24px 0 70px; }
.metadata-editor-card { max-width: 1060px; margin-top: 20px; padding: clamp(22px,4vw,42px); }
.editor-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.editor-heading h1,.editor-heading h2 { margin: 5px 0 7px; font-size: clamp(28px,4vw,43px); line-height: 1.1; letter-spacing: -.04em; }
.editor-heading p { max-width: 720px; margin: 0; color: var(--muted); }
.editor-kicker { color: #5d5bd1; font-size: 10px; font-weight: 900; letter-spacing: .15em; }
.metadata-only-pill { flex: 0 0 auto; padding: 8px 12px; border: 1px solid #cfe8e2; border-radius: 999px; background: #eaf8f4; color: #11745d; font-size: 11px; font-weight: 850; }
.metadata-source-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 20px 0 26px; }
.source-tool { padding: 17px; border: 1px solid #e0e3ef; border-radius: 17px; background: linear-gradient(145deg,#fbfbff,#f5f7fc); }
.source-tool > label { display: block; margin-bottom: 8px; color: #39435a; font-size: 12px; font-weight: 850; }
.source-tool .metadata-actions { display: grid; grid-template-columns: minmax(0,1fr) auto; }
.source-tool .btn { white-space: nowrap; }
.metadata-form-grid { padding-top: 24px; border-top: 1px solid #eaecf2; }
.editor-actions { display: flex; gap: 10px; margin-top: 28px; padding-top: 22px; border-top: 1px solid #eaecf2; }

.account-library-page { padding: 36px 0 76px; }
.account-library-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  overflow: hidden;
  padding: clamp(24px,5vw,48px);
  border-radius: 26px;
  background: linear-gradient(135deg,#22294f 0,#4c4eb7 58%,#167e84 130%);
  box-shadow: 0 24px 70px rgba(37,43,91,.22);
  color: #fff;
}
.account-library-hero::after { position: absolute; right: -80px; bottom: -160px; width: 330px; height: 330px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; box-shadow: 0 0 0 38px rgba(255,255,255,.04),0 0 0 84px rgba(255,255,255,.025); content: ""; }
.account-library-hero > * { position: relative; z-index: 1; }
.account-library-hero .editor-kicker { color: #ccd0ff; }
.account-library-hero h1 { margin: 6px 0 8px; color: #fff; font-size: clamp(30px,5vw,48px); line-height: 1.08; letter-spacing: -.045em; }
.account-library-hero p { max-width: 690px; margin: 0; color: rgba(255,255,255,.76); }
.account-library-hero .btn { background: #fff; color: #4548b5; white-space: nowrap; }
.account-summary-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin: -18px 22px 24px; position: relative; z-index: 2; }
.account-summary-grid > div { padding: 18px; border: 1px solid rgba(222,226,238,.9); border-radius: 17px; background: rgba(255,255,255,.95); box-shadow: 0 14px 38px rgba(37,43,83,.09); }
.account-summary-grid span,.account-summary-grid strong { display: block; }
.account-summary-grid span { color: var(--muted); font-size: 11px; font-weight: 780; }
.account-summary-grid strong { margin-top: 4px; color: #303a53; font-size: 24px; letter-spacing: -.03em; }
.modern-plan-panel { border: 1px solid #e2e4f0; border-radius: 20px; background: linear-gradient(135deg,rgba(255,255,255,.95),rgba(246,246,255,.95)); box-shadow: var(--shadow); }
.account-document-section { margin-top: 30px; }
.account-document-list .doc-card { padding: 24px; }
.account-source-link { display: inline-flex; margin-top: 11px; font-size: 12px; font-weight: 800; }
.account-document-list .empty strong { display: block; color: var(--ink); font-size: 20px; }
.account-document-list .empty p { margin: 5px 0 17px; }

.logo-upload-card { padding: 18px; border: 1px solid #e0e4ee; border-radius: 18px; background: #fafbfe; }
.logo-upload-card h3 { margin: 0 0 12px; font-size: 16px; }
.logo-preview-wide { min-height: 130px; margin-bottom: 14px; background: linear-gradient(135deg,#eef0f7,#fff); }
.logo-preview-wide img { max-width: 90%; max-height: 110px; object-fit: contain; }

.traffic-command-center { overflow: hidden; }
.traffic-breakdown-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 11px; margin-top: 20px; }
.traffic-breakdown-card { padding: 16px; border: 1px solid #e3e6ef; border-radius: 15px; background: linear-gradient(145deg,#fff,#f8f9fd); }
.traffic-breakdown-card h4 { margin: 0 0 9px; color: #3d465b; font-size: 12px; }
.traffic-breakdown-card p { margin: 0; color: var(--muted); font-size: 11px; }
.traffic-breakdown-card ol { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.traffic-breakdown-card li { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #667086; font-size: 10px; }
.traffic-breakdown-card li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.traffic-breakdown-card li strong { min-width: 29px; padding: 3px 7px; border-radius: 999px; background: #ececff; color: #5653c4; text-align: center; }
.traffic-recent-panel { margin-top: 20px; border: 1px solid #e0e4ed; border-radius: 16px; overflow: hidden; }
.traffic-recent-panel > summary { padding: 14px 16px; background: #f7f8fc; color: #3f485e; cursor: pointer; font-size: 12px; font-weight: 850; }
.traffic-recent-panel .table-wrap { border: 0; border-radius: 0; box-shadow: none; }
.traffic-recent-panel table { min-width: 940px; }
.traffic-recent-panel td strong,.traffic-recent-panel td small { display: block; }
.traffic-recent-panel td small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.traffic-recent-panel code { padding: 4px 7px; border-radius: 7px; background: #eef0f5; color: #384258; font-size: 10px; }

.admin-topbar { background: rgba(22,28,53,.96); backdrop-filter: blur(20px); }
.admin-topbar .brand-logo { max-width: 180px; max-height: 44px; object-fit: contain; }
.admin-main.admin-container { width: min(1380px,calc(100% - 40px)); }
.admin-card { border-radius: 19px; }
.admin-top h1 { letter-spacing: -.035em; }
.dashboard-stat-card,.document-metric-grid > div { transition: transform .2s ease,box-shadow .2s ease; }
.dashboard-stat-card:hover,.document-metric-grid > div:hover { transform: translateY(-3px); box-shadow: 0 18px 44px rgba(36,44,82,.11); }

.modern-effects .modern-reveal { opacity: 0; transform: translateY(13px); transition: opacity .52s ease,transform .52s cubic-bezier(.2,.7,.2,1); }
.modern-effects .modern-reveal.is-revealed { opacity: 1; transform: none; }

@media (max-width: 980px) {
  .public-nav { gap: 2px; }
  .public-nav > a { padding-inline: 8px; }
  .traffic-breakdown-grid { grid-template-columns: 1fr 1fr; }
  .metadata-source-tools { grid-template-columns: 1fr; }
  .account-summary-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
  body { padding-bottom: 68px; }
  .container { width: min(100% - 24px,1200px); }
  .site-header .nav-wrap { min-height: 64px; }
  .brand-with-logo { max-width: calc(100vw - 132px); }
  .brand-logo-replaces-name .brand-logo { width: min(var(--brand-logo-width,180px),calc(100vw - 145px)); max-height: 42px; }
  .home-modern:not(.home-has-query) .home-search-stage { min-height: calc(100svh - 132px); padding-top: 38px; padding-bottom: 64px; }
  .home-brand-lockup { margin-bottom: 26px; }
  .home-brand-lockup > .home-brand-text { font-size: clamp(38px,13vw,60px); }
  .home-brand-image { width: min(var(--home-logo-width,360px),84vw); height: min(var(--home-logo-height,112px),28vw); }
  .home-search-shell { min-height: 58px; grid-template-columns: 44px minmax(0,1fr) auto; border-radius: 20px; }
  .home-search-shell input { height: 56px; font-size: 15px; }
  .home-search-button { min-width: 48px; min-height: 46px; padding: 0 14px; }
  .home-search-button span { display: none; }
  .home-modern::before,.home-modern::after { display: none; }
  .editor-heading,.account-library-hero { align-items: flex-start; flex-direction: column; }
  .metadata-only-pill { order: -1; }
  .source-tool .metadata-actions { grid-template-columns: 1fr; }
  .source-tool .btn { width: 100%; }
  .editor-actions { align-items: stretch; flex-direction: column; }
  .account-library-page { padding-top: 18px; }
  .account-library-hero { padding: 26px 22px; border-radius: 21px; }
  .account-hero-actions { width: 100%; }
  .account-hero-actions .btn,
  .account-library-hero .btn { width: 100%; }
  .account-profile-grid { grid-template-columns: 1fr; }
  .account-summary-grid { margin: 12px 0 20px; gap: 9px; }
  .account-summary-grid > div { padding: 14px; }
  .account-summary-grid strong { font-size: 20px; }
  .account-document-list .doc-card { padding: 18px; }
  .traffic-breakdown-grid { grid-template-columns: 1fr; }
  .traffic-recent-panel { margin-inline: -4px; }
  .logo-upload-card { grid-column: auto; }
  .admin-main.admin-container { width: min(100% - 24px,1380px); }
}

@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior: auto!important; animation-duration: .001ms!important; animation-iteration-count: 1!important; transition-duration: .001ms!important; }
}
