:root{
  --bg:#050509;
  --panel: rgba(255,255,255,0.06);
  --panel2: rgba(255,255,255,0.10);
  --text:#e9e9f1;
  --muted:#b7b7c8;
  --accent:#00ffee;
  --shadow: 0 20px 60px rgba(0,0,0,0.55);
  --radius: 18px;
}
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", sans-serif;
  color:var(--text);
  background:
    radial-gradient(1200px 800px at 70% 20%, rgba(0,255,238,0.12), transparent 60%),
    radial-gradient(900px 650px at 15% 75%, rgba(0,255,238,0.09), transparent 55%),
    linear-gradient(180deg, #040406 0%, #0a0a12 100%);
}
.bg{
  position:fixed; inset:0;
  background: radial-gradient(900px 220px at 30% 0%, rgba(0,255,238,0.10), transparent 55%);
  pointer-events:none;
}
.topbar{
  position:sticky; top:0; z-index:10;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(10px);
  border-bottom:1px solid rgba(255,255,255,0.08);
}
.brand{ display:flex; align-items:center; gap:12px; min-width:0; }
.brand-title{ font-weight:900; letter-spacing:0.08em; text-transform:uppercase; font-size:14px; }
.brand-sub{ font-size:12px; color:var(--muted); }
.logo-wrap{
  width:40px; height:40px; border-radius:12px;
  background: rgba(0,255,238,0.18);
  border:1px solid rgba(0,255,238,0.35);
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 0 30px rgba(0,255,238,0.12);
  flex:0 0 auto;
  overflow:hidden;
}
.logo-img{ width:70%; height:70%; object-fit:contain; }
.logo-fallback .logo-fallback-dot{
  width:10px; height:10px; border-radius:50%;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(0,255,238,0.6);
}
.legal-content{
  border-radius: 14px;
  border:1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.20);
  padding: 14px;
  line-height: 1.6;
}
.legal-content h3{
  margin: 14px 0 8px;
  font-size: 16px;
}
.legal-content p{ margin: 0 0 10px; color: rgba(233,233,241,0.92); }
.legal-content ul{ margin: 0 0 12px 20px; }
.topbar-actions{ display:flex; align-items:center; gap:10px; }
.select, .input, .textarea{
  border-radius: 14px;
  border:1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  color:var(--text);
  padding:12px 12px;
  outline:none;
}
.select{ padding:10px 12px; }
.container{ max-width:1080px; margin:0 auto; padding: 22px 18px 60px; }
.card{
  border-radius: var(--radius);
  background: var(--panel);
  border:1px solid rgba(255,255,255,0.10);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}
