* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Vazirmatn', 'Tahoma', sans-serif;
}

/* ========== تم تیره (پیش‌فرض) ========== */
body,
body.theme-dark {
  --page-bg: linear-gradient(160deg, #0b1220 0%, #121a2b 50%, #0f172a 100%);
  --card-bg: #1a2332;
  --card-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --border: #2d3a4f;
  --text: #e7ecf3;
  --muted: #8b9bb4;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent2: #10b981;
  --danger: #ef4444;
  --warn: #f59e0b;
  --header-color: #e7ecf3;
  --header-muted: #8b9bb4;
  --input-bg: #0f1419;
  --input-border: #2d3a4f;
  --input-text: #e7ecf3;
  --btn-bg: #3b82f6;
  --btn-hover: #2563eb;
  --btn-disabled: #475569;
  --tabs-wrap-bg: transparent;
  --tab-bg: #1a2332;
  --tab-border: #2d3a4f;
  --tab-color: #8b9bb4;
  --tab-active-bg: #1e2a44;
  --tab-active-color: #fff;
  --tab-active-border: #3b82f6;
  --chip-bg: #0f1419;
  --chip-border: #2d3a4f;
  --chip-color: #8b9bb4;
  --chip-hover-bg: #0b172a;
  --chip-hover-color: #fff;
  --status-bg: #132033;
  --status-border: #2d3a4f;
  --status-color: #8b9bb4;
  --error-bg: #3b1219;
  --error-border: #7f1d1d;
  --error-color: #fecaca;
  --analysis-bg: #1a2332;
  --analysis-border: #2d3a4f;
  --analysis-title: #e7ecf3;
  --analysis-text: #dbeafe;
  --article-number: #93c5fd;
  --score-bg: #0f1419;
  --score-border: #2d3a4f;
  --score-high-border: #10b981;
  --score-high-color: #6ee7b7;
  --score-mid-border: #f59e0b;
  --score-mid-color: #fcd34d;
  --score-low-border: #64748b;
  --score-low-color: #94a3b8;
  --tag-bg: #0f1419;
  --tag-border: #2d3a4f;
  --tag-color: #8b9bb4;
  --tag-law-bg: #052e1a;
  --tag-law-border: #065f46;
  --tag-law-color: #6ee7b7;
  --tag-domain-bg: #1e1b4b;
  --tag-domain-border: #3730a3;
  --tag-domain-color: #c7d2fe;
  --tag-sub-bg: #2e1065;
  --tag-sub-border: #5b21b6;
  --tag-sub-color: #ddd6fe;
  --official-text: #e7ecf3;
  --notes-bg: #2a2410;
  --notes-border: #f5c518;
  --notes-color: #fde68a;
  --amend-bg: #3b1219;
  --amend-border: #ef4444;
  --amend-color: #fecaca;
  --explain-bg: #0f1f3a;
  --explain-border: #3b82f6;
  --explain-color: #bfdbfe;
  --link-color: #93c5fd;
  --link-hover-bg: #1e2a44;
  --modal-bg: #1a2332;
  --modal-text: #e7ecf3;
  --modal-close-bg: #2d3a4f;
  --modal-close-color: #e7ecf3;
  --health-color: #8b9bb4;
  --health-ok: #6ee7b7;
  --health-bad: #fecaca;
  --code-bg: rgba(255, 255, 255, 0.08);
  --divider: #2d3a4f;
  --secondary-btn: #64748b;
  --loader-track: rgba(255, 255, 255, 0.25);
  --loader-head: #fff;
  --loader-on-card-track: rgba(59, 130, 246, 0.3);
  --loader-on-card-head: #3b82f6;
  --toggle-bg: #1a2332;
  --toggle-border: #2d3a4f;
  --toggle-color: #f7d84a;
  --result-card-border: #2d3a4f;
  --surface: #1f2937;
}

/* ========== تم روشن ========== */
body.theme-light {
  --page-bg: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  --card-bg: #ffffff;
  --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  --border: #e0e0e0;
  --text: #222;
  --muted: #555;
  --accent: #2a5298;
  --accent-hover: #1e3c72;
  --accent2: #10b981;
  --danger: #ef4444;
  --warn: #f59e0b;
  --header-color: #ffffff;
  --header-muted: rgba(255, 255, 255, 0.85);
  --input-bg: #ffffff;
  --input-border: #e0e0e0;
  --input-text: #222;
  --btn-bg: #2a5298;
  --btn-hover: #1e3c72;
  --btn-disabled: #ccc;
  --tabs-wrap-bg: rgba(255, 255, 255, 0.15);
  --tab-bg: transparent;
  --tab-border: transparent;
  --tab-color: #ffffff;
  --tab-active-bg: #ffffff;
  --tab-active-color: #1e3c72;
  --tab-active-border: transparent;
  --chip-bg: #f0f4ff;
  --chip-border: #dbe4ff;
  --chip-color: #2a5298;
  --chip-hover-bg: #2a5298;
  --chip-hover-color: #ffffff;
  --status-bg: transparent;
  --status-border: transparent;
  --status-color: #ffffff;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --error-color: #b91c1c;
  --analysis-bg: #ffffff;
  --analysis-border: transparent;
  --analysis-title: #1e3c72;
  --analysis-text: #222;
  --article-number: #1e3c72;
  --score-bg: #e8f0fe;
  --score-border: transparent;
  --score-high-border: transparent;
  --score-high-color: #1a7a3a;
  --score-mid-border: transparent;
  --score-mid-color: #8a6d00;
  --score-low-border: transparent;
  --score-low-color: #a02834;
  --tag-bg: #f5f5f5;
  --tag-border: transparent;
  --tag-color: #666;
  --tag-law-bg: #e8f5e9;
  --tag-law-border: transparent;
  --tag-law-color: #1b5e20;
  --tag-domain-bg: #e3f2fd;
  --tag-domain-border: transparent;
  --tag-domain-color: #1565c0;
  --tag-sub-bg: #f3e5f5;
  --tag-sub-border: transparent;
  --tag-sub-color: #7b1fa2;
  --official-text: #333;
  --notes-bg: #fffbeb;
  --notes-border: #f5c518;
  --notes-color: #6b5900;
  --amend-bg: #fef2f2;
  --amend-border: #ef4444;
  --amend-color: #7f1d1d;
  --explain-bg: #eef6ff;
  --explain-border: #2a5298;
  --explain-color: #1e3c72;
  --link-color: #2a5298;
  --link-hover-bg: #eef3ff;
  --modal-bg: #ffffff;
  --modal-text: #222;
  --modal-close-bg: #f0f0f0;
  --modal-close-color: #555;
  --health-color: rgba(255, 255, 255, 0.8);
  --health-ok: #d4f5dd;
  --health-bad: #fecaca;
  --code-bg: rgba(0, 0, 0, 0.15);
  --divider: #f0f0f0;
  --secondary-btn: #64748b;
  --loader-track: rgba(255, 255, 255, 0.3);
  --loader-head: #ffffff;
  --loader-on-card-track: rgba(42, 82, 152, 0.25);
  --loader-on-card-head: #2a5298;
  --toggle-bg: rgba(255, 255, 255, 0.2);
  --toggle-border: rgba(255, 255, 255, 0.45);
  --toggle-color: #fff7b0;
  --result-card-border: transparent;
  --surface: #e0e0e0;
}

body {
  background: var(--page-bg);
  min-height: 100vh;
  padding: 20px;
  color: var(--text);
  line-height: 1.7;
  transition: background 0.3s ease, color 0.3s ease;
}

.container {
  max-width: 920px;
  margin: 0 auto;
  position: relative;
}

/* --- دکمه تغییر تم --- */
.theme-toggle {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--toggle-border);
  background: var(--toggle-bg);
  color: var(--toggle-color);
  font-size: 1.35rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s, background 0.2s, color 0.2s;
  padding: 0;
}

