/* AMANAH AI — shared workspace (client / admin / financial institution) */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body.ws { font-family: var(--font-sans); color: var(--txt); background: var(--bg-alt); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.ws a { color: var(--teal); }
.ws button, .ws input, .ws select, .ws textarea { font: inherit; color: inherit; }
.ws :focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.ws-header { background: var(--bg-dark); color: #fff; padding: 10px 20px; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.ws-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .02em; text-decoration: none; color: #fff !important; }
.ws-brand img { height: 28px; width: auto; }
.ws-role { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.12); }
.ws-sections { display: flex; gap: 4px; flex-wrap: wrap; }
.ws-sections button { background: transparent; border: 1px solid rgba(255,255,255,.2); color: rgba(255,255,255,.8); border-radius: 8px; padding: 5px 12px; cursor: pointer; }
.ws-sections button[aria-current="true"] { background: var(--teal); border-color: var(--teal); color: #fff; }
.ws-user { margin-left: auto; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 13px; color: rgba(255,255,255,.85); }
.ws-user a, .ws-user button { color: #fff !important; background: none; border: 0; cursor: pointer; text-decoration: underline; padding: 0; }
.ws-lang { display: inline-flex; gap: 2px; background: rgba(255,255,255,.1); border-radius: 8px; padding: 2px; }
.ws-lang button { border: 0; background: transparent; color: rgba(255,255,255,.7); font-weight: 700; font-size: 11px; padding: 4px 8px; border-radius: 6px; cursor: pointer; text-decoration: none !important; }
.ws-lang button.active { background: var(--teal); color: #fff; }

.ws-notice { background: var(--gold-pale); border-bottom: 1px solid #EAD9A6; color: var(--gold-d); padding: 8px 20px; font-size: 12.5px; }

/* layout */
.ws-main { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 16px; padding: 16px 20px 40px; max-width: 1400px; margin: 0 auto; }
.ws-main--single { grid-template-columns: 1fr; }
.ws-panel { background: var(--bg-s); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-width: 0; }
.ws-panel h2 { font-size: 16px; margin: 0 0 12px; }
.ws-panel h3 { font-size: 14px; margin: 18px 0 8px; }

/* list */
.ws-filters { display: grid; gap: 8px; margin-bottom: 12px; }
.ws-input, .ws-select, .ws-textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-i); min-width: 0; }
.ws-textarea { min-height: 80px; resize: vertical; }
.ws-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ws-list button { width: 100%; text-align: left; border: 1px solid var(--border-l); background: #fff; border-radius: 10px; padding: 10px 12px; cursor: pointer; display: grid; gap: 4px; }
.ws-list button[aria-current="true"] { border-color: var(--teal); background: var(--teal-pale); }
.ws-list .t { font-weight: 700; }
.ws-list .s { font-size: 12px; color: var(--txt-s); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* tabs */
.ws-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin: -4px 0 14px; }
.ws-tabs button { border: 0; background: none; padding: 8px 12px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--txt-m); font-weight: 600; }
.ws-tabs button[aria-selected="true"] { border-color: var(--teal); color: var(--teal); }
.ws-count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; text-align: center; margin-left: 4px; }

/* badges */
.ws-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--bg-h); color: var(--txt-m); white-space: nowrap; }
.ws-badge--ok { background: var(--green-pale); color: #1E7B45; }
.ws-badge--warn { background: var(--gold-pale); color: var(--gold-d); }
.ws-badge--bad { background: var(--red-pale); color: var(--red); }
.ws-badge--info { background: var(--blue-pale); color: #1D4ED8; }

/* data */
.ws-dl { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 6px 14px; margin: 0; }
.ws-dl dt { color: var(--txt-s); font-size: 12.5px; }
.ws-dl dd { margin: 0; min-width: 0; }
.ws-table-wrap { overflow-x: auto; position: relative; } /* contains .sr-only cells so they cannot widen the page */
.ws-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ws-table th, .ws-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border-l); vertical-align: top; }
.ws-table th { font-size: 12px; color: var(--txt-s); font-weight: 600; white-space: nowrap; }
.ws-nowrap { white-space: nowrap; }
.ws-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-width: 0; }
.ws-row > .ws-select { max-width: 100%; min-width: 0; }
.ws-table .ws-btn--sm { white-space: nowrap; }
.ws-stack { display: grid; gap: 8px; }
.ws-stack > * { min-width: 0; }
.ws-muted { color: var(--txt-s); font-size: 12.5px; }
.ws-empty { padding: 28px 12px; text-align: center; color: var(--txt-s); }
.ws-callout { border-left: 3px solid var(--gold); background: var(--gold-pale); padding: 10px 12px; border-radius: 6px; font-size: 13px; color: var(--txt-m); }
.ws-callout--info { border-color: var(--blue); background: var(--blue-pale); }

