:root {
  --ink: #18201d;
  --muted: #5b6862;
  --paper: #f7f2e8;
  --panel: #fffaf0;
  --line: #d9cbb5;
  --accent: #0c7c59;
  --accent-strong: #07583f;
  --accent-soft: #e1f0e8;
  --warning-soft: #fff1c7;
  --shadow: 0 18px 60px rgba(24, 32, 29, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(12, 124, 89, 0.08), transparent 28rem),
    radial-gradient(circle at top left, #dff0d8, transparent 34rem),
    var(--paper);
  font-family: Tajawal, "Segoe UI", sans-serif;
}

.shell { width: min(1280px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0; }
.is-hidden { display: none !important; }
.language-bar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 16px; }
.language-button { background: rgba(255, 250, 240, 0.72); color: var(--accent-strong); border: 1px solid var(--line); padding: 8px 12px; }
.language-button.active { background: var(--accent); color: white; border-color: var(--accent); }
.login-screen { min-height: calc(100vh - 112px); display: grid; place-items: center; }
.login-card { width: min(560px, 100%); background: rgba(255, 250, 240, 0.94); border: 1px solid var(--line); padding: 28px; box-shadow: var(--shadow); }
.login-form { display: grid; gap: 12px; margin-top: 16px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 8px; color: var(--muted); }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.app-screen { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: start; }
.sidebar { position: sticky; top: 18px; min-height: calc(100vh - 48px); background: #17352b; color: #fffaf0; border: 1px solid rgba(255, 255, 255, 0.12); padding: 18px; display: grid; align-content: space-between; box-shadow: var(--shadow); }
.sidebar .eyebrow { color: #a8dcc5; }
.sidebar h1 { font-size: 1.55rem; line-height: 1.1; margin-top: 0; }
.tool-nav { display: grid; gap: 8px; margin: 22px 0; }
.tool-tab { text-align: start; background: transparent; color: #f7f2e8; border: 1px solid rgba(255, 255, 255, 0.18); }
.tool-tab:hover, .tool-tab.active { background: #f7f2e8; color: #17352b; }
.workspace { display: grid; gap: 16px; min-width: 0; }
.hero { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; padding: 24px; }
.compact-hero { background: rgba(255, 250, 240, 0.82); border: 1px solid var(--line); box-shadow: var(--shadow); }
.eyebrow { margin: 0 0 8px; color: var(--accent-strong); font-weight: 700; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 4.5rem); line-height: 1; }
h2 { margin: 0 0 18px; }
.lead { max-width: 680px; color: var(--muted); font-size: 1.1rem; }
.status { border: 1px solid var(--line); padding: 12px 14px; background: #eef7ed; min-width: 180px; }
.status-stack { min-width: 280px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metric-card { border: 1px solid var(--line); background: white; padding: 12px; display: grid; gap: 6px; }
.metric-card span { color: var(--muted); font-size: 0.92rem; }
.metric-card strong { font-size: 0.98rem; }
.panel { background: rgba(255, 250, 240, 0.95); border: 1px solid var(--line); padding: 18px; box-shadow: 0 10px 28px rgba(24, 32, 29, 0.06); }
.primary-panel { min-height: 420px; }
.panel-heading { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.steps-panel { display: grid; grid-template-columns: 220px 1fr; gap: 18px; margin-bottom: 16px; }
.runtime-panel { display: grid; grid-template-columns: 220px 1fr; gap: 18px; margin-bottom: 16px; }
.runtime-map { margin: 0; min-height: 0; }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { border: 1px solid var(--line); background: white; color: var(--muted); padding: 10px; min-height: 68px; counter-increment: step; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 22px; height: 22px; margin-bottom: 8px; background: #e9ddc8; color: var(--ink); font-size: 0.85rem; }
.steps li.active { border-color: var(--accent); color: var(--ink); box-shadow: inset 0 0 0 2px rgba(12, 124, 89, 0.18); }
label { display: grid; gap: 6px; margin: 0 0 12px; color: var(--muted); }
input, textarea, select { width: 100%; border: 1px solid var(--line); padding: 10px 12px; font: inherit; background: white; color: var(--ink); }
textarea { min-height: 120px; resize: vertical; }
button { border: 0; background: var(--accent); color: white; padding: 11px 16px; font: inherit; cursor: pointer; }
button:hover { background: var(--accent-strong); }
.secondary-button { background: transparent; color: var(--accent-strong); border: 1px solid var(--line); }
.secondary-button:hover { background: var(--accent-soft); color: var(--accent-strong); }
.sidebar .secondary-button { color: #f7f2e8; border-color: rgba(255, 255, 255, 0.26); }
.sidebar .secondary-button:hover { color: #17352b; background: #f7f2e8; }
.feedback-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
pre { overflow: auto; white-space: pre-wrap; background: #18201d; color: #f7f2e8; padding: 12px; min-height: 56px; }

[dir="rtl"] .language-bar { justify-content: flex-start; }
[dir="rtl"] input, [dir="rtl"] textarea { text-align: right; }
[dir="rtl"] pre { direction: ltr; text-align: left; }
[dir="rtl"] .tool-tab { text-align: right; }
[dir="rtl"] .quick-actions { justify-content: flex-start; }

@media (max-width: 760px) {
  .app-screen { grid-template-columns: 1fr; }
  .sidebar { position: static; min-height: 0; }
  .hero { display: block; }
  .status-stack { grid-template-columns: 1fr; min-width: 0; margin-top: 16px; }
  .panel-heading { display: block; }
  .quick-actions { justify-content: flex-start; margin-bottom: 12px; }
  .steps-panel { grid-template-columns: 1fr; }
  .runtime-panel { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
}