.h1{ margin:0 0 6px; font-size:28px; }
.h2{ margin:0 0 6px; font-size:20px; }
.muted{ margin:0 0 10px; color:var(--muted); line-height:1.5; }
.divider{ height:1px; background: rgba(255,255,255,0.08); margin: 14px 0; }
.row{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.between{ justify-content:space-between; }
.label{ font-size:12px; letter-spacing:0.10em; text-transform:uppercase; color:rgba(233,233,241,0.86); margin-bottom:8px; font-weight:800; }
.hint{ color: rgba(183,183,200,0.9); font-size:12px; }
.hint.err{ color:#ff4d6d; }
.hint.ok{ color:#42f59b; }
.analysis-disclaimer{
  margin-top:10px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255, 196, 0, 0.35);
  background: rgba(255, 196, 0, 0.07);
  color: rgba(255, 228, 160, 0.96);
  line-height:1.45;
  white-space: normal;
}
.btn{
  border:0; cursor:pointer;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight:900;
  letter-spacing:0.02em;
  transition: all .15s ease;
  display:inline-flex;
  align-items:center;
  gap:10px;
  user-select:none;
  white-space:nowrap;
  color: var(--text);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
}
.btn:hover{ transform: translateY(-1px); border-color: rgba(0,255,238,0.22); }
.btn-primary{
  background: rgba(0,255,238,0.16);
  border-color: rgba(0,255,238,0.40);
  color: var(--accent);
}
.btn-ghost{
  background: rgba(255,255,255,0.04);
}
.app{
  display:grid;
  grid-template-columns: minmax(0,1fr);
  gap:14px;
}
.nav-dropdown-shell{
  position: fixed;
  left: 18px;
  top: 84px;
  z-index: 10002;
  width: min(320px, calc(100vw - 36px));
}
.nav-dropdown-toggle{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.14);
  background: #101018;
  color: var(--text);
  box-shadow: 0 12px 30px rgba(0,0,0,0.28);
  cursor: pointer;
}
.nav-dropdown-label{
  font-size:12px;
  letter-spacing:0.10em;
  text-transform:uppercase;
  color:rgba(233,233,241,0.70);
  font-weight:900;
}
.nav-dropdown-current{
  flex:1;
  min-width:0;
  font-weight:900;
  text-align:left;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.nav-dropdown-caret{
  flex:0 0 auto;
  color: var(--accent);
  transition: transform .12s ease;
}
.nav-dropdown-shell.is-open .nav-dropdown-caret{
  transform: rotate(180deg);
}
.nav-dropdown-menu{
  margin-top: 10px;
  border-radius: 20px;
  background: #0d0d14;
  border:1px solid rgba(255,255,255,0.12);
  box-shadow: 0 14px 32px rgba(0,0,0,0.30);
  padding: 14px;
  max-height: calc(100vh - 160px);
  overflow: auto;
}
.navbtn{
  width:100%;
  text-align:left;
  display:flex; align-items:center; gap:10px;
  padding:12px 12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  cursor:pointer;
  margin-bottom:10px;
}
.navbtn .dot{ width:8px; height:8px; border-radius:99px; background: rgba(255,255,255,0.25); }
.navbtn.active{
  border-color: rgba(0,255,238,0.35);
  background: rgba(0,255,238,0.10);
}
.navbtn.active .dot{ background: var(--accent); box-shadow: 0 0 14px rgba(0,255,238,0.5); }
.content{
  min-height: 200px;
  padding-top: 82px;
}
.top-messages-btn{
  position: relative;
  padding-right: 12px;
}
@media (max-width: 920px){
  .nav-dropdown-shell{
    left: 12px;
    top: 78px;
    width: min(320px, calc(100vw - 24px));
  }
  .content{
    padding-top: 78px;
  }
}
.page.hidden{ display:none; }
.dropzone{
  position:relative;
  border-radius: 18px;
  border:1px dashed rgba(255,255,255,0.20);
  background: rgba(255,255,255,0.03);
  padding: 18px;
}
.dropzone.dragover{ border-color: rgba(0,255,238,0.50); background: rgba(0,255,238,0.06); }
.file{
  position:absolute; inset:0;
  opacity:0; cursor:pointer;
}
.dropzone-inner{ display:flex; gap:12px; align-items:center; }
.drop-icon{ font-size:22px; }
.drop-title{ font-weight:900; }
.drop-sub{ color: var(--muted); font-size:13px; }
.details{
  border-radius: 18px;
  background: rgba(0,0,0,0.22);
  border:1px solid rgba(255,255,255,0.08);
  padding: 14px;
  margin-top: 14px;
}
.details-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.details-title{ font-weight:900; }
.pre{
  margin:0;
  white-space:pre-wrap;
  color: rgba(233,233,241,0.92);
  font-size:13px;
  line-height:1.55;
}
.list .item{
  display:flex; justify-content:space-between; align-items:center; gap:12px;
  padding: 12px 12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  margin-top: 10px;
}
.item-title{ font-weight:900; }
.item-sub{ color: var(--muted); font-size:12px; margin-top:4px; }
.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:12px;
}
@media (max-width: 720px){ .grid{ grid-template-columns: 1fr; } }
.partner{
  border-radius: 18px;
  background: rgba(0,0,0,0.22);
  border:1px solid rgba(255,255,255,0.08);
  padding: 14px;
}
.partner-name{ font-weight:900; margin-bottom:6px; }
.partner-meta{ color: var(--muted); font-size:13px; line-height:1.4; margin-bottom:10px; }
.partner-link{ color: var(--accent); text-decoration:none; font-weight:900; }
.partner-link:hover{ text-decoration:underline; }
.partner-photo-wrap{
  width:100%;
  margin: 0 0 10px;
  border-radius: 12px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
}
.partner-photo{
  width:100%;
  display:block;
  max-height: 180px;
  object-fit: cover;
}
.hidden{ display:none; }

/* Reply generator */
textarea{ width:100%; border-radius:14px; border:1px solid rgba(255,255,255,.14); background:rgba(255,255,255,.05);
  color:inherit; padding:12px; outline:none; font:inherit; resize:vertical; }
pre.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; font-size: 13px; line-height: 1.45; }
.row.gap{ gap:10px; flex-wrap:wrap; }

