/* ══════════════════════════════════════════════════════════
   auth.css — فرم‌ها، ثبت‌نام/ورود، پنل کاربری، جدول‌ها
   ══════════════════════════════════════════════════════════ */

.auth-body {
  background:
    radial-gradient(circle at 82% 8%, rgba(192, 241, 92, 0.08), transparent 42%),
    linear-gradient(170deg, #08120d, #060c09 70%);
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
.auth-body main { flex: 1; }

/* ── چیدمان صفحه ── */
.auth-wrap {
  padding-inline: var(--gutter);
  padding-block: clamp(32px, 5vw, 64px);
  max-width: 1400px;
  margin-inline: auto;
  width: 100%;
}
.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}
.auth-intro h1 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 14px; }
.auth-intro > p { max-width: 40ch; }
.auth-points { display: grid; gap: 14px; margin-top: 26px; }
.auth-points li {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  font-size: 0.9rem;
  color: var(--muted);
}
.auth-points span {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(192, 241, 92, 0.12);
  color: var(--lime);
  font-size: 0.8rem;
}

/* ── کارت فرم ── */
.auth-card {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(22px, 3vw, 34px);
  box-shadow: var(--shadow);
}
.auth-card h2 { font-size: 1.25rem; margin-bottom: 6px; }
.auth-card > p.hint { font-size: 0.86rem; margin-bottom: 22px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.form-grid .full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.84rem; font-weight: 700; color: rgba(238, 243, 238, 0.86); }
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--ink-3);
  color: var(--text);
  font-size: 0.92rem;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field input::placeholder,
