:root {
  --bg: #0b1220;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.10);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --faint: rgba(255, 255, 255, 0.45);
  --good: #59d58a;
  --warn: #f2c66d;
  --bad: #f08080;
  --accent: #7aa7ff;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: radial-gradient(1200px 800px at 20% 0%, rgba(122, 167, 255, 0.18), transparent 55%),
              radial-gradient(900px 600px at 90% 10%, rgba(89, 213, 138, 0.12), transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", "IRANSansX", "IRANSans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Tahoma, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  text-align: right;
}

a { color: var(--accent); text-decoration: none; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand .title {
  font-weight: 650;
  letter-spacing: 0.2px;
}

.brand .subtitle {
  font-size: 12px;
  color: var(--muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(122,167,255,0.12);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 600;
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 14px;
}

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
}

.card {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.card-title {
  font-weight: 650;
}

.card-sub {
  color: var(--muted);
  font-size: 12px;
}

.hero {
  padding: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.04));
}

.hero-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-state .primary {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: 0.2px;
}

.hero-state .secondary {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  border: 1px solid var(--border);
}

.badge.good { background: rgba(89,213,138,0.14); color: rgba(255,255,255,0.95); border-color: rgba(89,213,138,0.35); }
.badge.warn { background: rgba(242,198,109,0.14); color: rgba(255,255,255,0.95); border-color: rgba(242,198,109,0.35); }
.badge.bad { background: rgba(240,128,128,0.14); color: rgba(255,255,255,0.95); border-color: rgba(240,128,128,0.35); }

.kv {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .kv { grid-template-columns: 1fr; }
}

.kv .item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(0,0,0,0.10);
}

.kv .label {
  color: var(--muted);
  font-size: 12px;
}

.kv .value {
  margin-top: 6px;
  font-weight: 650;
}

.narrative {
  color: rgba(255,255,255,0.90);
  line-height: 1.55;
}

.narrative p { margin: 0 0 10px 0; }

.small {
  color: var(--muted);
  font-size: 12px;
}

.section {
  display: grid;
  gap: 10px;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

hr.sep {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 10px 0;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  color: var(--muted);
  direction: ltr;
  unicode-bidi: plaintext;
  text-align: left;
}

.disclaimer {
  border-right: 3px solid rgba(122,167,255,0.55);
  background: rgba(122,167,255,0.08);
  padding: 10px;
  border-radius: 10px;
  color: rgba(255,255,255,0.9);
  font-size: 12px;
}

.details {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.details summary {
  cursor: pointer;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-weight: 650;
}

.details .body {
  padding: 10px 12px;
}

.list {
  display: grid;
  gap: 6px;
}

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  font-size: 12px;
}

.tag.good { border-color: rgba(89,213,138,0.35); color: rgba(255,255,255,0.88); background: rgba(89,213,138,0.10); }
.tag.warn { border-color: rgba(242,198,109,0.35); color: rgba(255,255,255,0.88); background: rgba(242,198,109,0.10); }
.tag.bad { border-color: rgba(240,128,128,0.35); color: rgba(255,255,255,0.88); background: rgba(240,128,128,0.10); }

 .explain {
   gap: 12px;
 }
 
 .explain-block {
   border: 1px solid var(--border);
   background: rgba(0,0,0,0.10);
   border-radius: 12px;
   padding: 10px;
 }
 
 .explain-title {
   font-weight: 650;
   margin-bottom: 8px;
 }
 
 .explain-setups {
   display: grid;
   gap: 10px;
 }
 
 .explain-setup {
   border: 1px solid rgba(255,255,255,0.08);
   background: rgba(255,255,255,0.03);
   border-radius: 12px;
   padding: 10px;
 }
 
 .explain-setup-head {
   display: grid;
   grid-template-columns: auto 1fr;
   gap: 8px 10px;
   align-items: center;
 }
 
 .explain-setup-name {
   font-weight: 650;
 }
 
 .explain-setup-meta {
   grid-column: 1 / -1;
 }
 
 .explain-reasons {
   margin: 8px 0 0 0;
   padding-right: 18px;
   color: rgba(255,255,255,0.85);
 }
 
 .explain-reject {
   margin-top: 8px;
   color: rgba(255,255,255,0.88);
 }
 
 .score-grid {
   display: grid;
   gap: 8px;
 }
 
 .score-row {
   display: grid;
   grid-template-columns: 92px 1fr 56px;
   gap: 10px;
   align-items: center;
 }
 
 .score-bar {
   height: 10px;
   border-radius: 999px;
   border: 1px solid rgba(255,255,255,0.10);
   background: rgba(255,255,255,0.05);
   overflow: hidden;
 }
 
 .score-bar-fill {
   height: 100%;
   background: linear-gradient(90deg, rgba(122,167,255,0.55), rgba(89,213,138,0.45));
 }

.tabs-strip {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

 .tab-button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 650;
 }

 .tab-button.active {
  background: rgba(122,167,255,0.14);
  color: rgba(255,255,255,0.92);
  border-color: rgba(122,167,255,0.35);
 }

.tab-pill-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tab-icon {
  display: inline-block;
  vertical-align: middle;
}

.at-shell {
  margin-top: 14px;
}

.at-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 14px;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .at-grid { grid-template-columns: 1fr; }
}

