/* Genesis core styles. Plain CSS, no build step. Logical properties serve RTL and LTR. */
/* Fonts are self-hosted: run "bash genesis/fetch-assets.sh" once to download them into public/genesis/fonts/. */
@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/Inter-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --g-primary: #14524a;
  --g-primary-hover: #0e3f39;
  --g-accent: #c8862a;
  --g-bg: #f6f5f1;
  --g-surface: #ffffff;
  --g-border: #e2dfd6;
  --g-text: #1c2422;
  --g-muted: #5f6b67;
  --g-success: #2f7d4f;
  --g-success-bg: #e6f2ea;
  --g-danger: #b3362b;
  --g-danger-bg: #fbeceb;
  --g-radius-sm: 6px;
  --g-radius: 12px;
  --g-radius-lg: 20px;
  --g-shadow: 0 1px 2px rgba(28, 36, 34, 0.06), 0 4px 16px rgba(28, 36, 34, 0.05);
  --g-font: "Vazirmatn", "Inter", "Segoe UI", Tahoma, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body.g-body {
  margin: 0;
  background: var(--g-bg);
  color: var(--g-text);
  font-family: var(--g-font);
  font-size: 16px;
  line-height: 1.7;
}
[dir="rtl"] body.g-body { line-height: 1.9; font-family: "Vazirmatn", "Segoe UI", Tahoma, system-ui, sans-serif; }

.g-body a { color: var(--g-primary); }
.g-body h1, .g-body h2 { line-height: 1.35; margin: 0; }
.g-body h1 { font-size: 1.6rem; }
.g-body h2 { font-size: 1.15rem; }
.g-muted { color: var(--g-muted); }

:focus-visible { outline: 3px solid var(--g-accent); outline-offset: 2px; }

/* Panel frame */
.g-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.g-side { background: var(--g-primary); color: #fff; padding: 24px 16px; }
.g-brand { font-size: 1.2rem; font-weight: 700; padding-inline: 12px; }
.g-brand small { display: block; font-weight: 400; font-size: 0.8rem; opacity: 0.75; }
.g-nav { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 4px; }
.g-nav a {
  display: block; padding: 8px 12px; border-radius: var(--g-radius-sm);
  color: #fff; text-decoration: none; opacity: 0.85; transition: background 150ms, opacity 150ms;
}
.g-nav a:hover { background: rgba(255, 255, 255, 0.1); opacity: 1; }
.g-nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.16); opacity: 1; font-weight: 600; }

.g-main { min-width: 0; }
.g-top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 32px; background: var(--g-surface); border-block-end: 1px solid var(--g-border);
}
.g-top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.g-content { padding: 32px; max-width: 1200px; display: grid; gap: 24px; }

/* Components */
.g-card {
  background: var(--g-surface); border: 1px solid var(--g-border);
  border-radius: var(--g-radius); box-shadow: var(--g-shadow); padding: 24px;
}
.g-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.g-stat-value { font-size: 2rem; font-weight: 700; color: var(--g-primary); line-height: 1.2; }

.g-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--g-radius-sm);
  border: 1px solid transparent; background: var(--g-primary); color: #fff;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: background 150ms;
}
.g-btn:hover { background: var(--g-primary-hover); }
.g-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.g-body a.g-btn { color: #fff; }
.g-btn-ghost, .g-body a.g-btn-ghost { background: transparent; border-color: var(--g-border); color: var(--g-text); }
.g-btn-ghost:hover { background: var(--g-bg); }
.g-btn-sm { min-height: 32px; padding: 4px 12px; font-size: 0.875rem; }

.g-field { display: grid; gap: 4px; }
.g-field label { font-weight: 600; font-size: 0.9rem; }
.g-input {
  width: 100%; min-height: 42px; padding: 8px 12px; font: inherit; color: var(--g-text);
  background: var(--g-surface); border: 1px solid var(--g-border); border-radius: var(--g-radius-sm);
}
.g-input:focus { border-color: var(--g-primary); }
.g-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; align-items: end; }
.g-error { color: var(--g-danger); font-size: 0.875rem; }
.g-alert { padding: 12px 16px; border-radius: var(--g-radius-sm); background: var(--g-success-bg); color: var(--g-success); }

