:root {
  --app-bg: var(--zb-bg);
  --navy: var(--zb-graphite);
  --panel: var(--zb-panel);
  --ink: var(--zb-text);
  --muted: var(--zb-muted);
  --line: var(--zb-line);
  --accent: var(--zb-red);
  --accent-dark: var(--zb-red-dark);
  --accent-soft: rgba(255, 70, 56, 0.1);
  --tech-soft: rgba(0, 207, 232, 0.14);
  --danger: var(--zb-danger);
  --success: var(--zb-success);
}

body {
  background: var(--app-bg);
}

.container-fluid {
  --bs-gutter-x: 1.5rem;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

input,
select,
textarea,
.form-label,
.page-title p,
.result-head p,
.nav-item,
.step,
.summary,
.empty {
  unicode-bidi: plaintext;
}

#apiBase,
#adminKey,
#customerKey,
#customerId,
#customerRasmioApiKey,
#guideApiBase,
#guideSwaggerUrl,
#guideApiKeyText,
#licenseApiKey,
#allowedIps,
#personId,
#companyId,
#rasmioCustomerKey,
#startDate,
#endDate,
#resultBox,
#customerGuideText,
.code-token {
  direction: ltr;
  text-align: left;
  unicode-bidi: plaintext;
}

.code-token {
  display: inline-block;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--tech-soft);
  color: var(--ink);
  font-family: Consolas, Monaco, monospace;
}

.app-header {
  padding: 14px 0;
}

.app-header h1 {
  font-size: 24px;
  font-weight: 700;
}

.app-header p {
  color: #cbd7e6;
  font-size: 13px;
}

.app-shell {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 14px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.app-nav {
  position: sticky;
  top: 14px;
  align-self: start;
  min-height: calc(100vh - 118px);
  padding: 10px;
}

.nav-item {
  display: grid;
  gap: 1px;
  width: 100%;
  min-height: 48px;
  margin-bottom: 5px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: right;
  cursor: pointer;
}

.nav-item span {
  font-size: 14px;
  font-weight: 600;
}

.nav-item small {
  color: var(--muted);
  font-size: 11px;
}

.nav-item:hover,
.nav-item.active {
  background: var(--accent-soft);
  border-color: rgba(255, 70, 56, 0.28);
  color: var(--accent-dark);
}

.app-content {
  display: grid;
  gap: 12px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-title,
.form-card,
.soft-card,
.result-card {
  box-shadow: var(--zb-shadow);
}

.page-title {
  margin-bottom: 12px;
  padding: 16px 18px;
  background: #fff;
  border-top: 4px solid var(--accent);
}

.page-title h2,
.result-head h2 {
  margin: 0 0 5px;
  font-size: 21px;
  font-weight: 700;
}

.page-title p,
.result-head p {
  margin: 0;
  color: #475f7a;
  font-size: 14px;
  line-height: 1.75;
}

.form-card .card-body,
.soft-card .card-body,
.result-card .card-body {
  padding: 16px 18px;
}

.form-label {
  color: #6b7c91;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 500;
}

.form-control,
.form-select {
  border-color: #cbd8e7;
  border-radius: 8px;
}

.form-control-lg,
.form-select-lg {
  min-height: 42px;
  padding: 7px 12px;
  font-size: 0.98rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--zb-cyan);
  box-shadow: 0 0 0 0.2rem rgba(0, 207, 232, 0.14);
}

.ts-wrapper {
  min-height: 42px;
}

.ts-wrapper.form-select,
.ts-wrapper.form-control {
  padding: 0;
}

.ts-control {
  min-height: 42px;
  padding: 7px 12px;
  border-color: #cbd8e7;
  border-radius: 8px;
  direction: rtl;
  text-align: right;
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
  font-size: 0.98rem;
  line-height: 1.5;
  box-shadow: none;
}

.ts-wrapper.focus .ts-control {
  border-color: var(--zb-cyan);
  box-shadow: 0 0 0 0.2rem rgba(0, 207, 232, 0.14);
}

.ts-control input {
  direction: rtl;
  text-align: right;
  font-family: inherit;
  min-width: 90px;
}

.ts-dropdown {
  direction: rtl;
  text-align: right;
  border-color: #cbd8e7;
  border-radius: 10px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
}

.ts-dropdown .option,
.ts-dropdown .no-results {
  padding: 8px 12px;
  unicode-bidi: plaintext;
}

.ts-dropdown .active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.form-actions,
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.metric-card {
  height: 92px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.035);
}

.metric-card span {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin-top: 7px;
  color: var(--accent-dark);
  font-size: 20px;
  direction: ltr;
  text-align: right;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
}

.soft-card h3 {
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 700;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d4e3f0;
  border-radius: 10px;
  background: #f8fbff;
  color: var(--ink);
  text-align: right;
  font-size: 13px;
}