.at-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.at-status-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.at-metrics {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.at-metric {
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.10);
  border-radius: 12px;
  padding: 8px 10px;
  min-width: 120px;
}

.at-metric-label {
  color: var(--muted);
  font-size: 11px;
}

.at-progress {
  min-width: 240px;
  flex: 1;
  max-width: 360px;
}

.at-progress-label {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 8px;
}

.at-progress-bar {
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  overflow: hidden;
}

.at-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(122,167,255,0.55), rgba(89,213,138,0.55));
}

.at-progress-meta {
  margin-top: 8px;
}

.rt-wrap {
  overflow-x: auto;
}

.rt-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.rt-table th,
.rt-table td {
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  white-space: nowrap;
}

.rt-table th {
  color: rgba(255,255,255,0.80);
  background: rgba(255,255,255,0.04);
  font-weight: 650;
  text-align: right;
}

.rt-th {
  cursor: pointer;
  user-select: none;
}

.rt-th-active {
  color: rgba(255,255,255,0.95);
}

.rt-tr:hover td {
  background: rgba(255,255,255,0.03);
}

.rt-win td { background: rgba(89,213,138,0.06); }
.rt-loss td { background: rgba(240,128,128,0.06); }
.rt-be td { background: rgba(242,198,109,0.05); }

.rt-history {
  cursor: pointer;
}

.rt-selected td {
  outline: 1px solid rgba(122,167,255,0.45);
  background: rgba(122,167,255,0.08) !important;
}

.at-reasons {
  margin-top: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.10);
  border-radius: 12px;
  padding: 10px;
}

.at-reasons-title {
  font-weight: 650;
  margin-bottom: 8px;
}

.at-reasons-list {
  margin: 0;
  padding-right: 18px;
  color: rgba(255,255,255,0.85);
}

.at-hist {
  margin-top: 12px;
}

.at-hist-title {
  font-weight: 650;
  margin-bottom: 10px;
}

.at-hist-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: end;
}

.at-hist-bar {
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.10);
  border-radius: 12px;
  padding: 8px;
  height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
}

.at-hist-fill {
  width: 100%;
  border-radius: 10px;
  background: rgba(122,167,255,0.55);
  min-height: 2px;
}

.at-hist-label {
  color: var(--muted);
  font-size: 11px;
}

.at-hist-count {
  font-size: 11px;
}

.at-ai-verdict {
  margin-bottom: 10px;
  padding: 10px;
  border-right: 3px solid rgba(242,198,109,0.55);
  background: rgba(242,198,109,0.07);
  border-radius: 10px;
}

.at-ai-bullets {
  margin: 0 0 10px 0;
  padding-right: 18px;
  color: rgba(255,255,255,0.88);
}

.at-ai-raw {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.16);
  color: rgba(255,255,255,0.86);
  line-height: 1.55;
}

.at-history-actions {
  margin-top: 10px;
}