.g-table-wrap { overflow-x: auto; }
.g-table { width: 100%; border-collapse: collapse; }
.g-table th, .g-table td { padding: 12px; text-align: start; border-block-end: 1px solid var(--g-border); vertical-align: middle; }
.g-table th { font-size: 0.85rem; color: var(--g-muted); font-weight: 600; }
.g-table tr:last-child td { border-block-end: 0; }
.g-row-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.g-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: var(--g-bg); color: var(--g-muted); }
.g-badge-on { background: var(--g-success-bg); color: var(--g-success); }
.g-badge-accent { background: #f8eedd; color: #7a4f12; }

/* Login and public pages */
.g-center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.g-login { width: 100%; max-width: 400px; display: grid; gap: 16px; }
.g-check { display: flex; align-items: center; gap: 8px; }
.g-public-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 24px; background: var(--g-surface); border-block-end: 1px solid var(--g-border); }
.g-hero { max-width: 760px; margin: 0 auto; padding: 96px 24px; display: grid; gap: 16px; }
.g-hero h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); color: var(--g-primary); }
.g-foot { text-align: center; padding: 24px; font-size: 0.875rem; color: var(--g-muted); }

@media (max-width: 820px) {
  .g-shell { grid-template-columns: 1fr; }
  .g-side { padding: 16px; }
  .g-nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; margin-top: 12px; }
  .g-top { padding: 12px 16px; }
  .g-content { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Public site */
.g-skip { position: absolute; inset-inline-start: -9999px; }
.g-skip:focus { inset-inline-start: 16px; top: 16px; background: var(--g-surface); padding: 8px 12px; z-index: 10; }
.g-logo, .g-body a.g-logo { font-weight: 700; font-size: 1.15rem; color: var(--g-primary); text-decoration: none; }
.g-public-nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.g-public-nav a { color: var(--g-text); text-decoration: none; padding: 4px 0; border-block-end: 2px solid transparent; }
.g-public-nav a:hover, .g-public-nav a[aria-current="page"] { border-block-end-color: var(--g-accent); }
.g-page { max-width: 1100px; margin: 0 auto; padding: 48px 24px; display: grid; gap: 32px; }
.g-page-narrow { max-width: 760px; }
.g-page-head { display: grid; gap: 8px; }
.g-page-head h1 { color: var(--g-primary); font-size: clamp(1.5rem, 3.5vw, 2.1rem); }
.g-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.g-tile, .g-body a.g-tile { display: grid; gap: 4px; color: var(--g-text); text-decoration: none; transition: border-color 150ms; }
.g-tile:hover { border-color: var(--g-primary); }
.g-tile strong { color: var(--g-primary); font-size: 1.05rem; }
.g-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; counter-reset: step; }
.g-step { position: relative; padding-inline-start: 72px; counter-increment: step; }
.g-step::before {
  content: counter(step); position: absolute; inset-inline-start: 24px; top: 24px;
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--g-primary); color: #fff; font-weight: 700; line-height: 1;
}
.g-step-done { opacity: 0.65; }
.g-step-done::before { content: "✓"; background: var(--g-success); }
.g-step h3 { margin: 0 0 4px; font-size: 1.05rem; line-height: 1.5; }
.g-step p { margin: 0 0 8px; }
.g-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.g-notice { border-inline-start: 4px solid var(--g-accent); background: #fbf5ea; padding: 12px 16px; border-radius: var(--g-radius-sm); font-size: 0.95rem; }
.g-list { margin: 0; padding-inline-start: 20px; display: grid; gap: 4px; }
.g-stack { display: grid; gap: 16px; }
.g-textarea { min-height: 96px; resize: vertical; }
.g-fieldset { border: 1px solid var(--g-border); border-radius: var(--g-radius); padding: 16px; margin: 0; display: grid; gap: 12px; }
.g-fieldset legend { font-weight: 600; padding-inline: 8px; }
.g-radio { display: flex; align-items: center; gap: 8px; }
.g-foot p { margin: 0; }
@media print { .g-public-head, .g-foot, .g-no-print { display: none; } .g-card { box-shadow: none; } }
.g-foot { display: grid; gap: 8px; }
.g-foot-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; }
.g-prose { display: grid; gap: 12px; }
.g-prose h2 { margin-block-start: 16px; }
.g-prose p { margin: 0; }
.g-bar { height: 8px; border-radius: 999px; background: var(--g-border); overflow: hidden; }
.g-bar > span { display: block; height: 100%; background: var(--g-primary); }
.g-check-step { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-block-end: 1px solid var(--g-border); }
.g-check-step:last-child { border-block-end: 0; }
.g-check-btn { width: 28px; height: 28px; flex: none; border-radius: 50%; border: 2px solid var(--g-primary); background: var(--g-surface); color: #fff; cursor: pointer; font: inherit; line-height: 1; }
.g-check-btn[aria-pressed="true"] { background: var(--g-success); border-color: var(--g-success); }
.g-btn-danger { background: var(--g-danger); }
.g-btn-danger:hover { background: #8f2a21; }
.g-alert-error { background: var(--g-danger-bg); color: var(--g-danger); }
