/* RMS Synergy Policy Handbook — brand: Orange #EF7900 (Pantone 716C), Cool Gray #797979 (Cool Gray 9C), Causten */
@font-face { font-family: "Causten"; src: url("../fonts/Causten-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Causten"; src: url("../fonts/Causten-Medium.otf") format("opentype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Causten"; src: url("../fonts/Causten-SemiBold.otf") format("opentype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Causten"; src: url("../fonts/Causten-Bold.otf") format("opentype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Causten"; src: url("../fonts/Causten-ExtraBold.otf") format("opentype"); font-weight: 800; font-display: swap; }

:root {
  --orange: #EF7900;
  --orange-600: #B35A00;   /* text/buttons: AA contrast 4.8:1 on white */
  --orange-700: #9A4D00;
  --orange-50: #FEF4EA;
  --orange-100: #FDE6CF;
  --gray: #797979;          /* brand gray: graphics only */
  --ink: #2B2B2B;
  --ink-2: #4A4A4A;
  --muted: #666666;         /* 5.7:1 on white */
  --line: #E7E5E2;
  --bg: #F6F5F3;
  --card: #FFFFFF;
  --ok: #17704A;
  --ok-bg: #E6F4EC;
  --warn: #8F4700;
  --warn-bg: #FFF1E0;
  --err: #C0392B;
  --err-bg: #FDECEA;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(30, 20, 10, .04), 0 4px 16px rgba(30, 20, 10, .05);
  --font: "Causten", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--bg); display: flex; flex-direction: column; min-height: 100vh; }
a { color: inherit; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; }
code { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 700; color: var(--orange-600); margin: 0 0 .5rem; display: inline-flex; align-items: center; gap: 6px; }
.lead { font-size: 1.1rem; color: var(--ink-2); }
:focus-visible { outline: 3px solid rgba(239, 121, 0, .45); outline-offset: 2px; border-radius: 4px; }

/* ---------- Top bar ---------- */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.topbar::after { content: ""; display: block; height: 3px; background: linear-gradient(90deg, var(--orange) 0%, var(--orange) 55%, var(--gray) 100%); }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand img { height: 34px; width: auto; display: block; }
.brand-sub { border-left: 1px solid var(--line); padding-left: 14px; font-weight: 600; color: var(--muted); font-size: .95rem; white-space: nowrap; }
.mainnav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.mainnav > a { text-decoration: none; font-weight: 600; color: var(--ink-2); padding: 8px 14px; border-radius: 999px; font-size: .95rem; }
.mainnav > a:hover { background: var(--bg); }
.mainnav > a.on { color: var(--orange-600); background: var(--orange-50); }
.mainnav > a.nav-admin { border: 1px solid var(--line); }
.mainnav > a.nav-admin.on { border-color: var(--orange-100); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; padding: 8px; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 5px 0; border-radius: 2px; }

.usermenu { position: relative; margin-left: 8px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--orange); background: var(--orange-50); color: var(--orange-600); font-weight: 800; font-family: inherit; font-size: 1rem; cursor: pointer; }
.usermenu-pop { display: none; position: absolute; right: 0; top: 48px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.12); min-width: 240px; padding: 8px; }
.usermenu.open .usermenu-pop { display: block; }
.um-name { font-weight: 700; padding: 6px 10px 0; }
.um-mail { color: var(--muted); font-size: .85rem; padding: 0 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; word-break: break-all; }
.usermenu-pop a, .usermenu-pop button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; text-decoration: none; background: none; border: 0; font: inherit; color: var(--ink); cursor: pointer; }
.usermenu-pop a:hover, .usermenu-pop button:hover { background: var(--bg); }

