:root {
  --page: #f6f5f0; --paper: #fff; --text: #19251f; --muted: #66736d; --rule: #e5e3da;
  --blue: #2864d7; --blue-dark: #1d4ea8; --red: #c2413a; --amber: #b7791f; --green: #2f855a;
  --radius: 10px; color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body.viewer .write-only { display: none !important; }
body:not(.admin) .admin-only { display: none !important; }    /* firm admins signed in; the server checks too */
button.danger { color: var(--red); border-color: var(--red); }   /* viewers read; the server refuses their changes anyway */   /* element rules below (e.g. input { display: block }) must not unhide */
body { margin: 0; background: var(--page); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; letter-spacing: -.02em; }
h1 { font-size: 28px; margin: 6px 0; }
h2 { font-size: 20px; margin: 28px 0 10px; }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; }
.bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: var(--paper); border-bottom: 1px solid var(--rule); gap: 12px; flex-wrap: wrap; }
.brand { font: 700 20px Georgia, serif; }
.brand b { color: var(--blue); }
.brand span { font: 500 13px system-ui, sans-serif; color: var(--muted); margin-left: 6px; letter-spacing: .04em; text-transform: uppercase; }
.who { font-size: 13px; color: var(--muted); }
.card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; margin: 12px 0; }
.narrow { max-width: 440px; margin: 40px auto; }
.ms-btn { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 14px; border: 1px solid #8c8c8c;
  border-radius: 6px; background: #fff; color: #5e5e5e; font: 600 15px "Segoe UI", system-ui, sans-serif; text-decoration: none; margin: 14px 0 6px; }
.ms-btn:hover { background: #f3f3f3; }
.or { text-align: center; margin: 4px 0; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; }
.error { color: var(--red); min-height: 1.4em; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0; }
input, select { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; font: inherit; color: var(--text); border: 1px solid var(--rule); border-radius: 8px; background: #fff; }
button, .file-btn { font: 600 14px system-ui, sans-serif; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--blue); background: var(--blue); color: #fff; cursor: pointer; display: inline-block; }
button:hover, .file-btn:hover { background: var(--blue-dark); }
button:disabled { opacity: .45; cursor: default; }
button.ghost { background: #fff; color: var(--blue); }
button.link { background: none; border: 0; color: var(--blue); padding: 0; font-weight: 500; }
.back { margin-bottom: 4px; }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ws-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.ws-item { text-align: left; background: var(--paper); color: var(--text); border: 1px solid var(--rule); padding: 14px 16px; border-radius: var(--radius); font-weight: 400; }
.ws-item:hover { background: #fff; border-color: var(--blue); }
.ws-item b { display: block; font-size: 16px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; align-items: end; }
.grid-form button { margin: 10px 0; }
.upload { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border-style: dashed; }
.upload.over { border-color: var(--blue); background: #eef3fd; }
.status { min-height: 1.5em; color: var(--blue-dark); font-weight: 500; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); margin-top: 8px; overflow-x: auto; }
.tabs button { white-space: nowrap; background: none; color: var(--muted); border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 14px; }
.tabs button.active { color: var(--text); border-bottom-color: var(--blue); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 16px; }
.tile { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; }
.tile small { display: block; color: var(--muted); font-size: 12px; }
.tile b { display: block; font: 600 22px Georgia, serif; margin: 2px 0; }
.tile span { font-size: 12px; color: var(--muted); }
.concern { border-left: 4px solid var(--amber); }
.concern.high { border-left-color: var(--red); }
.concern.low { border-left-color: var(--muted); }
.concern h3 { margin: 0 0 4px; font-size: 15px; }
.concern .ev { font-size: 12px; color: var(--muted); margin-top: 6px; }
.chip { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 1px 7px; border-radius: 99px; background: #fbf0dc; color: var(--amber); margin-right: 6px; }
.chip.high { background: #fbe4e2; color: var(--red); }
.chip.low { background: #eee; color: var(--muted); }
.chip.ok { background: #e3f3ea; color: var(--green); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.neg { color: var(--red); }
.pos { color: var(--green); }
.card table { display: block; overflow-x: auto; }
.card table tbody, .card table thead { display: table; width: 100%; table-layout: auto; }
.scen-form { display: grid; grid-template-columns: auto repeat(4, minmax(110px, 1fr)) auto; gap: 0 10px; align-items: end; margin-top: 14px; }
.scen-form b { align-self: center; }
.scen-form button { margin: 10px 0; }
.expo { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.bars h3 { font-size: 13px; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
.bar-row { display: grid; grid-template-columns: 1fr 52px; gap: 8px; font-size: 13px; margin: 4px 0; }
.bar-row i { display: block; height: 6px; background: var(--blue); border-radius: 3px; margin-top: 4px; }
.chat-log { max-height: 60vh; overflow-y: auto; }
.msg { margin: 14px 0; }
.msg.user { text-align: right; }
.msg.user .bubble { display: inline-block; background: #eef3fd; padding: 8px 12px; border-radius: 12px; max-width: 80%; text-align: left; }
.msg .bubble p { margin: 6px 0; }
.msg .bubble ol, .msg .bubble ul { margin: 6px 0; padding-left: 22px; }
.badge { font-size: 12px; margin-top: 6px; }
.badge.ok { color: var(--green); }
.badge.warn { color: var(--red); }
.chat-form { display: flex; gap: 8px; margin-top: 12px; }
.chat-form input { margin: 0; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 16px 30px; }
@media (max-width: 700px) { .scen-form { grid-template-columns: 1fr 1fr; } .scen-form b { grid-column: 1 / -1; } h1 { font-size: 23px; } }

.msg .bubble .lesson-video { display: block; width: 100%; max-width: 480px; margin: 8px 0; border-radius: 8px; background: #000; }

/* Ask AIMi: the same black and green look as chataimi.ai (near-black surfaces, light-green accent, grey rules) */
.card.chat { --c-bg: #0f0f0f; --c-surface: #1a1a1a; --c-raise: #262626; --c-rule: #3a3a3a; --c-text: #ededed; --c-muted: #a0aec0; --c-green: #8ae188; --c-green-d: #4c976f;
  background: var(--c-bg); color: var(--c-text); border: 1px solid var(--c-raise); border-radius: 14px; padding: 0; overflow: hidden; color-scheme: dark; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: var(--c-surface); border-bottom: 1px solid var(--c-raise); }
.chat-head b { font-size: 15px; letter-spacing: .02em; }
.chat-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c-green); box-shadow: 0 0 0 3px rgba(138, 225, 136, .18); }
.chat-sub { margin-left: auto; font: 12px ui-monospace, "SF Mono", Menlo, monospace; color: var(--c-muted); }
.card.chat .chat-log { padding: 18px; max-height: 58vh; }
.card.chat .muted { color: var(--c-muted); }
.card.chat .msg.user .bubble { background: #17301f; border: 1px solid var(--c-green-d); color: var(--c-text); border-radius: 14px 14px 4px 14px; }
.card.chat .msg:not(.user) .bubble { border-left: 2px solid var(--c-green-d); padding: 2px 0 2px 14px; line-height: 1.6; }
.card.chat .msg:not(.user) .bubble a { color: var(--c-green); }
.card.chat .badge.ok { color: var(--c-green); font: 12px ui-monospace, "SF Mono", Menlo, monospace; }
.card.chat .badge.warn { color: #f0b429; font: 12px ui-monospace, "SF Mono", Menlo, monospace; }
.card.chat .chat-form { margin: 0; padding: 14px 18px 8px; border-top: 1px solid var(--c-raise); background: var(--c-surface); }
.card.chat .chat-form input { background: var(--c-bg); color: var(--c-text); border: 1px solid var(--c-rule); border-radius: 10px; padding: 11px 14px; }
.card.chat .chat-form input::placeholder { color: #6b7280; }
.card.chat .chat-form input:focus { outline: none; border-color: var(--c-green); box-shadow: 0 0 0 3px rgba(138, 225, 136, .16); }
.card.chat .chat-form button { background: var(--c-green); color: #0a0a0a; border: 0; border-radius: 10px; font-weight: 600; padding: 0 22px; }
.card.chat .chat-form button:hover { background: #a3eaa1; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 18px 16px; background: var(--c-surface); }
.chat-chips .chip { background: transparent; color: var(--c-muted); border: 1px solid var(--c-rule); border-radius: 999px; font-size: 12.5px; padding: 5px 12px; cursor: pointer; }
.chat-chips .chip:hover { color: var(--c-green); border-color: var(--c-green-d); }
.card.chat .msg .bubble .lesson-video { border: 1px solid var(--c-raise); }