/* small radio "pills" */
.pill{ display:inline-flex; align-items:center; gap:8px; padding:8px 10px; border:1px solid rgba(255,255,255,.12); border-radius:999px; background: rgba(0,0,0,.18); cursor:pointer; user-select:none; }
.pill input{ margin:0; }

.quota{
  position: fixed; right: 14px; top: 14px; z-index: 9999;
  padding: 8px 10px; border-radius: 14px;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(10px);
  font-size: 12px; line-height: 1.2;
  color: rgba(255,255,255,.92);
}
@media (max-width: 520px){ .quota{ top: 10px; right: 10px; } }
#partnerList a{ color: inherit; text-decoration: underline; }


/* Debug panel */
.debug{
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-height: 55vh;
  background: rgba(10,10,18,0.95);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 12px;
  z-index: 9999;
  overflow: hidden;
}
.debug-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.debug-pre{
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  max-height: 45vh;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
}

.review-link{
  color: var(--accent);
  text-decoration: none;
  padding: 6px 10px;
  border: 1px solid rgba(0,255,238,0.35);
  border-radius: 999px;
}
.review-link:hover{ text-decoration: underline; }

.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}
.modal.hidden{
  display: none;
}
.modal-card{
  width: min(520px, calc(100vw - 24px));
  border-radius: var(--radius);
  background: #10101a;
  border: 1px solid rgba(255,255,255,0.14);
  padding: 18px;
}
.pdf-modal-card{
  width: min(1100px, calc(100vw - 8px));
  max-height: calc(100vh - 8px);
  display: flex;
  flex-direction: column;
  padding: 10px;
}

.buy-modal-card{
  width: min(760px, calc(100vw - 24px));
}
.buy-package-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:12px;
  margin-top:8px;
}
.buy-package-card{
  text-align:left;
  border:1px solid rgba(255,255,255,0.12);
  background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
  border-radius: 18px;
  padding: 16px;
  color: var(--text);
  cursor:pointer;
  display:flex;
  flex-direction:column;
  gap:8px;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.buy-package-card:hover{
  transform: translateY(-2px);
  border-color: rgba(0,255,238,0.28);
  box-shadow: 0 16px 30px rgba(0,0,0,0.25);
}
.buy-package-card.active{
  border-color: rgba(0,255,238,0.55);
  background: linear-gradient(180deg, rgba(0,255,238,0.18) 0%, rgba(0,255,238,0.08) 100%);
  box-shadow: 0 18px 34px rgba(0,0,0,0.32), 0 0 28px rgba(0,255,238,0.08);
}
.buy-package-card-featured{
  position:relative;
}
.buy-package-badge{
  display:inline-flex;
  width:fit-content;
  padding:5px 9px;
  border-radius:999px;
  background: rgba(255,255,255,0.08);
  border:1px solid rgba(255,255,255,0.14);
  font-size:11px;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
}
.buy-package-title{
  font-size:18px;
  font-weight:900;
}
.buy-package-price{
  font-size:28px;
  line-height:1;
  font-weight:900;
  color: var(--accent);
}
.buy-package-bp{
  font-size:14px;
  font-weight:800;
}
.buy-package-note{
  font-size:12px;
  color: var(--muted);
  line-height:1.45;
}
@media (max-width: 820px){
  .buy-package-grid{
    grid-template-columns:1fr;
  }
}
.pdf-modal-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.pdf-preview-body{
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.28);
  padding: 6px;
}
.pdf-preview-loading{
  padding: 24px 8px;
  text-align: center;
  color: var(--muted);
}
.pdf-preview-page{
  margin: 0 auto 10px;
  width: fit-content;
  max-width: 100%;
}
.pdf-preview-page:last-child{
  margin-bottom: 0;
}
.pdf-preview-canvas{
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}