.theme-toggle:hover {
  transform: scale(1.08);
  filter: brightness(1.08);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
  line-height: 1;
}

body.theme-dark .theme-toggle .icon-sun { display: inline; }
body.theme-light .theme-toggle .icon-moon { display: inline; }

header {
  text-align: center;
  color: var(--header-color);
  margin-bottom: 30px;
  padding: 20px 0 10px;
}

header h1 {
  font-size: 28px;
  margin-bottom: 8px;
  color: var(--header-color);
}

header p {
  opacity: 0.95;
  font-size: 14px;
  color: var(--header-muted);
}

/* --- Tabs --- */
.mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: var(--tabs-wrap-bg);
  padding: 6px;
  border-radius: 12px;
}

.mode-tab {
  flex: 1;
  text-align: center;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--tab-color);
  background: var(--tab-bg);
  border: 1px solid var(--tab-border);
  font-weight: bold;
  font-size: 14px;
  transition: all 0.2s;
  user-select: none;
}

.mode-tab.active {
  background: var(--tab-active-bg);
  color: var(--tab-active-color);
  border-color: var(--tab-active-border);
}

.search-box {
  background: var(--card-bg);
  border: 1px solid var(--result-card-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--card-shadow);
  margin-bottom: 24px;
  transition: background 0.3s, border-color 0.3s;
}

.search-box.hidden { display: none !important; }
.hidden { display: none !important; }

.analysis-submit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
}

.analysis-mode-choice {
  display: flex;
  flex: 1;
  gap: 6px;
  border: 0;
  min-inline-size: 0;
  margin: 0;
  padding: 0;
}

.analysis-mode-choice legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.analysis-mode-choice label {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 38px;
  margin: 0;
  padding: 5px 8px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.analysis-mode-choice label:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.analysis-mode-choice label::before {
  display: inline-flex;
  width: 19px;
  height: 19px;
  align-items: center;
  justify-content: center;
  flex: 0 0 19px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 16%, var(--card-bg));
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.analysis-mode-choice label:first-of-type::before { content: "↗"; }
.analysis-mode-choice label:last-of-type::before { content: "☷"; }

.analysis-mode-choice input {
  accent-color: var(--accent);
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
}

.analysis-mode-choice label:has(input:checked) {
  border-color: var(--accent);
  background: var(--tab-active-bg);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.analysis-mode-choice label::after {
  content: "✓";
  position: absolute;
  display: none;
  font-weight: 800;
  opacity: 0;
}

.analysis-mode-choice label:has(input:checked)::after { opacity: 1; }

.analysis-mode-choice label strong,
.analysis-mode-choice label small {
  display: block;
}

.analysis-mode-choice label strong {
  font-size: 11px;
  line-height: 1.5;
}

.analysis-mode-choice label small {
  display: none;
}

.analysis-submit-row > div[style="text-align: left;"] {
  flex: 0 0 142px;
  margin: 0;
}

.analysis-submit-row > div[style="text-align: left;"] button {
  width: 100%;
  padding: 9px 10px;
  font-size: 13px;
}

@media (max-width: 640px) {
  .analysis-submit-row {
    align-items: stretch;
    flex-direction: column;
  }

  .analysis-submit-row > div[style="text-align: left;"] {
    flex-basis: auto;
    width: 100%;
  }
}

.search-input-wrapper {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: stretch;
}

input[type="text"],
textarea,
select {
  width: 100%;
  background: var(--input-bg);
  color: var(--input-text);
  border: 2px solid var(--input-border);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, background 0.3s, color 0.3s;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.7;
}

button {
  background: var(--btn-bg);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px 28px;
  font-family: inherit;
  font-size: 16px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: bold;
  transition: background 0.2s;
}

button:hover { background: var(--btn-hover); }
button:disabled {
  background: var(--btn-disabled);
  cursor: not-allowed;
  opacity: 1;
}
button.secondary { background: var(--secondary-btn); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

.filters label { margin-left: 4px; }

.filters select,
.filters input {
  width: auto;
  min-width: 120px;
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--input-bg);
  color: var(--input-text);
}

.quick-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.example-chip {
  background: var(--chip-bg);
  color: var(--chip-color);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--chip-border);
  transition: all 0.2s;
}

.example-chip:hover {
  background: var(--chip-hover-bg);
  color: var(--chip-hover-color);
  border-color: var(--accent);
}

.status {
  text-align: center;
  color: var(--status-color);
  background: var(--status-bg);
  border: 1px solid var(--status-border);
  border-radius: 10px;
  padding: 16px 20px;
  font-size: 15px;
  margin-bottom: 8px;
}

.search-progress-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 24px;
}

