@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

.apd-dashboard {
  --apd-red: #991e23;
  --apd-red-dark: #731318;
  --apd-green: #17864a;
  --apd-down: #d23b44;
  --apd-yellow: #c58a18;
  --apd-ink: #17191d;
  --apd-muted: #70757d;
  --apd-line: #e7e9ed;
  --apd-soft: #f6f7f9;
  direction: rtl;
  isolation: isolate;
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
  padding: 20px;
  border: 1px solid rgba(19, 25, 35, .08);
  border-radius: 22px;
  background: linear-gradient(145deg, #fff 0%, #fbfbfc 68%, #f6f7f9 100%);
  box-shadow: 0 20px 55px rgba(25, 30, 40, .09), 0 2px 8px rgba(25, 30, 40, .04);
  color: var(--apd-ink);
  font-family: Vazirmatn, Inter, "Segoe UI", Tahoma, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.apd-dashboard * { box-sizing: border-box; letter-spacing: 0; }
.apd-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.apd-heading-copy { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; }
.apd-header h2 { margin: 0; color: var(--apd-title-color, var(--apd-ink)); font-size: clamp(20px, 2.3vw, 27px); line-height: 1.35; font-weight: 850; }
.apd-eyebrow { display: block; margin-top: 3px; color: var(--apd-subtitle-color, var(--apd-red)); font-size: 11px; line-height: 1.7; font-weight: 760; }
.apd-live { display: flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid #e7e9ec; border-radius: 999px; background: rgba(255,255,255,.8); color: var(--apd-muted); font-size: 10px; white-space: nowrap; }
.apd-live i { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--apd-green); box-shadow: 0 0 0 4px rgba(23,134,74,.12); animation: apd-pulse 2s infinite; }

.apd-tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 14px;
  padding: 5px;
  border: 1px solid #e9eaed;
  border-radius: 14px;
  background: #f1f2f4;
}
.apd-tab-indicator { position: absolute; z-index: 0; top: 0; left: 0; width: 0; height: 0; border-radius: 10px; background: linear-gradient(135deg, #aa292f, var(--apd-red-dark)); box-shadow: 0 8px 20px rgba(153,30,35,.22); transform: translate3d(var(--apd-tab-x, 0), var(--apd-tab-y, 0), 0); transition: transform .4s cubic-bezier(.22,1,.36,1), width .3s ease, height .3s ease; will-change: transform, width; }
.apd-tabs button { position: relative; z-index: 1; appearance: none; min-width: 0; min-height: 42px; padding: 6px 8px; border: 0; border-radius: 10px; background: transparent; color: #565c65; cursor: pointer; font: 720 12px/1.65 Vazirmatn, Inter, sans-serif; transition: color .2s ease, transform .2s ease; }
.apd-tabs button:hover { color: var(--apd-red); transform: translateY(-1px); }
.apd-tabs button[aria-selected="true"], .apd-tabs button[aria-selected="true"]:hover { color: #fff; }
.apd-tabs button:focus-visible { outline: 3px solid rgba(153,30,35,.2); outline-offset: 2px; }

.apd-panel { display: grid; grid-template-columns: minmax(210px, 25%) minmax(0, 1fr); gap: 12px; animation: apd-panel-in .36s cubic-bezier(.2,.75,.25,1) both; }
.apd-panel[hidden], .apd-chart-card[hidden] { display: none !important; }
.apd-summary { display: flex; min-width: 0; flex-direction: column; overflow: hidden; border: 1px solid var(--apd-line); border-radius: 16px; background: rgba(255,255,255,.92); box-shadow: 0 8px 24px rgba(28,33,42,.05); }
.apd-finish-image { position: relative; min-height: 132px; background: linear-gradient(135deg, #e7e9ed, #dfe2e7); background-position: center; background-size: cover; }
.apd-finish-image::after { position: absolute; inset: auto 0 0; height: 45%; background: linear-gradient(transparent, rgba(15,17,20,.5)); content: ""; }
.apd-finish-image span { position: absolute; z-index: 1; right: 12px; bottom: 10px; max-width: calc(100% - 24px); color: #fff; font-size: 10px; font-weight: 700; text-shadow: 0 1px 5px rgba(0,0,0,.35); }
.apd-price-block { padding: 15px; }
.apd-price-block > span { display: block; margin-bottom: 2px; color: var(--apd-muted); font-size: 10px; }
.apd-price { display: block; overflow-wrap: anywhere; font-size: clamp(25px, 3vw, 31px); line-height: 1.25; font-weight: 880; }
.apd-price-block > small { display: block; margin-top: 1px; color: var(--apd-muted); font-size: 10px; }
.apd-change { display: flex; align-items: center; gap: 7px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--apd-line); font-size: 10px; font-weight: 720; }
.apd-change b { display: grid; width: 22px; height: 22px; flex: 0 0 22px; place-items: center; border-radius: 7px; background: currentColor; color: inherit; font-size: 0; }
.apd-change b::after { color: #fff; font-size: 13px; content: "−"; }
.apd-change.apd-up b::after { content: "↗"; }
.apd-change.apd-down b::after { content: "↘"; }
.apd-up { color: var(--apd-green); }
.apd-down { color: var(--apd-down); }
.apd-flat { color: var(--apd-yellow); }
.apd-updated { display: flex; flex-direction: column; gap: 1px; margin-top: 10px; padding: 8px 9px; border-radius: 9px; background: var(--apd-soft); color: var(--apd-muted); font-style: normal; }
.apd-updated span { font-size: 9px; }
.apd-updated strong { color: #555b63; font-size: 10px; font-weight: 720; }

.apd-chart-zone { min-width: 0; }
.apd-chart-toggle { display: flex; width: 100%; min-height: 48px; align-items: center; gap: 10px; margin: 0 0 8px; padding: 8px 12px; border: 1px solid var(--apd-line); border-radius: 13px; background: rgba(255,255,255,.9); color: var(--apd-ink); cursor: pointer; font-family: inherit; text-align: right; box-shadow: 0 5px 16px rgba(28,33,42,.04); }
.apd-chart-toggle:hover { border-color: rgba(153,30,35,.3); }
.apd-chart-toggle-icon { position: relative; width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; background: rgba(153,30,35,.09); }
.apd-chart-toggle-icon::before { position: absolute; inset: 8px 7px 7px; border-right: 2px solid var(--apd-red); border-bottom: 2px solid var(--apd-red); content: ""; }
.apd-chart-toggle-icon::after { position: absolute; top: 11px; right: 9px; width: 13px; height: 7px; border-top: 2px solid var(--apd-red); transform: rotate(-22deg); content: ""; }
.apd-chart-toggle > span:nth-child(2) { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.apd-chart-toggle strong { font-size: 11px; font-weight: 780; }
.apd-chart-toggle small { color: var(--apd-muted); font-size: 9px; }
.apd-chart-toggle > i { width: 8px; height: 8px; margin-left: 3px; border-left: 2px solid #899099; border-bottom: 2px solid #899099; transform: rotate(135deg); transition: transform .25s ease; }
.apd-chart-toggle[aria-expanded="false"] > i { transform: rotate(-45deg); }
.apd-chart-toggle[aria-expanded="false"] + .apd-chart-card { display: none; }
.apd-chart-card { min-width: 0; padding: 14px; border: 1px solid var(--apd-line); border-radius: 16px; background: rgba(255,255,255,.93); box-shadow: 0 8px 24px rgba(28,33,42,.05); }
.apd-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 5px; }
.apd-chart-head > div:first-child span { display: block; color: var(--apd-muted); font-size: 9px; }
.apd-chart-head strong { font-size: 12px; font-weight: 760; }
.apd-legend { display: flex; flex-wrap: wrap; gap: 10px; color: var(--apd-muted); font-size: 9px; }
.apd-legend span { display: flex; align-items: center; gap: 4px; }
.apd-legend i { width: 7px; height: 7px; border-radius: 2px; }
.apd-legend .up { background: var(--apd-green); }
.apd-legend .down { background: var(--apd-down); }
.apd-legend .flat { background: var(--apd-yellow); }
.apd-chart { position: relative; width: 100%; height: 258px; direction: ltr; }
.apd-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.apd-grid-line { stroke: #eceef1; stroke-width: 1; }
.apd-axis-label { fill: #858b93; font: 9px Vazirmatn, Inter, sans-serif; }
.apd-line { fill: none; stroke-width: 3; stroke-linecap: round; }
.apd-dot { cursor: pointer; stroke: #fff; stroke-width: 2; transition: r .18s ease; }
.apd-dot:hover, .apd-dot:focus { r: 7; outline: none; }
.apd-empty { display: grid; height: 100%; place-items: center; border: 1px dashed #dde0e5; border-radius: 10px; background: #fafbfc; color: var(--apd-muted); text-align: center; font-size: 11px; }
.apd-tooltip { position: absolute; z-index: 2; pointer-events: none; opacity: 0; transform: translate(-50%, calc(-100% - 8px)); padding: 6px 8px; border-radius: 7px; background: #191c21; color: #fff; font-size: 9px; white-space: nowrap; transition: opacity .15s ease; }
.apd-tooltip.is-visible { opacity: 1; }

@keyframes apd-panel-in { from { opacity: 0; transform: translateY(7px) scale(.997); } to { opacity: 1; transform: none; } }
@keyframes apd-pulse { 50% { box-shadow: 0 0 0 7px rgba(23,134,74,0); } }

@media (max-width: 840px) {
  .apd-tabs { display: flex; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: thin; }
  .apd-tabs button { flex: 0 0 145px; }
  .apd-panel { grid-template-columns: minmax(190px, 32%) minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .apd-dashboard { padding: 11px; border-radius: 17px; }
  .apd-header { align-items: flex-start; margin-bottom: 11px; }
  .apd-header h2 { font-size: 19px; }
  .apd-live { padding: 6px 8px; }
  .apd-live span { display: none; }
  .apd-tabs { margin-bottom: 10px; border-radius: 12px; }
  .apd-tabs button { min-height: 38px; flex-basis: 132px; font-size: 11px; }
  .apd-panel { grid-template-columns: 1fr; gap: 8px; }
  .apd-summary { display: grid; grid-template-columns: 102px minmax(0, 1fr); border-radius: 13px; }
  .apd-finish-image { min-height: 154px; }
  .apd-finish-image span { right: 8px; bottom: 8px; font-size: 9px; }
  .apd-price-block { padding: 11px; }
  .apd-price { font-size: 24px; }
  .apd-change { margin-top: 7px; padding-top: 7px; }
  .apd-updated { margin-top: 7px; padding: 6px 7px; }
  .apd-chart-toggle { margin-bottom: 0; border-radius: 12px; }
  .apd-chart-toggle[aria-expanded="true"] { margin-bottom: 7px; }
  .apd-chart-card { padding: 10px 8px; border-radius: 13px; }
  .apd-chart-head { align-items: flex-start; flex-direction: column; gap: 4px; padding: 0 5px; }
  .apd-chart { height: 210px; }
  .apd-axis-label { font-size: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .apd-dashboard *, .apd-tab-indicator { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