.step b {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  min-height: 34px;
  padding: 5px 14px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.status-badge.ok {
  background: #e3f8ee;
  color: var(--success);
}

.status-badge.error {
  background: #fdebef;
  color: var(--danger);
}

.tableBox {
  min-height: 260px;
  max-height: 48vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  direction: rtl;
  text-align: right;
  font-size: 13px;
}

th,
td {
  padding: 9px 12px;
  border-bottom: 1px solid #e6edf5;
  vertical-align: top;
  white-space: nowrap;
  max-width: 460px;
  overflow: hidden;
  text-overflow: ellipsis;
  unicode-bidi: plaintext;
}

.number-cell,
.date-cell,
.number-chip {
  direction: ltr;
  text-align: left;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.date-cell {
  color: #334155;
  font-weight: 500;
}

.number-chip {
  display: inline-flex;
  align-items: center;
  min-width: 90px;
  justify-content: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--tech-soft);
  color: var(--ink);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--zb-hover);
  color: #334155;
  font-weight: 700;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: var(--zb-bg);
}

.summary,
.empty {
  margin: 10px;
  padding: 11px;
  border-radius: 8px;
  background: #f7f9fc;
  color: var(--muted);
}

pre {
  min-height: 260px;
  max-height: 48vh;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: var(--zb-dark);
  color: #e5e7eb;
  direction: ltr;
  text-align: left;
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
  line-height: 1.6;
}

.filter-switch {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-switch .form-check-input {
  width: 2.6rem;
  height: 1.35rem;
}

.handoff-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.endpoint-card {
  min-height: 86px;
  padding: 12px;
  border: 1px solid #d4e3f0;
  border-radius: 10px;
  background: #f8fbff;
}

.endpoint-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.endpoint-card code {
  display: block;
  direction: ltr;
  text-align: left;
  white-space: normal;
  word-break: break-word;
  color: var(--accent-dark);
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
}

.guide-text {
  min-height: 310px;
  line-height: 1.8;
  resize: vertical;
}

@media (max-width: 992px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-nav {
    position: static;
    min-height: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .steps {
    grid-template-columns: 1fr;
  }

  .handoff-grid {
    grid-template-columns: 1fr;
  }

  .result-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* UX redesign pass - shared visual language */
.admin-shell {
  padding-top: 16px;
  padding-bottom: 24px;
}

.app-shell {
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  align-items: start;
}

.app-nav,
.panel,
.result-panel {
  border-radius: 12px;
  box-shadow: var(--zb-shadow-tight);
}

.app-nav {
  position: sticky;
  top: 88px;
  padding: 12px;
  min-height: auto;
}

.nav-button {
  min-height: 44px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.nav-button.active {
  color: var(--zb-red);
  border-color: rgba(255, 70, 56, 0.45);
  background: var(--zb-red-soft);
}

.panel,
.result-panel {
  padding: 14px;
}

.panel h2,
.result-panel h2 {
  margin-bottom: 10px;
  font-size: clamp(18px, 2vw, 24px);
}

.intro {
  margin-bottom: 14px;
  padding: 11px 12px;
  border-radius: 10px;
  background: var(--zb-bg);
  color: var(--zb-muted);
  font-size: 13px;
  line-height: 1.85;
}

.form-grid {
  gap: 12px;
}

label {
  gap: 5px;
  color: var(--zb-muted);
  font-size: 12.5px;
  font-weight: 800;
}

input,
select,
textarea {
  min-height: 38px;
  border-radius: 9px;
  font-size: 13px;
}

.actions {
  gap: 8px;
}

.actions button,
.result-tools button,
.top-actions a,
.top-actions button {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 12.5px;
}

button.primary,
.top-actions .primary {
  border-color: var(--zb-red);
  background: var(--zb-red);
  color: #fff;
  box-shadow: 0 8px 18px rgba(255, 70, 56, 0.16);
}

.metric-card,
.endpoint-card {
  min-height: 72px;
  padding: 11px;
  border-radius: 10px;
  background: var(--zb-surface);
}

.metric-card strong {
  font-size: 20px;
}

.table-wrap {
  border-radius: 10px;
  max-height: 420px;
}

th,
td {
  padding: 8px 10px;
  font-size: 12.5px;
  line-height: 1.65;
}

pre {
  min-height: 180px;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-nav {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Admin layout guard: keep the real nav narrow in RTL and give content the wide column. */
.app-shell {
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.app-content {
  min-width: 0;
}

.app-nav {
  width: 100%;
  max-width: 220px;
  min-height: auto;
  padding: 10px;
  overflow: hidden;
}

.nav-item {
  min-height: 46px;
  margin-bottom: 6px;
  padding: 8px 10px;
  border-radius: 9px;
  line-height: 1.45;
}

.nav-item span {
  font-size: 13.5px;
  font-weight: 800;
}

.nav-item small {
  font-size: 11px;
  line-height: 1.5;
}

.nav-item.active {
  color: var(--zb-red);
  border-color: rgba(255, 70, 56, 0.45);
  background: var(--zb-red-soft);
}

.page-title,
.form-card,
.soft-card,
.result-card {
  border-radius: 12px;
}

.steps {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.step {
  min-height: 74px;
  overflow: hidden;
}

.step span {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@media (max-width: 1200px) {
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-nav {
    position: static;
    max-width: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .app-nav,
  .steps {
    grid-template-columns: 1fr;
  }
}
