/* ==========================================================================
   SIJIL : Ministry of Economy & Trade e-Services Suite (demo)
   One stylesheet. Tokens first, then shell, then components.
   Identity: petrol ink + saffron on warm paper, gazette serif headings,
   seal-shaped milestones, Amazigh triangle band.
   ========================================================================== */

:root {
  /* Brand */
  --ink-950: #081c1f;
  --ink-900: #0f2a2e;
  --ink-800: #17393e;
  --ink-700: #1f4a50;
  --pt-700: #155e52;      /* oasis green, primary */
  --pt-600: #1b7364;
  --pt-500: #23897a;
  --pt-100: #dcefe9;
  --pt-50:  #eef7f4;
  --sf-700: #9a6200;      /* saffron */
  --sf-600: #c07c06;
  --sf-500: #d98e04;
  --sf-100: #fbecc8;
  --sf-50:  #fdf6e4;
  --tc-700: #9c3f22;      /* terracotta */
  --tc-500: #c25a35;
  --tc-100: #f8e1d7;
  --sl-700: #2f5574;      /* slate blue, info */
  --sl-500: #3e6a8a;
  --sl-100: #dfe9f1;

  /* Neutrals (warm) */
  --paper: #f5f7f6;
  --paper-2: #edf0ee;
  --surface: #ffffff;
  --line: #e4e8e5;
  --line-2: #cfd4cd;
  --tx-1: #18221f;
  --tx-2: #44504c;
  --tx-3: #6f7a75;
  --tx-4: #98a19c;

  /* Status */
  --ok: #1d7a4f;   --ok-bg: #e2f3ea;
  --wn: #a86400;   --wn-bg: #fcefd2;
  --er: #b23b2b;   --er-bg: #f9e2dd;
  --in: #2f5574;   --in-bg: #e1ebf3;

  /* Type */
  --f-ui: "Avenir Next", "Segoe UI", "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --f-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --f-mono: "SF Mono", "Menlo", "Consolas", monospace;
  --f-ar: "Geeza Pro", "Noto Kufi Arabic", "Segoe UI", Tahoma, sans-serif;

  --r-s: 6px; --r: 10px; --r-l: 14px; --r-xl: 20px;
  --sh-1: 0 1px 2px rgba(15,42,46,.06), 0 1px 1px rgba(15,42,46,.04);
  --sh-2: 0 4px 14px rgba(15,42,46,.08), 0 1px 3px rgba(15,42,46,.06);
  --sh-3: 0 18px 48px rgba(15,42,46,.18), 0 4px 12px rgba(15,42,46,.08);
  --nav-w: 252px;
  --bar-h: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--f-ui); font-size: 14px; line-height: 1.5; color: var(--tx-1);
  background: var(--paper); -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}
html[dir="rtl"] body { font-family: var(--f-ar), var(--f-ui); }
a { color: var(--pt-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--tx-1); }
p { margin: 0 0 10px; }
.mono { font-family: var(--f-mono); font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--tx-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: end; }
.center { text-align: center; }
.hide { display: none !important; }
.serif { font-family: var(--f-display); }
html[dir="rtl"] .serif { font-family: var(--f-ar); }

/* ---------- Amazigh triangle band (signature) ---------- */
.band {
  height: 6px;
  background:
    linear-gradient(135deg, var(--sf-500) 25%, transparent 25%) 0 0 / 12px 6px,
    linear-gradient(225deg, var(--sf-500) 25%, transparent 25%) 0 0 / 12px 6px,
    var(--pt-700);
}
.band.thin { height: 4px; background-size: 8px 4px, 8px 4px, auto; }