.search-progress-step {
  transition: opacity .2s ease;
}

.search-progress-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  direction: ltr;
}

.search-progress-dots i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .35;
  animation: searchProgressDot 1s infinite ease-in-out;
}

.search-progress-dots i:nth-child(2) { animation-delay: .15s; }
.search-progress-dots i:nth-child(3) { animation-delay: .3s; }

@keyframes searchProgressDot {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

.error-box {
  background: var(--error-bg);
  color: var(--error-color);
  border: 1px solid var(--error-border);
  padding: 16px 20px;
  border-radius: 10px;
  text-align: center;
  font-size: 14px;
  margin-top: 8px;
}

.analysis-panel {
  display: none;
  background: var(--analysis-bg);
  border: 1px solid var(--analysis-border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--card-shadow);
  margin-bottom: 20px;
}

.analysis-panel.show { display: block; }

.analysis-panel h3 {
  color: var(--analysis-title);
  margin-bottom: 12px;
  font-size: 17px;
  border-bottom: 2px solid var(--divider);
  padding-bottom: 8px;
}

.analysis-text {
  direction: rtl;
  text-align: right;
  line-height: 2.15;
  font-size: 16px;
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
  color: var(--analysis-text);
  letter-spacing: -.1px;
  padding: 8px 6px 4px;
}

.analysis-text p {
  margin: 0 0 15px;
  text-align: justify;
  text-justify: inter-word;
}

.analysis-text .analysis-main-heading {
  display: block;
  margin: 22px 0 10px;
  color: var(--analysis-title);
  font-size: 19px;
  font-weight: 900;
  line-height: 1.8;
  border-right: 4px solid var(--accent);
  padding: 7px 12px 7px 0;
  background: linear-gradient(90deg, transparent, rgba(124, 58, 237, .08));
  border-radius: 0 8px 8px 0;
}

.analysis-text .analysis-subheading {
  margin: 22px 0 9px;
  color: var(--analysis-title);
  font-size: 19px;
  line-height: 1.8;
  font-weight: 900;
  border-right: 4px solid var(--accent);
  padding: 7px 12px 7px 0;
  background: linear-gradient(90deg, transparent, rgba(124, 58, 237, .08));
  border-radius: 0 8px 8px 0;
  letter-spacing: -.2px;
}

.analysis-text .analysis-heading-level-4 {
  font-size: 21px;
  margin-top: 28px;
  margin-bottom: 12px;
}

.analysis-text .analysis-heading-level-5,
.analysis-text .analysis-heading-level-6 {
  font-size: 17px;
  margin-top: 18px;
}

.analysis-text strong {
  color: var(--analysis-title);
  font-weight: 800;
}

.analysis-text code {
  direction: ltr;
  font-family: Consolas, monospace;
  background: rgba(127, 127, 127, .14);
  border-radius: 5px;
  padding: 1px 5px;
}

.analysis-text .analysis-list {
  margin: 5px 0 17px;
  padding: 0 18px 0 0;
}

.analysis-text .analysis-list-item {
  position: relative;
  margin: 7px 0;
  padding-right: 18px;
  text-align: justify;
}

.analysis-text .analysis-list-item::before {
  content: "•";
  position: absolute;
  right: 0;
  color: var(--accent);
  font-size: 19px;
  line-height: 1;
}

.analysis-text .analysis-spacer {
  height: 5px;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-card {
  background: var(--card-bg);
  border: 1px solid var(--result-card-border);
  border-radius: 14px;
  padding: 20px 24px;
  box-shadow: var(--card-shadow);
  animation: fadeIn 0.4s ease;
  transition: background 0.3s, border-color 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--divider);
}

.article-number {
  font-size: 18px;
  font-weight: bold;
  color: var(--article-number);
}

.score-badge {
  background: var(--score-bg);
  border: 1px solid var(--score-border);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: bold;
}

body.theme-light .score-badge.high {
  background: #d4f5dd;
  color: var(--score-high-color);
  border-color: var(--score-high-border);
}
body.theme-light .score-badge.mid,
body.theme-light .score-badge.medium {
  background: #fff3cd;
  color: var(--score-mid-color);
  border-color: var(--score-mid-border);
}
body.theme-light .score-badge.low {
  background: #f8d7da;
  color: var(--score-low-color);
  border-color: var(--score-low-border);
}

body.theme-dark .score-badge.high {
  border-color: var(--score-high-border);
  color: var(--score-high-color);
}
body.theme-dark .score-badge.mid,
body.theme-dark .score-badge.medium {
  border-color: var(--score-mid-border);
  color: var(--score-mid-color);
}
body.theme-dark .score-badge.low {
  border-color: var(--score-low-border);
  color: var(--score-low-color);
}

.meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.tag {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--tag-color);
}

.tag.law {
  background: var(--tag-law-bg);
  border-color: var(--tag-law-border);
  color: var(--tag-law-color);
}

