:root {
  --navy: #1f4e79; --navy-d: #163a5c; --ink: #1d2733; --muted: #5d6b7a; --line: #dfe5ec;
  --bg: #f4f6f9; --card: #fff; --ok: #1e7b4a; --warn: #b26a00; --bad: #b3261e; --accent: #2f7fc1;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,30,54,.06), 0 2px 8px rgba(16,30,54,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0 0 .25rem; font-weight: 650; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; font-weight: 650; }
h3 { font-size: 1rem; margin: 0 0 .5rem; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; height: 58px;
  padding: 0 18px; background: var(--navy); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.topbar .brand { color: #fff; font-weight: 650; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.topbar .brand:hover { text-decoration: none; }
.brand .logo { width: 30px; height: 30px; border-radius: 7px; background: #fff; color: var(--navy); display: grid; place-items: center; font-weight: 800; font-size: .8rem; }
.topbar form.search { flex: 1; max-width: 560px; }
.topbar form.search input { width: 100%; border: 0; border-radius: 8px; padding: 9px 14px; font-size: .95rem; background: rgba(255,255,255,.95); }
.topbar .user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: .9rem; white-space: nowrap; }
.topbar .user a, .topbar .user button { color: #dce8f5; }
.topbar .menu-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; }
.devbanner { background: #b3261e; color: #fff; text-align: center; padding: 4px; font-size: .85rem; font-weight: 600; }

.shell { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 58px); }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 16px 10px; }
.sidebar .section { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 16px 10px 6px; }
.sidebar a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); }
.sidebar a:hover { background: #eef3f8; text-decoration: none; }
.sidebar a.active { background: #e3edf7; color: var(--navy); font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 3px; background: var(--navy); flex: none; }
main { padding: 24px 28px 60px; min-width: 0; }
.pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

/* ---------- components ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card > .cardhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.side { grid-template-columns: minmax(0, 1fr) 330px; }
.stat { font-size: 1.8rem; font-weight: 700; color: var(--navy); }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--navy); background: var(--navy); color: #fff;
  border-radius: 8px; padding: 8px 14px; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--navy-d); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--navy); }
.btn.secondary:hover { background: #eef3f8; }
.btn.danger { background: #fff; color: var(--bad); border-color: #e3b5b2; }
.btn.small { padding: 4px 10px; font-size: .8rem; }
.btn.big { padding: 12px 22px; font-size: 1rem; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a.active { color: var(--navy); border-color: var(--navy); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #e8eef5; color: var(--navy); white-space: nowrap; }
.badge.ok { background: #e3f4ea; color: var(--ok); }
.badge.warn { background: #fdf0dc; color: var(--warn); }
.badge.bad { background: #fbe5e3; color: var(--bad); }
.badge.new { background: #2f7fc1; color: #fff; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.flash.ok { background: #eaf6ef; border-color: #bfe2cc; color: #135c36; }
.flash.error { background: #fdecea; border-color: #f2c1bc; color: #8a1d16; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }

table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfd; }
table.list td { padding: 11px 14px; border-bottom: 1px solid #edf1f5; vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr:hover td { background: #fafcfe; }
.fileicon { display: inline-grid; place-items: center; width: 34px; height: 40px; border-radius: 5px; font-size: .62rem; font-weight: 700; color: #fff; background: #7a8796; flex: none; }
.fileicon.pdf { background: #c8362b; } .fileicon.docx, .fileicon.doc { background: #2b5ca8; }
.fileicon.xlsx, .fileicon.xls, .fileicon.csv { background: #1d7044; } .fileicon.pptx, .fileicon.ppt { background: #c4561f; }
.fileicon.folder { background: #e2b33b; }
.docrow { display: flex; gap: 12px; align-items: center; }
.docrow .t { font-weight: 600; color: var(--ink); }

form.stack label { display: block; font-weight: 600; font-size: .85rem; margin: 12px 0 4px; }
form.stack .hint { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=search], input[type=number], input[type=datetime-local], input[type=date], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #c9d3de; border-radius: 7px; font: inherit; background: #fff; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc3e8; border-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400 !important; margin: 10px 0 !important; }
.check input { width: auto; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; }
details.panel { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; background: #fbfcfd; }
details.panel summary { cursor: pointer; font-weight: 600; color: var(--navy); }

/* dashboard */
.meeting-card { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid #edf1f5; }
.meeting-card:last-child { border-bottom: 0; }
.datebox { width: 54px; flex: none; text-align: center; border-radius: 8px; border: 1px solid var(--line); overflow: hidden; }
.datebox .m { background: var(--navy); color: #fff; font-size: .7rem; font-weight: 700; text-transform: uppercase; padding: 2px 0; }
.datebox .d { font-size: 1.35rem; font-weight: 700; padding: 2px 0; }
.progress { height: 6px; background: #e8edf3; border-radius: 99px; overflow: hidden; margin-top: 6px; max-width: 240px; }
.progress span { display: block; height: 100%; background: var(--ok); }
.welcome { background: linear-gradient(120deg, var(--navy), #2f6a9e); color: #fff; border: 0; }
.welcome h1 { color: #fff; }
.welcome .muted { color: #d4e2f0; }

/* agenda */
.agenda-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid #edf1f5; }
.agenda-item .num { width: 30px; height: 30px; border-radius: 50%; background: #e8eef5; color: var(--navy); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.agenda-item:last-child { border-bottom: 0; }

/* votes */
.tally { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tally div { border: 1px solid var(--line); border-radius: 8px; padding: 10px; text-align: center; }
.tally b { display: block; font-size: 1.6rem; }
.choice { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; cursor: pointer; font-weight: 600 !important; }
.choice input { width: auto; }

/* viewer */
.viewer-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.viewer-bar { position: sticky; top: 58px; z-index: 10; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: #e9eef4; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin-bottom: 10px; }
.viewer-bar input { width: 64px; padding: 4px 6px; }
.pages { margin: 0 auto; max-width: 980px; transition: max-width .15s; user-select: none; -webkit-user-select: none; }
.pages .pg { position: relative; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.12); margin: 0 auto 16px; min-height: 300px; aspect-ratio: 8.5 / 11; }
.pages .pg.loaded { aspect-ratio: auto; min-height: 0; }
.pages .pg img { width: 100%; display: block; -webkit-user-drag: none; }
.pages .pg .pn { position: absolute; right: 8px; bottom: -14px; font-size: .7rem; color: var(--muted); }
.side-panel .card { padding: 14px 16px; }
.note { border-left: 3px solid #e2b33b; background: #fffbea; padding: 8px 10px; border-radius: 4px; margin-bottom: 8px; font-size: .9rem; white-space: pre-wrap; }
mark { background: #fff0a8; padding: 0 1px; }
.result { padding: 14px 18px; border-bottom: 1px solid #edf1f5; }
.result:last-child { border-bottom: 0; }
.result .hits { margin: 6px 0 0 46px; font-size: .88rem; color: #3b4652; }
.result .hits a { color: var(--muted); font-weight: 600; margin-right: 6px; }

/* login */
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(140deg, #163a5c, #2f6a9e); padding: 20px; }
.login-box { background: #fff; border-radius: 14px; padding: 36px 34px; width: 100%; max-width: 420px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-box .logo { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 12px; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; }
.ms-btn { display: inline-flex; align-items: center; gap: 12px; background: #2f2f2f; color: #fff; border-radius: 6px; padding: 12px 22px; font-weight: 600; margin-top: 18px; }
.ms-btn:hover { background: #111; text-decoration: none; }
.ms-logo { display: grid; grid-template-columns: 9px 9px; gap: 2px; }
.ms-logo i { width: 9px; height: 9px; display: block; }
.ms-logo i:nth-child(1) { background: #f25022; } .ms-logo i:nth-child(2) { background: #7fba00; }
.ms-logo i:nth-child(3) { background: #00a4ef; } .ms-logo i:nth-child(4) { background: #ffb900; }
.legal { font-size: .75rem; color: var(--muted); margin-top: 22px; line-height: 1.4; }

@media (max-width: 1100px) { .viewer-wrap, .grid.side { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; top: 58px; left: 0; bottom: 0; width: 260px; z-index: 40; box-shadow: 4px 0 20px rgba(0,0,0,.15); overflow-y: auto; }
  .sidebar.open { display: block; }
  .topbar .menu-toggle { display: block; }
  .topbar .user .name { display: none; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  main { padding: 16px 14px 50px; }
  table.list .hide-sm { display: none; }
  .topbar .brand span.full { display: none; }
}
@media print { body.no-print * { display: none !important; } body.no-print::after { content: "Printing is disabled for confidential materials."; display: block !important; padding: 40px; } }
.padx { margin: 0 10px; }
.mt { margin-top: 14px; } .mb0 { margin-bottom: 0; } .w100 { width: 100%; } .center { text-align: center; }
.inline-form input.w-page { width: 80px; } .note-plain { white-space: pre-wrap; margin: 8px 0 0; }
.datebox { align-self: flex-start; }