/* ==========================================================================
   SHELL : light top bar, area tabs, slim demo guide, page header, footer
   ========================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 50; height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
}
.tb-back { width: 36px; height: 36px; border: 0; background: none; border-radius: 10px; color: var(--tx-2); cursor: pointer; display: grid; place-items: center; margin-inline-start: -6px; }
.tb-back:hover { background: var(--paper); }
.tb-brand { display: flex; align-items: center; gap: 9px; color: var(--tx-1); text-decoration: none; }
.tb-brand:hover { text-decoration: none; }
.tb-brand b { font-family: var(--f-display); font-size: 19px; letter-spacing: .06em; font-weight: 600; }
html[dir="rtl"] .tb-brand b { font-family: var(--f-ar); letter-spacing: 0; }
.tb-area { color: var(--tx-1); font-weight: 600; font-size: 14px; padding-inline-start: 12px; border-inline-start: 1px solid var(--line-2); line-height: 18px; white-space: nowrap; }
.tb-search { flex: 1; max-width: 420px; margin-inline-start: auto; position: relative; }
.tb-search input { width: 100%; height: 36px; border-radius: 18px; border: 1px solid transparent; background: var(--paper); padding: 0 14px 0 38px; font: inherit; font-size: 13.5px; color: var(--tx-1); }
html[dir="rtl"] .tb-search input { padding: 0 38px 0 14px; }
.tb-search input:focus { outline: 0; border-color: var(--pt-500); background: #fff; }
.tb-search svg { position: absolute; top: 10px; inset-inline-start: 13px; color: var(--tx-2); }
.tb-search input::placeholder { color: var(--tx-2); }
.tb-actions { display: flex; align-items: center; gap: 4px; }
.tb-btn { position: relative; height: 36px; min-width: 36px; border: 0; background: none; border-radius: 10px; color: var(--tx-1); cursor: pointer; display: grid; place-items: center; font: inherit; }
.tb-btn:hover { background: var(--paper); }
.tb-btn.lang { font-weight: 700; color: var(--pt-700); font-size: 16px; }
.tb-btn .dot { position: absolute; top: 3px; inset-inline-end: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--sf-500); color: var(--ink-950); font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.tb-user { display: flex; align-items: center; gap: 10px; border: 0; background: none; cursor: pointer; padding: 4px 4px 4px 8px; border-radius: 22px; font: inherit; color: inherit; margin-inline-start: 6px; }
.tb-user:hover { background: var(--paper); }
.tb-user .who { text-align: end; line-height: 1.2; display: block !important; }
.tb-user .who b { display: block; font-size: 13px; }
.tb-user .who span { font-size: 12px; color: var(--tx-2); font-weight: 500; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: #fff; flex: none; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }

.tabbar { background: #fff; border-bottom: 1px solid var(--line); display: flex; gap: 6px; padding: 0 20px; overflow-x: auto; position: sticky; top: 56px; z-index: 40; }
.tabbar a { padding: 13px 12px 11px; font-size: 14px; color: var(--tx-1); border-bottom: 3px solid transparent; white-space: nowrap; text-decoration: none; display: flex; align-items: center; gap: 6px; }
.tabbar a:hover { color: var(--tx-1); text-decoration: none; }
.tabbar a.on { color: var(--pt-700); border-bottom-color: var(--pt-600); font-weight: 650; }
.tcnt { font-style: normal; font-size: 11px; font-weight: 700; background: var(--sf-100); color: var(--sf-700); border-radius: 9px; padding: 0 6px; }

/* Slim demo guide strip (light) */
.guide { display: flex; align-items: center; gap: 14px; padding: 8px 20px; background: #fff8e6; border-bottom: 1px solid #f1dfb2; color: var(--tx-1); font-size: 13.5px; min-height: 46px; flex-wrap: wrap; }
.guide.off { background: none; border: 0; min-height: 0; padding: 6px 20px 0; }
.g-show { border: 0; background: none; color: var(--tx-2); font: inherit; font-size: 12.5px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.g-show:hover { color: var(--pt-700); }
.g-tag { display: inline-flex; gap: 6px; align-items: center; color: var(--sf-700); font-weight: 700; font-size: 13px; }
.g-dots { display: inline-flex; gap: 3px; }
.g-dots i { width: 14px; height: 5px; border-radius: 3px; background: #e9dcbc; }
.g-dots i.d { background: var(--pt-600); } .g-dots i.n { background: var(--sf-500); }
.g-step { color: var(--tx-2); font-size: 13px; white-space: nowrap; }
.g-svc { font-size: 12px; font-weight: 600; color: var(--pt-700); background: #fff; border: 1px solid #f1dfb2; border-radius: 20px; padding: 2px 10px; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.g-svc:hover { border-color: var(--pt-600); }
.g-t { color: var(--tx-1); font-weight: 700; white-space: nowrap; }
.g-d { display: none; }
.g-act { display: inline-flex; gap: 4px; align-items: center; margin-inline-start: auto; }
.g-go { height: 32px; border-radius: 8px; border: 0; background: var(--pt-700); color: #fff; font: inherit; font-weight: 700; font-size: 13px; padding: 0 14px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.g-go:hover { background: var(--pt-600); }
.g-here { display: inline-flex; gap: 5px; align-items: center; color: var(--pt-700); font-weight: 700; font-size: 13px; padding: 0 8px; white-space: nowrap; }
.g-lnk { height: 32px; min-width: 32px; border: 0; background: none; color: var(--tx-2); border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer; display: inline-grid; place-items: center; padding: 0 8px; }
.g-lnk:hover { background: rgba(0,0,0,.05); color: var(--tx-1); }

/* Page */
.page { padding: 18px 32px 110px; max-width: none; margin: 0; width: 100%; }
body.has-fbar .page { padding-bottom: 150px; }
.ph { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.ph-l { display: flex; gap: 12px; align-items: center; }
.ph-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--pt-50); color: var(--pt-700); flex: none; }
.ph-ic.sf { background: var(--sf-50); color: var(--sf-700); } .ph-ic.sl { background: var(--sl-100); color: var(--sl-700); }
.ph-ic.tc { background: var(--tc-100); color: var(--tc-700); } .ph-ic.vi { background: #efe9f8; color: #6b4c9a; }
.ph h1 { font-size: 21px; font-weight: 700; letter-spacing: -.015em; line-height: 1.2; }
.ph p { margin: 2px 0 0; color: var(--tx-3); font-size: 13px; max-width: 760px; }
.ph-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* One-line hint, expandable to the today / with SIJIL pair */
.sjhint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-inline-start: 3px solid var(--sf-500); border-radius: 12px; padding: 10px 14px; margin-bottom: 22px; font-size: 13.5px; color: var(--tx-2); }
.sjhint .hi { color: var(--sf-700); display: grid; }
.sjhint .ht { flex: 1; min-width: 240px; }
.sjhint-more { border: 0; background: none; color: var(--pt-700); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.sjhint-more svg { transition: transform .15s; }
.sjhint.open .sjhint-more svg { transform: rotate(180deg); }
.sjhint-pair { display: none; flex-basis: 100%; margin-top: 8px; }
.sjhint.open .sjhint-pair { display: block; }
.sjhint-pair .pair { box-shadow: none; }

/* Floating action bar */
.fbar { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%) translateY(140%); width: min(1100px, calc(100% - 40px)); z-index: 60;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-3); padding: 10px 12px 10px 18px;
  display: flex; align-items: center; gap: 14px; transition: transform .2s ease; visibility: hidden; }
html[dir="rtl"] .fbar { padding: 10px 18px 10px 12px; }
.fbar.on { transform: translateX(-50%) translateY(0); visibility: visible; }
.fb-msg { flex: 1; font-size: 13.5px; color: var(--tx-2); display: flex; gap: 8px; align-items: center; min-width: 0; }
.fb-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.sitefoot { border-top: 1px solid var(--line); padding: 12px 20px; font-size: 11.5px; color: var(--tx-3); display: flex; gap: 10px; align-items: center; justify-content: center; background: #fff; }
.sitefoot img { height: 22px; }

/* Compact launchpad tiles + groups */
.lp { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
@media (max-width: 1100px) { .lp { grid-template-columns: 1fr; } }
.lp-grp { margin-bottom: 26px; }
.lp-grp h2 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.lp-grp h2::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--pt-600); }
.lp-grp.sf h2::before { background: var(--sf-500); } .lp-grp.sl h2::before { background: var(--sl-500); }
.lp-grp.tc h2::before { background: var(--tc-500); } .lp-grp.vi h2::before { background: #7d5fb0; }
.tiles { display: flex; flex-wrap: wrap; gap: 14px; }
.tl2 { width: 168px; height: 150px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; text-decoration: none; color: inherit; position: relative; box-shadow: var(--sh-1); transition: transform .12s, box-shadow .12s, border-color .12s; }
.tl2:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--line-2); text-decoration: none; }
.tl2 b { font-size: 14.5px; line-height: 1.3; }
.tl2 span.s { font-size: 12px; color: var(--tx-3); margin-top: 3px; line-height: 1.35; }
.tl2 .foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; }
.tl2 .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--pt-50); color: var(--pt-700); }
.tl2 .n { font-size: 26px; font-weight: 700; color: var(--pt-700); line-height: 1; }
.tl2.sf .ic { background: var(--sf-50); color: var(--sf-700); } .tl2.sf .n { color: var(--sf-700); }
.tl2.sl .ic { background: var(--sl-100); color: var(--sl-700); } .tl2.sl .n { color: var(--sl-700); }
.tl2.tc .ic { background: var(--tc-100); color: var(--tc-700); } .tl2.tc .n { color: var(--tc-700); }
.tl2.vi .ic { background: #efe9f8; color: #6b4c9a; } .tl2.vi .n { color: #6b4c9a; }
.tl2 .badge-n { position: absolute; top: 10px; inset-inline-end: 10px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--sl-100); color: var(--sl-700); font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
.tl2.mine { border-color: #e8c77a; box-shadow: 0 0 0 3px var(--sf-50), var(--sh-1); }
.desk { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--sh-1); position: sticky; top: 120px; }
.desk h3 { font-size: 16px; display: flex; gap: 9px; align-items: center; margin-bottom: 8px; }
.desk h3::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--pt-600); }
.dk { display: flex; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid #efeadf; text-decoration: none; color: inherit; }
.dk:last-child { border-bottom: 0; }
.dk:hover { text-decoration: none; background: var(--paper); border-radius: 10px; }
.dk .ic { width: 34px; height: 34px; border-radius: 10px; background: var(--pt-50); color: var(--pt-700); display: grid; place-items: center; flex: none; }
.dk b { display: block; font-size: 13.5px; }
.dk span { font-size: 12px; color: var(--tx-3); }
.dk .v { margin-inline-start: auto; font-size: 20px; font-weight: 700; color: var(--tx-1); }

/* Choice cards (one question per step) */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.choice { background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; grid-template-columns: 40px 1fr; column-gap: 12px; align-items: center; cursor: pointer; text-align: start; font: inherit; color: inherit; box-shadow: var(--sh-1); transition: border-color .12s, box-shadow .12s; }
.choice:hover { border-color: var(--pt-500); }
.choice.on { border-color: var(--pt-600); box-shadow: 0 0 0 3px rgba(35,137,122,.15); }
.choice .ic { width: 40px; height: 40px; border-radius: 11px; background: var(--sf-50); color: var(--sf-700); display: grid; place-items: center; margin: 0; grid-row: span 2; }
.choice b { display: block; font-size: 14.5px; align-self: end; }
.choice span { display: block; font-size: 12.5px; color: var(--tx-3); margin-top: 1px; align-self: start; }

/* ==========================================================================
   COMPONENTS
   ========================================================================== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--sh-1); }
.card-h { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.card-h h3 { font-size: 14.5px; font-weight: 650; }
.card-h .sub { font-size: 12px; color: var(--tx-3); font-weight: 400; margin-top: 1px; }
.card-b { padding: 14px 16px; }
.card-f { padding: 12px 18px; border-top: 1px solid var(--line); background: #fafbf9; border-radius: 0 0 var(--r-l) var(--r-l); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.sec-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--tx-3); font-weight: 700; margin: 26px 0 10px; display: flex; align-items: center; gap: 10px; }
.sec-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
html[dir="rtl"] .sec-title { letter-spacing: 0; font-size: 13px; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 360px; }
@media (max-width: 1180px) { .g4, .g5 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .g2, .g3, .g4, .g5 { grid-template-columns: 1fr; } .page { padding-left: 16px; padding-right: 16px; } .tb-area, .g-d { display: none; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt0{margin-top:0}.mt1{margin-top:6px}.mt2{margin-top:12px}.mt3{margin-top:18px}.mt4{margin-top:26px}
.mb1{margin-bottom:6px}.mb2{margin-bottom:12px}.mb3{margin-bottom:18px}.mb4{margin-bottom:26px}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 15px;
  border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--tx-1);
  font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--paper); text-decoration: none; }
.btn.primary { background: var(--pt-700); border-color: var(--pt-700); color: #fff; }
.btn.primary:hover { background: var(--pt-600); }
.btn.accent { background: var(--sf-500); border-color: var(--sf-500); color: var(--ink-950); }
.btn.accent:hover { background: #e79c12; }
.btn.danger { color: var(--er); border-color: #e7c3bb; }
.btn.danger:hover { background: var(--er-bg); }
.btn.ghost { border-color: transparent; background: none; color: var(--pt-700); }
.btn.ghost:hover { background: var(--pt-50); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn.lg { height: 40px; padding: 0 18px; font-size: 14.5px; border-radius: 10px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 11.5px; font-weight: 650; white-space: nowrap; background: var(--paper-2); color: var(--tx-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.wn { background: var(--wn-bg); color: var(--wn); }
.badge.er { background: var(--er-bg); color: var(--er); }
.badge.in { background: var(--in-bg); color: var(--in); }
.badge.pt { background: var(--pt-100); color: var(--pt-700); }
.code { font-family: var(--f-mono); font-size: 11.5px; background: var(--paper-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; color: var(--tx-2); white-space: nowrap; }

/* KPI facets */
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 14px 16px; box-shadow: var(--sh-1); position: relative; overflow: hidden; }
.kpi .lbl { font-size: 12px; color: var(--tx-3); font-weight: 600; }
.kpi .val { font-family: var(--f-display); font-size: 26px; font-weight: 600; margin-top: 4px; line-height: 1.1; letter-spacing: -.01em; }
html[dir="rtl"] .kpi .val { font-family: var(--f-ui); }
.kpi .val small { font-size: 14px; color: var(--tx-3); font-family: var(--f-ui); font-weight: 500; margin-inline-start: 4px; }
.kpi .delta { font-size: 12px; margin-top: 6px; color: var(--tx-3); }
.kpi .delta b.up { color: var(--ok); } .kpi .delta b.down { color: var(--er); }
.kpi .spark { position: absolute; right: 14px; bottom: 10px; opacity: .9; }
.kpi:has(.spark) { padding-bottom: 44px; }
html[dir="rtl"] .kpi .spark { right: auto; left: 14px; }
.kpi.accent { background: var(--pt-50); border-color: var(--pt-100); }
.kpi.accent .lbl, .kpi.accent .delta { color: var(--tx-2); }
.kpi.accent .val { color: var(--pt-700); }