/* ---------- Layout ---------- */
.page { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 24px 56px; }
.narrow { max-width: 640px; margin: 0 auto; }
.page-title { font-size: 1.8rem; }
.section { margin-top: 36px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; display: flex; align-items: center; gap: 10px; }
.count { background: var(--orange-600); color: #fff; font-size: .8rem; border-radius: 999px; padding: 2px 9px; }
.link { color: var(--orange-600); font-weight: 600; text-decoration: none; background: none; border: 0; padding: 0; font: inherit; font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--err); }
.link.accent { color: var(--ok); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 20px; }
.empty { background: #fff; border: 1px dashed #d8d4cf; border-radius: var(--radius); padding: 36px; text-align: center; color: var(--muted); }

/* ---------- Flash ---------- */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; border: 1px solid transparent; }
.flash-success { background: var(--ok-bg); color: var(--ok); border-color: #c6e6d4; }
.flash-error { background: var(--err-bg); color: var(--err); border-color: #f5c9c3; }
.flash-warning { background: var(--warn-bg); color: var(--warn); border-color: #fbd9b1; }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: background .15s, transform .05s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--orange-600); color: #fff; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.btn-primary:hover { background: var(--orange-700); }
.btn-sm { padding: 6px 12px; font-size: .88rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.danger-btn { color: var(--err); }
.danger-btn:hover { border-color: var(--err); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--gray); }
.btn-block { width: 100%; }
.form label { display: block; font-weight: 600; font-size: .9rem; color: var(--ink-2); margin-bottom: 14px; }
.field-label { font-weight: 600; font-size: .9rem; color: var(--ink-2); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-weight: 400; color: var(--ink); background: #fff;
  border: 1px solid #D9D5D0; border-radius: 10px; padding: 10px 12px; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(239, 121, 0, .15); }
textarea { resize: vertical; }
.input-lg { font-size: 1.15rem !important; font-weight: 600 !important; }
.check { display: flex !important; gap: 10px; align-items: flex-start; font-weight: 500 !important; cursor: pointer; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--orange); flex: none; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.form-actions.col { flex-direction: column; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inline { display: inline; }
.icon-btn { background: #fff; border: 1px solid var(--line); border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font: inherit; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.filters select, .filters input { width: auto; min-width: 200px; margin: 0; }
.icon-pick { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.icon-pick legend { font-weight: 600; font-size: .9rem; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.icon-pick label { margin: 0 !important; }
.icon-pick input { position: absolute; opacity: 0; pointer-events: none; }
.icon-pick span { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; color: var(--gray); cursor: pointer; }
.icon-pick input:checked + span { border-color: var(--orange); color: var(--orange); background: var(--orange-50); }
.icon-pick input:focus-visible + span { outline: 3px solid rgba(239, 121, 0, .45); }

/* ---------- Tags & badges ---------- */
.tag { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .03em; padding: 2px 8px; border-radius: 6px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); vertical-align: middle; }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-muted { background: #EEECE9; color: var(--muted); }
.badge-accent { background: var(--orange-50); color: var(--orange-600); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table a { text-decoration: none; font-weight: 600; }
.table a:hover { color: var(--orange-600); }
.table .actions { text-align: right; }
.table .actions > * { margin-left: 12px; }
.row-on td { background: var(--orange-50); }
.row-muted td { opacity: .55; }
.cell-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bar { height: 8px; background: #EEECE9; border-radius: 99px; overflow: hidden; margin-bottom: 4px; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), #F59B3D); border-radius: 99px; }

/* ---------- Auth ---------- */
.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100vh - 160px); border-radius: 20px; overflow: hidden; background: #fff; box-shadow: var(--shadow); border: 1px solid var(--line); }
.auth-side { position: relative; overflow: hidden; background: linear-gradient(150deg, #4B4B4B 0%, #2E2E2E 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: flex-end; }
.auth-side h1 { color: #fff; font-size: 2.6rem; position: relative; z-index: 1; }
.auth-side p { color: #E6E6E6; max-width: 380px; position: relative; z-index: 1; font-size: 1.1rem; }
.auth-logo { position: absolute; top: 44px; left: 48px; height: 40px; width: auto; z-index: 1; }
.auth-ring { position: absolute; right: -140px; top: -120px; width: 460px; height: 460px; border-radius: 50%; border: 56px solid transparent; background: linear-gradient(160deg, var(--gray), var(--orange)) border-box; -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: .9; }
.auth-main { display: grid; place-items: center; padding: 40px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 1.6rem; }
.auth-card label { display: block; font-weight: 600; font-size: .9rem; color: var(--ink-2); margin-bottom: 14px; }
.auth-card .btn { margin: 6px 0 14px; padding: 12px; }

/* ---------- Home hero ---------- */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 36px 40px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: linear-gradient(180deg, var(--orange), var(--gray)); }
.hero h1 { font-size: 2.4rem; margin-bottom: .25em; }
.hero .lead { margin-bottom: 20px; max-width: 620px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 6px 6px 6px 14px; max-width: 640px; color: var(--muted); }
.search input { border: 0; background: transparent; margin: 0; padding: 8px 4px; box-shadow: none !important; }
.hero-stat { display: flex; align-items: center; gap: 18px; padding: 18px 22px; background: var(--bg); border-radius: 16px; }
.hero-stat strong { display: block; font-size: 1.5rem; }
.ring { --p: 0; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--orange) calc(var(--p) * 1%), #E3E0DC 0); position: relative; flex: none; }
.ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--bg); }
.ring span { position: relative; font-weight: 800; font-size: 1.1rem; }

/* ---------- Category cards ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.cat-card { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px; text-decoration: none; box-shadow: var(--shadow); transition: transform .15s, border-color .15s, box-shadow .15s; }
.cat-card:hover { transform: translateY(-2px); border-color: var(--orange); box-shadow: 0 10px 28px rgba(239, 121, 0, .12); }
.cat-card h3 { margin: 14px 0 6px; font-size: 1.15rem; }
.cat-card p { color: var(--muted); font-size: .92rem; flex: 1; margin-bottom: 14px; }
.cat-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--orange-50); color: var(--orange); flex: none; }
.cat-icon.lg { width: 64px; height: 64px; border-radius: 18px; }
.cat-icon.sm { width: 28px; height: 28px; border-radius: 8px; }
.cat-code { position: absolute; top: 22px; right: 22px; font-size: .72rem; font-weight: 800; letter-spacing: .12em; color: var(--muted); }
.cat-header .cat-code { position: static; display: inline-block; margin-bottom: 4px; }
.cat-n { font-weight: 700; font-size: .85rem; color: var(--orange-600); }

/* ---------- Pending ---------- */
.pending-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.pending { display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--orange); border-radius: 12px; padding: 14px 16px; text-decoration: none; }
.pending:hover { background: var(--orange-50); }
.pending .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px var(--orange-100); flex: none; }
.pending-body { flex: 1; display: flex; flex-direction: column; }
.chev { font-size: 1.4rem; color: var(--gray); }

/* ---------- Search results ---------- */
.result-list { display: grid; gap: 10px; }
.result { display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; text-decoration: none; }
.result:hover { border-color: var(--orange); }
.result-cat { display: flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; color: var(--orange-600); margin-bottom: 4px; }
.result strong { font-size: 1.05rem; margin-right: 8px; }
.result p { margin: 6px 0 0; color: var(--ink-2); font-size: .92rem; }
mark { background: var(--orange-100); color: inherit; border-radius: 3px; padding: 0 2px; }

/* ---------- Doc layout ---------- */
.doc-layout { display: grid; grid-template-columns: 280px 1fr; gap: 32px; align-items: start; }
.sidebar { position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.side-back { display: block; text-decoration: none; font-weight: 600; color: var(--muted); font-size: .88rem; padding: 6px 8px 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.side-back:hover { color: var(--orange-600); }
.sidebar details { margin-bottom: 2px; }
.sidebar summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: .92rem; color: var(--ink-2); }
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar summary svg { color: var(--gray); flex: none; }
.sidebar summary:hover { background: var(--bg); }
.sidebar summary.on { color: var(--orange-600); }
.sidebar summary.on svg { color: var(--orange); }
.sidebar ul { list-style: none; margin: 2px 0 8px; padding: 0 0 0 20px; border-left: 2px solid var(--line); margin-left: 16px; }
.sidebar li a { display: block; padding: 6px 10px; text-decoration: none; font-size: .88rem; color: var(--ink-2); border-radius: 6px; }
.sidebar li a:hover { background: var(--bg); }
.sidebar li a.on { color: var(--orange-600); background: var(--orange-50); font-weight: 700; }
.sidebar li a.side-overview { color: var(--muted); }
.doc-main { min-width: 0; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 18px; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--orange-600); }
.cat-header { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 26px; }

.policy-list { display: grid; gap: 10px; }
.policy-row { display: flex; align-items: center; gap: 18px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; text-decoration: none; transition: border-color .15s; }
.policy-row:hover { border-color: var(--orange); }
.policy-num { font-weight: 800; font-size: 1.3rem; color: var(--orange-600); min-width: 32px; }
.policy-body { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.policy-body strong { font-size: 1.05rem; }
.policy-meta { display: flex; gap: 12px; align-items: center; font-size: .8rem; color: var(--muted); margin-top: 4px; flex-wrap: wrap; }

/* ---------- Policy page ---------- */
.policy { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 36px 44px 40px; box-shadow: var(--shadow); }
.policy-head { border-bottom: 1px solid var(--line); padding-bottom: 22px; margin-bottom: 28px; }
.policy-head h1 { font-size: 2.1rem; }
.doc-control { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 18px 0; }
.doc-control > div { background: #FBFAF9; padding: 10px 14px; }
.doc-control span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.doc-control strong { font-size: .95rem; }
.policy-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.policy-actions .btn { padding: 8px 14px; font-size: .9rem; }
.print-only { display: none; }

.prose { font-size: 1.04rem; line-height: 1.75; color: #333; max-width: 78ch; }
.prose h2 { font-size: 1.35rem; margin: 1.8em 0 .6em; padding-top: .2em; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose h3 { font-size: 1.12rem; margin: 1.5em 0 .5em; color: var(--ink-2); }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.prose li { margin-bottom: .4em; }
.prose ul li::marker { color: var(--orange); }
.prose ol li::marker { color: var(--orange-600); font-weight: 700; }
.prose blockquote { margin: 1.2em 0; padding: 12px 18px; border-left: 4px solid var(--orange); background: var(--orange-50); border-radius: 0 10px 10px 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0 1.4em; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose th { background: #FBFAF9; }
.prose a { color: var(--orange-600); }

.ack-box { margin-top: 36px; border: 2px solid var(--orange); background: var(--orange-50); border-radius: 16px; padding: 22px 24px; }
.ack-box.done { border-color: #c6e6d4; background: var(--ok-bg); }
.ack-box .check { margin-bottom: 16px; font-size: 1rem; }
.ack-note { color: var(--warn); font-weight: 600; }
.ack-done { display: flex; gap: 14px; align-items: center; }
.ack-done strong { display: block; color: var(--ok); }
.ack-check { width: 40px; height: 40px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; flex: none; }

/* ---------- Admin ---------- */
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.admin-head h1 { margin: 0; font-size: 1.8rem; }
.subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.subnav a { padding: 10px 16px; text-decoration: none; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.subnav a:hover { color: var(--ink); }
.subnav a.on { color: var(--orange-600); border-bottom-color: var(--orange); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.stat span { display: block; font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat strong { font-size: 1.9rem; font-weight: 800; }
.stat-accent { background: var(--orange-600); border: 0; color: #fff; }
.stat-accent span { color: #fff; }
.admin-split { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
.sticky { position: sticky; top: 90px; }
.stack > .card { margin-bottom: 20px; }
.warn-card { border-left: 4px solid var(--orange); }
.cred-card { border: 2px solid var(--orange); }
.plain { margin: 0; padding-left: 1.2em; }

.editor-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.editor-side { position: sticky; top: 90px; }
.editor-side .card { padding: 18px; }
.editor-side h3 { font-size: .95rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.rte { border: 1px solid #D9D5D0; border-radius: 12px; overflow: hidden; background: #fff; }
.rte:focus-within { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(239, 121, 0, .15); }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; background: #FBFAF9; border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.rte-toolbar button { font: inherit; font-size: .85rem; min-width: 34px; height: 32px; padding: 0 8px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--ink-2); font-weight: 600; }
.rte-toolbar button:hover, .rte-toolbar button.on { background: var(--orange-50); color: var(--orange-600); }
.rte-toolbar .sep { width: 1px; background: var(--line); margin: 4px 4px; }
.rte-area { min-height: 420px; padding: 20px 22px; outline: none; max-width: none; }
.rte-area:empty::before { content: "Tulis atau tampal kandungan polisi di sini…"; color: var(--muted); }
.rte-source { width: 100%; min-height: 420px; border: 0; border-radius: 0; margin: 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }

.meta-list { display: grid; grid-template-columns: 120px 1fr; gap: 8px 16px; margin: 0; }
.meta-list dt { color: var(--muted); font-weight: 600; }
.meta-list dd { margin: 0; }

/* ---------- Document control / approvals ---------- */
fieldset.card { min-width: 0; margin: 0 0 20px; }
fieldset[disabled] { opacity: .75; }
.editor-main { margin-bottom: 0; }
.badge-err { background: var(--err-bg); color: var(--err); }
.badge-dark { background: #3A3A3A; color: #fff; }
.flash-info { background: #EEF4FB; color: #1D4E89; border-color: #cfe0f3; }
.flash .link { margin-left: 6px; }
.warn-text { color: var(--warn); }
.err-text { color: var(--err); font-weight: 600; }
.rev-status { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 20px; margin-bottom: 18px; }
.rev-status > div > span { display: block; }
.rev-status strong { font-size: 1rem; }
.rev-steps { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.rev-steps span { font-size: .8rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.rev-steps span.on { background: var(--orange-600); color: #fff; }
.rev-steps span.done { background: var(--ok-bg); color: var(--ok); }
.change-box { margin-top: 18px; padding: 16px; border-radius: 12px; background: var(--orange-50); border: 1px solid var(--orange-100); }
.change-box label { margin-bottom: 4px !important; }
.change-box p { margin: 0; }
.discard { margin: 10px 0 0; text-align: right; }
.review-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; margin-top: 12px; }
.review-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 18px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.review-meta span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.reason { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 14px; }
.tabs button { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 12px; color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.tabs button.on { color: var(--orange-600); border-bottom-color: var(--orange); }
.diff-line { margin: 0 0 6px; padding: 6px 10px; border-radius: 6px; font-size: .95rem; border-left: 3px solid transparent; }
.diff-line.ins { background: #E6F4EC; border-left-color: var(--ok); }
.diff-line.ins::before { content: "+ "; font-weight: 800; color: var(--ok); }
.diff-line.del { background: var(--err-bg); border-left-color: var(--err); text-decoration: line-through; color: #7a2a20; }
.diff-line.del::before { content: "− "; font-weight: 800; }
.superseded-banner { background: #3A3A3A; color: #fff; font-weight: 800; letter-spacing: .1em; text-align: center; padding: 10px; border-radius: 10px; margin-bottom: 20px; font-size: .85rem; }
.head-actions { display: flex; gap: 8px; }
.table-dense td { padding: 9px 10px; }
.table-dense th { padding: 8px 10px; }
.group-row td { background: var(--bg); font-weight: 800; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 14px; }
.inline-label { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.inline-label input { margin: 0; width: auto; }
.subnav .count { margin-left: 4px; font-size: .72rem; padding: 1px 7px; }
.print-wrap, .print-wrap > tbody, .print-wrap > tbody > tr, .print-wrap > tbody > tr > td { display: block; }
.print-wrap > tfoot { display: none; }
.print-footer { font-size: 8.5pt; color: #444; border-top: 1px solid #999; padding-top: 6px; margin-top: 24px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); background: #fff; }
.footer-inner { max-width: 1240px; margin: 0 auto; padding: 18px 24px; display: flex; justify-content: space-between; gap: 16px; font-size: .82rem; color: var(--muted); flex-wrap: wrap; }
.footer-tag { font-weight: 700; color: var(--orange-600); letter-spacing: .06em; text-transform: uppercase; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .doc-layout, .admin-split, .editor-layout, .review-layout { grid-template-columns: 1fr; }
  .rev-steps { margin-left: 0; }
  .sidebar, .sticky, .editor-side { position: static; max-height: none; }
  .doc-layout .sidebar { order: 2; }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .page { padding: 18px 14px 40px; }
  .topbar-inner { padding: 10px 14px; flex-wrap: wrap; }
  .brand-sub { display: none; }
  .nav-toggle { display: block; }
  .mainnav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-top: 8px; }
  body.nav-open .mainnav { display: flex; }
  .usermenu { margin: 8px 0 0; }
  .usermenu-pop { position: static; display: block; box-shadow: none; border: 0; padding: 0; }
  .avatar { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { min-height: 220px; padding: 32px; }
  .auth-logo { top: 28px; left: 32px; height: 30px; }
  .auth-side h1 { font-size: 1.9rem; }
  .hero { padding: 26px 22px; }
  .hero h1 { font-size: 1.9rem; }
  .policy { padding: 24px 20px; }
  .policy-head h1 { font-size: 1.6rem; }
  .doc-control { grid-template-columns: 1fr 1fr; }
  .policy-row { flex-wrap: wrap; }
  .admin-head { flex-direction: column; align-items: flex-start; }
}

/* ---------- Print ---------- */
@media print {
  @page { margin: 18mm 16mm; }
  body { background: #fff; font-size: 11pt; }
  .topbar, .footer, .sidebar, .no-print, .crumbs { display: none !important; }
  .page { padding: 0; max-width: none; }
  .doc-layout { display: block; }
  .policy { border: 0; box-shadow: none; padding: 0; }
  .print-only { display: block; }
  .print-logo { height: 36px; width: auto; margin-bottom: 18px; }
  .prose { max-width: none; font-size: 11pt; }
  .doc-control > div { background: #fff; }
  .print-wrap { display: table; width: 100%; border-collapse: collapse; }
  .print-wrap > tbody { display: table-row-group; }
  .print-wrap > tbody > tr { display: table-row; }
  .print-wrap > tbody > tr > td { display: table-cell; padding: 0; }
  .print-wrap > tfoot { display: table-footer-group; }
  .print-footer-space { height: 16mm; }
  .print-footer { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; margin: 0; }
  .superseded-banner { border: 2px solid #000; color: #000; background: #fff; }
  .admin-head, .subnav, .filters, .flash { display: none !important; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .register-print-head h1 { font-size: 16pt; margin: 6px 0 2px; }
  .table-dense { font-size: 8.5pt; }
  .table a { color: #000; }
  .badge { padding: 0; background: none !important; color: #000 !important; }
}
