/* Employment Tribunal – shared design tokens and components for the Portal and the CMS (PICAD Pvt Ltd).
   "Lagoon": a light, rounded, card-based service look (see docs/ui-research.md). Cool mist background, white cards,
   teal primary with a coral accent. Fonts: Figtree for English; Dhivehi strictly MV Waheed (headings, bold text)
   and Faruma (body), served from /shared/fonts.
   RTL-first: logical properties throughout. */
/* Both cover Thaana and Arabic only, so English words and numbers inside Dhivehi text fall through to Figtree. */
@font-face { font-family: "MV Waheed"; src: url("/shared/fonts/mv-waheed.otf") format("opentype"); font-display: swap; unicode-range: U+0780-07BF, U+0600-06FF, U+FDF2, U+FDFD; }
@font-face { font-family: "Faruma"; src: url("/shared/fonts/faruma.ttf") format("truetype"); font-display: swap; unicode-range: U+0780-07BF, U+0600-06FF, U+FDF2, U+FDFD; }

:root {
  /* Lagoon palette */
  --bg: #f3f7f7; --surface: #fff; --tint: #e4f2f0; --tint-2: #eef5f5;
  --text: #0e2a2f; --text-2: #2c454a; --muted: #5a6e73; --border: #d3e1e2; --border-strong: #a9c1c3;
  --primary: #0e8277; --primary-dark: #0a5c55; --primary-deep: #073f3a;
  --accent: #ff7a59; --accent-text: #b8452b; --accent-soft: #fff0eb;
  --success: #1e8e4f; --warn: #b7791f; --danger: #c2362f; --info: #2563eb; --violet: #6b4fbb;
  --r-xs: 6px; --r-sm: 10px; --r-md: 16px; --r-lg: 24px; --pill: 999px;
  --sh-sm: 0 1px 2px rgba(14, 42, 47, .06);
  --sh-md: 0 4px 12px -2px rgba(14, 42, 47, .08), 0 2px 4px rgba(14, 42, 47, .04);
  --sh-lg: 0 16px 32px -8px rgba(14, 42, 47, .14);
  /* Aliases kept so page code can stay token-based */
  --paper: var(--bg); --paper-2: var(--tint-2); --white: #fff; --ink: var(--text); --ink-2: var(--text-2); --line: var(--border); --line-dark: #24444a;
  --brand: var(--primary); --brand-2: var(--primary); --brand-soft: var(--tint); --gold: var(--accent);
  --blue: var(--info); --amber: var(--warn); --teal: var(--primary); --green: var(--success); --grey: #6b7c80; --red: var(--danger);
  /* Type */
  --font: "Faruma", "Figtree", system-ui, sans-serif;
  --display: "MV Waheed", "Figtree", system-ui, sans-serif;
  --serif: var(--display);
  --mono: "Figtree", "Faruma", system-ui, sans-serif;
  --fs: 16px; --lh: 1.9;
}
html[lang="en"] { --font: "Figtree", "Faruma", system-ui, sans-serif; --display: "Figtree", "MV Waheed", system-ui, sans-serif; --lh: 1.6; }
/* MV Waheed and Faruma have one weight each: never fake a bold or italic for Thaana (Figtree keeps its real bolds). */
html[lang="dv"] { font-synthesis: none; }
/* Dhivehi headings and bold text set in MV Waheed; running text in Faruma. */
html[lang="dv"] :is(b, strong, dt, th, label, .btn, .link, .eyebrow, .tag, .pill, .chip, .role, .tabs .on, .cms-h, .efaas) { font-family: var(--display); }
html[lang="dv"] :is(h1, h2, h3, h4) { line-height: 1.7; }
html.big { --fs: 18px; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body { margin: 0; font: 400 var(--fs)/var(--lh) var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 700; line-height: 1.5; color: var(--text); }
html[lang="en"] :is(h1, h2, h3, h4) { line-height: 1.2; letter-spacing: -.02em; }
p { margin: 0 0 12px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.num, .ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: .01em; direction: ltr; unicode-bidi: isolate; }
/* Numbers and codes read left to right, but when one is laid out as a block (table cell, grid or flex child) it must
   still sit on the reading side of a Dhivehi page. */
html[dir="rtl"] :is(.num, .ltr, .mono) { text-align: right; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
/* Hidden above the page rather than off to the side, so it never causes horizontal scroll in RTL. */
.skip { position: absolute; inset-inline-start: 8px; top: -80px; background: var(--primary-dark); color: #fff; padding: 8px 14px; z-index: 100; border-radius: var(--r-sm); }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.flip { display: inline-block; }
html[dir="rtl"] .flip { transform: scaleX(-1); }
.flip-back { display: inline-block; transform: scaleX(-1); }
html[dir="rtl"] .flip-back { transform: none; }

/* prototype ribbon */
.ribbon { background: var(--primary-deep); color: #cfe7e3; font-size: 12.5px; }
.ribbon .wrap { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding-block: 6px; }
.ribbon b { color: #fff; }
.ribbon a { color: #ffd2c4 !important; }

.eyebrow { display: inline-block; font-size: 13px; font-weight: 700; color: var(--primary); letter-spacing: .02em; }
.eyebrow.light { color: #bfe9e2; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 1px solid var(--primary); background: var(--primary); color: #fff !important; padding: 9px 20px; font-weight: 700; font-size: 15px; line-height: 1.3; border-radius: var(--r-sm); cursor: pointer; white-space: nowrap; box-shadow: var(--sh-sm); transition: background .15s, box-shadow .15s, transform .15s; }
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: var(--sh-md); }
.btn:active { transform: translateY(1px); }
.btn.brand { background: var(--primary); }
.btn.ghost { background: var(--surface); color: var(--primary-dark) !important; border-color: var(--border-strong); box-shadow: none; }
.btn.ghost:hover { border-color: var(--primary); background: var(--tint); }
.btn.light { background: #fff; border-color: #fff; color: var(--primary-dark) !important; }
.btn.gold { background: var(--accent); border-color: var(--accent); color: #2b0e05 !important; }
.btn.gold:hover { background: #ff6640; border-color: #ff6640; }
.btn.sm { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.link { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; font-size: 14.5px; color: var(--primary) !important; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.link:hover { color: var(--primary-dark) !important; text-decoration-thickness: 2px; }

/* pills / status badges */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; line-height: 1.7; padding: 1px 10px; border-radius: var(--pill); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.t-blue { color: #1d4fbf; background: #e7efff; } .t-amber { color: #8a5a10; background: #fdf3df; } .t-violet { color: #5a3fa8; background: #efeafb; }
.t-teal { color: var(--primary-dark); background: var(--tint); } .t-green { color: #17703e; background: #e2f4e9; } .t-grey { color: #46585c; background: #e9eeef; }
.t-red { color: #a82b25; background: #fde9e7; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-sm); }
.pad { padding: 22px 24px; }
.grid { display: grid; gap: 18px; }
.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)); }

/* tables */
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-sm); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: start; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 12px 16px; background: var(--tint-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #f8fbfb; }
.tbl tr[data-href] { cursor: pointer; }
.tbl .sub { display: block; color: var(--muted); font-size: 12.5px; }

/* forms */
.form { display: grid; gap: 18px; }
.form .row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form label, .lbl { display: block; font-weight: 700; font-size: 14.5px; margin-bottom: 6px; }
.form .hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.req { color: var(--danger); }
.form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .form select, .form textarea, .field { width: 100%; border: 1px solid var(--border-strong); background: #fff; padding: 10px 14px; font-size: 15px; border-radius: var(--r-sm); min-height: 44px; }
.form textarea { min-height: 120px; resize: vertical; }
.form :is(input, select, textarea):focus, .field:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(14, 130, 119, .18); }
.form input[readonly] { background: var(--tint-2); color: var(--text-2); }
.form .bad :is(input, select, textarea) { border-color: var(--danger); }
.form .err { color: var(--danger); font-size: 13px; font-weight: 600; margin-top: 6px; }
.choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.choice { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); background: #fff; padding: 14px 16px; cursor: pointer; border-radius: var(--r-sm); transition: border-color .15s, box-shadow .15s; }
.choice:hover { border-color: var(--border-strong); }
.choice:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14, 130, 119, .15); background: #f7fcfb; }
.choice input { margin-top: 5px; accent-color: var(--primary); width: 18px; height: 18px; }
.choice b { display: block; font-size: 15px; }
.choice small { color: var(--muted); font-size: 13px; line-height: 1.5; display: block; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .field { width: auto; min-width: 150px; font-size: 14px; }
.toolbar .field.grow { flex: 1; min-width: 220px; }

/* tabs (pill style), stepper */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px; background: var(--tint-2); border: 1px solid var(--border); border-radius: var(--pill); width: max-content; max-width: 100%; }
.tabs button, .tabs a { border: 0; background: none; padding: 7px 16px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-2); border-radius: var(--pill); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { background: #fff; color: var(--text); }
.tabs .on { background: #fff; color: var(--primary-dark); box-shadow: var(--sh-md); }
.tabs em { font-size: 11px; font-style: normal; font-weight: 700; background: var(--tint); color: var(--primary-dark); padding: 0 7px; border-radius: 9px; }
.stepper { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin-bottom: 22px; counter-reset: st; }
.stepper .s { position: relative; text-align: center; font-size: 13px; color: var(--muted); padding-top: 40px; }
.stepper .s::before { content: ""; position: absolute; top: 15px; inset-inline: 0; height: 3px; background: var(--border); }
.stepper .s:first-child::before { inset-inline-start: 50%; } .stepper .s:last-child::before { inset-inline-end: 50%; }
.stepper .s b { position: absolute; top: 0; inset-inline-start: calc(50% - 16px); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--border); font-size: 12px; color: var(--muted); z-index: 1; }
.stepper .s.done { color: var(--text-2); } .stepper .s.done::before { background: var(--primary); }
.stepper .s.done b { background: var(--primary); border-color: var(--primary); color: #fff; }
.stepper .s.on { color: var(--text); font-weight: 700; } .stepper .s.on b { border-color: var(--primary); color: var(--primary-dark); box-shadow: 0 0 0 5px rgba(14, 130, 119, .18); }

/* vertical timeline */
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { position: relative; padding: 0 0 18px; padding-inline-start: 28px; }
.steps li::after { content: ""; position: absolute; inset-inline-start: 7px; top: 22px; bottom: 0; width: 2px; background: var(--border); }
.steps li:last-child::after { display: none; }
.steps li::before { content: ""; position: absolute; inset-inline-start: 0; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--border-strong); }
.steps li.done::before { background: var(--primary); border-color: var(--primary); }
.steps li.done::after { background: var(--primary); }
.steps li.now::before { background: #fff; border: 5px solid var(--accent); }
.steps b { display: block; font-size: 15px; }
.steps span { color: var(--muted); font-size: 13.5px; }

/* notes */
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-sm); background: #ecf3ff; color: #18325f; font-size: 14px; border: 1px solid #cfdcf7; }
.note.warn { background: #fdf5e6; border-color: #f1dcae; color: #5b3d06; }
.note.bad { background: #fdeceb; border-color: #f4c7c3; color: #6e1a15; }
.note.ok { background: #e6f5ec; border-color: #bfe3cd; color: #134a2b; }
.note svg { flex: none; margin-top: 3px; }
.note p { margin: 0; }

/* modal + toast */
.modal-bg { position: fixed; inset: 0; background: rgba(7, 32, 36, .5); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 90; }
.modal { background: var(--surface); border-radius: var(--r-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; box-shadow: 0 30px 80px rgba(7, 32, 36, .35); }
.modal.wide { max-width: 860px; }
.modal-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--border); background: #fff; position: sticky; top: 0; z-index: 1; }
.modal-h h2 { font-size: 20px; }
.modal-b { padding: 22px 24px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--tint-2); flex-wrap: wrap; }
.x-btn { width: 36px; height: 36px; border: 1px solid var(--border); background: #fff; cursor: pointer; display: grid; place-items: center; border-radius: 50%; }
.x-btn:hover { background: var(--tint); }
.toast { position: fixed; inset-inline-start: 50%; bottom: 24px; transform: translateX(-50%); background: var(--primary-deep); color: #fff; padding: 12px 20px; z-index: 99; display: flex; gap: 10px; align-items: center; box-shadow: var(--sh-lg); font-size: 14px; max-width: calc(100vw - 32px); border-radius: var(--pill); }
html[dir="rtl"] .toast { transform: translateX(50%); }
.toast svg { color: #7fe0cf; }

/* eFaas button (brand shape stays round) */
.efaas { display: inline-flex; align-items: center; gap: 10px; border: 0; background: #23262b; color: #fff; border-radius: 999px; padding: 10px 22px 10px 14px; cursor: pointer; font-weight: 700; font-size: 15px; min-height: 44px; }
html[dir="rtl"] .efaas { padding: 10px 14px 10px 22px; }
.efaas:hover { background: #000; }
.efaas.big { padding-block: 14px; font-size: 16px; }

/* misc */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 14.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.doc { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.doc:last-child { border-bottom: 0; }
.doc .ft { flex: none; width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--tint); color: var(--primary-dark); display: grid; place-items: center; font-size: 10px; font-weight: 800; }
.doc .meta { flex: 1; min-width: 0; }
.doc .meta b { display: block; font-size: 14.5px; }
.doc .meta small { color: var(--muted); font-size: 12.5px; }
.seal { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; color: var(--primary-dark); background: var(--tint); padding: 2px 9px; border-radius: var(--pill); white-space: nowrap; }
.empty { color: var(--muted); padding: 28px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--r-md); text-align: center; }
.ic-well { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--tint); color: var(--primary-dark); flex: none; }
.ic-well.coral { background: var(--accent-soft); color: var(--accent-text); }

@media (max-width: 900px) {
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form .row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .stepper .s span { display: none; }
}
input[type="file"] { max-width: 100%; }
@media (max-width: 600px) {
  .doc { flex-wrap: wrap; }
  .doc .meta { flex-basis: calc(100% - 52px); }
}