.tag.domain {
  background: var(--tag-domain-bg);
  border-color: var(--tag-domain-border);
  color: var(--tag-domain-color);
}

.tag.sub-domain {
  background: var(--tag-sub-bg);
  border-color: var(--tag-sub-border);
  color: var(--tag-sub-color);
}

.official-text {
  font-size: 15px;
  line-height: 1.9;
  color: var(--official-text);
  margin-bottom: 12px;
  direction: rtl;
  text-align: justify;
  text-justify: inter-word;
  unicode-bidi: plaintext;
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
}

.search-input-wrapper {
  position: relative;
}

.analysis-attach-btn {
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--btn-bg);
  color: #fff;
  font-size: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  box-shadow: none;
  transition: background 0.2s, transform 0.2s;
  z-index: 2;
}

.analysis-attach-btn::before,
.analysis-attach-btn::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
}

.analysis-attach-btn::after {
  transform: rotate(90deg);
}

.analysis-attach-btn:hover {
  transform: translateY(-1px);
  filter: none;
  background: var(--btn-hover);
}

.analysis-attach-btn:disabled {
  opacity: .6;
  cursor: wait;
}

.analysis-file-status {
  min-height: 20px;
  margin: 6px 4px 0;
  color: var(--muted-text, #718096);
  font-size: 12px;
}

.amendment, .notes {
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-top: 8px;
  line-height: 1.7;
  direction: rtl;
  text-align: justify;
  text-justify: inter-word;
  unicode-bidi: plaintext;
}

.notes {
  background: var(--notes-bg);
  border-right: 3px solid var(--notes-border);
  color: var(--notes-color);
}

.amendment {
  background: var(--amend-bg);
  border-right: 3px solid var(--amend-border);
  color: var(--amend-color);
}

/* ========== کامپوننت‌های هماهنگ شده (Explanation & Terminology) ========== */
.result-card .explanation,
.result-card .terminology-section {
  background: var(--explain-bg);
  border: 1px solid var(--explain-border);
  border-right: 4px solid var(--explain-border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 12px;
  color: var(--explain-color);
  line-height: 1.8;
  font-size: 0.95em;
  animation: fadeIn 0.3s ease-in-out;
}

.result-card .explanation strong,
.result-card .term-title {
  color: var(--article-number);
  font-weight: 700;
}

.result-card .term-title {
  cursor: help;
}

.article-link {
  color: var(--link-color);
  font-weight: bold;
  cursor: pointer;
  border-bottom: 1px dashed var(--link-color);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.article-link:hover {
  background: var(--link-hover-bg);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show { display: flex; }

.modal-box {
  background: var(--modal-bg);
  color: var(--modal-text);
  border-radius: 14px;
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.25s ease;
  border: 1px solid var(--result-card-border);
}

.modal-close {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--modal-close-bg);
  border: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  color: var(--modal-close-color);
}

.modal-close:hover { filter: brightness(0.95); }

.modal-loading, .modal-error {
  text-align: center;
  padding: 30px;
  color: var(--muted);
}

.loading {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  border: 3px solid var(--loader-track);
  border-top-color: var(--loader-head);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

.error-box .loading,
.modal-loading .loading,
.result-card .loading,
.analysis-panel .loading {
  border: 3px solid var(--loader-on-card-track);
  border-top-color: var(--loader-on-card-head);
}

.cursor-blink {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  margin-right: 2px;
  vertical-align: middle;
  background: currentColor;
  animation: blink 1s steps(1) infinite;
}

.analysis-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.analysis-loading .dots {
  display: inline-flex;
  gap: 4px;
}

.analysis-loading .dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  animation: pulse 1.2s infinite ease-in-out;
}

.analysis-loading .dots span:nth-child(2) { animation-delay: 0.2s; }
.analysis-loading .dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse {
  0%, 80%, 100% { transform: scale(0.85); opacity: 0.35; }
  40% { transform: scale(1); opacity: 1; }
}

.health {
  text-align: center;
  font-size: 0.85rem;
  color: var(--health-color);
  margin-top: 28px;
}

.health.ok { color: var(--health-ok); }
.health.bad { color: var(--health-bad); }

.health code,
.error-box code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
}

@media (max-width: 640px) {
  .theme-toggle {
    top: -4px;
    left: 0;
    width: 40px;
    height: 40px;
  }
  header h1 { font-size: 22px; padding: 0 40px; }
  .search-input-wrapper { flex-direction: column; }
  button { width: 100%; }
}

.filters-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.filters-inline label {
  white-space: nowrap;
  flex: 0 0 auto;
}

.topk-select {
  width: 72px;
  min-width: 72px;
  flex: 0 0 72px;
}

.law-select {
  min-width: 0;
  flex: 1 1 auto;
}

.browse-law-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.filters select,
.filters input,
.filters button {
  height: 40px;
}

/* اصلاح جهت و پدینگ های select ها */
.filters select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--surface, #1f2937);
  color: var(--text, #fff);
  border: 1px solid var(--border, #374151);
  border-radius: 10px;
  /* پدینگ راست برای نوشته و چپ برای فلش مرورگر */
  padding: 0 16px 0 24px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  direction: rtl;
  text-align: right;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%238b9bb4%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%226%209%2012%2015%2018%209%22%3E%3C%2Fpolyline%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: left 8px center;
  background-size: 16px;
}

.filters select option {
  background: #111827;
  color: #fff;
  direction: rtl;
  text-align: right;
}

#lawCodeFilter {
  padding-right: 16px;
  padding-left: 32px;
}

#topK {
  padding-right: 12px;
  padding-left: 24px;
  text-align: center;
}

#browseLawBtn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .filters-inline {
    flex-wrap: wrap;
  }

  .law-select {
    flex-basis: 100%;
  }
}
/* ========== Law combobox ========== */
.law-combo {
  position: relative;
  min-width: 0;
  flex: 1 1 auto;
}