.lang-switcher{
  position: fixed;
  right: 16px;
  bottom: 72px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 8px;
  align-items: center;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(9,9,14,0.92);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.lang-switcher:not(.is-open){
  padding: 6px;
}
.lang-switcher.is-open{
  padding: 10px 8px;
}
.lang-flag{
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.lang-flag.hidden{
  display: none;
}
.lang-flag:hover{
  transform: translateY(-1px);
  border-color: rgba(0,255,238,0.28);
}
.lang-flag.active{
  background: rgba(0,255,238,0.14);
  border-color: rgba(0,255,238,0.45);
  box-shadow: 0 0 24px rgba(0,255,238,0.12);
}
.lang-flag:focus-visible{
  outline: 2px solid rgba(0,255,238,0.55);
  outline-offset: 2px;
}

.buy-bp-fab{
  position: fixed;
  right: 16px;
  bottom: 148px;
  z-index: 10000;
  min-width: 168px;
  justify-content: center;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(0,255,238,0.45);
  background: linear-gradient(180deg, rgba(0,255,238,0.24) 0%, rgba(0,255,238,0.12) 100%);
  box-shadow: 0 18px 40px rgba(0,0,0,0.35), 0 0 28px rgba(0,255,238,0.10);
}
.buy-bp-fab:hover{
  border-color: rgba(0,255,238,0.6);
  box-shadow: 0 22px 48px rgba(0,0,0,0.4), 0 0 32px rgba(0,255,238,0.16);
}
@media (max-width: 520px){
  .buy-bp-fab{
    right: 10px;
    bottom: 140px;
    min-width: 148px;
    padding: 11px 14px;
    font-size: 13px;
  }
}

.messages-fab{
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10000;
  border-radius: 999px;
  padding: 10px 14px;
  border: 1px solid rgba(0,255,238,0.45);
  background: rgba(0,255,238,0.15);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}
.messages-badge{
  margin-left: 8px;
  background: #ff4d6d;
  color: #fff;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 12px;
}
.messages-panel{
  position: fixed;
  right: 16px;
  bottom: 124px;
  width: min(420px, calc(100vw - 24px));
  max-height: 60vh;
  overflow: auto;
  z-index: 10000;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(9,9,14,0.98);
  padding: 12px;
}
.messages-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}
.message-item{
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 10px;
  margin-top: 10px;
  background: rgba(255,255,255,0.03);
}
.message-item.unread{
  border-color: rgba(0,255,238,0.5);
}
.message-title{ font-weight: 800; margin-bottom: 6px; }
.message-body{ font-size: 13px; line-height: 1.4; }
.message-meta{ color: var(--muted); font-size: 12px; margin-top: 8px; }

@media (max-width: 520px){
  .lang-switcher{
    right: 10px;
    bottom: 66px;
    padding: 8px 6px;
  }
  .lang-flag{
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  .messages-fab{
    right: 10px;
    bottom: 10px;
  }
  .messages-panel{
    right: 10px;
    bottom: 114px;
    width: min(420px, calc(100vw - 20px));
  }
}

.app-legal-footer{
  max-width: 1080px;
  margin: 4px auto 32px;
  padding: 0 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.app-security-badge{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  margin: 0 auto 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,255,238,0.35);
  background: rgba(0,255,238,0.10);
  color: #c9fff8;
  font-weight: 700;
}
.analysis-counter-badge{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,255,238,0.35);
  background: rgba(0,255,238,0.10);
  color: #c9fff8;
  font-weight: 700;
}
.app-legal-link{
  color: var(--accent);
  text-decoration: none;
}
.app-legal-link:hover{ text-decoration: underline; }
.app-legal-sep{ color: rgba(255,255,255,0.35); margin: 0 8px; }
.checkbox-line{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
}