/* Tables */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th { text-align: start; font-size: 12px; font-weight: 650; color: var(--tx-3); padding: 10px 14px; background: #f8f9f7; border-bottom: 1px solid var(--line); white-space: nowrap; }
html[dir="rtl"] .tbl th { letter-spacing: 0; font-size: 12.5px; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid #efeadf; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: var(--pt-50); }
.tbl tbody tr.hl { background: var(--sf-50); }
.tbl tbody tr.hl td:first-child { box-shadow: inset 3px 0 0 var(--sf-500); }
html[dir="rtl"] .tbl tbody tr.hl td:first-child { box-shadow: inset -3px 0 0 var(--sf-500); }
.tbl .t-main { font-weight: 600; color: var(--tx-1); }
.tbl .t-sub { font-size: 12px; color: var(--tx-3); }
.tbl-wrap { overflow-x: auto; }

/* Toolbar / filters */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.seg { display: inline-flex; background: var(--paper-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--tx-2); padding: 5px 12px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--tx-1); box-shadow: var(--sh-1); }
.seg button .n { font-size: 11px; color: var(--tx-3); margin-inline-start: 4px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 650; color: var(--tx-2); }
.field label .req { color: var(--tc-500); }
.field .hint { font-size: 11.5px; color: var(--tx-3); }
.input, .select, textarea.input {
  height: 38px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 12px; font: inherit; font-size: 13.5px;
  background: var(--surface); color: var(--tx-1); width: 100%;
}
textarea.input { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus { outline: 0; border-color: var(--pt-500); box-shadow: 0 0 0 3px rgba(35,137,122,.15); }
.input.ok { border-color: #9fd0b6; background: #f8fdfa; }
.input[readonly] { background: #faf8f3; }

/* Explain + pain/answer pair (plain-language layer) */
.explain { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 14px 18px; box-shadow: var(--sh-1); }
.explain .ic { width: 38px; height: 38px; border-radius: 10px; background: var(--sf-50); color: var(--sf-700); display: grid; place-items: center; }
.explain h4 { font-size: 13.5px; margin-bottom: 3px; }
.explain p { margin: 0; color: var(--tx-2); font-size: 13.5px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; background: var(--surface); box-shadow: var(--sh-1); }
.pair > div { padding: 14px 18px; }
.pair .today { background: #fbf4f1; border-inline-end: 1px solid var(--line); }
.pair .tomorrow { background: #f1f8f5; }
.pair .tag { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 5px; display: flex; gap: 6px; align-items: center; }
html[dir="rtl"] .pair .tag { letter-spacing: 0; font-size: 12px; }
.pair .today .tag { color: var(--tc-700); }
.pair .tomorrow .tag { color: var(--pt-700); }
.pair p { margin: 0; font-size: 13.5px; color: var(--tx-2); }
@media (max-width: 860px) { .pair { grid-template-columns: 1fr; } }

/* Journey rail: seal-shaped milestones */
.rail { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 6px 2px 4px; }
.rail .st { flex: 1; min-width: 84px; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; }
.rail .st::before { content: ""; position: absolute; top: 19px; inset-inline-start: calc(-50% + 22px); inset-inline-end: calc(50% + 22px); height: 3px; background: var(--line); border-radius: 2px; }
.rail .st:first-child::before { display: none; }
.rail .st.done::before, .rail .st.now::before { background: var(--pt-500); }
.seal {
  width: 40px; height: 40px; display: grid; place-items: center; position: relative; z-index: 1;
  clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
  background: var(--line); color: var(--tx-3); font-weight: 700; font-size: 13px;
}
.rail .st.done .seal { background: var(--pt-600); color: #fff; }
.rail .st.now .seal { background: var(--sf-500); color: var(--ink-950); animation: pulse 2s ease-in-out infinite; }
.rail .st.ret .seal { background: var(--tc-500); color: #fff; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.rail .st .nm { font-size: 12.5px; font-weight: 650; margin-top: 8px; color: var(--tx-1); line-height: 1.25; padding: 0 4px; }
.rail .st .by { font-size: 11px; color: var(--tx-3); margin-top: 2px; }
.rail .st.wait .nm { color: var(--tx-3); font-weight: 500; }

/* Object page header (Fiori-like, own flavour) */
.obj { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--sh-1); overflow: hidden; }
.obj-top { display: flex; gap: 18px; padding: 20px 22px; align-items: flex-start; }
.obj-emblem { width: 58px; height: 58px; border-radius: 14px; background: var(--pt-50); color: var(--pt-700); display: grid; place-items: center; flex: none; }
.obj-title { font-family: var(--f-display); font-size: 22px; font-weight: 600; line-height: 1.2; }
html[dir="rtl"] .obj-title { font-family: var(--f-ar); }
.obj-meta { display: flex; gap: 8px 16px; flex-wrap: wrap; margin-top: 6px; font-size: 12.5px; color: var(--tx-3); align-items: center; }
.facets { display: flex; border-top: 1px solid var(--line); background: #fcfbf8; flex-wrap: wrap; }
.facet { flex: 1; min-width: 150px; padding: 12px 22px; border-inline-end: 1px solid var(--line); }
.facet:last-child { border-inline-end: 0; }
.facet .k { font-size: 11px; color: var(--tx-3); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
html[dir="rtl"] .facet .k { letter-spacing: 0; font-size: 12px; }
.facet .v { font-size: 15px; font-weight: 650; margin-top: 3px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; background: none; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--tx-3); padding: 10px 14px; cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tabs button.on { color: var(--pt-700); border-bottom-color: var(--pt-600); }
.tabs button .n { background: var(--paper-2); color: var(--tx-2); border-radius: 9px; font-size: 11px; padding: 0 6px; }

/* Key/value list */
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 9px 16px; font-size: 13.5px; }
.kv dt { color: var(--tx-3); }
.kv dd { margin: 0; font-weight: 550; }

/* Timeline */
.tl { position: relative; padding-inline-start: 24px; }
.tl::before { content: ""; position: absolute; inset-inline-start: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl .ev { position: relative; padding-bottom: 16px; }
.tl .ev:last-child { padding-bottom: 0; }
.tl .ev::before { content: ""; position: absolute; inset-inline-start: -21px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--pt-500); }
.tl .ev.pay::before { border-color: var(--sf-500); }
.tl .ev.ret::before { border-color: var(--tc-500); }
.tl .ev.sys::before { border-color: var(--sl-500); }
.tl .ev .t { font-size: 11.5px; color: var(--tx-3); }
.tl .ev .m { font-size: 13.5px; font-weight: 550; }
.tl .ev .d { font-size: 12.5px; color: var(--tx-2); }

/* Doc rows */
.doc { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.doc + .doc { margin-top: 8px; }
.doc .fi { width: 36px; height: 42px; border-radius: 5px; background: var(--paper-2); display: grid; place-items: center; font-size: 9.5px; font-weight: 800; color: var(--tx-3); flex: none; position: relative; }
.doc .fi.pdf { background: #f6e1db; color: var(--tc-700); }
.doc .fi.jpg { background: var(--sl-100); color: var(--sl-700); }
.doc .info { flex: 1; min-width: 0; }
.doc .info b { display: block; font-size: 13.5px; }
.doc .info span { font-size: 12px; color: var(--tx-3); }
.checks { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.chk { font-size: 11px; display: inline-flex; gap: 4px; align-items: center; color: var(--ok); background: var(--ok-bg); border-radius: 5px; padding: 1px 6px; font-weight: 600; }
.chk.no { color: var(--er); background: var(--er-bg); }
.chk.wait { color: var(--tx-3); background: var(--paper-2); }

/* Launchpad tiles */
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px 16px 14px;
  display: flex; flex-direction: column; min-height: 168px; cursor: pointer; text-decoration: none; color: inherit;
  box-shadow: var(--sh-1); transition: transform .14s, box-shadow .14s, border-color .14s; position: relative;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--line-2); text-decoration: none; }
.tile .ti { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--pt-50); color: var(--pt-700); }
.tile .ti.sf { background: var(--sf-50); color: var(--sf-700); }
.tile .ti.sl { background: var(--sl-100); color: var(--sl-700); }
.tile .ti.tc { background: var(--tc-100); color: var(--tc-700); }
.tile .ti.ink { background: var(--pt-50); color: var(--pt-700); }
.tile h4 { font-size: 14.5px; margin-top: 12px; line-height: 1.3; }
.tile p { font-size: 12.5px; color: var(--tx-3); margin: 3px 0 0; }
.tile .tf { margin-top: auto; padding-top: 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.tile .big { font-family: var(--f-display); font-size: 28px; font-weight: 600; line-height: 1; }
html[dir="rtl"] .tile .big { font-family: var(--f-ui); }
.tile .big.txt { font-size: 19px; font-family: var(--f-ui); font-weight: 700; color: var(--pt-700); }
.tile .unit { font-size: 11.5px; color: var(--tx-3); }
.tile .mine-flag { position: absolute; top: 12px; inset-inline-end: 12px; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--sf-700); background: var(--sf-50); padding: 2px 7px; border-radius: 5px; }

/* Callouts */
.note { border-radius: 10px; padding: 12px 14px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.note.ok { background: var(--ok-bg); color: #14583a; }
.note.wn { background: var(--wn-bg); color: #7a4a00; }
.note.er { background: var(--er-bg); color: #8a2c20; }
.note.in { background: var(--in-bg); color: #24445e; }
.note svg { flex: none; margin-top: 1px; }

/* Progress bar */
.bar { height: 8px; background: var(--paper-2); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--pt-500); border-radius: 4px; }
.bar.sf > i { background: var(--sf-500); }
.bar.er > i { background: var(--tc-500); }

/* Drawer (notifications) */
.scrim { position: fixed; inset: 0; background: rgba(8,28,31,.35); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .15s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: 400px; max-width: 92vw; background: var(--surface); z-index: 91; box-shadow: var(--sh-3); transform: translateX(105%); transition: transform .2s ease; display: flex; flex-direction: column; }
html[dir="rtl"] .drawer { transform: translateX(-105%); }
.drawer.on { transform: none !important; }
.drawer .dh { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.drawer .db { overflow-y: auto; padding: 8px 0; flex: 1; }
.ntf { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid #f1ede4; }
.ntf .ni { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--pt-50); color: var(--pt-700); }
.ntf .ni.pay { background: var(--sf-50); color: var(--sf-700); }
.ntf .ni.sys { background: var(--sl-100); color: var(--sl-700); }
.ntf .ni.ret { background: var(--tc-100); color: var(--tc-700); }
.ntf b { font-size: 13px; display: block; }
.ntf span { font-size: 12px; color: var(--tx-3); }

/* Role picker modal */
.modal { position: fixed; inset: 0; display: none; place-items: center; z-index: 95; padding: 20px; }
.modal.on { display: grid; }
.modal .box { background: var(--surface); border-radius: 18px; box-shadow: var(--sh-3); width: 640px; max-width: 100%; max-height: 90vh; overflow: auto; position: relative; z-index: 1; }
.modal .bg { position: absolute; inset: 0; background: rgba(8,28,31,.45); }
.persona { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); text-align: start; font: inherit; width: 100%; color: inherit; }
.persona:hover { border-color: var(--pt-500); background: var(--pt-50); }
.persona.on { border-color: var(--pt-600); box-shadow: 0 0 0 3px rgba(35,137,122,.14); }
.persona b { display: block; font-size: 13.5px; }
.persona span { font-size: 12px; color: var(--tx-3); }
.persona .rl { margin-inline-start: auto; }
.persona .avatar { color: #fff; font-size: 14px; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink-900); color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: var(--sh-3); z-index: 99; opacity: 0; transition: all .2s; display: flex; gap: 10px; align-items: center; font-size: 13.5px; pointer-events: none; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { color: var(--sf-500); }

/* Empty / info card */
.empty { text-align: center; padding: 34px 20px; color: var(--tx-3); }
.empty .eic { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 50%; background: var(--paper-2); display: grid; place-items: center; color: var(--tx-3); }

/* Legend */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--tx-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }

/* Paper documents (receipt / certificate) */
.paper-doc { background: #fffdf8; border: 1px solid var(--line-2); border-radius: 6px; box-shadow: var(--sh-2); position: relative; }

/* Print */
@media print {
  .topbar, .tabbar, .guide, .fbar, .sitefoot, .sjhint, .ph-actions, .no-print, .toast, .drawer, .scrim { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; }
  .card, .kpi, .obj { box-shadow: none; }
}

/* Keep the site footer at the bottom of short pages */
#app { min-height: 100vh; display: flex; flex-direction: column; }
#app > .page { flex: 1 0 auto; width: 100%; }
.ph-ic.pt { background: var(--pt-100); color: var(--pt-700); }

.tb-admin { display: inline-flex; gap: 6px; align-items: center; height: 28px; padding: 0 10px; border-radius: 14px; background: var(--sf-50); color: var(--sf-700); font-size: 12.5px; font-weight: 700; text-decoration: none; margin-inline-start: 4px; }
.tb-admin:hover { background: var(--sf-100); text-decoration: none; }

.ph-ic svg { width: 19px; height: 19px; }

/* Main menu in the top bar */
.tb-nav { display: flex; gap: 2px; margin-inline-start: 18px; }
.tb-nav a { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--tx-1); text-decoration: none; }
.tb-nav a:hover { background: var(--paper); text-decoration: none; }
.tb-nav a.on { background: var(--pt-50); color: var(--pt-700); }
.tb-nav a svg { color: var(--tx-2); } .tb-nav a.on svg { color: var(--pt-700); }
@media (max-width: 1100px) { .tb-nav a span { display: none; } .tb-area { display: none; } }
