/* RWA-EMS shared styles. Brand colours are injected at runtime from the organization profile. */
:root {
  --brand: #1B7F3B; --brand2: #1F5FA8;
  --bg: #F4F6F5; --panel: #FFFFFF; --text: #1C2321; --muted: #5C6763; --line: #DDE3E0;
  --ok: #1B7F3B; --okbg: #E3F3E8; --warn: #8A5A00; --warnbg: #FFF1D6; --bad: #B3261E; --badbg: #FCE4E2;
  --info: #1F5FA8; --infobg: #E3EDFA; --focus: #F2B705;
  --radius: 10px; --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 14px rgba(0,0,0,.04);
  font-family: "Segoe UI", "Nirmala UI", system-ui, -apple-system, "Noto Sans Telugu", sans-serif;
  font-size: 15px; color: var(--text); background: var(--bg);
}
:root[data-theme="dark"] {
  --bg: #121614; --panel: #1C2220; --text: #E7ECEA; --muted: #9AA5A1; --line: #2E3734;
  --okbg: #16321F; --warnbg: #3A2C0B; --badbg: #3D1A17; --infobg: #172A44; --ok: #6FD08E; --warn: #F1C15D; --bad: #F28B82; --info: #8AB4F8;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
a { color: var(--brand2); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; } h2 { font-size: 1.15rem; margin: 0; } h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: .5rem .9rem; border-radius: 8px;
  cursor: pointer; font: inherit; font-weight: 600; min-height: 38px; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.secondary { background: var(--brand2); border-color: var(--brand2); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { padding: .25rem .6rem; min-height: 30px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { background: none; border: none; color: inherit; font-size: 1.1rem; cursor: pointer; padding: .3rem .5rem; border-radius: 6px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: .45rem .6rem; min-height: 38px; width: 100%; }
input[type=checkbox] { width: auto; min-height: auto; transform: scale(1.25); margin: .4rem; }
input.invalid, select.invalid { border-color: var(--bad); box-shadow: 0 0 0 2px var(--badbg); }
.field { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; }
.field > span { font-weight: 600; color: var(--muted); }
.field .help { color: var(--muted); font-size: .78rem; }
.field .pii { color: var(--warn); font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem 1rem; }
.form-grid .span2 { grid-column: span 2; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.card + .card { margin-top: 1rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .8rem; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; box-shadow: var(--shadow);
  border-left: 5px solid var(--brand); }
.metric .v { font-size: 1.7rem; font-weight: 700; } .metric .l { color: var(--muted); font-size: .85rem; }
.metric.warn { border-left-color: var(--warn); } .metric.bad { border-left-color: var(--bad); } .metric.info { border-left-color: var(--brand2); }
.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; border: 1px solid transparent; }
.badge.ok { background: var(--okbg); color: var(--ok); } .badge.warn { background: var(--warnbg); color: var(--warn); }
.badge.bad { background: var(--badbg); color: var(--bad); } .badge.info { background: var(--infobg); color: var(--info); }
.badge.muted { background: var(--line); color: var(--muted); }
.table-wrap { display: flex; flex-direction: column; gap: .5rem; }
.table-search { max-width: 320px; }
.table-scroll { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table.data { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.data th { position: sticky; top: 0; background: var(--panel); border-bottom: 2px solid var(--line); text-align: left; padding: 0; z-index: 1; }
.th-btn { background: none; border: 0; font: inherit; font-weight: 700; color: var(--muted); padding: .55rem .6rem; cursor: pointer; width: 100%; text-align: left; }
table.data td { border-bottom: 1px solid var(--line); padding: .45rem .6rem; vertical-align: top; }
table.data tr.clickable { cursor: pointer; } table.data tr.clickable:hover td { background: var(--infobg); }
table.data td.empty { text-align: center; color: var(--muted); padding: 1.5rem; }
td.actions { white-space: nowrap; } td.actions .btn { margin-right: .3rem; }
.pager { display: flex; gap: .6rem; align-items: center; justify-content: flex-end; color: var(--muted); font-size: .85rem; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.modal { background: var(--panel); border-radius: 12px; width: min(640px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal.wide { width: min(1100px, 100%); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); }
.modal-body { padding: 1rem 1.1rem; overflow: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1.1rem; border-top: 1px solid var(--line); }
#toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 100; }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--info); padding: .7rem 1rem; border-radius: 8px; box-shadow: var(--shadow); max-width: 420px; }
.toast.error { border-left-color: var(--bad); } .toast.success { border-left-color: var(--ok); } .toast.warn { border-left-color: var(--warn); }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button { background: none; border: none; border-bottom: 3px solid transparent; padding: .55rem .9rem; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected=true] { color: var(--text); border-bottom-color: var(--brand); }
/* change history */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 3px solid var(--line); }
.timeline li { margin: 0 0 1rem 1rem; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -1.55rem; top: .35rem; width: .8rem; height: .8rem; border-radius: 50%; background: var(--brand); }
.timeline .meta { color: var(--muted); font-size: .82rem; }
.chg { width: 100%; border-collapse: collapse; margin-top: .35rem; font-size: .86rem; }
.chg td, .chg th { border: 1px solid var(--line); padding: .3rem .45rem; text-align: left; vertical-align: top; }
.chg .old { background: var(--badbg); } .chg .new { background: var(--okbg); }
.kind { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.compare td.changed { background: var(--warnbg); font-weight: 600; }
.statusbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; font-size: .82rem; }
.chip { padding: .15rem .55rem; border-radius: 999px; background: var(--line); color: var(--text); font-weight: 600; }
.chip.ok { background: var(--okbg); color: var(--ok); } .chip.bad { background: var(--badbg); color: var(--bad); } .chip.warn { background: var(--warnbg); color: var(--warn); }
.notice { background: var(--warnbg); color: var(--warn); border-radius: 8px; padding: .6rem .9rem; margin-bottom: 1rem; font-weight: 600; }
.notice.info { background: var(--infobg); color: var(--info); } .notice.bad { background: var(--badbg); color: var(--bad); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal div { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; min-height: 54px; padding: 4px; font-size: .78rem; }
pre.mono { white-space: pre-wrap; font-family: Consolas, monospace; font-size: .82rem; background: var(--bg); padding: .6rem; border-radius: 8px; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand2) 100%); }
.login { width: min(440px, 100%); }
.login .logo { width: 110px; height: 110px; object-fit: contain; display: block; margin: 0 auto .5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media print { nav, header, .no-print, .pager, .table-search { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }
