/* Partner console: additions on top of /business/merchant/dashboard/dashboard.css. */
.partner-content { padding: 24px clamp(18px, 3vw, 34px) 44px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.account-name { color: #475569; font-size: .82rem; font-weight: 700; }

.env-switch { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.env-switch button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: #475569; font-size: .78rem; font-weight: 700; cursor: pointer; }
.env-switch button.active[data-env="sandbox"] { background: #fef3c7; color: #92400e; }
.env-switch button.active[data-env="live"] { background: #dcfce7; color: #166534; }
.env-switch button:disabled { cursor: not-allowed; opacity: .5; }
.env-hint { color: #94a3b8; font-size: .7rem; }

.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-heading h1 { margin: 5px 0 7px; color: #0f172a; font-size: clamp(1.35rem, 2.6vw, 2rem); line-height: 1.15; }
.section-heading p, .panel-heading p, .panel-note { margin: 0; color: #64748b; font-size: .86rem; line-height: 1.6; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-grid.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.metric-grid .metric-card { min-height: 112px; padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm); }
.metric-card span { display: block; color: #64748b; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.metric-card strong { display: block; margin-top: 9px; color: #0f172a; font-size: 1.6rem; line-height: 1.1; word-break: break-word; }
.metric-card small { display: block; margin-top: 8px; color: #94a3b8; font-size: .72rem; }
.panel { margin-bottom: 18px; padding: 22px; border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm); min-width: 0; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.panel h2 { margin: 0 0 4px; color: #0f172a; font-size: 1.02rem; }
.grid-two { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; }
.grid-halves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.badge { display: inline-flex; align-items: center; gap: 5px; width: max-content; padding: 4px 9px; border-radius: 999px; background: #eff6ff; color: #2563eb; font-size: .7rem; font-weight: 700; white-space: nowrap; }
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.warn { background: #fef3c7; color: #a16207; }
.badge.error { background: #fee2e2; color: #b91c1c; }
.badge.muted { background: #f1f5f9; color: #64748b; }
.segmented { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: #f8fafc; }
.segmented button { min-height: 30px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: #64748b; font-size: .75rem; font-weight: 700; cursor: pointer; }
.segmented button.active { background: #fff; color: #1d4ed8; box-shadow: 0 2px 6px rgba(15, 23, 42, .08); }
.text-button { border: 0; background: transparent; color: #2563eb; font-size: .78rem; font-weight: 700; cursor: pointer; padding: 0; }
.text-button.danger { color: #b91c1c; }
.row-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.empty-inline { padding: 24px 6px; color: #94a3b8; font-size: .82rem; text-align: center; }
.code-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.code-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 10px; padding: 9px 11px; border-radius: 9px; background: #f8fafc; font-size: .8rem; color: #334155; }
.steps { margin: 0; padding-inline-start: 20px; color: #475569; font-size: .84rem; line-height: 1.8; }

.data-table-wrap { overflow-x: auto; border: 1px solid #edf2f7; border-radius: 12px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 640px; font-size: .79rem; }
.data-table th { padding: 11px 14px; background: #f8fafc; color: #94a3b8; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; text-align: start; white-space: nowrap; }
.data-table td { padding: 12px 14px; border-top: 1px solid #f1f5f9; color: #475569; vertical-align: middle; }
.data-table tr.clickable { cursor: pointer; }
.data-table tr.clickable:hover td, .data-table tr.clickable:focus-visible td { background: #f8fbff; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .76rem; direction: ltr; unicode-bidi: isolate; }
.method { display: inline-block; min-width: 54px; padding: 2px 6px; border-radius: 5px; background: #eef2ff; color: #4338ca; font-size: .68rem; font-weight: 800; text-align: center; }
.method.get { background: #ecfdf5; color: #047857; }
.method.delete { background: #fef2f2; color: #b91c1c; }

.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 14px; }
.toolbar .field { flex: 1 1 150px; }
.field { display: grid; gap: 6px; min-width: 0; color: #475569; font-size: .76rem; font-weight: 700; }
.field input, .field select, .field textarea { min-height: 40px; width: 100%; padding: 8px 11px; border: 1px solid #dbe2ea; border-radius: 9px; background: #fff; color: #1e293b; font-size: .82rem; font-weight: 500; }
.field input[readonly] { background: #f8fafc; color: #64748b; }
.field textarea { min-height: 220px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; direction: ltr; text-align: left; }
.field small { color: #94a3b8; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-stack { display: grid; gap: 12px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.form-message { margin-top: 10px; font-size: .8rem; }
.form-message.ok { color: #047857; }
.form-message.error { color: #b91c1c; }

.code-block { position: relative; margin: 0; padding: 14px; max-height: 420px; overflow: auto; border-radius: 11px; background: #0f172a; color: #e2e8f0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .75rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; direction: ltr; text-align: left; }
.code-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 6px; color: #64748b; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.sandbox-banner { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 12px 14px; border: 1px solid #fde68a; border-radius: 12px; background: #fffbeb; color: #92400e; font-size: .82rem; }
.feedback { margin-bottom: 16px; padding: 12px 14px; border-radius: 10px; font-size: .82rem; font-weight: 600; }
.feedback.ok { background: #ecfdf5; color: #047857; }
.feedback.error { background: #fef2f2; color: #b91c1c; }
.hidden { display: none !important; }

.usage-chart { min-height: 260px; }
.error-codes { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.error-codes li { display: flex; justify-content: space-between; gap: 10px; font-size: .8rem; color: #334155; }

.modal { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 16px; background: rgba(15, 23, 42, .45); }
.modal-card { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 22px; border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.modal-card h2 { margin: 0 0 6px; font-size: 1.1rem; color: #0f172a; }
.secret-box { display: flex; gap: 8px; align-items: stretch; margin: 14px 0; }
.secret-box code { flex: 1; min-width: 0; padding: 11px; border-radius: 9px; background: #0f172a; color: #e2e8f0; font-size: .76rem; word-break: break-all; direction: ltr; }
.warning-text { color: #b45309; font-size: .8rem; font-weight: 600; }
.drawer { position: fixed; inset-block: 0; inset-inline-end: 0; z-index: 1900; width: min(420px, 100vw); padding: 22px; overflow-y: auto; background: #fff; border-inline-start: 1px solid var(--border); box-shadow: -18px 0 40px rgba(15, 23, 42, .12); }
.drawer-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.drawer h2 { margin: 0; font-size: 1.05rem; color: #0f172a; }
.drawer dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 14px; margin: 16px 0 0; font-size: .8rem; }
.drawer dt { color: #94a3b8; font-weight: 700; }
.drawer dd { margin: 0; color: #1e293b; word-break: break-word; }

.session-loading { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; background: #fff; }
.session-spinner { width: 32px; height: 32px; border: 4px solid #e5e7eb; border-top-color: #9ca3af; border-radius: 50%; animation: partner-spin .8s linear infinite; }
@keyframes partner-spin { to { transform: rotate(360deg); } }

/* Right-to-left (Arabic). */
[dir="rtl"] .sidebar { border-right: 0; border-left: 1px solid var(--border); }
[dir="rtl"] .sidebar-link { text-align: right; }
[dir="rtl"] .sidebar-link:hover { transform: translateX(-2px); }
[dir="rtl"] .drawer { box-shadow: 18px 0 40px rgba(15, 23, 42, .12); }

@media (max-width: 1200px) {
  .metric-grid.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .grid-two, .grid-halves { grid-template-columns: 1fr; }
  .sidebar.is-open { transform: translateX(0); }
  [dir="rtl"] .sidebar { left: auto; right: 0; transform: translateX(105%); }
  [dir="rtl"] .sidebar.is-open { transform: translateX(0); }
}
@media (max-width: 760px) {
  .metric-grid, .metric-grid.six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .section-heading { flex-direction: column; }
  .topbar-actions { gap: 8px; }
  .account-name, .env-hint { display: none; }
  .partner-content { padding: 18px 16px 36px; }
}

/* Demo mode (?demo=1) */
.demo-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid #fde68a; border-radius: 14px; background: #fffbeb; color: #92400e; font-size: .84rem; font-weight: 600; line-height: 1.5; }
.demo-banner.hidden { display: none; }
.demo-banner-text { display: flex; align-items: flex-start; gap: 10px; min-width: 0; flex: 1 1 320px; }
.demo-banner-text .badge { flex-shrink: 0; }
.demo-banner-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-banner-actions .action-button { min-height: 36px; text-decoration: none; }
@media (max-width: 640px) { .demo-banner-actions, .demo-banner-actions .action-button { width: 100%; } .demo-banner-actions .action-button { justify-content: center; } }
