/* ERP.UserGuide — تنسيق موحّد لكل أدلة الشاشات */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
  --text: #142033;
  --muted: #5b6b7c;
  --accent: #0f6e6a;
  --accent-soft: #e6f4f3;
  --line: #d7dde5;
  --bg: #f4f6f8;
  --bg-2: #eef2f5;
  --card: #ffffff;
  --card-border: #e2e8ee;
  --ok: #157a45;
  --ok-bg: #e8f7ee;
  --step: #0f6e6a;
  --warn: #9a6700;
  --warn-bg: #fff7e6;
  --cond: #8a4b12;
  --cond-bg: #fff1e6;
  --shadow-sm: 0 1px 2px rgba(20, 32, 51, .04);
  --shadow-md: 0 4px 18px rgba(20, 32, 51, .06);
  --radius: 12px;
  --radius-sm: 8px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text: #e8edf4;
    --muted: #9aa8b8;
    --accent: #5ec4be;
    --accent-soft: rgba(94, 196, 190, .12);
    --line: #2c3648;
    --bg: #0f141c;
    --bg-2: #171d28;
    --card: #161c27;
    --card-border: #2a3344;
    --ok: #4ade80;
    --ok-bg: rgba(74, 222, 128, .12);
    --step: #5ec4be;
    --warn: #fbbf24;
    --warn-bg: rgba(251, 191, 36, .1);
    --cond: #f0b27a;
    --cond-bg: rgba(240, 178, 122, .1);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .28);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --text: #e8edf4;
  --muted: #9aa8b8;
  --accent: #5ec4be;
  --accent-soft: rgba(94, 196, 190, .12);
  --line: #2c3648;
  --bg: #0f141c;
  --bg-2: #171d28;
  --card: #161c27;
  --card-border: #2a3344;
  --ok: #4ade80;
  --ok-bg: rgba(74, 222, 128, .12);
  --step: #5ec4be;
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, .1);
  --cond: #f0b27a;
  --cond-bg: rgba(240, 178, 122, .1);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .28);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--card-border);
  padding: .8rem 1.25rem;
}

.site-header .bar {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}

.site-header a.brand {
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
}

.site-header a.brand::before {
  content: "";
  width: .7rem;
  height: .7rem;
  border-radius: 2px;
  background: var(--step);
  display: inline-block;
}

.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  margin-inline-start: 1rem;
  font-size: .9rem;
  font-weight: 600;
  padding: .25rem .1rem;
  border-bottom: 2px solid transparent;
  transition: border-color .15s, color .15s;
}

.site-header nav a:hover {
  color: var(--step);
  border-color: var(--step);
}

/* ===== Layout ===== */
main { padding: 1.5rem 1.25rem 2.5rem; }

.wrap {
  max-width: 940px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--card-border);
  padding: 1.85rem 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 .45rem;
  color: var(--text);
  padding-bottom: .55rem;
  border-bottom: 2px solid var(--step);
}

h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 1.7rem 0 .65rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .5rem;
}

h2::before {
  content: "";
  width: .28rem;
  height: 1rem;
  border-radius: 2px;
  background: var(--step);
  display: inline-block;
  flex: none;
}

h3 { font-size: 1.02rem; font-weight: 700; margin: 1rem 0 .4rem; color: var(--text); }

p, li { margin: .5rem 0; }

.meta { color: var(--muted); margin-bottom: 1rem; }

code {
  font-family: Consolas, "Courier New", monospace;
  font-size: .88em;
  background: var(--bg-2);
  border: 1px solid var(--card-border);
  padding: .08em .4em;
  border-radius: 4px;
}

/* ===== Numbered flow steps ===== */
.flow { list-style: none; padding: 0; margin: .6rem 0 1.1rem; counter-reset: step; position: relative; }

.flow > li {
  position: relative;
  padding: .85rem 3.2rem .85rem 1rem;
  margin: .55rem 0;
  border: 1px solid var(--card-border);
  border-inline-start: 3px solid var(--step);
  border-radius: var(--radius-sm);
  background: var(--card);
  transition: border-color .15s, background .15s;
}

.flow > li:hover {
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--card));
  border-color: color-mix(in srgb, var(--step) 28%, var(--card-border));
}

.flow > li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  right: .8rem;
  top: .8rem;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--step);
  color: #fff;
  font-size: .85rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.flow strong { display: block; margin-bottom: .2rem; }

/* ===== Tags / badges ===== */
.tag {
  display: inline-block;
  font-size: .74rem;
  font-weight: 700;
  color: var(--ok);
  background: var(--ok-bg);
  border-radius: 6px;
  padding: .14rem .55rem;
  margin-right: .35rem;
}

.tag.opt { color: var(--muted); background: var(--bg-2); }
.tag.cond { color: var(--cond); background: var(--cond-bg); }

/* ===== Callouts ===== */
.note, .warn {
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  margin: 1rem 0;
  border-inline-start-width: 3px;
  border-inline-start-style: solid;
}

.note {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--step) 18%, var(--card-border));
  border-inline-start-color: var(--step);
}

.warn {
  background: var(--warn-bg);
  border: 1px solid color-mix(in srgb, var(--warn) 22%, var(--card-border));
  border-inline-start-color: var(--warn);
  color: var(--warn);
}

/* ===== Tables ===== */
table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  margin: .6rem 0 1.1rem;
  font-size: .95rem;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

th, td {
  border-bottom: 1px solid var(--card-border);
  padding: .55rem .75rem;
  text-align: right;
  vertical-align: top;
}

th {
  background: var(--bg-2);
  font-weight: 700;
  color: var(--text);
}

tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: color-mix(in srgb, var(--bg-2) 45%, var(--card)); }

.links a { color: var(--step); font-weight: 600; }

hr { border: none; border-top: 1px solid var(--card-border); margin: 1.5rem 0; }

ul { padding-right: 1.35rem; margin: .35rem 0; }

a { color: var(--step); }

/* ===== Index / system grid ===== */
.index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: .85rem;
  margin: 1rem 0;
}

.index-card {
  display: block;
  position: relative;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  transition: border-color .15s, background .15s;
}

.index-card:hover {
  border-color: var(--step);
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--card));
}

.index-card strong {
  display: block;
  color: var(--text);
  margin-bottom: .25rem;
  font-size: 1rem;
}

.index-card span { color: var(--muted); font-size: .86rem; }

.index-card .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--step);
  margin-bottom: .5rem;
}

.index-card .icon svg {
  width: 1.1rem;
  height: 1.1rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.index-card.soon { opacity: .5; pointer-events: none; }

/* ===== Search box on index pages ===== */
#site-search {
  width: 100%;
  padding: .68rem .9rem;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  margin: .5rem 0 1.1rem;
  background: var(--bg-2);
  color: var(--text);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}

#site-search:focus {
  outline: none;
  border-color: var(--step);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--step) 16%, transparent);
  background: var(--card);
}

.site-footer {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.1rem 1.25rem 2.25rem;
  color: var(--muted);
  font-size: .84rem;
}

.site-footer a { color: var(--muted); }

@media (max-width: 600px) {
  main { padding: 1rem .85rem 2rem; }
  .wrap { padding: 1.2rem 1.1rem; }
  h1 { font-size: 1.35rem; }
}
