:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f1f1f1);
  --text: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #888888);
  --btn: var(--tg-theme-button-color, #2aabee);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: var(--tg-theme-destructive-text-color, #e53935);
}
/* manual theme override (theme toggle button) */
[data-theme="light"] {
  --bg: #ffffff; --bg2: #f1f2f6; --text: #111111; --hint: #7a7a7a;
  --btn: #2aabee; --btn-text: #ffffff; --danger: #e53935;
}
[data-theme="dark"] {
  --bg: #101014; --bg2: #1d1d22; --text: #f2f2f2; --hint: #9a9aa0;
  --btn: #2aabee; --btn-text: #ffffff; --danger: #ff6b6b;
}
.theme-btn { font-size: 18px !important; }
/* ProtonVPN mini logo */
.pv-logo {
  width: 22px; height: 22px; flex-shrink: 0; display: inline-block;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%236d4aff'/%3E%3Cstop offset='1' stop-color='%2337b6ff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M12 1.8l8.2 3v6.1c0 5.2-3.6 9.9-8.2 11.3C7.4 20.8 3.8 16.1 3.8 10.9V4.8z' fill='url(%23g)'/%3E%3Cpath d='M8.5 8.2h2.6c1.7 0 3 1.2 3 2.8s-1.3 2.8-3 2.8H9.9v2.6H8.5zm2.5 4.3c.9 0 1.6-.6 1.6-1.5s-.7-1.5-1.6-1.5H9.9v3z' fill='white'/%3E%3C/svg%3E") center/contain no-repeat;
}
/* account switcher (dropdown) */
.acct-switcher { position: relative; margin-bottom: 10px; }
.acct-current {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 12px; cursor: pointer;
  background: var(--bg2); border: 1px solid #00000012;
  font-size: 15px; font-weight: 600; color: var(--text);
}
.acct-current .caret { margin-left: auto; color: var(--hint); font-size: 13px; }
.acct-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: var(--bg); border: 1px solid #0000001c; border-radius: 12px;
  overflow: hidden; box-shadow: 0 6px 20px #00000040;
}
.acct-option {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 12px 14px; background: none; border: none; cursor: pointer;
  font-size: 15px; color: var(--text); text-align: left;
  border-bottom: 1px solid #0000000c;
}
.acct-option:last-child { border-bottom: none; }
.acct-option:active { background: var(--bg2); }
.acct-option .check { margin-left: auto; color: var(--btn); font-weight: 700; }
.acct-option .sub { display: block; font-size: 12px; color: var(--hint); font-weight: 400; }
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; -webkit-tap-highlight-color: transparent;
}
#app { max-width: 560px; margin: 0 auto; padding: 12px 12px 40px; }
.hidden { display: none !important; }
.topbar { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; }
.topbar h1 { font-size: 19px; margin: 0; flex: 1; }
.card {
  background: var(--bg2); border-radius: 14px; padding: 14px; margin-bottom: 12px;
}
.card h2 { font-size: 16px; margin: 0 0 10px; }
.center { text-align: center; }
input, select {
  width: 100%; padding: 11px 12px; margin: 6px 0; font-size: 15px;
  border: 1px solid #00000022; border-radius: 10px;
  background: var(--bg); color: var(--text);
}
label { display: block; font-size: 13px; color: var(--hint); margin-top: 8px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
label.check input { width: auto; margin: 0; }
.btn {
  border: none; border-radius: 10px; padding: 11px 16px; font-size: 15px;
  background: var(--bg2); color: var(--text); cursor: pointer; margin: 4px 4px 4px 0;
}
.btn.primary { background: var(--btn); color: var(--btn-text); font-weight: 600; width: 100%; margin-top: 10px; }
.btn.ghost { background: transparent; font-size: 22px; padding: 4px 10px; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; }
.row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.row.actions { margin-bottom: 10px; }
.row.actions .btn.primary { width: auto; flex: 1; margin-top: 0; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }
.meta { color: var(--hint); font-size: 13px; }
.list .item {
  background: var(--bg2); border-radius: 12px; padding: 12px; margin-bottom: 8px;
}
.item .t { font-weight: 600; }
.item .s { font-size: 13px; color: var(--hint); margin-top: 2px; }
.item .row { margin-top: 8px; }
/* professional cards */
.app-icon { font-size: 44px; margin-bottom: 6px; }
.item.empty { text-align: center; padding: 26px 14px; }
.empty-icon { font-size: 38px; margin-bottom: 8px; opacity: .85; }
.item.server-card { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.item.server-card:active { transform: scale(.985); }
.item.config-card, .item.account-card, .item.server-card {
  border: 1px solid #00000010;
  box-shadow: 0 1px 3px #00000010;
}
.srv-summary {
  font-size: 14px; margin-bottom: 6px; padding: 10px 12px;
  background: var(--bg); border-radius: 10px; border: 1px solid #00000010;
}
/* (account chips removed: replaced by the dropdown account switcher) */
.srv-summary { font-size: 14px; margin-bottom: 6px; }
.loadbar { height: 6px; border-radius: 3px; background: #00000018; margin-top: 6px; overflow: hidden; }
.loadbar > div { height: 100%; border-radius: 3px; }
.badge {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: #00000014; margin: 2px 2px 0 0;
}
.radios { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 4px; }
/* responsive banner */
.banner { margin: 18px 0 8px; border-radius: 14px; overflow: hidden; }
.banner img { width: 100%; height: auto; display: block; border-radius: 14px; }
/* professional error modal */
.error-icon { font-size: 42px; margin-bottom: 8px; }
.error-modal p { font-size: 14px; }
.error-detail {
  background: var(--bg2); border-radius: 10px; padding: 10px;
  font-size: 12px; font-family: monospace; white-space: pre-wrap;
  max-height: 160px; overflow-y: auto; margin: 10px 0; color: var(--hint);
}
.radio { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); margin: 0; }
.radio input { width: auto; margin: 0; accent-color: var(--btn); }
.conf {
  background: #00000010; border-radius: 10px; padding: 10px; font-size: 12px;
  overflow-x: auto; white-space: pre; max-height: 300px; overflow-y: auto;
}
.country { font-weight: 700; margin: 14px 0 6px; font-size: 16px; }
/* modal */
#modal {
  position: fixed; inset: 0; background: #00000088; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card { background: var(--bg); border-radius: 16px; padding: 18px; width: 100%; max-width: 420px; }
.modal-card h2 { margin: 0 0 10px; font-size: 17px; }
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #222; color: #fff; padding: 10px 18px; border-radius: 20px;
  font-size: 14px; z-index: 99;
}
/* loading overlay */
#loading {
  position: fixed; inset: 0; background: #00000066; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.spinner {
  width: 46px; height: 46px; border-radius: 50%;
  border: 4px solid #ffffff2e; border-top-color: var(--btn);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { color: #fff; font-size: 14px; }
