:root { color-scheme: light; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #152235; background: #e8eff3; --brand: #12647e; --brand-dark: #0d4b60; --brand-soft: #dceff5; --line: #d8e1e7; --muted: #607283; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.shell { width: min(1180px, 100%); min-height: 100vh; margin: 0 auto; padding: 1rem; display: grid; grid-template-columns: 82px 340px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 0; }
header { grid-column: 1; grid-row: 1; display: grid; place-items: center; padding: .75rem .5rem; background: #f7fafb; border: 1px solid var(--line); border-bottom: 0; border-radius: 1rem 0 0 0; }
.brand { margin: 0; display: grid; justify-items: center; gap: .25rem; color: var(--brand); font-size: 0; font-weight: 800; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--brand); color: #fff; }
.brand-mark .icon { width: 23px; height: 23px; }
.beta-label { color: var(--muted); font-size: .58rem; letter-spacing: .12em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .15rem; font-size: 1.7rem; letter-spacing: -.025em; }
h2, h3 { letter-spacing: -.015em; }
.eyebrow { margin-bottom: .35rem; color: var(--brand); font-weight: 750; letter-spacing: .08em; text-transform: uppercase; font-size: .72rem; }
.subtle, .help-text { color: var(--muted); }
.card { min-width: 0; background: #fff; border: 1px solid var(--line); padding: 1.35rem; box-shadow: none; }
#boot-panel, #sign-in-panel, #directory-panel, #groups-panel, #settings-panel, #admin-panel { grid-column: 2 / 4; grid-row: 1 / 3; width: min(760px, calc(100% - 2rem)); margin: 1rem auto; align-self: start; border-radius: 1rem; }
#boot-panel, #sign-in-panel { grid-column: 1 / 4; margin-top: 7vh; }
.boot-panel { min-height: 12rem; display: grid; place-items: center; align-content: center; gap: .8rem; color: var(--muted); }
.boot-mark { width: 3rem; height: 3rem; display: grid; place-items: center; border-radius: 1rem; background: var(--brand); color: #fff; }
#messages-panel { grid-column: 2; grid-row: 1 / 3; border-left: 0; border-radius: 0; overflow-y: auto; }
#conversation-panel { grid-column: 3; grid-row: 1 / 3; min-height: 0; border-left: 0; border-radius: 0 1rem 1rem 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; padding: 0; overflow: hidden; }
body[data-view="messages"] #messages-panel { grid-column: 2 / 4; width: min(520px, 100%); justify-self: start; border-radius: 0 1rem 1rem 0; }
form { display: grid; gap: .65rem; margin-top: 1rem; }
label { font-weight: 700; }
input, textarea, select { width: 100%; min-height: 44px; border: 1px solid #9aabb9; border-radius: .7rem; padding: .7rem .8rem; font: inherit; background: #fff; color: inherit; }
input:focus, textarea:focus, select:focus { outline: 3px solid #8dd6eb; outline-offset: 1px; border-color: var(--brand); }
textarea { resize: none; }
button { min-height: 44px; border: 0; border-radius: .7rem; padding: .65rem .9rem; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; background: var(--brand); color: #fff; font: inherit; font-weight: 750; cursor: pointer; }
button:hover { background: var(--brand-dark); }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible { outline: 3px solid #8dd6eb; outline-offset: 2px; }
button.secondary { background: transparent; color: var(--brand); border: 1px solid #8ab0bf; }
.icon-button { width: 44px; padding: 0; flex: 0 0 44px; }
.quiet-button { background: transparent; color: #496274; }
.quiet-button:hover { background: #eef4f6; color: var(--brand); }
.status { min-height: 1.25rem; margin: .65rem 0 0; color: var(--muted); }
.section-heading, .search-row { display: flex; gap: .75rem; align-items: center; justify-content: space-between; }
.actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.search-row input { flex: 1; }
.inbox-heading { margin-bottom: .9rem; }
.compose-button { border-radius: 999px; }
.search-field { min-height: 42px; display: flex; align-items: center; gap: .55rem; padding: 0 .8rem; border-radius: 999px; background: #edf3f6; color: #667987; }
.search-field input { min-height: 40px; padding: 0; border: 0; outline: 0; background: transparent; }
.conversation-filters { display: flex; gap: .4rem; margin-top: .8rem; }
button.filter { min-height: 34px; padding: .3rem .72rem; border-radius: 999px; background: transparent; border: 1px solid var(--line); color: #465d70; }
button.filter.active { background: var(--brand-soft); border-color: #9bc8d5; color: var(--brand-dark); }
.conversation-list, .members { list-style: none; padding: 0; margin: .7rem -1.35rem 0; display: grid; }
.conversation-row { display: grid; grid-template-columns: 48px minmax(0,1fr) auto; align-items: center; gap: .72rem; width: 100%; min-height: 70px; padding: .72rem 1.35rem; border: 0; border-top: 1px solid #edf1f3; border-radius: 0; background: transparent; color: #152235; text-align: left; font-weight: 500; }
.conversation-row:hover { background: #f0f6f8; }
.conversation-row:focus-visible { outline-offset: -3px; }
.conversation-avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; }
.conversation-copy { min-width: 0; }
.conversation-copy strong, .conversation-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-copy strong { font-size: .98rem; }
.conversation-copy span, .conversation-time { margin-top: .15rem; color: var(--muted); font-size: .8rem; }
.member { border-bottom: 1px solid #e5ebef; padding: 1rem 1.35rem; }
.member strong { display: block; font-size: 1rem; }
.member small { color: var(--muted); }
.groups { margin-top: .3rem; color: #486176; }
.member button { margin-top: .65rem; }
.admin-create-panel { margin: .8rem 0 1rem; border: 1px solid var(--line); border-radius: .8rem; background: #f7fafb; }
.admin-create-panel summary { cursor: pointer; padding: .85rem 1rem; color: var(--brand-dark); font-weight: 800; }
.admin-create-panel form { padding: 0 1rem 1rem; }
.member-list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: .8rem 0; font-weight: 800; }
.member-list-toolbar label { display: flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .82rem; }
.member-list-toolbar select { width: auto; min-height: 36px; padding: .35rem 2rem .35rem .6rem; }
.admin-member-list .member { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .2rem .8rem; align-items: center; }
.admin-member-list .member > strong, .admin-member-list .member > small, .admin-member-list .member > .groups { grid-column: 1; }
.admin-member-list .member { grid-template-columns: minmax(10rem,1.2fr) minmax(12rem,1.4fr) minmax(8rem,1fr) minmax(7rem,.8fr) auto; padding-block: .72rem; }
.admin-member-list .member > strong { grid-column: 1; }
.admin-member-list .member > small { grid-column: 2; }
.admin-member-list .member > .groups { grid-column: 3; }
.admin-member-list .member > button { grid-column: 5; grid-row: 1; margin: 0; }
.member-role-summary { grid-column: 4; display:flex; gap:.3rem; color:var(--brand-dark); }
.role-icon { width:1.85rem; height:1.85rem; display:grid; place-items:center; border-radius:50%; background:var(--brand-soft); border:1px solid #b9d5de; }
.role-icon .icon { width:1rem; height:1rem; }
.group-detail { margin-top:1rem; padding-top:1rem; border-top:1px solid var(--line); }
.group-detail > .section-heading { justify-content:flex-start; }
.planned-policy { margin:0 0 1rem; padding:1rem; border:1px solid #cbd9df; border-radius:.8rem; background:#f8fafb; }
.planned-policy legend { font-weight:800; padding:0 .35rem; }
.planned-policy small { display:block; margin-top:.65rem; color:var(--muted); }
.planned-badge { display:inline-block; margin-left:.35rem; padding:.18rem .45rem; border-radius:999px; background:#e7eef2; color:var(--muted); font-size:.7rem; text-transform:uppercase; letter-spacing:.05em; }
.planned-departments { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.2rem .8rem; margin:.5rem 0; }
.member-controls { display: grid; gap: .85rem; }
.member-search { flex: 1; }
.member-search input { min-height: 40px; }
.admin-compact-row { display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.admin-compact-row button { margin:0; }
.member-editor-backdrop { position:fixed; inset:0; z-index:20; background:rgba(10,31,47,.28); }
.member-editor-panel { position:absolute; inset:0 0 0 auto; width:min(32rem,92vw); overflow:auto; background:#fff; padding:1.25rem; box-shadow:-12px 0 35px rgba(10,31,47,.18); }
.member-editor-panel .section-heading { position:sticky; top:-1.25rem; z-index:2; margin:-1.25rem -1.25rem 1rem; padding:1rem 1.25rem; background:#fff; border-bottom:1px solid var(--line); }
.profile-summary { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:.8rem; }
.profile-view { display:grid; grid-template-columns:minmax(8rem,.7fr) minmax(0,1.3fr); margin-top:1rem; }
.profile-view dt,.profile-view dd { padding:.55rem 0; border-bottom:1px solid var(--line); margin:0; }
.profile-actions { display:flex; gap:.65rem; }
.profile-actions button { width:auto; }
.creation-panel, .settings-section { margin-top: 1rem; padding: 1rem; border-radius: .8rem; background: #f4f7f9; }
.admin-nav { display: flex; flex-wrap: nowrap; gap: .45rem; margin: 1.1rem 0; overflow-x: auto; padding-bottom: .35rem; scrollbar-width: thin; }
.admin-nav button { flex: 0 0 auto; }
.admin-nav button.active { background: var(--brand-soft); color: var(--brand-dark); border-color: #9bc8d5; }
.settings-heading { justify-content: flex-start; }
.settings-heading .icon-button { display: none; }
.profile-form { gap: .8rem; }
.profile-name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.profile-name-grid > div { display: grid; gap: .65rem; }
.profile-form input:disabled, .profile-form textarea:disabled { background: #e9eef1; color: #607283; border-color: transparent; }
.security-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .65rem; }
.security-summary p { margin: 0; padding: .75rem; border-radius: .65rem; background: #fff; color: var(--muted); }
.security-summary strong { color: #152235; }
#settings-session-details { margin-top: .9rem; border-top: 1px solid var(--line); padding-top: .8rem; }
#settings-session-details summary { cursor: pointer; font-weight: 750; color: var(--brand-dark); }
#settings-session-details button { margin-top: .6rem; }
.admin-nav button { padding: .5rem .7rem; }
.admin-section { border-top: 1px solid var(--line); margin-top: 1.75rem; padding-top: 1.35rem; scroll-margin-top: 1rem; }
.admin-list { list-style: none; padding: 0; display: grid; gap: .6rem; }
.admin-list li { border: 1px solid var(--line); border-radius: .65rem; padding: .8rem; }
.choice-list { display: grid; gap: .4rem; max-height: 14rem; overflow-y: auto; }
.choice-list label { display: flex; align-items: center; gap: .55rem; margin: 0; min-height: 44px; }
.choice-list input { width: auto; min-height: auto; }
.danger { background: #8a2831; border-color: #8a2831; }
.app-nav { grid-column: 1; grid-row: 2; position: static; transform: none; width: auto; display: flex; flex-direction: column; justify-content: flex-start; gap: .4rem; padding: .75rem .5rem; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 0 1rem; background: #f7fafb; box-shadow: none; z-index: 20; }
.app-nav button { min-height: 58px; margin: 0; padding: .55rem .3rem; flex-direction: column; gap: .2rem; border: 0; background: transparent; color: #5a6f7f; font-size: .68rem; }
.app-nav button .icon { width: 1.35rem; height: 1.35rem; }
.app-nav button.nav-active { color: var(--brand); background: var(--brand-soft); }
#group-management { margin-top: 1.5rem; }
.member-controls { display: grid; gap: .5rem; margin-top: .75rem; }
.member-controls .actions { align-items: end; }
.member-controls button { margin-top: 0; }
.role-controls { border: 0; padding: 0; margin: .75rem 0 0; display: grid; gap: .35rem; }
.role-controls legend { font-weight: 700; margin-bottom: .25rem; }
.check-row { display: flex; gap: .55rem; align-items: center; font-weight: 600; }
.check-row input { width: auto; min-height: auto; }
.audit-meta { display: block; color: var(--muted); margin-top: .25rem; }
.features { list-style: none; padding: 0; display: grid; gap: .65rem; }
.feature { border: 1px solid var(--line); border-radius: .65rem; padding: .8rem; display: grid; gap: .2rem; }
.feature small { color: var(--muted); }
.feature-state { justify-self: start; border-radius: 999px; padding: .2rem .55rem; background: #eef3f7; font-size: .75rem; font-weight: 750; }
.feature-state.included { background: #dff4e7; color: #175c31; }
.feature-state.locked { background: #fff0d6; color: #734b00; }
.conversation-heading { position: sticky; top: 0; z-index: 10; min-height: 72px; display: grid; grid-template-columns: auto auto minmax(0,1fr) auto; align-items: center; gap: .7rem; padding: .72rem .9rem; border-bottom: 1px solid var(--line); background: rgba(248,250,251,.98); }
.conversation-back { min-width: 44px; min-height: 44px; padding: .5rem; border: 0; background: transparent; color: var(--brand); }
.conversation-back:hover { background: #eef4f6; }
.back-label { display: none; }
.conversation-header-avatar { width: 42px; height: 42px; }
.conversation-identity { min-width: 0; }
.conversation-identity h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.05rem; }
.conversation-identity p { margin: .12rem 0 0; font-size: .77rem; }
.messages { list-style: none; padding: 1.2rem; margin: 0; display: grid; align-content: end; gap: .42rem; overflow-y: auto; background: #eef3f5; }
.message { justify-self: start; max-width: min(78%, 34rem); background: #fff; border-radius: .95rem .95rem .95rem .24rem; padding: .55rem .75rem; box-shadow: 0 1px 1px rgba(27,50,65,.08); white-space: pre-wrap; overflow-wrap: anywhere; }
.message.mine { justify-self: end; border-radius: .95rem .95rem .24rem .95rem; background: #d8eef4; }
.message.system { justify-self: center; max-width: 88%; padding: .3rem .65rem; border-radius: 999px; background: rgba(96,114,131,.12); color: #526675; box-shadow: none; font-size: .76rem; text-align: center; }
.message.system time { display: inline; margin-left: .35rem; }
.message strong { display: block; margin-bottom: .2rem; color: var(--brand); font-size: .78rem; }
.message time { display: block; margin-top: .25rem; color: #6b7c88; font-size: .68rem; text-align: right; }
#message-status { margin: 0; padding: .25rem .9rem; background: #eef3f5; }
.composer { grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: .55rem; margin: 0; padding: .65rem .8rem; border-top: 1px solid var(--line); background: #f8fafb; }
.composer textarea { max-height: 8rem; border-color: transparent; border-radius: 1.25rem; background: #fff; }
.send-button { width: 46px; height: 46px; padding: 0; border-radius: 50%; }
.dialog-backdrop { position: fixed; inset: 0; display: grid; place-items: center; padding: 1rem; background: rgba(15,29,43,.44); backdrop-filter: blur(3px); z-index: 50; }
.dialog { width: min(440px, 100%); max-height: min(760px, calc(100svh - 2rem)); padding: 1rem; display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(216,225,231,.9); border-radius: 1.15rem; background: #fff; box-shadow: 0 24px 72px rgba(8,25,38,.24); }
.dialog .section-heading { min-height: 44px; padding: 0 0 .55rem; border-bottom: 1px solid #edf1f3; }
.dialog .section-heading h2 { margin: 0; font-size: 1.25rem; }
.dialog .quiet-button { color: #536877; }
.recipient-form { flex: 1 1 auto; min-height: 0; margin-top: .7rem; display: flex; flex-direction: column; gap: .55rem; }
.recipient-form > label:first-child { color: var(--muted); font-size: .78rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.recipient-chips { min-height: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.recipient-chips:empty { display: none; }
.recipient-chip { min-height: 34px; padding: .25rem .35rem .25rem .65rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-size: .82rem; }
.recipient-chip:hover { background: #c9e5ee; }
.recipient-chip .remove-mark { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: rgba(18,100,126,.12); font-size: 1rem; line-height: 1; }
.recipient-search-field { flex: 0 0 auto; border: 1px solid #d2dce2; border-radius: .8rem; background: #f4f7f8; }
.recipient-results-heading { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; min-height: 28px; margin-top: .1rem; color: #344c60; font-size: .8rem; }
.recipient-results-heading small { color: var(--muted); font-size: .75rem; font-weight: 500; }
.recipient-results { flex: 1 1 auto; list-style: none; min-height: 3rem; max-height: min(42vh, 22rem); margin: 0; padding: 0; overflow-y: auto; border-top: 1px solid #edf1f3; }
button.recipient-result { width: 100%; min-height: 60px; padding: .55rem .25rem; display: grid; grid-template-columns: 40px minmax(0,1fr) 32px; justify-content: stretch; gap: .65rem; border: 0; border-bottom: 1px solid #edf1f3; border-radius: 0; background: #fff; color: #152235; text-align: left; font-weight: 500; box-shadow: none; }
button.recipient-result:hover { background: #f5f8f9; }
button.recipient-result:active { background: #eaf2f5; }
.recipient-result .conversation-avatar { width: 40px; height: 40px; font-size: .8rem; }
.recipient-result-copy { min-width: 0; }
.recipient-result-copy strong, .recipient-result-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recipient-result-copy strong { font-size: .9rem; font-weight: 700; }
.recipient-result-copy small { margin-top: .12rem; color: var(--muted); font-size: .75rem; font-weight: 450; }
.recipient-add { width: 28px; height: 28px; align-self: center; display: grid; place-items: center; border: 1px solid #a9c5cf; border-radius: 50%; color: var(--brand); }
.recipient-add .icon { width: 16px; height: 16px; }
#group-name-section { display: grid; gap: .45rem; padding-top: .4rem; }
#add-group-member-results { max-height: 14rem; }
#recipient-status { flex: 0 0 auto; min-height: 0; margin: 0; font-size: .78rem; }
#recipient-status:empty { display: none; }
#start-selected-conversation { flex: 0 0 auto; min-height: 46px; margin-top: .2rem; border-radius: .8rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@media (max-width: 720px) {
  .settings-heading .icon-button { display: inline-flex; }
  #settings-panel, #admin-panel { padding: .8rem; padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
  .settings-section { padding: .9rem; }
  .profile-name-grid, .security-summary { grid-template-columns: 1fr; }
  .profile-view { grid-template-columns:1fr; }
  .profile-view dt { padding-bottom:.1rem; border-bottom:0; font-weight:750; }
  .profile-view dd { padding-top:0; }
  .admin-member-list .member { grid-template-columns:minmax(0,1fr) auto; }
  .admin-member-list .member > strong,.admin-member-list .member > small,.admin-member-list .member > .groups,.member-role-summary { grid-column:1; }
  .admin-member-list .member > button { grid-column:2; grid-row:1 / 5; }
  .member-editor-panel { inset:0; width:100%; }
  .member-list-toolbar { align-items:stretch; flex-direction:column; }
  .planned-departments { grid-template-columns:1fr; }
  #groups-panel .group-detail { margin-inline:-1rem; padding:1rem; }
  .admin-nav { position: sticky; top: 0; z-index: 3; margin-inline: -.8rem; padding: .55rem .8rem; background: rgba(255,255,255,.96); border-block: 1px solid var(--line); }

  :root { background: #fff; }
  .shell { display: block; width: 100%; min-height: 100svh; padding: 0 0 4.75rem; }
  header { display: none; }
  .card, #boot-panel, #sign-in-panel, #directory-panel, #groups-panel, #settings-panel, #admin-panel { width: 100%; min-height: calc(100svh - 4.75rem); margin: 0; border: 0; border-radius: 0; padding: 1rem; }
  #messages-panel { min-height: calc(100svh - 4.75rem); border: 0; padding-top: 1.1rem; }
  body[data-view="messages"] #messages-panel { width: 100%; border-radius: 0; }
  body[data-view="conversation"] { overflow: hidden; }
  body[data-view="conversation"] .shell { padding-bottom: 0; }
  body[data-view="conversation"] #messages-panel, body[data-view="conversation"] .app-nav { display: none !important; }
  #conversation-panel { width: 100%; height: 100dvh; min-height: 100svh; border: 0; border-radius: 0; }
  .conversation-heading { min-height: calc(64px + env(safe-area-inset-top)); padding: max(.55rem, env(safe-area-inset-top)) .5rem .55rem; grid-template-columns: auto auto minmax(0,1fr) auto; }
  .conversation-back { padding: .4rem .3rem; }
  .back-label { display: inline; font-size: .8rem; }
  .conversation-header-avatar { width: 40px; height: 40px; }
  .messages { padding: .8rem; }
  .message { max-width: 86%; }
  .composer { padding-bottom: max(.65rem, env(safe-area-inset-bottom)); }
  .app-nav { position: fixed; left: 0; right: 0; bottom: 0; width: 100%; height: 4.75rem; display: grid; grid-template-columns: repeat(3, 1fr); transform: none; padding: .35rem .5rem max(.35rem, env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--line); border-radius: 0; background: rgba(255,255,255,.98); }
  .app-nav button { min-height: 54px; }
  .section-heading { align-items: center; }
  .search-row { align-items: stretch; flex-direction: column; }
  .actions { align-items: stretch; }
  .admin-nav { display: grid; grid-template-columns: 1fr 1fr; }
  .conversation-list, .members { margin-left: -1rem; margin-right: -1rem; }
  .conversation-row, .member { padding-left: 1rem; padding-right: 1rem; }
  .dialog-backdrop { align-items: end; padding: 0; }
  .dialog { width: 100%; height: min(78svh, 720px); max-height: calc(100svh - .5rem); padding: .9rem 1rem max(.9rem, env(safe-area-inset-bottom)); border-width: 1px 0 0; border-radius: 1.25rem 1.25rem 0 0; }
  .dialog .section-heading h2 { font-size: 1.2rem; }
  .recipient-results { max-height: none; }
}