.field textarea::placeholder { color: rgba(159, 176, 166, 0.55); }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(192, 241, 92, 0.18);
  background: #17241d;
}
.field input[aria-invalid='true'],
.field textarea[aria-invalid='true'] { border-color: #f2645c; }
.field textarea { min-height: 120px; resize: vertical; line-height: 1.9; }
.field small { font-size: 0.75rem; color: var(--muted); }
.field-error { font-size: 0.76rem; color: #ff8b84; }

/* ── دکمه‌ها ── */
.btn-block {
  width: 100%;
  justify-content: center;
  margin-top: 20px;
}
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.btn-ghost:hover { border-color: var(--lime); color: var(--lime); }

/* ── پیام‌ها ── */
.alert {
  padding: 12px 15px;
  border-radius: 12px;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 18px;
  border: 1px solid;
  line-height: 1.9;
}
.alert--ok { background: rgba(192, 241, 92, 0.1); border-color: rgba(192, 241, 92, 0.35); color: #d8f89a; }
.alert--err { background: rgba(242, 100, 92, 0.1); border-color: rgba(242, 100, 92, 0.35); color: #ffa8a2; }
.alert--info { background: rgba(140, 180, 255, 0.08); border-color: rgba(140, 180, 255, 0.28); color: #c3d8ff; }

.form-foot {
  margin-top: 16px;
  font-size: 0.83rem;
  color: var(--muted);
  text-align: center;
}
.form-foot a { color: var(--lime); font-weight: 700; }

/* ══════════════ پنل ══════════════ */
.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.panel-head h1 { font-size: clamp(1.4rem, 2.6vw, 2rem); margin-bottom: 4px; }
.panel-head p { margin: 0; font-size: 0.88rem; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.stat-card {
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--ink-2);
  border: 1px solid var(--line);
}
.stat-card small { display: block; font-size: 0.76rem; color: var(--muted); margin-bottom: 6px; }
.stat-card strong { font-size: 1.5rem; font-weight: 800; line-height: 1.2; display: block; }
.stat-card strong i { font-size: 0.8rem; font-style: normal; color: var(--muted); font-weight: 500; }
.stat-card.accent { border-color: rgba(192, 241, 92, 0.3); background: rgba(192, 241, 92, 0.06); }
.stat-card.accent strong { color: var(--lime); }

.plots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}
.plot {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--ink-2);
  border: 1px solid var(--line);
  transition: border-color 0.2s, transform 0.2s;
}
.plot:hover { border-color: rgba(192, 241, 92, 0.3); transform: translateY(-3px); }
.plot-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.plot-top h3 { margin: 0; font-size: 1rem; }
.plot-top small { font-size: 0.76rem; color: var(--muted); }
.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid;
}
.badge--ok { color: #bff08a; background: rgba(192, 241, 92, 0.1); border-color: rgba(192, 241, 92, 0.3); }
.badge--warn { color: #ffd07a; background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.32); }
.badge--off { color: #ff9d96; background: rgba(242, 100, 92, 0.1); border-color: rgba(242, 100, 92, 0.32); }

.gauge {
  height: 8px;
  border-radius: 999px;
  background: rgba(238, 243, 238, 0.1);
  overflow: hidden;
  margin: 6px 0 10px;
}
.gauge span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(to left, var(--lime), var(--lime-deep));
}
.gauge.warn span { background: linear-gradient(to left, #f5b942, #d98f16); }
.gauge.off span { background: linear-gradient(to left, #f2645c, #b93f38); }
.plot-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.table-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink-2);
  overflow: hidden;
  margin-bottom: 26px;
}
.table-card h3 {
  margin: 0;
  padding: 16px 20px;
  font-size: 0.98rem;
  border-bottom: 1px solid var(--line);
}
table.data { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
table.data th,
table.data td { padding: 12px 20px; text-align: start; border-bottom: 1px solid var(--line-soft); }
table.data th { font-weight: 700; color: var(--muted); font-size: 0.78rem; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: rgba(192, 241, 92, 0.03); }

.inline-form {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
  background: rgba(192, 241, 92, 0.03);
}
.inline-form .field { flex: 1 1 160px; }
.inline-form .field input, .inline-form .field select { padding: 10px 12px; }
.inline-form .button { padding: 11px 20px; font-size: 0.86rem; }

/* ══════════════ ریسپانسیو ══════════════ */
@media (max-width: 900px) {
  .auth-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plots { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .form-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  table.data th, table.data td { padding: 10px 12px; }
  .table-card { overflow-x: auto; }
}

/* ── نوار هشدار قطعی دیتابیس ── */
.db-banner {
  display: flex;
  align-items: center;
  gap: 10px 16px;
  flex-wrap: wrap;
  padding: 12px var(--gutter);
  background: rgba(242, 100, 92, 0.12);
  border-bottom: 1px solid rgba(242, 100, 92, 0.35);
  color: #ffb3ad;
  font-size: 0.85rem;
  font-weight: 600;
}
.db-banner__why { font-weight: 400; color: rgba(255, 179, 173, 0.85); unicode-bidi: plaintext; }
.db-banner a { margin-inline-start: auto; color: var(--lime); font-weight: 700; }
.db-banner a:hover { text-decoration: underline; }

/* ─────────── قطعه‌های مشترک (v21) ───────────
   صفحه‌ی ورود دیگر panel.css (۶۳ کیلوبایت) را بار نمی‌کند؛
   این چند قاعده همان چیزی است که در فرم ورود لازم دارد:
   برچسب نقش، دکمه‌ی «انتخاب»، متن مونواسپیس و جدول اسکرول‌شو. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  border: 1px solid var(--line);
  color: var(--muted);
}
.chip--info { color: #c3d8ff; border-color: rgba(140, 180, 255, 0.3); background: rgba(140, 180, 255, 0.08); }
.chip--warn { color: #ffd07a; border-color: rgba(245, 158, 11, 0.3); background: rgba(245, 158, 11, 0.08); }
.chip--ok   { color: var(--lime); border-color: rgba(192, 241, 92, 0.35); background: rgba(192, 241, 92, 0.1); }
.chip--off  { color: #ff9d96; border-color: rgba(242, 100, 92, 0.32); background: rgba(242, 100, 92, 0.08); }

.copy-btn {
  margin-inline-start: auto;
  border: 1px solid rgba(192, 241, 92, 0.4);
  background: rgba(192, 241, 92, 0.12);
  color: var(--lime);
  border-radius: 9px;
  padding: 6px 11px;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
}
.copy-btn:hover { background: rgba(192, 241, 92, 0.22); }

.mono {
  font-family: ui-monospace, Consolas, monospace;
  direction: ltr;
  unicode-bidi: isolate;
  font-size: 0.8rem;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* ══════════════ سفارش سفارشی (v39) ══════════════ */
.auth-grid--wide { grid-template-columns: 1fr 1.15fr; }
@media (max-width: 900px) {
  .auth-grid--wide { grid-template-columns: 1fr; }
}

.needs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.need-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.need-item:hover { border-color: rgba(192, 241, 92, 0.4); }
.need-item input { accent-color: var(--lime); width: 15px; height: 15px; flex: none; }
.need-item:has(input:checked) {
  border-color: rgba(192, 241, 92, 0.55);
  background: rgba(192, 241, 92, 0.1);
  color: var(--lime);
}

.custom-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}
.custom-steps > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.custom-steps b {
  font-size: 0.72rem;
  color: var(--lime);
  letter-spacing: 0.1em;
}
.custom-steps span { font-size: 0.76rem; color: var(--muted); line-height: 1.7; }
@media (max-width: 620px) {
  .custom-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .needs-grid { grid-template-columns: 1fr 1fr; }
  .need-item { font-size: 0.76rem; padding: 8px 10px; }
}
