:root {
  --purple: #7b20d3;
  --violet: #5024ff;
  --purple-deep: #35106c;
  --ink: #191520;
  --muted: #766f80;
  --surface: #fff;
  --canvas: #f6f4f8;
  --line: #e9e4ed;
  --success: #24b982;
  --warning: #f2a526;
  --danger: #df4d63;
  --shadow: 0 20px 60px rgba(47, 20, 71, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-family: IRANSans, "Vazirmatn", Tahoma, Arial, sans-serif;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(140deg, #4c16ed 0%, #781dce 58%, #35106c 100%);
}

.brand-backdrop {
  position: absolute;
  inset: 0;
  opacity: .3;
  background:
    radial-gradient(circle at 12% 18%, transparent 0 70px, #fff 71px 73px, transparent 74px 88px, #fff 89px 91px, transparent 92px),
    linear-gradient(148deg, transparent 47%, #ffffff20 48%, transparent 49%);
}

.login-card {
  width: min(430px, 100%);
  padding: 42px;
  border-radius: 26px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 35px 90px #20015c66;
  position: relative;
}

.login-card img { width: 145px; height: 48px; object-fit: contain; object-position: right; }
.kicker, .eyebrow { color: var(--purple); font-size: 10px; font-weight: 800; letter-spacing: 2px; }
.login-card .kicker { display: block; margin-top: 24px; }
.login-card h1 { margin: 9px 0; font-size: 29px; }
.login-card p { color: var(--muted); line-height: 1.9; font-size: 13px; margin: 0 0 24px; }
.login-card label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.login-card input {
  width: 100%;
  height: 50px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0 15px;
  outline: 0;
}
.login-card input:focus { border-color: var(--purple); box-shadow: 0 0 0 4px #7b20d315; }
.login-card button, .primary-button {
  width: 100%;
  margin-top: 14px;
  border: 0;
  padding: 15px 18px;
  border-radius: 12px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--purple), var(--violet));
  display: flex;
  justify-content: space-between;
}
.form-error { color: var(--danger); font-size: 12px; margin-top: 12px; }

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

.sidebar {
  min-height: 100vh;
  color: #fff;
  padding: 27px 20px;
  position: sticky;
  top: 0;
  overflow-y: auto;
  background:
    radial-gradient(circle at 100% 10%, transparent 0 50px, #ffffff30 51px 53px, transparent 54px 66px, #ffffff1d 67px 69px, transparent 70px),
    linear-gradient(165deg, #7c1fd1 0%, #4d20fa 60%, #361068 100%);
}

.brand { padding: 0 10px 27px; border-bottom: 1px solid #ffffff2c; }
.brand img { width: 127px; height: 42px; object-fit: contain; filter: brightness(0) invert(1); }
.brand span { display: block; font-size: 9px; letter-spacing: 2.5px; opacity: .65; margin-top: 7px; }

.sidebar nav { display: grid; gap: 6px; margin: 22px 0; }
.main-nav, .agent-button {
  width: 100%;
  border: 0;
  color: #efe8ff;
  background: transparent;
  border-radius: 11px;
  padding: 11px 12px;
  display: flex;
  gap: 11px;
  align-items: center;
  text-align: right;
}
.main-nav:hover, .main-nav.active, .agent-button:hover, .agent-button.active { background: #ffffff18; color: #fff; }
.main-nav b { margin-right: auto; background: #ffffff20; border-radius: 999px; min-width: 23px; padding: 3px 6px; text-align: center; font-size: 10px; }
.nav-icon { width: 21px; text-align: center; opacity: .8; }

.sidebar-section { border-top: 1px solid #ffffff2c; padding-top: 20px; }
.sidebar-section > p { margin: 0 11px 10px; color: #dcd1ef; font-size: 10px; }
.agent-button { padding: 9px 12px; font-size: 12px; justify-content: space-between; }
.agent-button small { direction: ltr; opacity: .55; }

.sidebar-footer { position: absolute; bottom: 24px; left: 20px; right: 20px; border-top: 1px solid #ffffff2c; padding-top: 17px; font-size: 10px; }
.sidebar-footer > div { display: flex; gap: 8px; align-items: center; }
.sidebar-footer i, .system-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px #24b9822a; }
.sidebar-footer button { color: #dfd4f2; border: 0; background: none; padding: 12px 0 0; font-size: 10px; }

main { min-width: 0; padding: 35px clamp(20px, 4vw, 58px) 50px; }
header { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
header h1 { font-size: 28px; margin: 5px 0 7px; }
header p { margin: 0; color: var(--muted); font-size: 13px; }
.eyebrow { margin: 0; }
.system-status { display: flex; align-items: center; gap: 9px; color: #137556; background: #e7faf3; border: 1px solid #ccf2e3; border-radius: 999px; padding: 9px 13px; font-size: 11px; }
.menu-button { display: none; border: 0; background: #fff; border-radius: 10px; padding: 9px 11px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin: 27px 0 18px; }
.stats article { background: #fff; border: 1px solid var(--line); border-radius: 15px; padding: 17px 18px; }
.stats small, .stats span { display: block; color: var(--muted); font-size: 10px; }
.stats strong { display: block; color: var(--purple); font-size: 25px; margin: 8px 0 5px; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 17px; }
.panel { min-height: 510px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: var(--shadow); }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.panel-heading span { color: var(--muted); font-size: 10px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 13px; font-weight: 700; }
.step { direction: ltr; border: 1px solid var(--line); border-radius: 8px; padding: 5px 7px; }

textarea {
  width: 100%;
  min-height: 275px;
  resize: vertical;
  background: #fbfafc;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: 0;
  padding: 16px;
  line-height: 2;
  font-size: 13px;
}
textarea:focus { border-color: #9d5bdc; box-shadow: 0 0 0 4px #7b20d310; }
.examples { display: flex; flex-wrap: wrap; gap: 7px; margin: 13px 0; }
.example { border: 1px solid var(--line); color: var(--muted); background: #fff; border-radius: 999px; padding: 6px 10px; font-size: 10px; }
.input-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 9px; margin: 12px 2px; }
.primary-button:disabled { opacity: .55; cursor: wait; }

.empty-state { min-height: 390px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.helper-mark { margin: auto; width: 68px; height: 68px; display: grid; place-content: center; color: #fff; background: var(--purple); border-radius: 17px; font-size: 31px; box-shadow: 0 15px 35px #7b20d33b; }
.empty-state h3 { color: var(--ink); margin: 20px 0 6px; font-size: 15px; }
.empty-state p { margin: 0; font-size: 11px; }

.structured-output { max-height: 485px; overflow: auto; display: grid; gap: 8px; }
.output-field { border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; background: #fcfbfd; }
.output-field > small { color: var(--purple); font-size: 9px; font-weight: 800; display: block; margin-bottom: 5px; }
.output-field > div { white-space: pre-wrap; line-height: 1.9; font-size: 12px; overflow-wrap: anywhere; }
.output-field ul { margin: 4px 0 0; padding-right: 18px; }
.approval-callout { margin-top: 12px; padding: 12px 14px; border: 1px solid #f4d49a; background: #fff7e8; color: #7d5100; border-radius: 11px; }
.approval-callout span { font-size: 11px; font-weight: 800; }
.approval-callout p { font-size: 10px; margin: 5px 0 0; line-height: 1.8; }

.section-heading { display: flex; justify-content: space-between; align-items: center; margin: 26px 0 17px; }
.section-heading h2 { margin: 0 0 5px; font-size: 20px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.secondary-button { border: 1px solid var(--line); background: #fff; padding: 9px 13px; border-radius: 10px; color: var(--muted); font-size: 11px; }
.run-list { display: grid; gap: 11px; }
.run-card { background: #fff; border: 1px solid var(--line); border-radius: 15px; padding: 17px; }
.run-card-head { display: flex; justify-content: space-between; gap: 15px; align-items: center; }
.run-card-head h3 { margin: 0 0 4px; font-size: 13px; }
.run-card-head p { margin: 0; color: var(--muted); font-size: 9px; direction: ltr; text-align: right; }
.status-chip { border-radius: 999px; padding: 6px 9px; font-size: 9px; white-space: nowrap; }
.status-chip.pending { background: #fff3dc; color: #8a5700; }
.status-chip.approved { background: #e4f9f1; color: #137556; }
.status-chip.rejected { background: #feecef; color: #9d2840; }
.status-chip.not_required { background: #f0edf3; color: #625b6a; }
.run-summary { margin: 13px 0; padding: 12px; border-radius: 10px; background: #faf8fb; color: #4e4854; line-height: 1.9; font-size: 11px; white-space: pre-wrap; }
.run-actions { display: flex; gap: 8px; }
.run-actions button { border: 0; border-radius: 9px; padding: 8px 12px; font-size: 10px; }
.approve-button { color: #fff; background: var(--success); }
.reject-button { color: #fff; background: var(--danger); }
.details-button { color: var(--purple); background: #f1e8fb; }
.empty-list { text-align: center; background: #fff; color: var(--muted); border: 1px dashed var(--line); border-radius: 15px; padding: 50px; font-size: 12px; }

.toast { position: fixed; left: 25px; bottom: 25px; z-index: 20; color: #fff; background: #201927; padding: 12px 15px; border-radius: 11px; box-shadow: var(--shadow); font-size: 11px; }
.mobile-scrim { display: none; }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .workspace-grid { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 15; right: 0; top: 0; bottom: 0; width: 275px; transform: translateX(100%); transition: .22s ease; }
  .app-shell.menu-open .sidebar { transform: translateX(0); }
  .mobile-scrim { position: fixed; inset: 0; z-index: 14; background: #160a2b77; }
  .app-shell.menu-open .mobile-scrim { display: block; }
  .menu-button { display: block; }
  main { padding: 22px 15px 40px; }
  header { align-items: flex-start; }
  header > div:nth-child(2) { flex: 1; }
  .system-status { display: none; }
  .sidebar-footer { position: static; margin-top: 25px; }
}

@media (max-width: 520px) {
  .login-card { padding: 30px 24px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .panel { padding: 17px; }
  .input-meta { display: none; }
  .section-heading { align-items: flex-end; }
}
