/* Tasmee committee portal. Colours and tone follow tasmee.org (deploy/www). */

@font-face {
  font-family: 'Almarai';
  src: url('/fonts/Almarai-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Almarai';
  src: url('/fonts/Almarai-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --green: #0F5132; --green-deep: #0A3D25; --green-mid: #14663f; --green-soft: #E8F0EB;
  --gold: #B88A2E; --gold-light: #D9B45F; --gold-soft: #FBF3E2; --gold-ink: #8A6417;
  --ink: #16211C; --muted: #5C6B63; --paper: #FBFAF7; --card: #FFFFFF; --line: #E3E0D8;
  --danger: #A4262C; --danger-soft: #FBECEC;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(16,33,28,.04), 0 8px 28px rgba(16,33,28,.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: 'Almarai', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  font-size: 16px; line-height: 1.7; -webkit-font-smoothing: antialiased;
}
html[lang="en"] body { line-height: 1.55; }
[hidden] { display: none !important; }
a { color: var(--green); }
h1, h2, h3 { line-height: 1.35; color: var(--green-deep); }
.wrap { width: min(980px, 100% - 1.5rem); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85em; }

/* ---------------------------------------------------------------- header */
header.top {
  background: linear-gradient(160deg, var(--green-deep), var(--green) 60%, var(--green-mid));
  color: #fff; padding: .75rem 0 0; position: sticky; top: 0; z-index: 20;
  box-shadow: 0 2px 10px rgba(10,61,37,.18);
}
.top__bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 48px; }
.brand { color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.1rem; }
.brand img { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.top__right { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.who { color: #fff; text-decoration: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; min-width: 0; }
.who__name { font-weight: 700; font-size: .95rem; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who__role { font-size: .75rem; opacity: .85; }
.langtoggle {
  font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; background: transparent; color: #fff;
  border: 1.5px solid rgba(255,255,255,.45); padding: .4rem .95rem; border-radius: 999px; min-height: 40px; flex: none;
}
.langtoggle:hover { border-color: #fff; }

.nav { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; padding: .5rem 0 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: rgba(255,255,255,.85); text-decoration: none; font-weight: 700; font-size: .95rem; white-space: nowrap;
  padding: .6rem .9rem .7rem; border-radius: 12px 12px 0 0; display: inline-flex; align-items: center; gap: .4rem; min-height: 44px;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a[aria-current="page"] { background: var(--paper); color: var(--green-deep); }
.badge {
  display: inline-grid; place-items: center; min-width: 1.45rem; height: 1.45rem; padding: 0 .4rem;
  border-radius: 999px; background: var(--gold); color: #fff; font-size: .78rem; font-weight: 700; line-height: 1;
}
.badge:empty { display: none; }

/* ------------------------------------------------------------------ main */
main { padding: 1.25rem 0 4rem; }
#page:focus { outline: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin: 0 0 1rem; }
.page-head h1 { margin: 0; font-size: clamp(1.3rem, 4vw, 1.65rem); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.15rem 1.2rem; margin: 0 0 1rem; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 .5rem; font-size: 1.15rem; }
.card h3 { margin: 0 0 .4rem; font-size: 1rem; }
.card.is-target { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft), var(--shadow); }

.notice { border-radius: 12px; padding: .8rem 1rem; margin: 1rem 0 0; background: var(--green-soft); }
.notice--err { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.notice--warn { background: var(--gold-soft); color: var(--gold-ink); }
.notice:empty { display: none; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.loading { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.loading::before {
  content: ''; display: inline-block; width: 1.1rem; height: 1.1rem; margin-inline-end: .5rem; vertical-align: -3px;
  border: 2.5px solid var(--green-soft); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- forms */
.field { margin: 0 0 1rem; }
.label { display: block; font-weight: 700; margin-bottom: .3rem; }
.hint { display: block; font-size: .85rem; color: var(--muted); margin-top: .3rem; }
input[type=text], input[type=tel], input[type=email], select, textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: 12px; padding: .65rem .8rem; min-height: 48px;
}
textarea { min-height: 5.5rem; resize: vertical; }
select { cursor: pointer; }
input[dir=ltr] { text-align: left; }
input:focus, textarea:focus, select:focus { border-color: var(--green); outline: none; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.err { color: var(--danger); font-size: .9rem; font-weight: 700; margin: .6rem 0 0; }
.err:empty { display: none; }

.btn {
  font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; border: 1.5px solid transparent; border-radius: 999px;
  padding: .6rem 1.25rem; min-height: 46px; background: var(--green); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; text-decoration: none; line-height: 1.2;
}
.btn:hover { background: var(--green-mid); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.is-busy { cursor: progress; opacity: .7; }
.btn--ghost { background: transparent; color: var(--green); border-color: var(--line); }
.btn--ghost:hover { background: var(--green-soft); }
.btn--danger { background: var(--danger); }
.btn--danger:hover { background: #8a1f24; }
.btn--danger-ghost { background: transparent; color: var(--danger); border-color: #ECC9CB; }
.btn--danger-ghost:hover { background: var(--danger-soft); }
.btn--warn { background: var(--gold); }
.btn--warn:hover { background: #a37a27; }
.btn--small { min-height: 40px; padding: .4rem .95rem; font-size: .92rem; }
.btn--wide { width: 100%; }
.linkbtn { font: inherit; background: none; border: 0; padding: .5rem 0; color: var(--green); text-decoration: underline; cursor: pointer; min-height: 44px; }
.row { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.row--split { justify-content: space-between; }

.switch { display: flex; align-items: center; gap: .7rem; cursor: pointer; min-height: 44px; font-weight: 700; }
.switch input { appearance: none; -webkit-appearance: none; width: 48px; height: 28px; border-radius: 999px; background: #CFCBC1; position: relative; margin: 0; cursor: pointer; flex: none; transition: background .15s; }
.switch input::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--green); }
.switch input:checked::after { inset-inline-start: 23px; }
.switch input:disabled { opacity: .5; }

/* ------------------------------------------------------------------ login */
.login { max-width: 460px; }
.login__card { margin-top: 1.5rem; padding: 1.5rem 1.3rem; }
.login__card h1 { margin: 0 0 .3rem; font-size: 1.45rem; }
.login__card form .btn { margin-top: 1rem; }
.code-input { font-size: 1.5rem !important; letter-spacing: .35em; text-align: center !important; }

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; margin: 0 0 1rem; padding-bottom: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; white-space: nowrap; text-decoration: none;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px;
  padding: .5rem 1rem; min-height: 44px; display: inline-flex; align-items: center; gap: .45rem;
}
.tab:hover { border-color: var(--green); }
.tab[aria-current="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.tab .count { font-size: .8rem; background: var(--green-soft); color: var(--green); border-radius: 999px; padding: .05rem .5rem; min-width: 1.5rem; text-align: center; }
.tab[aria-current="true"] .count { background: rgba(255,255,255,.2); color: #fff; }

/* ---------------------------------------------------------------- pills */
.pill { font-size: .8rem; font-weight: 700; border-radius: 999px; padding: .15rem .7rem; white-space: nowrap; background: #F3F1EC; color: var(--muted); display: inline-block; }
.pill--approved, .pill--read { background: var(--green-soft); color: var(--green); }
.pill--rejected { background: var(--danger-soft); color: var(--danger); }
.pill--pending, .pill--new { background: var(--gold-soft); color: var(--gold-ink); }
.pill--paused, .pill--archived { background: #ECEEF0; color: #4A5560; }
.pill--owner { background: var(--gold-soft); color: var(--gold-ink); }
.pill--inactive { background: var(--danger-soft); color: var(--danger); }

/* --------------------------------------------------------------- offers */
.item__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.item__title { font-size: 1.2rem; font-weight: 700; color: var(--green-deep); margin: 0; overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .2rem .9rem; margin: .7rem 0; font-size: .95rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.quote { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; margin: .6rem 0; }
.slots { display: grid; gap: .6rem; margin: .8rem 0; }
.slot { border: 1px solid var(--line); border-radius: 14px; padding: .75rem .9rem; }
.slot__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .4rem; margin-bottom: .4rem; }
.slot__name { font-weight: 700; }
.slot audio { width: 100%; height: 44px; display: block; margin: .3rem 0; }
.slot .row { margin-top: .35rem; }
.bar { height: 8px; background: var(--green-soft); border-radius: 999px; overflow: hidden; margin-top: .5rem; }
.bar > span { display: block; height: 100%; width: 0; background: var(--green); transition: width .15s; }
.bar.is-fail > span { background: var(--danger); }
.problems { margin: .6rem 0; padding: .6rem .9rem .6rem; padding-inline-start: 2rem; background: var(--gold-soft); color: var(--gold-ink); border-radius: 12px; font-size: .92rem; }
.decision { font-size: .92rem; color: var(--muted); border-top: 1px solid var(--line); margin-top: .8rem; padding-top: .7rem; }
.actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .9rem; }
.replies { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .7rem; font-size: .92rem; }

/* --------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: start; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 700; font-size: .85rem; white-space: nowrap; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin: 0 0 1rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: .75rem .9rem; }
.stat__label { color: var(--muted); font-size: .85rem; }
.stat__value { font-size: 1.35rem; font-weight: 700; color: var(--green-deep); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- activity */
.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: .7rem 0; border-top: 1px solid var(--line); }
.log li:first-child { border-top: 0; }
.log__line { display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: baseline; }
.log__who { font-weight: 700; }
.log__when { color: var(--muted); font-size: .85rem; margin-inline-start: auto; }
.log__detail { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; margin-top: .15rem; }

/* -------------------------------------------------------------- members */
.member { display: grid; gap: .6rem; }
.member__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; align-items: center; }
.member__name { font-weight: 700; font-size: 1.05rem; }
.member__controls { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; align-items: center; }
.member__controls select { width: auto; min-width: 9rem; }
.member.is-inactive { opacity: .7; }
.form-grid { display: grid; gap: .2rem 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* --------------------------------------------------------------- dialog */
dialog {
  border: 0; border-radius: var(--radius); padding: 1.3rem 1.2rem 1.1rem; width: min(480px, calc(100% - 1.5rem));
  box-shadow: 0 20px 60px rgba(10,61,37,.25); color: var(--ink); background: #fff;
}
dialog::backdrop { background: rgba(10,30,20,.45); }
dialog h2 { margin: 0 0 .4rem; font-size: 1.2rem; }
.dlg__text { margin: 0 0 1rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.dlg__text:empty { display: none; }
.dlg__actions { justify-content: flex-start; }
#dlgInput[hidden], #dlgTextarea[hidden] { display: none; }

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed; inset-inline: 0; bottom: 1.2rem; margin-inline: auto; width: max-content; max-width: calc(100% - 2rem);
  background: var(--green-deep); color: #fff; font-weight: 700; padding: .7rem 1.2rem; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); opacity: 0; transform: translateY(1rem); transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50;
}
.toast.is-on { opacity: 1; transform: none; }
.toast.is-err { background: var(--danger); }

@media (max-width: 560px) {
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dt { margin-top: .35rem; font-size: .85rem; }
  .actions .btn { flex: 1 1 auto; }
  .card { padding: 1rem .95rem 1.05rem; }
  .who__name { max-width: 34vw; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
