/* سامانه ارتباط از راه دور — شرکت پتروشیمی زنجان */
@font-face {
  font-family: "Vazirmatn";
  src: local("Vazirmatn"), url("fonts/Vazirmatn[wght].woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --navy: #0b1f3a;
  --navy-2: #12305a;
  --primary: #0e7490;
  --primary-2: #0891b2;
  --accent: #38bdf8;
  --ok: #059669; --ok-bg: #d1fae5;
  --warn: #b45309; --warn-bg: #fef3c7;
  --bad: #dc2626; --bad-bg: #fee2e2;
  --gold: #a16207; --gold-bg: #fef9c3;
  --bg: #f3f6fa;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --font: "Vazirmatn", "Vazir", "IRANSans", "Segoe UI", Tahoma, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.7; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; display: flex; align-items: center; gap: .5rem; }
h2 { font-size: 1.05rem; margin: 0 0 .8rem; display: flex; align-items: center; gap: .45rem; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; display: flex; align-items: center; gap: .4rem; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .85em; }
.muted { color: var(--muted); }
.tiny { font-size: .8rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.i { flex: none; vertical-align: -0.2em; }
.i.sm { width: 15px; height: 15px; }
/* جهت آیکون‌های پیکان: «back» یعنی بازگشت، «flip» یعنی بعدی، «mirror» در راست‌به‌چپ وارونه */
.flip { transform: scaleX(-1); }
[dir="ltr"] .i.flip { transform: none; }
[dir="ltr"] .i.back { transform: scaleX(-1); }
[dir="rtl"] .i.mirror { transform: scaleX(-1); }

/* ---- دکمه‌ها ---- */
.btn { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: .5rem 1rem; border-radius: 10px; font: inherit; font-weight: 500; cursor: pointer; transition: .15s; text-decoration: none !important; }
.btn:hover { border-color: var(--primary-2); color: var(--primary); }
.btn.primary { background: linear-gradient(135deg, var(--primary-2), var(--primary)); color: #fff; border-color: transparent; box-shadow: 0 4px 14px rgba(8, 145, 178, .3); }
.btn.primary:hover { filter: brightness(1.07); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.link { border: 0; background: none; color: var(--muted); }
.btn.sm { padding: .3rem .65rem; font-size: .85rem; border-radius: 8px; }
.btn.block { width: 100%; justify-content: center; padding: .75rem; font-size: 1rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.actions.center { justify-content: center; }
.actions form { margin: 0; }

/* ---- فرم ---- */
.form { display: grid; gap: 1rem; min-width: 0; }
.form > * { min-width: 0; }
.form label { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-weight: 500; font-size: .92rem; }
.form label.choice > span, .form label.toggle > span, .form label.ip > span, .form label.svc-pick > span { flex: 1; align-self: stretch; }
.form label > input, .form label > select, .form label > .input-icon, .form label > .suffix-input, .form label > small { flex-basis: 100%; }
input, select, textarea { font: inherit; padding: .6rem .8rem; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: var(--text); width: 100%; min-width: 0; }
input:focus, select:focus { outline: none; border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(8, 145, 178, .15); }
.input-icon { position: relative; display: block; }
.input-icon > .i { position: absolute; top: 50%; inset-inline-start: .75rem; transform: translateY(-50%); color: var(--muted); pointer-events: none; width: 18px; height: 18px; }
.input-icon > input { padding-inline-start: 2.4rem; }
.input-icon > input[dir="ltr"] { padding-inline-start: .8rem; padding-left: 2.4rem; }
.input-icon > input[dir="ltr"] ~ .i, .input-icon:has(input[dir="ltr"]) > .i { inset-inline-start: auto; left: .75rem; }
.suffix-input { display: flex; align-items: stretch; border: 1px solid #cbd5e1; border-radius: 10px; overflow: hidden; background: #f8fafc; }
.suffix-input input { border: 0; border-radius: 0; flex: 1; }
.suffix-input span { padding: .6rem .7rem; color: var(--muted); font-size: .85rem; white-space: nowrap; }
fieldset { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem 1.2rem; margin: 0; display: grid; gap: .9rem; }
legend { font-weight: 700; padding: 0 .4rem; display: flex; align-items: center; gap: .45rem; }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .85rem; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: end; }
.span2 { grid-column: span 2; }
.field-label { font-weight: 500; font-size: .92rem; display: flex; gap: .35rem; align-items: center; }
.form.inline { display: flex; gap: .5rem; margin-top: 1rem; }

/* کارت‌های انتخابی با آیکون */
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; }
.choice-cards.small { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.choice, .ip, .svc-pick, .toggle, .segmented label, .day-chips label { position: relative; }
.choice input, .ip input, .svc-pick input, .toggle input, .segmented input, .day-chips input { position: absolute; top: 0; right: 0; width: 1px; height: 1px; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
.choice-body { display: grid; justify-items: center; text-align: center; gap: .3rem; padding: 1rem .8rem; border: 2px solid var(--line); border-radius: var(--radius); cursor: pointer; transition: .15s; background: #fff; color: var(--muted); }
.choice-body b { color: var(--text); }
.choice-body small { font-weight: 400; font-size: .8rem; }
.choice input:checked + .choice-body { border-color: var(--primary-2); background: #ecfeff; color: var(--primary); box-shadow: 0 0 0 3px rgba(8, 145, 178, .12); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--accent); }
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .5rem; }
.ip span { display: grid; justify-items: center; gap: .2rem; padding: .6rem .3rem; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; color: var(--muted); font-size: .75rem; background: #fff; transition: .15s; }
.ip input:checked + span { border-color: var(--primary-2); color: var(--primary); background: #ecfeff; }
.svc-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .6rem; }
.svc-picker.off { opacity: .4; pointer-events: none; }
.svc-pick span { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .6rem; align-items: center; padding: .65rem .8rem; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; transition: .15s; }
.svc-pick span .i { grid-row: span 2; color: var(--muted); }
.svc-pick span small { color: var(--muted); font-size: .75rem; text-align: start; }
.svc-pick input:checked + span { border-color: var(--ok); background: #ecfdf5; }
.svc-pick input:checked + span .i { color: var(--ok); }
.svc-pick.disabled { opacity: .55; }
.toggles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .6rem; }
.toggle span { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: .7rem; align-items: center; padding: .7rem .9rem; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; transition: .15s; font-weight: 400; }
.toggle span .i { grid-row: span 2; color: var(--muted); }
.toggle span small { grid-column: 2; color: var(--muted); font-size: .78rem; }
.toggle span::after { content: ""; grid-row: 1 / span 2; grid-column: 3; width: 38px; height: 22px; border-radius: 11px; background: #cbd5e1; box-shadow: inset 0 0 0 2px #cbd5e1; transition: .2s;
  background-image: radial-gradient(circle at 11px 11px, #fff 8px, transparent 9px); }
.toggle input:checked + span { border-color: var(--primary-2); background: #f0fdff; }
.toggle input:checked + span .i { color: var(--primary); }
.toggle input:checked + span::after { background-color: var(--primary-2); box-shadow: inset 0 0 0 2px var(--primary-2); background-image: radial-gradient(circle at 27px 11px, #fff 8px, transparent 9px); }
.toggle.compact span { padding: .5rem .8rem; }
.segmented { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; width: fit-content; background: #fff; }
.segmented label { display: block; }
.segmented span { display: flex; align-items: center; gap: .35rem; padding: .5rem .9rem; cursor: pointer; font-size: .85rem; border-inline-end: 1px solid var(--line); color: var(--muted); }
.segmented input:checked + span { background: var(--primary); color: #fff; }

/* ---- هشدار ---- */
.alert { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; border-radius: 12px; margin-bottom: 1rem; text-align: start; }
.alert > div { display: grid; }
.alert.error { background: var(--bad-bg); color: #7f1d1d; border: 1px solid #fecaca; }
.alert.error > .i { color: var(--bad); margin-top: .2rem; }

/* ---- ساختار صفحه ---- */
.topbar { display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1.5rem; background: linear-gradient(90deg, var(--navy), var(--navy-2)); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar-brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none !important; }
.topbar-brand span { display: grid; line-height: 1.35; }
.topbar-brand small { color: #93c5fd; font-size: .72rem; }
.topnav { display: flex; gap: .3rem; flex: 1; }
.topnav a { color: #cbd5e1; padding: .4rem .8rem; border-radius: 8px; display: flex; gap: .4rem; align-items: center; text-decoration: none; }
.topnav a:hover, .topnav a.on { background: rgba(255, 255, 255, .12); color: #fff; }
.topbar-user { display: flex; align-items: center; gap: .6rem; }
.topbar-user .who { display: grid; line-height: 1.3; font-size: .85rem; }
.topbar-user .who small { color: #93c5fd; }
.topbar-user .btn { color: #fff; border-color: rgba(255, 255, 255, .25); }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--primary)); color: #fff; font-weight: 700; flex: none; }
.avatar.sm { width: 30px; height: 30px; font-size: .85rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.4rem; }
.subnav { display: flex; gap: .2rem; padding: 0 1.5rem; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.subnav a { padding: .7rem .9rem; color: var(--muted); border-bottom: 3px solid transparent; display: flex; gap: .4rem; align-items: center; white-space: nowrap; text-decoration: none; }
.subnav a.on { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 1.5rem; flex: 1; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head p { margin: 0; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem; border: 1px solid var(--line); }
.card.wide { max-width: 1100px; }
details.card summary { cursor: pointer; font-weight: 600; display: flex; gap: .4rem; align-items: center; }
details.card[open] summary { margin-bottom: 1rem; }
.cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.25rem; }
.footer { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; padding: 1rem; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); background: #fff; }
.footer span { display: flex; align-items: center; gap: .3rem; }
.credit { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-size: .8rem; }
.credit a { color: var(--primary); font-weight: 600; }

/* ---- برند ---- */
.brand { display: flex; align-items: center; gap: 1rem; }
.brand-text { display: grid; line-height: 1.5; }
.brand-org { font-weight: 800; font-size: 1.15rem; }
.brand-unit { color: var(--muted); font-size: .9rem; }
.brand-app { color: var(--primary); font-weight: 700; font-size: 1rem; }
.brand-hero { flex-direction: column; text-align: center; gap: 1.2rem; }
.brand-hero .brand-logo svg { width: 110px; height: 110px; filter: drop-shadow(0 10px 30px rgba(56, 189, 248, .45)); }
.brand-hero .brand-org { font-size: 2rem; color: #fff; }
.brand-hero .brand-unit { color: #bae6fd; font-size: 1.15rem; }
.brand-hero .brand-app { color: #fff; font-size: 1.35rem; margin-top: .4rem; padding: .3rem 1.2rem; border-radius: 99px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25); }
.brand-compact { display: none; }

/* ---- صفحه ورود ---- */
.auth { display: grid; grid-template-columns: 1.15fr 1fr; min-height: 100vh; }
.auth-hero { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2.5rem; padding: 3rem;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(56, 189, 248, .35), transparent 60%), radial-gradient(800px 500px at 0% 110%, rgba(14, 116, 144, .55), transparent 60%), linear-gradient(160deg, #071630, var(--navy) 45%, #0c3b5c); color: #fff; }
.hero-grid { position: absolute; inset: 0; opacity: .12;
  background-image: linear-gradient(rgba(255, 255, 255, .5) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .5) 1px, transparent 1px); background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, #000 30%, transparent 75%); -webkit-mask-image: radial-gradient(circle at center, #000 30%, transparent 75%); }
.auth-hero > * { position: relative; }
.hero-points { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; max-width: 460px; }
.hero-points li { display: flex; align-items: center; gap: .8rem; color: #e0f2fe; }
.hero-points .pi { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); color: var(--accent); flex: none; }
.hero-foot { color: #93c5fd; font-size: .85rem; display: flex; gap: .4rem; align-items: center; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 2rem; background: #fff; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 1.6rem; margin-top: 0; }
.auth-card .form { margin: 1.5rem 0 1rem; }
.auth-card .notice { display: flex; gap: .4rem; align-items: flex-start; }
.auth-foot { margin-top: 2.5rem; color: var(--muted); font-size: .8rem; display: grid; justify-items: center; gap: .3rem; text-align: center; }

/* ---- صفحه‌های وسط‌چین (۲FA و خطا) ---- */
.center-page { background: radial-gradient(900px 500px at 50% -10%, rgba(56, 189, 248, .25), transparent 60%), linear-gradient(180deg, #e8f1fb, var(--bg)); }
.center-card { width: min(520px, calc(100% - 2rem)); margin: 6vh auto; background: #fff; border-radius: 20px; box-shadow: 0 20px 60px rgba(15, 23, 42, .12); padding: 2rem 2rem 1.4rem; text-align: center; border: 1px solid var(--line); }
.center-card .brand { justify-content: center; padding-bottom: 1.2rem; margin-bottom: 1.4rem; border-bottom: 1px dashed var(--line); text-align: start; }
.center-card .credit { margin-top: 1.4rem; }
.card-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: #ecfeff; color: var(--primary); margin-bottom: .6rem; }
.center-card h1 { justify-content: center; }
.err-icon { display: inline-grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; margin-bottom: .6rem; }
.err-icon.bad { background: var(--bad-bg); color: var(--bad); }
.err-icon.warn { background: var(--warn-bg); color: var(--warn); }
.err-code { display: inline-block; font-size: .8rem; font-weight: 700; color: var(--muted); background: #f1f5f9; padding: .1rem .7rem; border-radius: 99px; margin-bottom: .4rem; }
.err-msg { font-size: 1.05rem; margin: .4rem 0; }
.err-hint { color: var(--muted); font-size: .9rem; background: #f8fafc; border-radius: 10px; padding: .6rem .8rem; }
.err-meta { color: var(--muted); font-size: .78rem; margin: 1rem 0; display: flex; gap: .35rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.steps { text-align: start; padding-inline-start: 1.2rem; }
.qr { width: 220px; height: 220px; margin: .5rem auto; display: block; border: 1px solid var(--line); border-radius: 12px; }
.secret { display: block; word-break: break-all; background: #f1f5f9; padding: .5rem; border-radius: 8px; margin-top: .4rem; }
.otp { text-align: center; font-size: 1.8rem; letter-spacing: .5em; font-weight: 700; }

/* ---- کاشی‌های سرویس ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.tile { position: relative; display: flex; gap: 1rem; align-items: flex-start; padding: 1.2rem; background: #fff; border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--text); transition: .18s; text-decoration: none !important; }
.tile:hover:not(.off) { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(15, 23, 42, .12); border-color: var(--accent); }
.tile.off { filter: grayscale(1); opacity: .7; cursor: not-allowed; }
.tile-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; flex: none; color: #fff; }
.kind-web { background: linear-gradient(135deg, #38bdf8, #0e7490); }
.kind-rdp { background: linear-gradient(135deg, #818cf8, #4338ca); }
.kind-ssh { background: linear-gradient(135deg, #34d399, #047857); }
.tile-body { display: grid; gap: .25rem; min-width: 0; }
.tile-name { font-weight: 700; font-size: 1.05rem; }
.tile-desc { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; }
.kind-badge { position: absolute; top: .8rem; inset-inline-end: .8rem; font-size: .7rem; color: var(--muted); display: inline-flex; gap: .25rem; align-items: center; background: #f1f5f9; padding: .1rem .5rem; border-radius: 99px; }
.flags .kind-badge { position: static; }
.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; padding: .15rem .6rem; border-radius: 99px; background: #f1f5f9; color: #334155; margin: .1rem; width: fit-content; text-decoration: none !important; }
.chip.ok { background: var(--ok-bg); color: #065f46; }
.chip.idle { background: #f1f5f9; color: var(--muted); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.none { background: #fff; border: 1px dashed var(--line); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: .2rem; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-icon { display: inline-grid; place-items: center; width: 80px; height: 80px; border-radius: 50%; background: #e2e8f0; color: #475569; margin-bottom: .6rem; }

/* ---- داشبورد ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { display: flex; gap: .8rem; align-items: center; background: #fff; padding: 1rem; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.stat b { font-size: 1.5rem; display: block; line-height: 1.2; }
.stat small { color: var(--muted); }
.stat-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; flex: none; }
.stat-icon.blue { background: #e0f2fe; color: #0369a1; } .stat-icon.teal { background: #ccfbf1; color: #0f766e; }
.stat-icon.violet { background: #ede9fe; color: #6d28d9; } .stat-icon.gray { background: #f1f5f9; color: #475569; }
.stat-icon.amber { background: var(--warn-bg); color: var(--warn); } .stat-icon.red { background: var(--bad-bg); color: var(--bad); }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: start; color: var(--muted); font-weight: 500; padding: .55rem .6rem; border-bottom: 2px solid var(--line); white-space: nowrap; }
.table td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.card { padding: 0; overflow: hidden; display: table; }
.table tr.bad td { background: #fff7f7; }
.table .detail { font-family: ui-monospace, Consolas, monospace; font-size: .75rem; color: var(--muted); max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .ua, .ua { font-size: .75rem; color: var(--muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted-row { opacity: .55; }
.ev { display: inline-flex; gap: .3rem; align-items: center; }
.row-link { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .55rem .2rem; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none !important; }
.row-link:hover { background: #f8fafc; }
.flag { display: inline-flex; align-items: center; gap: .25rem; font-size: .75rem; padding: .1rem .55rem; border-radius: 6px; background: #e0f2fe; color: #075985; margin: .1rem; }
.flag.warn { background: var(--warn-bg); color: var(--warn); } .flag.bad { background: var(--bad-bg); color: var(--bad); }
.flag.ok { background: var(--ok-bg); color: var(--ok); } .flag.gold { background: var(--gold-bg); color: var(--gold); }
.flags { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .35rem; }
.flags.big .flag { font-size: .85rem; padding: .25rem .7rem; }
.pager { display: flex; justify-content: center; gap: 1rem; align-items: center; margin-top: 1rem; }
.search { display: flex; gap: .5rem; align-items: center; }
.search.inline select { width: auto; }

/* ---- سرویس‌ها ---- */
.svc-list { display: grid; gap: .7rem; }
.svc-row { display: flex; align-items: center; gap: 1rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.svc-row.disabled { opacity: .6; }
.svc-main { flex: 1; min-width: 0; }
.svc-addr { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; color: var(--muted); text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-addr .arrow { color: var(--primary); }

/* ---- قانون‌ها ---- */
.rule-list { display: grid; gap: .8rem; }
.rule-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; border-inline-start: 5px solid #cbd5e1; display: grid; gap: .7rem; }
.rule-card.state-active { border-inline-start-color: var(--ok); }
.rule-card.state-expired { border-inline-start-color: var(--bad); opacity: .75; }
.rule-card.state-future { border-inline-start-color: var(--accent); }
.rule-card.disabled { opacity: .55; }
.rule-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.rule-subject { display: flex; align-items: center; gap: .45rem; font-size: 1.05rem; }
.rule-subject small { color: var(--muted); font-size: .75rem; background: #f1f5f9; padding: 0 .5rem; border-radius: 6px; }
.state-chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--muted); }
.state-active .state-chip { color: var(--ok); font-weight: 600; }
.state-expired .state-chip { color: var(--bad); }
.rule-body { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.rule-info { display: grid; gap: .25rem; font-size: .88rem; flex: 1; min-width: 260px; }
.rule-info > div { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.rule-actions { display: flex; gap: .4rem; justify-content: flex-end; }
.rule-actions form { margin: 0; }
.mini-grid { display: grid; grid-template-columns: repeat(48, 4px); grid-auto-rows: 9px; gap: 1px; padding: 4px; background: #f1f5f9; border-radius: 6px; direction: ltr; flex: none; }
.mini-grid i { background: #e2e8f0; border-radius: 1px; }
.mini-grid i.on { background: var(--ok); }
.access-list { display: grid; gap: .3rem; }
.access-row { display: flex; justify-content: space-between; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); gap: .5rem; }
.access-row > span:first-child { display: flex; align-items: center; gap: .4rem; }
.action-grid { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.action-grid form { margin: 0; }
.user-head { display: flex; gap: 1rem; align-items: center; }
.user-head p { margin: 0; text-align: start; }

/* ---- ویرایشگر جدول هفتگی ---- */
.quick { display: flex; flex-wrap: wrap; gap: .4rem; }
.quickfill { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; background: #f8fafc; border: 1px dashed var(--line); padding: .6rem .8rem; border-radius: 12px; }
.qf-label { display: flex; align-items: center; gap: .3rem; font-weight: 600; color: var(--primary); }
.day-chips { display: flex; flex-wrap: wrap; gap: .25rem; }
.day-chips span { display: inline-block; padding: .2rem .6rem; border: 1px solid var(--line); border-radius: 99px; cursor: pointer; font-size: .82rem; background: #fff; user-select: none; }
.day-chips input:checked + span { background: var(--primary); color: #fff; border-color: var(--primary); }
.qf-time { display: flex; align-items: center; gap: .3rem; font-size: .85rem; }
.qf-time select { width: auto; padding: .3rem .5rem; }
.sched-wrap { overflow-x: auto; padding-bottom: .3rem; direction: ltr; }
.sched { display: grid; grid-template-columns: 78px repeat(48, minmax(9px, 1fr)); gap: 2px; min-width: 560px; user-select: none; touch-action: none; direction: ltr; }
.sched .hd { font-size: .68rem; color: var(--muted); text-align: left; grid-column: span 2; padding-left: 1px; }
.sched .corner { grid-column: 1; }
.sched .day { font-size: .78rem; font-weight: 600; padding: 0 .4rem; display: flex; align-items: center; justify-content: flex-end; white-space: nowrap; overflow: hidden; cursor: pointer; border-radius: 6px; }
.sched .day:hover { background: #ecfeff; color: var(--primary); }
.sched .c { height: 28px; background: #e2e8f0; border-radius: 3px; cursor: crosshair; transition: background .05s; }
.sched .c.hour { margin-left: 1px; }
.sched .c.on { background: linear-gradient(180deg, #34d399, #059669); }
.sched .c:hover { outline: 2px solid var(--accent); outline-offset: -1px; }
.sched .c.night:not(.on) { background: #d5dde8; }
.sched-summary { display: flex; align-items: center; gap: .4rem; font-size: .9rem; background: #ecfdf5; color: #065f46; padding: .55rem .8rem; border-radius: 10px; }

/* ---- تقویم شمسی ---- */
.jdp { position: absolute; z-index: 50; width: 300px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(15, 23, 42, .2); padding: .8rem; font-size: .88rem; }
.jdp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; font-weight: 700; }
.jdp-head button { border: 0; background: #f1f5f9; border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 1rem; }
.jdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.jdp-grid .wd { color: var(--muted); font-size: .75rem; padding: .2rem 0; }
.jdp-grid button { border: 0; background: none; padding: .38rem 0; border-radius: 8px; cursor: pointer; font: inherit; }
.jdp-grid button:hover { background: #ecfeff; }
.jdp-grid button.today { box-shadow: inset 0 0 0 1px var(--primary-2); }
.jdp-grid button.sel { background: var(--primary); color: #fff; }
.jdp-grid button.fri { color: var(--bad); }
.jdp-time { display: flex; gap: .4rem; align-items: center; justify-content: center; margin: .6rem 0; direction: ltr; }
.jdp-time select { width: auto; padding: .3rem .4rem; }
.jdp-foot { display: flex; gap: .4rem; justify-content: space-between; }

/* ---- جستجوی AD ---- */
.autocomplete { position: relative; }
.ac-list { position: absolute; z-index: 40; inset-inline: 0; top: 100%; margin: .2rem 0 0; padding: .3rem; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 23, 42, .15); max-height: 300px; overflow-y: auto; }
.ac-list li { padding: .45rem .6rem; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 1rem; }
.ac-list li:hover, .ac-list li.active { background: #ecfeff; }
.ac-list li small { color: var(--muted); }

/* ---- موبایل ---- */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .brand-compact { display: flex; margin-bottom: 1.2rem; padding-bottom: 1rem; border-bottom: 1px dashed var(--line); }
  .cols, .grid2, .grid3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .topbar { flex-wrap: wrap; gap: .6rem; padding: .6rem 1rem; }
  .topbar-user .who { display: none; }
  .container { padding: 1rem; }
  .svc-row { flex-wrap: wrap; }
}
@media print { .topbar, .subnav, .footer, .actions { display: none; } }

/* ---- چندزبانه ---- */
[dir="ltr"] body, [dir="ltr"] input, [dir="ltr"] select, [dir="ltr"] button { font-family: "Segoe UI", "Vazirmatn", Tahoma, sans-serif; }
.langs { display: flex; align-items: center; gap: .15rem; font-size: .8rem; color: var(--muted); }
.langs a { padding: .2rem .55rem; border-radius: 8px; color: inherit; text-decoration: none; }
.langs a.on { background: var(--primary); color: #fff; }
.langs a:hover:not(.on) { background: #e2e8f0; }
.langs.on-dark { color: #cbd5e1; }
.langs.on-dark a:hover:not(.on) { background: rgba(255, 255, 255, .12); }
.auth-panel > .langs { align-self: flex-end; }
.auth-panel { justify-content: space-between; }
.center-card > .langs { justify-content: center; margin-bottom: 1rem; }
.lang-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; }
.lang-card { display: grid; gap: .2rem; padding: .9rem; border: 2px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none !important; text-align: center; }
.lang-card small { color: var(--muted); font-size: .75rem; }
.lang-card.on { border-color: var(--primary-2); background: #ecfeff; }

/* ---- حساب، کاربر محلی، گروه‌ها ---- */
.alert.success { background: var(--ok-bg); color: #065f46; border: 1px solid #a7f3d0; }
.alert.warn { background: var(--warn-bg); color: #78350f; border: 1px solid #fde68a; }
.alert.warn > .i { color: var(--warn); margin-top: .2rem; }
.flag.violet { background: #ede9fe; color: #6d28d9; }
.avatar.local { background: linear-gradient(135deg, #a78bfa, #6d28d9); }
.kind-group { background: linear-gradient(135deg, #a78bfa, #6d28d9); color: #fff; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
details.sub { border: 1px dashed var(--line); border-radius: 12px; padding: .7rem 1rem; }
details.sub summary { cursor: pointer; font-weight: 600; display: flex; gap: .4rem; align-items: center; }
details.sub[open] summary { margin-bottom: .8rem; }
.span3 { grid-column: 1 / -1; }
.form.inline.wrap { flex-wrap: wrap; align-items: center; }
.form label.check { display: inline-flex; align-items: center; gap: .3rem; font-weight: 400; }
.form label.check input { width: auto; }
.group-row { display: flex; align-items: center; gap: .8rem; padding: .7rem .4rem; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none !important; }
.group-row:hover { background: #f8fafc; }
.group-row .tile-icon { width: 42px; height: 42px; border-radius: 12px; }
.group-main { display: grid; flex: 1; min-width: 0; }
.member-row { display: flex; align-items: center; gap: .7rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.member-row form { margin: 0; }
.member-main { display: grid; flex: 1; min-width: 0; }
.member-main a { color: var(--text); }
.member-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex: none; background: #e0f2fe; color: #0369a1; }
.member-icon.local { background: #ede9fe; color: #6d28d9; }
.member-icon.adgroup { background: #ccfbf1; color: #0f766e; }
.member-icon.lgroup { background: #fae8ff; color: #a21caf; }
.ac-list li > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-kind { font-style: normal; font-size: .7rem; padding: 0 .45rem; border-radius: 6px; background: #e0f2fe; color: #075985; white-space: nowrap; align-self: center; }
.ac-kind.local { background: #ede9fe; color: #6d28d9; }
.ac-kind.lgroup { background: #fae8ff; color: #a21caf; }
.topbar a.avatar, .topbar a.who { color: #fff; text-decoration: none; }
.topnav a, .topbar-user .btn, .topbar .who, .langs a { white-space: nowrap; }
@media (max-width: 1100px) {
  .topbar-brand small, .topbar-user .who { display: none; }
  .topbar { gap: .8rem; }
}

/* ---- صفحه اصلی کاربر ---- */
.welcome { display: flex; align-items: center; gap: 1.1rem; padding: 1.4rem 1.6rem; margin-bottom: 1.25rem; border-radius: var(--radius);
  color: #fff; background: radial-gradient(600px 200px at 85% -40%, rgba(56, 189, 248, .45), transparent 70%), linear-gradient(120deg, var(--navy), #0c3b5c); box-shadow: var(--shadow); }
.avatar.xl { width: 64px; height: 64px; font-size: 1.6rem; box-shadow: 0 0 0 4px rgba(255, 255, 255, .15); }
.welcome-text { display: grid; line-height: 1.5; }
.welcome-hello { font-size: .95rem; color: #bae6fd; }
.welcome-name { font-size: 1.5rem; font-weight: 800; }
.welcome-meta { font-size: .8rem; color: #93c5fd; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: .8rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; }
.services-card .tile { box-shadow: none; }
.services-card .tile:hover:not(.off) { box-shadow: 0 10px 26px rgba(15, 23, 42, .1); }
.empty h2, .empty h3 { justify-content: center; text-align: center; }
.empty { display: grid; justify-items: center; }
.services-card .empty { text-align: center; padding: 3.5rem 1rem; margin: .5rem 0; border: 2px dashed var(--line); border-radius: var(--radius); background: #f8fafc; }
.services-card .empty h3 { font-size: 1.1rem; margin: .4rem 0 .2rem; color: var(--text); }
.services-card .empty p { margin: 0; }
/* پیام قفل در انتهای صفحه اصلی (بالای پانویس) */
.home-page .container { display: flex; flex-direction: column; }
.bottom-note { margin-top: auto; padding-top: 2rem; display: grid; justify-items: center; gap: .4rem; text-align: center; color: var(--muted); }
.bottom-note .empty-icon { width: 64px; height: 64px; margin: 0; }
.bottom-note p { margin: 0; }
.services-card .empty { padding: 3rem 1rem; }
.services-card .empty h3 { margin: 0; }

/* =====================================================================
   گوشی و تبلت
   ===================================================================== */
html { -webkit-text-size-adjust: 100%; }
body { padding-bottom: env(safe-area-inset-bottom); }
a, button, .btn, .choice-body, .svc-pick span, .toggle span, .ip span { -webkit-tap-highlight-color: transparent; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* تبلت (عمودی) */
@media (max-width: 1024px) {
  .stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .svc-picker { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}

@media (max-width: 900px) {
  /* ورود: بنر کوچک با لوگو و سه عنوان به‌جای ستون بزرگ */
  .auth-hero { display: flex; padding: 1.6rem 1rem 1.3rem; gap: 0; min-height: 0; }
  .auth-hero .hero-points, .auth-hero .hero-foot, .auth-hero .hero-grid { display: none; }
  .brand-hero { gap: .6rem; }
  .brand-hero .brand-logo svg { width: 64px; height: 64px; }
  .brand-hero .brand-org { font-size: 1.3rem; }
  .brand-hero .brand-unit { font-size: .95rem; }
  .brand-hero .brand-app { font-size: 1rem; padding: .2rem .9rem; }
  .brand-compact { display: none !important; }
  .auth { grid-template-columns: 1fr; min-height: 100dvh; grid-template-rows: auto 1fr; }
  .auth-panel { justify-content: flex-start; padding: 1.5rem 1.1rem 1rem; }
  .auth-card h1 { font-size: 1.35rem; }
  .auth-foot { margin-top: 2rem; }

  /* نوار بالا و منو */
  .topbar { flex-wrap: nowrap; gap: .5rem; padding: .5rem .75rem; padding-top: max(.5rem, env(safe-area-inset-top)); }
  .topbar-brand span { display: none; }
  .topnav { gap: .15rem; overflow-x: auto; scrollbar-width: none; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { padding: .45rem .6rem; font-size: .85rem; }
  .topbar-user { gap: .35rem; }
  .topbar-user .btn { padding: .35rem .5rem; }
  .langs.on-dark { display: none; }        /* زبان ادمین روی گوشی: از صفحه «حساب کاربری من» */
  .subnav { padding: 0 .5rem; scrollbar-width: none; position: sticky; top: 52px; z-index: 15; }
  .subnav::-webkit-scrollbar { display: none; }
  .subnav a { padding: .65rem .7rem; font-size: .88rem; }

  .container { padding: 1rem .85rem; }
  .page-head { align-items: stretch; }
  .page-head > .actions, .page-head > .btn, .page-head > form { width: 100%; }
  .page-head .search { flex-wrap: wrap; }
  .page-head .search .input-icon { flex: 1; min-width: 160px; }
  h1 { font-size: 1.25rem; }
  .card { padding: 1rem; }
  .footer { gap: .4rem 1rem; padding: .8rem; padding-bottom: max(.8rem, env(safe-area-inset-bottom)); }

  /* جدول‌ها: اسکرول افقی به‌جای بیرون‌زدن از صفحه */
  table.table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  table.table.card { display: block; }

  /* فرم‌ها: ورودی بزرگ‌تر برای لمس (۱۶px جلوی بزرگ‌نمایی خودکار iOS را می‌گیرد) */
  input, select, textarea { font-size: 16px; min-height: 44px; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 36px; }
  .choice-cards, .choice-cards.small { grid-template-columns: 1fr; }
  .choice-body { grid-template-columns: auto 1fr; grid-template-rows: auto auto; justify-items: start; text-align: start; column-gap: .8rem; padding: .8rem; }
  .choice-body .i { grid-row: span 2; }
  .toggles { grid-template-columns: 1fr; }
  .segmented { width: 100%; }
  .segmented label { flex: 1 1 45%; }
  .segmented span { justify-content: center; }
  .icon-picker { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
  .quick .btn { flex: 1 1 auto; justify-content: center; }
  .quickfill { flex-direction: column; align-items: stretch; }
  .quickfill .btn { justify-content: center; }
  .day-chips span { padding: .35rem .7rem; }
  .actions { width: 100%; }
  form .actions .btn.primary { flex: 1; justify-content: center; }

  /* جدول زمانی: ستون روزها ثابت می‌ماند، ساعت‌ها اسکرول می‌خورند */
  .sched { min-width: 720px; grid-template-columns: 64px repeat(48, minmax(12px, 1fr)); }
  .sched .day { position: sticky; left: 0; background: #fff; z-index: 2; font-size: .72rem; }
  .sched .c { height: 32px; }
  .sched-wrap { border-radius: 10px; }

  /* کاشی‌ها و صفحه اصلی */
  .tiles { grid-template-columns: 1fr; }
  .tile { padding: 1rem; }
  .welcome { padding: 1.1rem; gap: .8rem; }
  .avatar.xl { width: 52px; height: 52px; font-size: 1.3rem; }
  .welcome-name { font-size: 1.25rem; }

  /* کنترل پنل */
  .stats { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .stat { padding: .75rem; }
  .stat b { font-size: 1.2rem; }
  .stat-icon { width: 38px; height: 38px; }
  .rule-head, .rule-actions { flex-wrap: wrap; }
  .rule-actions { justify-content: stretch; }
  .rule-actions .btn { flex: 1; justify-content: center; }
  .mini-grid { grid-template-columns: repeat(48, 3px); grid-auto-rows: 7px; }
  .svc-row .actions { width: auto; }
  .user-head { align-items: flex-start; }
  .jdp { width: calc(100vw - 16px); left: 8px !important; }
  .center-card { margin: 1rem auto; padding: 1.4rem 1.1rem 1rem; }
}

@media (max-width: 330px) {
  .stats { grid-template-columns: 1fr; }
  .topnav a .i { display: none; }
}
/* آیتم‌های grid/flex نباید به اندازه محتوای عریض (جدول) کش بیایند */
.cols > *, .grid2 > *, .grid3 > *, .card, .container > * { min-width: 0; }
@media (max-width: 900px) {
  .topbar-user .btn { font-size: 0; gap: 0; padding: .45rem; }   /* فقط آیکون خروج */
  .topnav a { white-space: nowrap; }
}

/* ---- تأیید دومرحله‌ای در کنترل پنل و کدهای پشتیبان ---- */
.mfa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.mfa-card .qr { margin: .6rem 0; }
.backup-box { margin-top: 1rem; text-align: start; border: 1px dashed var(--line); border-radius: 12px; padding: .6rem .9rem; }
.backup-box summary { cursor: pointer; font-size: .9rem; color: var(--primary); display: flex; align-items: center; gap: .35rem; }
.backup-box .form { margin-top: .8rem; }
.backup-code { text-align: center; font-family: ui-monospace, Consolas, monospace; font-size: 1.3rem; letter-spacing: .15em; text-transform: uppercase; }
.backup-list { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem 2rem; margin: 1.2rem auto; padding: 1rem 2.5rem; max-width: 520px;
  border: 2px dashed var(--line); border-radius: 12px; background: #f8fafc; }
.backup-list code { font-size: 1.25rem; letter-spacing: .12em; font-weight: 700; }
.backup-rules { color: var(--muted); }
.print-sheet .brand { padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px dashed var(--line); }
@media (max-width: 900px) { .mfa-grid { grid-template-columns: 1fr; } .backup-list { grid-template-columns: 1fr; padding: 1rem; } }
@media print {
  .no-print, .footer { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
}
/* کاشی: نشان نوع (وب/RDP/SSH) بالای کاشی، روی نام نمی‌افتد */
.tile { padding-top: 2.1rem; }
.kind-badge { top: .6rem; }
.tile .chip { white-space: nowrap; }
@media (max-width: 1024px) { .tiles { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
@media (max-width: 900px) { .tiles { grid-template-columns: 1fr; } }