.law-combo-input-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  padding: 0 6px 0 4px;
  transition: border-color 0.2s, background 0.3s;
}

.law-combo-input-wrap:focus-within {
  border-color: var(--accent);
}

.law-combo-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0 !important;
  outline: none;
  background: transparent !important;
  color: var(--input-text);
  padding: 0 8px !important;
  font-size: 13px;
  font-family: inherit;
  direction: rtl;
  text-align: right;
}

.law-combo-input::placeholder {
  color: var(--muted);
  opacity: 0.9;
}

.law-combo-clear,
.law-combo-caret {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0 !important;
  margin: 0;
  border: 0;
  border-radius: 8px;
  background: transparent !important;
  color: var(--muted);
  font-size: 14px;
  font-weight: normal;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  white-space: nowrap;
}

.law-combo-clear:hover,
.law-combo-caret:hover {
  background: var(--chip-bg) !important;
  color: var(--text);
}

.law-combo-list {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  direction: rtl;
  text-align: right;
  unicode-bidi: plaintext;
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
}

.law-combo-list li {
  padding: 9px 14px;
  font-size: 13px;
  line-height: 1.55;
  cursor: pointer;
  color: var(--text);
  direction: rtl;
  text-align: right;
  unicode-bidi: plaintext;
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
}

.law-combo-list li:hover,
.law-combo-list li[aria-selected="true"] {
  background: var(--link-hover-bg);
  color: var(--link-color);
}

.law-combo-list li.is-all {
  color: var(--muted);
  border-bottom: 1px solid var(--divider);
  margin-bottom: 4px;
  padding-bottom: 10px;
}

.law-combo-list li.no-match {
  color: var(--muted);
  font-style: italic;
  cursor: default;
}

.law-combo-list li.no-match:hover {
  background: transparent;
  color: var(--muted);
}

.browse-law-btn {
  height: 40px;
  padding: 0 16px !important;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#browseLawBtn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .law-combo.law-select {
    flex-basis: 100%;
  }
}

/* ========== واژه‌نامه و توضیح: هماهنگ با تم کلی ========== */
.result-card .terminology-section,
.result-card .explanation {
  background: var(--explain-bg) !important;
  color: var(--explain-color) !important;
  border: 1px solid var(--explain-border) !important;
  border-right: 4px solid var(--explain-border) !important;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 12px;
  line-height: 1.8;
  font-size: 0.95em;
  animation: fadeIn 0.3s ease-in-out;
}

/* همه‌ی متن‌های داخل این دو بخش از رنگ متن خودشان تبعیت کنند */
.result-card .terminology-section *,
.result-card .explanation * {
  color: inherit !important;
}

/* عنوان‌های داخلی */
.result-card .terminology-section .term-title,
.result-card .explanation strong {
  color: var(--article-number) !important;
  font-weight: 700;
}

/* متن تعریف واژه */
.result-card .terminology-section .term-def {
  color: var(--explain-color) !important;
}

/* در تم تیره، متن‌ها روشن‌تر و خواناتر */
body.theme-dark .result-card .terminology-section,
body.theme-dark .result-card .explanation {
  background: #1a2332 !important;
  border-color: #2d3a4f !important;
  border-right-color: var(--accent) !important;
}

body.theme-dark .result-card .terminology-section .term-title,
body.theme-dark .result-card .explanation strong {
  color: #ffffff !important;
}

body.theme-dark .result-card .terminology-section .term-def,
body.theme-dark .result-card .explanation div {
  color: #90908f !important;
}

/* در تم روشن، همان رنگ‌های هماهنگ قبلی حفظ شوند */
body.theme-light .result-card .terminology-section,
body.theme-light .result-card .explanation {
  background: #f0f7ff !important;
  border-color: #cfe2ff !important;
  border-right-color: var(--accent) !important;
}

body.theme-light .result-card .terminology-section .term-title,
body.theme-light .result-card .explanation strong {
  color: #0d6efd !important;
}

body.theme-light .result-card .terminology-section .term-def,
body.theme-light .result-card .explanation div {
  color: #4b5563 !important;
}
.terminology-toggle {
  user-select: none;
}

.terminology-section.collapsed .terminology-content {
  display: none;
}

.terminology-section .terminology-content {
  margin-top: 8px;
}

.related-tabs-box {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card-bg);
}

.related-tabs-header {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  background: var(--explain-bg);
}

.related-tab-btn {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 10px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  transition: .15s ease;
}

.related-tab-btn:hover,
.related-tab-btn.active {
  background: var(--link-hover-bg);
  color: var(--link-color);
  border-color: var(--link-color);
}

.related-tabs-body {
  padding: 0 10px;
  direction: rtl;
  text-align: right;
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
}

.related-tab-panel {
  display: none;
  padding: 10px 0;
}

.related-tab-panel.active {
  display: block;
}

.related-tab-panel[data-panel="opinions"],
.related-tab-panel[data-panel="opinions"] .related-opinions-content {
  width: 100%;
  direction: rtl;
  text-align: right;
}

