/* =========================================================
   Portal home — gauge + bottom dock (طرح ۶)
   Standalone: loaded only by index.php. login.php still uses portal.css
   ========================================================= */
@font-face {
  font-family: shradius;
  src: url("fonts/shradius.woff2") format("woff2-variations");
  font-style: normal;
  font-display: swap;
}


:root {
  --bg: #f5f7fb; --s: #ffffff; --s2: #eef1f7;
  --tx: #172033; --t2: #5f6b7d; --t3: #8993a4;
  --ac: #4f63ff; --aw: rgba(79,99,255,.12);
  --ok: #1c9a61; --okw: rgba(28,154,97,.12);
  --warn: #b7791f; --warnw: rgba(183,121,31,.13);
  --bad: #d9435f; --badw: rgba(217,67,95,.11);
  --ln: rgba(23,32,51,.09);
  --f: shradius, Tahoma, sans-serif;
}
:root[data-bs-theme="dark"] {
  --bg: #0a0e16; --s: #111722; --s2: #171e2b;
  --tx: #edf2fb; --t2: #a5afc0; --t3: #707b8f;
  --ac: #7182ff; --aw: rgba(113,130,255,.15);
  --ok: #45c98a; --okw: rgba(69,201,138,.13);
  --warn: #e6ad54; --warnw: rgba(230,173,84,.14);
  --bad: #ff6d83; --badw: rgba(255,109,131,.13);
  --ln: rgba(237,242,251,.09);
}

