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

:root {
  --bg: #f3f6f4;
  --bg-accent: #e7efe9;
  --surface: #ffffff;
  --ink: #1c2b24;
  --muted: #5f7268;
  --line: #d5e0d9;
  --brand: #0f6b4c;
  --brand-dark: #0a4d37;
  --brand-soft: #d9efe6;
  --danger: #b42318;
  --warning: #b54708;
  --success: #067647;
  --shadow: 0 10px 30px rgba(28, 43, 36, 0.06);
  --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(15, 107, 76, 0.08), transparent 40%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 100%);
  color: var(--ink);
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, #0f3d2e 0%, #0a2b21 100%);
  color: #e8f5ef;
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .5rem .75rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 1rem;
}

.brand strong { font-size: 1.4rem; letter-spacing: -.02em; }
.brand span { color: rgba(232,245,239,.7); font-size: .85rem; }

.nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: rgba(232,245,239,.86);
  padding: .7rem .9rem;
  border-radius: 10px;
  margin-bottom: .25rem;
  transition: background .2s ease, transform .2s ease;
}
.nav a:hover, .nav a.active {
  background: rgba(255,255,255,.1);
  color: #fff;
  transform: translateX(-2px);
}
.nav a.nav-warn {
  background: rgba(180, 35, 24, 0.28);
  color: #ffd7d3;
  border: 1px solid rgba(254, 205, 202, 0.35);
}
.nav a.nav-warn:hover, .nav a.nav-warn.active {
  background: rgba(180, 35, 24, 0.42);
  color: #fff;
}
.nav-warn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f97066;
  display: inline-block;
  margin-right: .35rem;
  box-shadow: 0 0 0 3px rgba(249,112,102,.25);
}

.timeline { display: flex; flex-direction: column; gap: .35rem; }
.timeline-item { display: grid; grid-template-columns: 18px 1fr; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.timeline-dot {
  width: 12px; height: 12px; border-radius: 50%; margin-top: .35rem;
  background: #98a2b3; box-shadow: 0 0 0 3px #eaecf0;
}
.timeline-item.status-running .timeline-dot { background: var(--warning); box-shadow: 0 0 0 3px #fef0c7; }
.timeline-item.status-success .timeline-dot { background: var(--success); box-shadow: 0 0 0 3px #d1fadf; }
.timeline-item.status-failed .timeline-dot { background: var(--danger); box-shadow: 0 0 0 3px #fee4e2; }
.timeline-item.status-skipped .timeline-dot { background: #667085; }
.timeline-title { font-weight: 600; margin-bottom: .25rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.bad { color: var(--danger); margin-top: .25rem; }
.badge-skipped { background: #f2f4f7; color: #475467; }

.content { padding: 1.5rem; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-title h1 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
}
.page-title p {
  margin: .35rem 0 0;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: .9rem; }
.stat .value { font-size: 1.7rem; font-weight: 700; margin-top: .35rem; color: var(--brand-dark); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: 0;
  border-radius: 10px;
  padding: .65rem 1rem;
  font-family: inherit;
  font-size: .95rem;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--brand-soft); color: var(--brand-dark); }
.btn-danger { background: #fee4e2; color: var(--danger); }
.btn-sm { padding: .4rem .7rem; font-size: .85rem; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .75rem .6rem; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .9rem; }
tr:hover td { background: #f8fbf9; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: .92rem; color: var(--muted); }
input, select, textarea {
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .7rem .8rem;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(15,107,76,.2);
  border-color: var(--brand);
}

.alert {
  padding: .85rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-success { background: #ecfdf3; color: var(--success); border-color: #abefc6; }
.alert-info { background: #eff8ff; color: #175cd3; border-color: #b2ddff; }
.alert-error { background: #fef3f2; color: var(--danger); border-color: #fecdca; }
.btn[disabled], .btn:disabled { opacity: .7; cursor: wait; }
.badge {
  display: inline-flex;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .8rem;
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.badge-success { background: #ecfdf3; color: var(--success); }
.badge-failed, .badge-error { background: #fef3f2; color: var(--danger); }
.badge-warning, .badge-partial, .badge-running { background: #fffaeb; color: var(--warning); }
.badge-pending { background: #f2f4f7; color: #475467; }
.badge-cancelled { background: #f2f4f7; color: #667085; border: 1px solid #d0d5dd; }
.badge-skipped { background: #f2f4f7; color: #667085; }
.badge-verified { background: #ecfdf3; color: var(--success); }
.tr-open { background: #fff8eb; }
.tr-open td { border-color: #f5e0b8; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 20% 20%, rgba(15,107,76,.18), transparent 35%),
    radial-gradient(circle at 80% 80%, rgba(15,107,76,.12), transparent 30%),
    linear-gradient(135deg, #f3f6f4, #dfece5);
}
.login-card {
  width: min(420px, 100%);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 2rem;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 .35rem; font-size: 1.8rem; }
.login-card p { margin: 0 0 1.5rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; direction: ltr; text-align: left; white-space: pre-wrap; }

.account-picker {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbf9;
  padding: .85rem 1rem;
}
.account-picker-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin-bottom: .65rem;
}
.account-picker-count {
  margin-inline-start: auto;
  font-size: .9rem;
  color: var(--muted);
}
.account-picker-count.is-ready { color: var(--ink); font-weight: 600; }
.account-picker-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 16rem;
  overflow-y: auto;
  border: 1px solid rgba(15,107,76,.14);
  border-radius: 10px;
  background: #fff;
}
.account-picker-group {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.account-picker-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 100%;
  box-sizing: border-box;
  padding: .65rem .85rem;
  margin: 0;
  border-bottom: 1px solid rgba(15,107,76,.1);
  color: var(--ink);
  cursor: pointer;
  background: #fff;
}
.account-picker-item:last-child { border-bottom: 0; }
.account-picker-item:hover { background: #f3faf6; }
.account-picker-item input {
  width: auto;
  flex: 0 0 auto;
  margin: 0;
}
.account-picker-item > span {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem .5rem;
  min-width: 0;
  flex: 1 1 auto;
}
.account-picker-item strong {
  font-weight: 700;
  direction: ltr;
}
.run-now-row td { background: #f4faf6; }
.run-now-panel { margin: .25rem 0; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
}