/* ???? ????? ??????? ????? */
.related-opinions-content {
  padding: 4px 0;
  direction: rtl;
  text-align: right;
  unicode-bidi: plaintext;
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
}
.related-opinions-content .opinion-item {
  border-bottom: 1px solid var(--divider, #e2e8f0);
  padding: 10px 4px;
  margin-bottom: 0;
  line-height: 1.8;
  direction: rtl;
  text-align: justify;
  unicode-bidi: plaintext;
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
}
.related-opinions-content .opinion-item:last-child {
  border-bottom: 0;
}
.related-opinions-content .opinion-title {
  display: block;
  font-weight: 600;
  font-size: 12px;
  color: var(--link-color, #2b6cb0);
  text-decoration: none;
  margin-bottom: 4px;
  direction: rtl;
  text-align: justify;
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
  width: 100%;
}

.related-opinions-content .opinion-source-badge {
  width: 100%;
  margin-top: 6px;
  text-align: right;
  direction: rtl;
}

.related-opinions-content .opinion-source-badge span {
  display: inline-block;
  font-size: 10px;
  background: #edf2f7;
  color: #4a5568;
  padding: 2px 8px;
  border-radius: 4px;
}

.related-opinions-content .opinion-item > .opinion-text,
.related-opinions-content .opinion-item > .opinion-meta,
.related-opinions-content .opinion-item > .opinion-mostanadat {
  width: 100%;
  text-align: justify !important;
  direction: rtl !important;
}
.related-opinions-content .opinion-text,
.related-opinions-content .opinion-meta,
.related-opinions-content .opinion-mostanadat {
  font-size: 12px;
  color: var(--text, #2d3748);
  margin-top: 5px;
  direction: rtl;
  text-align: justify;
  unicode-bidi: plaintext;
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
  white-space: pre-wrap;
}
.related-opinions-content .opinion-mostanadat {
  background: var(--explain-bg, #f0f7ff);
  border-right: 3px solid var(--accent, #446093);
  border-radius: 6px;
  padding: 7px 9px;
  margin-right: 0;
  text-indent: 0;
  direction: rtl !important;
  text-align: justify !important;
  text-justify: inter-word;
  unicode-bidi: plaintext;
}

.related-opinions-content .opinion-mostanadat strong {
  display: inline;
  direction: rtl;
  text-align: right;
  margin: 0;
  padding: 0;
}

.related-opinions-content .opinion-mostanadat > span {
  display: inline;
  direction: rtl !important;
  text-align: justify !important;
  unicode-bidi: plaintext;
}

/* ????? ??????: ????? ? ??????? ?? ?? ???? */
.analysis-download-area {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  width: 100%;
  margin: 12px auto 20px;
}
.analysis-download-area[hidden],
.analysis-download-area #draftActions[hidden],
#draftOutput[hidden] {
  display: none !important;
}
.analysis-download-area #draftActions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}
.analysis-download-area #draftActions button,
.analysis-download-area #downloadAnalysisExcelBtn {
  white-space: nowrap;
  min-height: 36px;
}
#draftOutput {
  max-height: 760px;
  min-height: 160px;
  overflow-y: auto;
  overflow-x: hidden;
  direction: rtl;
  text-align: right;
  padding: 8px 12px 8px 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
#draftOutput::-webkit-scrollbar { width: 7px; }
#draftOutput::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
/* حساب کاربری و پنل مدیریت؛ هماهنگ با قالب اصلی */
.admin-analysis-settings {
  margin: 0 0 18px;
  padding: 18px;
  border: 1px solid #e4ddd1;
  border-radius: 16px;
  background: #faf8f3;
}
.admin-analysis-settings h3 { margin: 0 0 6px; }
.admin-analysis-settings .setting-help {
  margin: 0 0 14px;
  color: #777066;
  font-size: .88rem;
}
.admin-analysis-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.admin-analysis-fields label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #405044;
  font-size: .9rem;
}
.admin-analysis-fields input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d9d0c3;
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
  color: #263d31;
}
.admin-settings-status {
  display: inline-block;
  margin-inline-start: 10px;
  color: #286044;
  font-size: .86rem;
  opacity: 0;
  transition: opacity .2s ease;
}
.admin-settings-status.show { opacity: 1; }
.admin-settings-status.error { color: #ad4b3b; }
@media (max-width: 700px) {
  .admin-analysis-fields { grid-template-columns: 1fr; }
}
.account-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
  font-size: 12px;
}
.account-panel { margin: 0 auto 16px; max-width: 760px; }
.account-panel-card {
  background: var(--card-bg, rgba(255,255,255,.06));
  border: 1px solid var(--border-color, rgba(255,255,255,.14));
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.account-panel-card form { display: grid; gap: 8px; margin-top: 10px; }
.account-panel-card input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #ccd3df);
  background: transparent;
  color: inherit;
}
.account-tabs { display: flex; gap: 6px; }
.account-tabs .active { outline: 2px solid rgba(68,96,147,.35); }
.account-message { min-height: 22px; margin-top: 8px; font-size: 12px; }
.account-usage, .account-history { margin-top: 10px; font-size: 12px; }
.history-item { padding: 6px 0; border-bottom: 1px solid var(--border-color, rgba(255,255,255,.1)); }
.history-item span { color: var(--accent, #3b82f6); margin-left: 6px; }
.admin-heading { display:flex; align-items:center; justify-content:space-between; gap: 10px; }
.admin-user-row {
  display:grid;
  grid-template-columns: 1.6fr .7fr .7fr .7fr auto;
  gap: 8px;
  align-items:center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-color, rgba(255,255,255,.12));
  font-size: 12px;
}
.admin-user-row input, .admin-user-row select { min-width: 0; padding: 6px; }
@media (max-width: 640px) {
  .admin-user-row { grid-template-columns: 1fr 1fr; }
}

/* میزکار حساب؛ قبل از ورود هیچ‌یک از ابزارهای اصلی نمایش داده نشود */
body.auth-locked .container > *:not(#accountBar):not(#accountPanel):not(#publicLanding):not(#publicLandingV2):not(.theme-toggle) {
  display: none !important;
}
body.auth-locked .theme-toggle { display: none !important; }
body.auth-locked #accountPanel { display: block !important; }

.public-landing { position:relative; max-width:1320px; margin:0 auto; padding:0 42px 70px; color:#252827; direction:rtl; overflow:hidden; }
.landing-glow { position:absolute; border-radius:50%; filter:blur(2px); pointer-events:none; z-index:-1; }
.landing-glow-one { width:420px; height:420px; top:120px; right:-180px; background:rgba(174,121,55,.1); }
.landing-glow-two { width:360px; height:360px; top:530px; left:-180px; background:rgba(36,72,59,.08); }
.landing-nav { height:88px; display:flex; align-items:center; justify-content:space-between; gap:22px; border-bottom:1px solid #e6e3dc; direction:ltr; }
.landing-brand { display:flex; align-items:center; gap:10px; color:#252827; text-decoration:none; font-size:22px; font-weight:900; direction:rtl; order:4; }
.landing-logo { width:40px; height:40px; display:grid; place-items:center; border-radius:13px; color:#fff; background:#24483b; font-size:23px; box-shadow:0 8px 16px rgba(36,72,59,.2); }
.landing-links { display:flex; align-items:center; gap:25px; margin:0 auto; direction:rtl; }
.landing-links a { color:#59615d; text-decoration:none; font-size:13px; white-space:nowrap; }
.landing-links a:hover { color:#ae7937; }
.landing-command { order:1; display:flex; align-items:center; gap:9px; min-width:270px; padding:10px 13px; border:1px solid #dddcd6; border-radius:10px; color:#767b77; background:#fff; font:inherit; font-size:11px; cursor:pointer; }
.landing-command kbd { margin-right:auto; color:#a0a29e; font-size:10px; }
.landing-login { order:2; color:#fff; background:#27463b; text-decoration:none; border-radius:9px; padding:11px 22px; font-size:13px; font-weight:800; }
.landing-hero { min-height:650px; display:grid; grid-template-columns:1fr 1.05fr; align-items:center; gap:58px; padding:78px 64px 72px; border-radius:0 0 42px 42px; background:linear-gradient(180deg,#fbfaf7 0%,#f4efe7 100%); overflow:hidden; box-shadow:0 22px 60px rgba(56,47,33,.06); }
.landing-hero-copy { max-width:560px; }
.landing-eyebrow { display:inline-block; color:#ae7937; font-size:12px; font-weight:800; letter-spacing:.02em; margin-bottom:14px; }
.landing-hero h2 { margin:0; color:#202c29; font-size:58px; line-height:1.38; letter-spacing:-1.8px; }
.landing-hero h2 em { color:#ae7937; font-style:normal; }
.landing-hero p { max-width:520px; margin:18px 0 0; color:#65716d; line-height:2.1; font-size:16px; }
.landing-actions { display:flex; align-items:center; gap:12px; margin-top:26px; }
.landing-primary,.landing-secondary { display:inline-flex; align-items:center; gap:10px; text-decoration:none; border-radius:13px; padding:13px 19px; font-size:13px; font-weight:800; }
.landing-primary { color:#fff; background:#ae7937; box-shadow:0 9px 18px rgba(174,121,55,.24); }
.landing-primary span { font-size:18px; line-height:1; }
.landing-secondary { color:#315144; background:#fff; border:1px solid #dfe6df; }
.landing-trust { display:flex; gap:12px; align-items:center; margin-top:24px; color:#7c8983; font-size:11px; }
.landing-trust span { color:#ae7937; font-weight:900; }
.landing-hero-art { position:relative; min-height:490px; display:grid; place-items:center; background:radial-gradient(circle,#eadcc3 0%,#f5efe6 37%,transparent 68%); border-radius:50%; }
.hero-orbit { position:absolute; border:1px solid rgba(174,121,55,.2); border-radius:50%; transform:rotate(-18deg); }
.orbit-one { width:360px; height:230px; }.orbit-two { width:290px; height:400px; transform:rotate(42deg); }
.hero-scale { width:205px; height:205px; display:grid; place-items:center; align-content:center; gap:2px; border-radius:50%; color:#fff; background:linear-gradient(145deg,#315a49,#19362c); box-shadow:0 20px 35px rgba(26,57,45,.25),0 0 0 14px rgba(255,255,255,.46),0 0 0 15px rgba(174,121,55,.16); font-size:88px; z-index:1; }
.hero-scale small { display:block; font-size:13px; font-weight:800; }
.hero-card { position:absolute; z-index:2; display:grid; gap:4px; padding:15px 17px; border-radius:15px; background:rgba(255,255,255,.92); border:1px solid rgba(216,197,161,.55); box-shadow:0 12px 25px rgba(57,46,28,.12); }
.hero-card small { color:#ae7937; font-size:10px; }.hero-card strong { color:#28483b; font-size:13px; }.hero-card span { color:#758078; font-size:10px; }
.hero-card-top { top:46px; right:4px; }.hero-card-bottom { bottom:45px; left:0; }.hero-dot { display:inline-block; width:7px; height:7px; border-radius:50%; background:#50a56f; margin-left:5px; }
.landing-section { padding:102px 18px 65px; }.landing-section-head h3,.landing-how h3 { margin:0; color:#213d32; font-size:34px; }
.landing-feature-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:18px; margin-top:32px; }.landing-feature-grid article { min-height:150px; padding:28px; border:1px solid #e7e4dc; border-radius:22px; background:rgba(255,255,255,.82); box-shadow:0 10px 24px rgba(57,46,28,.05); transition:transform .2s,box-shadow .2s; }.landing-feature-grid article:hover { transform:translateY(-5px); box-shadow:0 17px 30px rgba(57,46,28,.1); }.feature-icon { color:#ae7937; font-size:29px; }.landing-feature-grid h4 { margin:15px 0 8px; color:#28483b; font-size:17px; }.landing-feature-grid p { margin:0; color:#7b8781; line-height:1.9; font-size:13px; }
.landing-how { display:grid; grid-template-columns:.7fr 1.3fr; gap:35px; align-items:center; padding:38px 28px; border-radius:22px; background:#24483b; color:#fff; }.landing-how h3 { color:#fff; }.landing-steps { display:grid; grid-template-columns:repeat(3,1fr); gap:18px; }.landing-steps div { display:grid; gap:8px; }.landing-steps b { width:30px; height:30px; display:grid; place-items:center; border-radius:50%; color:#24483b; background:#e7c98d; }.landing-steps strong { font-size:14px; }.landing-steps span { color:rgba(255,255,255,.7); font-size:11px; line-height:1.8; }
.landing-cta { display:flex; justify-content:space-between; align-items:center; gap:20px; padding:60px 18px 42px; }.landing-cta h3 { margin:0 0 8px; color:#213d32; font-size:28px; }.landing-cta p { margin:0; color:#78847e; font-size:13px; }.landing-footer { display:flex; justify-content:space-between; gap:15px; padding:20px 5px 0; border-top:1px solid #e7e4dc; color:#89928d; font-size:11px; }
body.auth-locked .public-landing { display:block !important; } body:not(.auth-locked) .public-landing { display:none !important; }
@media (max-width:760px) { .public-landing{padding:12px 14px 30px}.landing-nav{height:55px}.landing-links{display:none}.landing-hero{grid-template-columns:1fr; padding:42px 24px 25px; gap:15px}.landing-hero h2{font-size:35px}.landing-hero p{font-size:14px}.landing-hero-art{min-height:260px}.hero-scale{width:120px;height:120px;font-size:54px}.hero-card-top{top:10px}.hero-card-bottom{bottom:8px}.landing-section{padding:60px 4px 35px}.landing-section-head h3,.landing-how h3{font-size:25px}.landing-feature-grid,.landing-steps{grid-template-columns:1fr}.landing-how{grid-template-columns:1fr;padding:30px 22px}.landing-cta{display:grid;padding:45px 4px 30px}.landing-footer{display:grid;gap:8px} }

.account-bar {
  position: fixed;
  z-index: 1000;
  right: 18px;
  top: auto;
  bottom: 22px;
  transform: none;
  width: 76px;
  min-height: 58px;
  padding: 8px;
  border: 0;
  border-radius: 20px;
  background: transparent;
  box-shadow: none;
  flex-direction: column;
  gap: 7px;
}
.account-bar #accountStatus {
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
}
.account-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: rgba(36,72,59,.92);
  color: #fff;
  font-size: 21px;
  flex: 0 0 42px;
}
.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.account-bar button, .account-bar .account-link {
  width: 72px;
  min-height: 40px;
  padding: 6px 4px;
  border-radius: 12px;
  font-size: 0;
  text-decoration: none;
  text-align: center;
}
.account-bar #accountBtn { display:flex; align-items:center; justify-content:center; background:rgba(255,255,255,.72); border:1px solid rgba(36,72,59,.18); width:76px; min-height:34px; }
.account-panel-icon { display:none; }
.account-panel-label { display:block; color:#24483b; font-size:10px; white-space:nowrap; }
.account-bar #adminBtn,
.account-bar #logoutBtn { display:none !important; }
.account-bar { display:flex; }
body.auth-locked .account-bar { display:none !important; }
body:not(.auth-locked) .account-bar { display:flex !important; }
.account-bar #adminBtn::before { content: "⚙️"; display: block; font-size: 17px; }
.quota-notice-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(28, 48, 39, .42);
  backdrop-filter: blur(3px);
}
.quota-notice-modal.open { display: flex; animation: quotaFadeIn .2s ease-out; }
.quota-notice-card {
  width: min(390px, 100%);
  padding: 26px 24px 22px;
  text-align: center;
  border: 1px solid #e7d6bd;
  border-radius: 22px;
  background: linear-gradient(145deg, #fffdf9, #f6eee2);
  box-shadow: 0 18px 55px rgba(45, 57, 45, .24);
  color: #28483b;
}
.quota-notice-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 13px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #ae7937;
  color: #fff;
  font-size: 31px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(174,121,55,.25);
}
.quota-notice-card h3 { margin: 0 0 10px; font-size: 19px; }
.quota-notice-card p { margin: 0 auto 20px; color: #65736a; line-height: 1.9; font-size: 13px; }
.quota-notice-card button {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  background: #28483b;
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.quota-notice-card button:hover { background: #1d392e; }
@keyframes quotaFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.analysis-opinions { display: none !important; margin-top: 18px; direction: rtl; }
.analysis-opinions-title {
  color: #254d3b;
  font-size: 16px;
  font-weight: 700;
  margin: 18px 0 10px;
}
.analysis-opinions-list { display: grid; gap: 10px; }
.analysis-opinion-card {
  background: #fff;
  border: 1px solid #e5e0d5;
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 4px 14px rgba(46, 66, 53, .06);
}
.analysis-opinion-card-title { font-weight: 700; line-height: 1.8; }
.analysis-opinion-link { color: #254d3b; text-decoration: none; }
.analysis-opinion-link:hover { color: #ad7735; text-decoration: underline; }
.analysis-opinion-payam, .analysis-opinion-meta {
  color: #59645d;
  font-size: 13px;
  line-height: 1.9;
  margin-top: 5px;
  white-space: pre-wrap;
}
.account-panel {
  position: fixed;
  z-index: 999;
  right: 124px;
  top: 50%;
  transform: translateY(-50%);
  width: min(380px, calc(100vw - 120px));
  margin: 0;
}
body:not(.auth-locked) .account-panel:not(#adminPanel) {
  display: none !important;
}
@media (max-width: 640px) {
  .account-bar { right: 10px; top: auto; bottom: 14px; transform: none; width: 70px; }
  .account-panel { right: 108px; top: auto; bottom: 12px; transform: none; width: min(340px, calc(100vw - 124px)); }
}