/* Explicit Portal theme state (keeps theme switching deterministic) */
body.p6[data-portal-theme="light"] {
  --bg: #f5f7fb; --s: #ffffff; --s2: #eef1f7;
  --tx: #172033; --t2: #5f6b7d; --t3: #8993a4;
  --ac: #4f63ff; --aw: rgba(79,99,255,.12);
  --ok: #1c9a61; --okw: rgba(28,154,97,.12);
  --warn: #b7791f; --warnw: rgba(183,121,31,.13);
  --bad: #d9435f; --badw: rgba(217,67,95,.11);
  --ln: rgba(23,32,51,.09);
}
body.p6[data-portal-theme="dark"] {
  --bg: #0a0e16; --s: #111722; --s2: #171e2b;
  --tx: #edf2fb; --t2: #a5afc0; --t3: #707b8f;
  --ac: #7182ff; --aw: rgba(113,130,255,.15);
  --ok: #45c98a; --okw: rgba(69,201,138,.13);
  --warn: #e6ad54; --warnw: rgba(230,173,84,.14);
  --bad: #ff6d83; --badw: rgba(255,109,131,.13);
  --ln: rgba(237,242,251,.09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body.p6 {
  margin: 0; min-height: 100vh; font-family: var(--f); color: var(--tx); line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  background: radial-gradient(800px 420px at 85% -10%, var(--aw), transparent 60%), var(--bg);
  padding-top: env(safe-area-inset-top, 0px);
}
body.p6-modal-open { overflow: hidden; }
.p6 h1, .p6 h2, .p6 h3, .p6 p { margin: 0; }
.p6 button, .p6 select, .p6 input { font-family: inherit; font-size: inherit; color: inherit; }
.p6 bdi { unicode-bidi: isolate; }
.p6 .ltr { direction: ltr; unicode-bidi: isolate; }
.p6 .mut { color: var(--t2); font-size: .8rem; }
.p6-wrap { width: min(520px, calc(100% - 1.4rem)); margin: .7rem auto; background: var(--s); border-radius: 28px; box-shadow: 0 20px 60px rgba(15,23,42,.08); padding: 1.1rem 1.1rem calc(7.2rem + env(safe-area-inset-bottom, 0px)); }

/* header */
.p6-head { display: flex; align-items: center; gap: .75rem; padding: .2rem 0 1rem; }
.p6-avatar { width: 42px; height: 42px; flex: none; border-radius: 13px; background: var(--ac); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; }
.p6-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.45; }
.p6-who b { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p6-sub { color: var(--t2); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p6-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--t3); margin-inline-end: .4rem; }
.p6-dot.on { background: var(--ok); box-shadow: 0 0 0 4px var(--okw); }
.p6-tools { display: flex; gap: .3rem; }
.p6-ib { width: 36px; height: 36px; border: 0; border-radius: 11px; background: var(--s2); color: var(--t2); display: grid; place-items: center; cursor: pointer; text-decoration: none; font-size: 1rem; }
.p6-ib:hover { color: var(--ac); }
.p6-ib .icon-light { display: none; }
:root[data-bs-theme="dark"] .p6-ib .icon-dark { display: none; }
:root[data-bs-theme="dark"] .p6-ib .icon-light { display: inline; }

/* alerts */
.p6-alert { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem .9rem; border-radius: 14px; font-size: .86rem; margin-bottom: .8rem; }
.p6-alert i { margin-top: .15rem; }
.p6-alert.ok { background: var(--okw); color: var(--ok); }
.p6-alert.bad { background: var(--badw); color: var(--bad); }
.p6-alert.warn { background: var(--warnw); color: var(--warn); }
.p6-alert strong { display: block; font-size: .9rem; }
.p6-alert .p6-tags { margin-top: .3rem; display: flex; flex-wrap: wrap; gap: .3rem; }

/* tags */
.p6-tag { display: inline-flex; align-items: center; gap: .25rem; padding: 0 .6rem; border-radius: 99px; font-size: .72rem; font-weight: 500; background: var(--s2); color: var(--t2); line-height: 1.7; }
.p6-tag.ok { background: var(--okw); color: var(--ok); }
.p6-tag.warn { background: var(--warnw); color: var(--warn); }
.p6-tag.danger, .p6-tag.bad { background: var(--badw); color: var(--bad); }

/* panels */
.p6-pn { display: none; }
.p6-pn.on { display: block; animation: p6fade .2s ease; }
@keyframes p6fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.p6-h { font-size: .9rem; font-weight: 700; margin: 1.5rem 0 .4rem; display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin: 15px 0 5px 0 !important;}
.p6-h:first-child { margin-top: .2rem; }
.p6-h span { font-weight: 400; color: var(--t2); font-size: .78rem; }

/* gauge */
.p6-status { text-align: center; margin-bottom: .2rem; }
.p6-gauge { position: relative; width: 300px; max-width: 100%; margin: 0 auto; }
.p6-gauge svg { width: 100%; display: block; }
.p6-gauge .bg { fill: none; stroke: var(--s2); stroke-width: 14; stroke-linecap: round; }
.p6-gauge .fg { fill: none; stroke: var(--ac); stroke-width: 14; stroke-linecap: round; }
.p6-gauge.warn .fg { stroke: var(--warn); }
.p6-gauge.bad .fg { stroke: var(--bad); }
.p6-gauge-c { position: absolute; inset: auto 0 4px 0; text-align: center; line-height: 1.35; }
.p6-gauge-c .num { display: block; font-size: 2.2rem; font-weight: 800; line-height: 1.15; }
.p6-gauge-sub { text-align: center; margin-top: .45rem; }
.p6-chips { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin: .8rem 0 .3rem; }
.p6-chip { background: var(--s2); border-radius: 99px; padding: .22rem .85rem; font-size: .8rem; display: inline-flex; gap: .35rem; align-items: center; }
.p6-chip i { color: var(--ac); }

/* chart */
.p6-chart svg { width: 100%; height: 84px; display: block; }
.p6-chart .area { fill: var(--aw); }
.p6-chart .line { fill: none; stroke: var(--ac); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.p6-days { display: flex; justify-content: space-between; direction: ltr; font-size: .66rem; color: var(--t3); margin-top: .2rem; }
.p6-empty { color: var(--t3); text-align: center; padding: 1.2rem 0; font-size: .85rem; }

/* rows */
.p6-row { display: flex; align-items: center; gap: .7rem; padding: .65rem 0; border-top: 1px solid var(--ln); font-size: .86rem; }
.p6-row:first-of-type { border-top: 0; }
.p6-row .m { flex: 1; min-width: 0; }
.p6-row .m b { font-weight: 500; }
.p6-row .m .mut { display: flex; flex-wrap: wrap; gap: .1rem .7rem; }
.p6-st { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--t3); }
.p6-st.on { background: var(--ok); box-shadow: 0 0 0 4px var(--okw); }
.p6-x { border: 0; background: var(--badw); color: var(--bad); width: 32px; height: 32px; border-radius: 10px; cursor: pointer; }
.p6-pkg { background: var(--aw); border-radius: 16px; padding: .85rem 1rem; margin-bottom: .6rem; }
.p6-pkg .t { font-weight: 700; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.p6-pkg.q { background: var(--s2); }
.p6-hint { color: var(--t3); font-size: .82rem; padding: .3rem 0; }
.p6-guide { background: var(--s2); border-radius: 14px; padding: .8rem 1rem; font-size: .86rem; color: var(--t2); }

/* form controls */
.p6-field { margin-bottom: .7rem; }
.p6-field label { display: block; font-size: .78rem; color: var(--t2); margin-bottom: .25rem; }
.p6-in, .p6-select { width: 100%; background: var(--s2); border: 1px solid transparent; border-radius: 12px; padding: .6rem .85rem; outline: 0; }
.p6-in:focus, .p6-select:focus { border-color: var(--ac); }
.p6-ig { display: flex; gap: .4rem; }
.p6-ig .p6-in { flex: 1; }
.p6-btn { border: 0; background: var(--s2); color: var(--tx); padding: .6rem 1rem; border-radius: 12px; cursor: pointer; font-size: .88rem; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; text-decoration: none; }
.p6-btn.primary { background: var(--ac); color: #fff; }
.p6-btn.soft { background: var(--aw); color: var(--ac); }
.p6-btn.danger { background: var(--badw); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 22%, transparent); }
.p6-btn.danger:hover { background: color-mix(in srgb, var(--bad) 14%, var(--s2)); }
.p6-btn.block { width: 100%; }
.p6-btn:disabled { opacity: .5; cursor: not-allowed; }
.p6-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.p6-actions .p6-btn { flex: 1; }

/* dock */
.p6-dock { position: fixed; inset-inline: 0; bottom: env(safe-area-inset-bottom, 0px); display: flex; justify-content: center; pointer-events: none; z-index: 20; }
.p6-dock nav { pointer-events: auto; display: flex; gap: .15rem; max-width: calc(100vw - 1rem); overflow-x: auto; scrollbar-width: none; background: color-mix(in srgb, var(--s) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: 24px; padding: .35rem; margin: .8rem; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.p6-dock nav::-webkit-scrollbar { display: none; }
.p6-dock button { position: relative; border: 0; background: none; cursor: pointer; padding: .4rem .45rem; border-radius: 18px; font-size: .7rem; color: var(--t2); display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 56px; flex: 0 0 56px; white-space: nowrap; }
.p6-dock-has-badge { overflow: visible; }
.p6-dock-badge { position: absolute; top: 1px; inset-inline-end: 7px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; background: var(--ac); color: #fff; border: 2px solid var(--s); font-size: .52rem; line-height: 1; font-weight: 800; }
.p6-dock button i { font-size: 1.15rem; line-height: 1.4; }
.p6-dock button.on { background: var(--aw); color: var(--ac); font-weight: 700; }

.p6-toast{position:fixed;left:50%;bottom:calc(5.7rem + env(safe-area-inset-bottom,0px));transform:translate(-50%,12px) scale(.98);z-index:80;min-width:min(330px,calc(100% - 2rem));max-width:calc(100% - 2rem);padding:.7rem .95rem;border-radius:14px;background:var(--s);color:var(--tx);border:1px solid var(--ln);box-shadow:0 14px 36px rgba(15,23,42,.18);text-align:center;font-size:.78rem;font-weight:600;opacity:0;visibility:hidden;transition:opacity .2s ease,transform .2s ease,visibility .2s ease}.p6-toast:not([hidden]){opacity:1;visibility:visible;transform:translate(-50%,0) scale(1)}.p6-toast.ok{background:color-mix(in srgb,var(--ok) 11%,var(--s));border-color:color-mix(in srgb,var(--ok) 32%,var(--ln));color:var(--ok)}.p6-toast.bad{background:color-mix(in srgb,var(--bad) 10%,var(--s));border-color:color-mix(in srgb,var(--bad) 32%,var(--ln));color:var(--bad)}

/* password sheet */
.p6-modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.p6-modal[hidden] { display: none; }
.p6-back { position: absolute; inset: 0; background: rgba(5,8,15,.55); backdrop-filter: blur(3px); }
.p6-sheet { position: relative; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; background: var(--s); border-radius: 24px 24px 0 0; padding: 1.2rem 1.2rem calc(1.4rem + env(safe-area-inset-bottom, 0px)); animation: p6up .22s ease; }
@keyframes p6up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.p6-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.p6-sheet-head h2 { font-size: 1rem; }
.p6-sheet-head p { color: var(--t2); font-size: .8rem; }
.p6-two { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
@media (min-width: 600px) { .p6-modal { align-items: center; } .p6-sheet { border-radius: 24px; } }
@media (max-width: 380px) { .p6-dock button { min-width: 54px; flex-basis: 54px; padding: .4rem .3rem; font-size: .64rem; } .p6-two { grid-template-columns: 1fr; } }

/* ---------- v2 additions ---------- */
.p6 [hidden] { display: none !important; }
.p6-gauge-c .num small { font-size: .9rem; font-weight: 500; color: var(--t2); margin-inline-start: .2rem; }
.p6-btn.sm { padding: .38rem .85rem; font-size: .8rem; border-radius: 10px; }
.p6-ib.sm { width: 32px; height: 32px; border-radius: 10px; font-size: .9rem; }
.p6-link { border: 0; background: none; padding: 0; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* pager */
.p6-pager { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .9rem; }

/* connection info rows */
.p6-kv { display: flex; align-items: center; gap: .7rem; background: var(--s2); border-radius: 14px; padding: .55rem .6rem .55rem .9rem; margin-bottom: .45rem; }
.p6-kv .k { color: var(--t2); font-size: .8rem; min-width: 74px; }
.p6-kv .v { flex: 1; min-width: 0; font-weight: 500; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; text-align: end; }

/* config files */
.p6-file { display: flex; align-items: center; gap: .75rem; background: var(--s2); border-radius: 16px; padding: .65rem .7rem .65rem .8rem; margin-bottom: .5rem; }
.p6-file .ic, .p6-tile .ic { width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--aw); color: var(--ac); display: grid; place-items: center; font-size: 1.1rem; }
.p6-file .m, .p6-tile .m { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.45; }
.p6-file .m b, .p6-tile .m b { font-weight: 700; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* steps */
.p6-steps { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.p6-steps li { display: flex; gap: .75rem; align-items: flex-start; padding: .55rem 0; position: relative; }
.p6-steps li + li::before { content: ""; position: absolute; inset-inline-start: 13px; top: -.55rem; height: 1.1rem; width: 2px; background: var(--ln); }
.p6-steps li span { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--aw); color: var(--ac); font-weight: 700; font-size: .82rem; display: grid; place-items: center; }
.p6-steps li p { font-size: .88rem; color: var(--t2); padding-top: .1rem; }

/* support tiles */
.p6-tile { display: flex; align-items: center; gap: .75rem; background: var(--s2); border-radius: 16px; padding: .65rem .8rem; margin-bottom: .5rem; text-decoration: none; color: var(--tx); }
.p6-tile .go { color: var(--t3); }
.p6-tile:hover .go { color: var(--ac); }

/* ---------- login (same system) ---------- */
body.p6-auth { min-height: 100vh; display: flex; justify-content: center; align-items: center; }
.p6-auth-box { width: min(420px, calc(100% - 1.4rem)); margin: .7rem auto; background: var(--s); border-radius: 28px; box-shadow: 0 20px 60px rgba(15,23,42,.08); padding: 1.4rem 1.3rem calc(1.4rem + env(safe-area-inset-bottom, 0px)); }
.p6-auth-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.p6-brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; }
.p6-brand .p6-avatar { width: 36px; height: 36px; border-radius: 11px; font-size: 1rem; }
.p6-auth-hero { text-align: center; margin-bottom: 1.1rem; }
.p6-auth-hero .p6-gauge { width: 190px; margin-bottom: .2rem; }
.p6-auth-hero .p6-gauge-c { inset: auto 0 10px 0; }
.p6-auth-hero .p6-gauge-c i { font-size: 1.9rem; color: var(--ac); }
.p6-auth-hero h1 { font-size: 1.25rem; font-weight: 800; margin-top: .3rem; }
.p6-auth-hero p { color: var(--t2); font-size: .86rem; }
.p6-auth form .p6-in { padding: .75rem .95rem; }
.p6-auth form .p6-btn.primary { padding: .8rem 1rem; font-size: .95rem; margin-top: .3rem; }
.p6-auth-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 1.2rem; font-size: .8rem; color: var(--t3); }
.p6-auth-foot a { color: var(--ac); text-decoration: none; }
.p6-spin { display: inline-block; animation: p6spin .8s linear infinite; }
@keyframes p6spin { to { transform: rotate(360deg); } }

/* ---------- wallet (UI) ---------- */
.p6-wallet { background: linear-gradient(135deg, var(--ac), color-mix(in srgb, var(--ac) 55%, #000)); color: #fff; border-radius: 22px; padding: 1.1rem 1.2rem; position: relative; overflow: hidden; }
.p6-wallet::after { content: ""; position: absolute; width: 170px; height: 170px; border-radius: 50%; background: rgba(255,255,255,.1); inset-inline-start: -60px; bottom: -80px; pointer-events: none; }
.p6-wallet .mut { color: rgba(255,255,255,.8); }
.p6-wallet .amt { font-size: 2rem; font-weight: 800; line-height: 1.3; margin: .1rem 0 .7rem; }
.p6-wallet .amt small { font-size: .85rem; font-weight: 500; opacity: .85; margin-inline-start: .4rem; }
.p6-wallet .p6-btn { background: rgba(255,255,255,.2); color: #fff; position: relative; z-index: 1; }
.p6-amounts { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
.p6-amounts button { border: 0; background: var(--s2); border-radius: 12px; padding: .6rem; cursor: pointer; font-weight: 700; font-size: .92rem; }
.p6-amounts button small { font-weight: 400; color: var(--t2); font-size: .72rem; }
.p6-amounts button.on { background: var(--aw); color: var(--ac); box-shadow: inset 0 0 0 1.5px var(--ac); }
.p6-unit { align-self: center; color: var(--t2); font-size: .85rem; }
.p6-ic { width: 38px; height: 38px; flex: none; border-radius: 12px; display: grid; place-items: center; }
.p6-ic.in { background: var(--okw); color: var(--ok); }
.p6-ic.out { background: var(--badw); color: var(--bad); }
.p6-amt { font-size: .9rem; }
.p6-amt.in { color: var(--ok); }
.p6-amt.out { color: var(--bad); }
