/* IECM-OpenSim — styles.css */
:root {
  --bg: #0f1720; --panel: #16212e; --panel2: #1d2b3a; --line: #2b3b4e;
  --ink: #e7eef6; --muted: #9fb2c6; --accent: #39b3a6; --accent2: #f2a33c;
  --good: #4caf82; --warn: #e4794b; --co2: #d65a5a;
  --cap: #5b8dd6; --fuel:#c98b3a; --fom:#8a7fd0; --reag:#4caf82;
  --radius: 10px; --mono: "Consolas","SF Mono",ui-monospace,monospace;
}
* { box-sizing: border-box; }
html,body { margin:0; height:100%; }
body {
  background: var(--bg); color: var(--ink); font-size:14px;
  font-family: "Segoe UI", Tahoma, Vazirmatn, system-ui, -apple-system, Arial, sans-serif;
  display:flex; flex-direction:column; min-height:100%;
}
header.app {
  display:flex; align-items:center; gap:14px; padding:12px 20px;
  background: linear-gradient(90deg,#132231,#0f1720);
  border-bottom:1px solid var(--line);
}
header.app h1 { font-size:18px; margin:0; letter-spacing:.3px; }
header.app .tag { color:var(--accent); font-weight:700; }
header.app .sub { color:var(--muted); font-size:12px; margin-top:2px; }
header.app .spacer { flex:1; }
header.app .badge {
  font-size:11px; color:var(--muted); border:1px solid var(--line);
  padding:4px 10px; border-radius:20px;
}

.layout { display:flex; flex:1; min-height:0; }
aside.config {
  width:340px; min-width:300px; background:var(--panel);
  border-right:1px solid var(--line); overflow-y:auto; padding:14px;
}
main.results { flex:1; overflow-y:auto; padding:18px 22px; }

.group { margin-bottom:16px; border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; }
.group > h3 {
  margin:0; font-size:12px; text-transform:uppercase; letter-spacing:.8px;
  color:var(--accent); background:var(--panel2); padding:9px 12px; cursor:pointer;
  display:flex; justify-content:space-between; align-items:center;
}
.group .body { padding:10px 12px; }
.field { margin-bottom:10px; }
.field label { display:block; font-size:12px; color:var(--muted); margin-bottom:4px; }
.field .hint { font-size:11px; color:#728298; margin-top:3px; }
.field input[type=number], .field input[type=text], .field select {
  width:100%; background:var(--bg); color:var(--ink);
  border:1px solid var(--line); border-radius:7px; padding:7px 9px; font-size:13px;
}
.field.inline { display:flex; align-items:center; gap:8px; }
.field.inline input[type=checkbox]{ width:16px; height:16px; accent-color:var(--accent); }
.field.inline label { margin:0; }
.row2 { display:grid; grid-template-columns:1fr 1fr; gap:10px; }

button.run {
  width:100%; background:var(--accent); color:#06231f; border:0; font-weight:700;
  padding:11px; border-radius:9px; cursor:pointer; font-size:14px; margin-top:4px;
}
button.run:hover { filter:brightness(1.08); }
.small-btn{ background:var(--panel2); color:var(--ink); border:1px solid var(--line);
  padding:6px 10px; border-radius:7px; cursor:pointer; font-size:12px;}

/* tabs */
.tabs { display:flex; gap:6px; border-bottom:1px solid var(--line); margin-bottom:16px; flex-wrap:wrap;}
.tab { padding:9px 16px; cursor:pointer; color:var(--muted); border-bottom:2px solid transparent; font-size:13px;}
.tab.active { color:var(--ink); border-bottom-color:var(--accent); font-weight:600; }
.panel { display:none; } .panel.active { display:block; }

/* KPI cards */
.kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; margin-bottom:18px; }
.kpi { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:12px 14px; }
.kpi .k { font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; }
.kpi .v { font-size:22px; font-weight:700; margin-top:4px; font-family:var(--mono); }
.kpi .u { font-size:11px; color:var(--muted); }

table.data { width:100%; border-collapse:collapse; margin-bottom:16px; font-size:13px;}
table.data th, table.data td { text-align:left; padding:8px 10px; border-bottom:1px solid var(--line); }
table.data th { color:var(--muted); font-weight:600; font-size:12px; text-transform:uppercase; letter-spacing:.4px;}
table.data td.num { text-align:right; font-family:var(--mono); }
table.data tr:hover td { background:#1a2838; }
.section-title{ font-size:13px; color:var(--accent); text-transform:uppercase; letter-spacing:.6px; margin:18px 0 8px; }

/* stacked bar for COE / capital */
.stack { display:flex; height:30px; border-radius:7px; overflow:hidden; border:1px solid var(--line); margin:6px 0 4px;}
.stack span { display:flex; align-items:center; justify-content:center; font-size:10px; color:#07140f; white-space:nowrap; overflow:hidden;}
.legend{ display:flex; flex-wrap:wrap; gap:12px; font-size:12px; color:var(--muted); margin-bottom:10px;}
.legend i{ width:11px;height:11px;border-radius:3px;display:inline-block;margin-right:5px;vertical-align:-1px;}

.diagram { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:14px; }
.note{ font-size:12px; color:var(--muted); line-height:1.6; }
.pill{ display:inline-block; background:var(--panel2); border:1px solid var(--line); color:var(--muted);
  border-radius:20px; padding:2px 10px; font-size:11px; margin:2px 2px 0 0;}
.pill.on{ background:#133a33; color:var(--accent); border-color:#1f5a4f;}
.warnbox{ background:#2a1d16; border:1px solid #5a3a28; color:#e4a37b; padding:8px 12px; border-radius:8px; font-size:12px; margin-bottom:12px;}
footer.app{ padding:10px 20px; border-top:1px solid var(--line); color:var(--muted); font-size:11px;}
a { color:var(--accent); }

/* ===================== RTL (Persian) ===================== */
html[dir="rtl"] aside.config { border-right:0; border-left:1px solid var(--line); }
html[dir="rtl"] table.data th,
html[dir="rtl"] table.data td { text-align:right; }
html[dir="rtl"] table.data td.num,
html[dir="rtl"] table.data th.num { text-align:left; }
html[dir="rtl"] .kpi { text-align:right; }
html[dir="rtl"] .legend i { margin-right:0; margin-left:5px; }
html[dir="rtl"] .field.inline input[type=checkbox]{ margin-left:0; }
/* keep technical sub/sup and the diagram in logical LTR flow */
html[dir="rtl"] sub, html[dir="rtl"] sup { unicode-bidi:isolate; }