/* buttons */
.ws-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--teal); background: var(--teal); color: #fff !important; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; text-decoration: none; max-width: 100%; }
.ws-btn:disabled { opacity: .55; cursor: not-allowed; }
.ws-btn--ghost { background: #fff; color: var(--teal) !important; }
.ws-btn--danger { background: #fff; color: var(--red) !important; border-color: var(--red); }
.ws-btn--sm { padding: 4px 10px; font-size: 12.5px; }

/* score */
.ws-score { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.ws-score__num { font-size: 40px; font-weight: 800; line-height: 1; }
.ws-bar { height: 8px; border-radius: 4px; background: var(--bg-h); overflow: hidden; min-width: 60px; }
.ws-bar > span { display: block; height: 100%; background: var(--teal); }

/* messages */
.ws-threads { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.ws-threads button { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.ws-threads button[aria-current="true"] { border-color: var(--teal); background: var(--teal-pale); color: var(--teal); font-weight: 700; }
.ws-messages { display: grid; gap: 10px; max-height: 480px; overflow-y: auto; padding: 4px; margin-bottom: 12px; }
.ws-msg { border: 1px solid var(--border-l); border-radius: 10px; padding: 10px 12px; background: #fff; max-width: 92%; }
.ws-msg--own { justify-self: end; background: var(--teal-pale); border-color: #CBE7E0; }
.ws-msg--request { border-color: var(--gold); }
.ws-msg__meta { font-size: 11.5px; color: var(--txt-s); display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.ws-msg__body { white-space: pre-wrap; }
.ws-msg__deleted { font-style: italic; color: var(--txt-s); }
.ws-msg--system { justify-self: center; max-width: 100%; background: #F6F7F9; border-style: dashed; font-size: 13px; }
.ws-msg--system .ws-msg__meta i { color: var(--teal); }
.ws-msg__quote { border-left: 3px solid var(--border); padding: 2px 8px; margin: 4px 0; color: var(--txt-m); white-space: pre-wrap; }
.ws-callout--warn { border-color: var(--red); background: #FDF2F2; }
.ws-link { background: none; border: 0; padding: 0; color: var(--teal); text-decoration: underline; cursor: pointer; font: inherit; }

/* document exchange with an institution (v30) */
.ws-exchange h3 { margin-top: 22px; }
.ws-exchange h4 { margin: 0 0 6px; font-size: 14px; }
.ws-ex-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
.ws-ex-grid input[type=file] { max-width: 100%; font-size: 12.5px; }
.ws-ex-form { border: 1px solid var(--border-l); border-radius: 10px; padding: 12px; margin: 10px 0; background: #FBFCFC; }
.ws-ex-reqs { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 10px; }
.ws-ex-req { border: 1px solid var(--border-l); border-left: 4px solid var(--gold); border-radius: 10px; padding: 10px 12px; background: #fff; overflow-wrap: anywhere; }
.ws-ex-req--submitted { border-left-color: var(--blue); }
.ws-ex-req--accepted { border-left-color: var(--teal); }
.ws-ex-req--returned { border-left-color: var(--red); }
.ws-ex-req--cancelled { border-left-color: var(--border); opacity: .75; }
.ws-ex-req .ws-ex-form { margin-bottom: 0; }
.ws-ex-note { margin: 6px 0; white-space: pre-wrap; }
.ws-ex-answer { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border-l); }

/* inbox (company cabinet and institution cabinet) */
.ws-inbox__list, .fi-inbox__list { list-style: none; margin: 0; padding: 0; }
.ws-inbox__list li, .fi-inbox__list li { display: flex; gap: 12px; align-items: center; border-top: 1px solid var(--border-l); padding: 10px 4px; }
.ws-inbox__list li:first-child, .fi-inbox__list li:first-child { border-top: 0; }
.ws-inbox__open, .fi-inbox__open { flex: 1; min-width: 0; display: grid; gap: 2px; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; color: inherit; text-decoration: none; font: inherit; }
.ws-inbox__top, .fi-inbox__top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ws-inbox__preview, .fi-inbox__preview { color: var(--txt-m); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-inbox__who, .fi-inbox__who { color: var(--txt-s); }
.ws-inbox__side, .fi-inbox__side { display: flex; gap: 8px; align-items: center; flex: none; }
.ws-inbox__item--unread strong, .fi-inbox__item--unread strong { color: var(--teal); }
@media (max-width: 600px) {
  .ws-inbox__list li, .fi-inbox__list li { flex-wrap: wrap; }
  .ws-inbox__side, .fi-inbox__side { width: 100%; justify-content: flex-end; }
}

/* modal */
.ws-modal { position: fixed; inset: 0; background: rgba(13,17,23,.55); display: flex; align-items: flex-start; justify-content: center; padding: 24px 12px; overflow-y: auto; z-index: 50; }
.ws-modal__box { background: #fff; border-radius: 14px; width: min(640px, 100%); padding: 20px; }
.ws-modal__box h2 { margin-top: 0; font-size: 18px; }
.ws-check { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; }
.ws-check input { margin-top: 3px; flex: none; }

.ws-toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--bg-dark); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60; max-width: calc(100% - 24px); }
.ws-toast--error { background: var(--red); }

/* auth */
.ws-auth { max-width: 420px; margin: 48px auto; }
.ws-field { display: grid; gap: 4px; margin-bottom: 12px; }
.ws-field label { font-size: 12.5px; font-weight: 600; color: var(--txt-m); }
.ws-error { color: var(--red); font-size: 13px; min-height: 1em; }

/* document analysis */
.ws-doclist { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; font-size: 12.5px; overflow-wrap: anywhere; }
.ws-doclist li { padding: 4px 0; border-top: 1px dashed var(--border-l); }
.ws-doclist li:first-child { border-top: 0; }
.ws-hint { color: #92650A; font-size: 12px; margin-top: 2px; }
.ws-pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; background: #F6F7F9; border: 1px solid var(--border-l); border-radius: 8px; padding: 10px; font-size: 12px; line-height: 1.45; }
.ws-checklist td:first-child { min-width: 160px; }
.ws-checklist input[type=file] { max-width: 100%; font-size: 12px; }
.ws-table details summary { cursor: pointer; font-size: 12.5px; color: var(--teal); }

@media (max-width: 860px) {
  .ws-main { grid-template-columns: 1fr; padding: 12px; }
  .ws-header { padding: 10px 12px; }
  .ws-user { margin-left: 0; width: 100%; }
  .ws-dl { grid-template-columns: 1fr; gap: 2px; }
  .ws-dl dd { margin-bottom: 8px; }
  .ws-msg { max-width: 100%; }
  .ws-checklist td:first-child { min-width: 0; }
}

@media (max-width: 640px) {
  .ws-checklist tr { display: grid; grid-template-columns: 1fr auto; align-items: center; border-bottom: 1px solid var(--border-l); }
  .ws-checklist td { border-bottom: 0; }
  .ws-checklist td:first-child { grid-column: 1 / -1; padding-bottom: 2px; }
}

/* AMANAH form */
.ws-num { text-align: right !important; }
.ws-form-table td, .ws-form-table th { white-space: nowrap; }
.ws-form-table td:first-child { white-space: normal; min-width: 220px; }
.ws-form-table td:last-child { white-space: normal; min-width: 180px; font-size: 12px; }
.ws-form-total td { font-weight: 700; background: var(--bg-alt); }

/* v25: action plan, what-if hint, document audit, AI memo, readiness dashboard */
.ws-plan-item { margin-bottom: 10px; }
.ws-plan-item__title { font-weight: 600; margin: 6px 0 2px; overflow-wrap: anywhere; }
.ws-plan-item__edit { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 8px 12px; align-items: center; margin-top: 10px; }
.ws-plan-item__edit > div { grid-column: 2; }
@media (max-width: 640px) { .ws-plan-item__edit { grid-template-columns: minmax(0, 1fr); } .ws-plan-item__edit > div { grid-column: 1; } }
.ws-plan-item__edit input[type="file"] { max-width: 100%; }
.ws-sim { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.ws-sim input[type="range"] { width: 100%; margin: 10px 0 4px; accent-color: var(--teal); }
.ws-memo { padding-left: 20px; }
.ws-memo li { margin-bottom: 6px; }
.ws-audit td { vertical-align: top; }
.ws-dash { margin-bottom: 16px; }
.ws-dash-todo { padding-left: 18px; margin: 0 0 12px; }
.ws-dash-todo li { margin-bottom: 8px; }
.ws-plan-item__bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.ws-plan-item__bar .ws-select { width: auto; min-width: 150px; }
.ws-plan-item__more summary { cursor: pointer; font-size: 13px; color: var(--txt-m); margin-top: 8px; }
.ws-dash-list { margin-bottom: 16px; }
.ws-dash-list tr.is-current td { background: var(--teal-bg, rgba(14, 124, 102, .08)); }
.ws-delta { display: inline-block; font-weight: 700; font-size: 12px; border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
.ws-delta--up { color: var(--teal-d, #0A5C4E); background: var(--teal-pale, #E8F5F2); }
.ws-delta--down { color: #9B1C1C; background: #FDECEC; }
.ws-delta--flat { color: var(--txt-m); background: var(--bg-h); }
.ws-dyn { margin-bottom: 18px; }
.ws-dyn__line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 12px; }
.ws-dyn__step strong { font-size: 24px; }
.ws-dyn__arrow { font-size: 20px; color: var(--txt-m); }
.ws-dash-was { margin-top: 4px; font-size: 13px; color: var(--txt-m); }
.ws-fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px 6px; margin: 4px 0; }
.ws-fieldset legend { font-size: 13px; font-weight: 600; padding: 0 6px; }
.ws-small { font-size: 12.5px; margin: 2px 0 6px; }

/* decision of an institution (v31) */
.ws-dc { border: 1px solid var(--border-l); border-left: 4px solid var(--teal); border-radius: 10px; padding: 10px 12px; margin: 10px 0; background: #fff; overflow-wrap: anywhere; }
.ws-dc--approved_with_conditions { border-left-color: var(--gold); }
.ws-dc--declined { border-left-color: var(--red); }
.ws-dc-conds { margin: 6px 0; padding-left: 20px; }
.ws-dc-internal { background: #F6F7F9; border-radius: 8px; padding: 6px 10px; margin: 6px 0; }
.ws-decision details summary { cursor: pointer; color: var(--teal); font-size: 13px; margin: 6px 0; }
