:root {
    --bg: #f6f8f8;
    --surface: #fff;
    --soft: #f4fbfc;
    --line: #d9e8eb;
    --ink: #162327;
    --muted: #64777d;
    --cyan: #67c7dd;
    --cyan-dark: #067a92;
    --cyan-deep: #055e70;
    --green: #087f2e;
    --gold: #9d6f2b;
    --shadow: 0 18px 60px rgba(6, 122, 146, .12);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: var(--ink); background: var(--bg); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
h1, h2, p { margin-top: 0; }
.eyebrow { margin-bottom: 8px; text-transform: uppercase; font-size: 12px; font-weight: 800; color: var(--cyan-dark); }
.login-page { min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .7fr); }
.install-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(140deg, rgba(5,94,112,.10), rgba(8,127,46,.08)); }
.install-card { width: min(520px, 100%); margin: 0; }
.install-card h1 { font-size: 30px; }
.text-center { display: block; text-align: center; }
.login-hero { display: flex; flex-direction: column; justify-content: space-between; padding: 48px 56px; color: #fff; background: linear-gradient(140deg, rgba(5,94,112,.92), rgba(8,127,46,.72)), url("cad-hero.jpg") center / cover; }
.login-hero h1 { max-width: 780px; font-size: clamp(38px, 5vw, 70px); line-height: 1.04; }
.login-title-mobile { display: none; }
.login-hero p:last-child { max-width: 680px; color: rgba(255,255,255,.84); font-size: 20px; line-height: 1.55; }
.login-brand { display: inline-flex; align-items: center; gap: 12px; width: fit-content; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.16); }
.login-logo, .brand-logo, .profile-logo { display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.login-logo { width: 70px; height: 70px; }
.login-logo img, .brand-logo img, .profile-logo img { width: 78%; height: 78%; object-fit: contain; }
.login-card { align-self: center; margin: 32px; display: grid; gap: 16px; padding: 32px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.login-card h2 { margin-bottom: 0; font-size: 28px; line-height: 1.15; }
.login-card > p:not(.eyebrow), .login-card section + p { color: var(--muted); line-height: 1.45; }
label { display: grid; gap: 8px; font-weight: 800; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 12px 13px; }
textarea { min-height: 126px; resize: vertical; }
.primary-action, .ghost-action { border: 0; border-radius: 8px; padding: 11px 14px; font-weight: 900; }
.primary-action { color: #fff; background: var(--cyan-dark); }
.ghost-action { border: 1px solid var(--line); color: var(--cyan-deep); background: var(--soft); }
.danger-action { border-color: rgba(127, 29, 29, .28); color: #7f1d1d; background: #fde8e7; }
.primary-action.danger-action { color: #fff; background: #9f2f2a; }
.portal-shell { min-height: 100vh; display: grid; grid-template-columns: 286px minmax(0, 1fr); transition: grid-template-columns .18s ease; }
.portal-shell.sidebar-collapsed { grid-template-columns: 90px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 14px; padding: 20px; color: #fff; background: linear-gradient(180deg, rgba(5,94,112,.96), rgba(7,93,36,.94)); }
.sidebar-toggle { display: grid; gap: 4px; place-content: center; width: 40px; height: 40px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); cursor: pointer; }
.sidebar-toggle span { display: block; width: 17px; height: 2px; border-radius: 999px; background: var(--cyan-deep); }
.brand { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid rgba(255,255,255,.16); }
.brand small, .user-chip small, .sidebar-note span { display: block; color: rgba(255,255,255,.68); }
.brand-logo { width: 46px; height: 46px; }
.sidebar nav { display: flex; flex-direction: column; align-items: stretch; gap: 8px; width: 100%; overflow: auto; padding-right: 2px; }
.sidebar nav .nav-group { display: flex; flex-direction: column; align-items: stretch; gap: 4px; width: 100%; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.10); }
.sidebar nav .nav-group:first-child { padding-top: 0; border-top: 0; }
.sidebar nav .nav-group-label { display: block; width: 100%; padding: 0 10px 2px; color: rgba(255,255,255,.48); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.sidebar nav .nav-group a { display: block; width: 100%; min-width: 0; padding: 9px 10px; border-radius: 8px; color: rgba(255,255,255,.78); font-weight: 800; font-size: 14px; }
.sidebar nav a.active, .sidebar nav a:hover, .sidebar nav .nav-group a.active, .sidebar nav .nav-group a:hover { color: #fff; background: rgba(103,199,221,.24); }
.sidebar-note { margin-top: auto; padding: 12px; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; background: rgba(255,255,255,.06); }
.portal-shell.sidebar-collapsed .sidebar { align-items: center; padding: 20px 12px; }
.portal-shell.sidebar-collapsed .brand { justify-content: center; width: 100%; padding-bottom: 12px; }
.portal-shell.sidebar-collapsed .brand span:not(.brand-logo), .portal-shell.sidebar-collapsed .sidebar-note { display: none; }
.portal-shell.sidebar-collapsed nav { width: 100%; gap: 6px; }
.portal-shell.sidebar-collapsed .nav-group { gap: 5px; padding-top: 6px; width: 100%; }
.portal-shell.sidebar-collapsed .nav-group-label { display: none; }
.portal-shell.sidebar-collapsed nav a, .portal-shell.sidebar-collapsed nav .nav-group a { position: relative; display: grid; place-items: center; min-height: 42px; padding: 0; font-size: 0; }
.portal-shell.sidebar-collapsed nav a::before { content: attr(data-icon); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: #fff; background: rgba(255,255,255,.12); font-size: 18px; font-weight: 900; line-height: 1; }
.portal-shell.sidebar-collapsed nav a.active::before, .portal-shell.sidebar-collapsed nav a:hover::before { background: rgba(103,199,221,.28); }
.mobile-bottom-nav, .mobile-nav-dialog { display: none; }
.content { min-width: 0; padding: 28px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin-bottom: 0; font-size: 30px; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.user-chip small { color: var(--muted); }
.user-chip a { color: var(--cyan-dark); font-weight: 800; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #fff; background: var(--cyan-deep); font-weight: 900; }
.alert-strip, .panel, .metric, .event-row { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 8px 28px rgba(23,35,30,.06); }
.alert-strip { display: flex; gap: 10px; margin-bottom: 16px; padding: 14px; border-color: rgba(157,111,43,.28); background: #fff9eb; }
.alert-strip.danger { border-color: rgba(191, 55, 45, .35); color: #7f1d1d; background: #fde8e7; }
.alert-strip.danger a { color: #7f1d1d; font-weight: 900; text-decoration: underline; }
.metric::before, .panel::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--cyan); }
.metric-grid, .dashboard-grid, .card-grid, .split-grid { display: grid; gap: 15px; }
.metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 15px; }
.metric { padding: 18px; }
.metric span, .metric small, .panel p, .event-row small { color: var(--muted); }
.metric strong { display: block; margin: 8px 0 5px; color: var(--cyan-deep); font-size: 34px; }
.dashboard-grid { grid-template-columns: minmax(0, 1.5fr) minmax(280px, .75fr); }
.panel { padding: 20px; }
.cockpit-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 15px; }
.cockpit-hero h2 { margin-bottom: 8px; font-size: 28px; }
.cockpit-hero p { margin-bottom: 0; max-width: 720px; line-height: 1.45; }
.quick-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.cockpit-grid { margin-bottom: 15px; }
.cockpit-grid .panel h2 { font-size: 20px; }
.cockpit-list { margin-top: 12px; }
.wide { min-height: 320px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.timeline, .action-list { display: grid; gap: 10px; }
.timeline a, .action-list a { display: block; border: 1px solid var(--line); border-radius: 8px; padding: 13px; background: var(--soft); }
.timeline span { display: block; margin-top: 5px; color: var(--muted); }
.timeline.compact a { padding: 11px; }
.dashboard-lists { margin-top: 15px; }
.card-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.priority::before { background: var(--gold); }
.tag, .status { display: inline-flex; width: fit-content; padding: 5px 9px; border-radius: 999px; color: var(--cyan-deep); background: #dff5fa; font-size: 12px; font-weight: 900; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; min-width: 780px; border-collapse: collapse; }
th, td { padding: 14px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); background: var(--soft); font-size: 13px; }
td small { display: block; margin-top: 4px; color: var(--muted); }
.event-row { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 17px; margin-bottom: 13px; }
.event-row time, .group-code { display: grid; place-items: center; min-height: 58px; border-radius: 8px; color: var(--cyan-deep); background: #dff5fa; font-weight: 900; }
.group-code { width: 42px; min-height: 42px; color: #fff; background: linear-gradient(135deg, var(--cyan-dark), var(--green)); }
.split-grid { grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr); }
.form-panel { display: grid; gap: 14px; }
.form-note { margin-bottom: 0; font-size: 13px; line-height: 1.45; }
.checkbox-label { display: flex; grid-template-columns: none; align-items: center; gap: 10px; font-weight: 800; }
.checkbox-label input { width: auto; }
.attestation-field { align-items: flex-start; margin-top: 12px; border: 1px solid rgba(103, 199, 221, .45); border-radius: 8px; padding: 12px; color: var(--ink); background: #f4fbfd; font-size: 13px; line-height: 1.45; }
.attestation-field input { margin-top: 3px; flex: 0 0 auto; }
.flash { margin-bottom: 16px; border-radius: 8px; padding: 13px 14px; font-weight: 800; }
.flash.success { color: var(--cyan-deep); background: #dff5fa; border: 1px solid rgba(103,199,221,.55); }
.flash.error { color: #872b27; background: #f8dddd; border: 1px solid rgba(191,90,80,.35); }
.admin-summary { margin-bottom: 15px; }
.admin-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 15px; }
.admin-hero h2 { margin-bottom: 8px; font-size: 28px; }
.admin-hero p { margin-bottom: 0; max-width: 720px; line-height: 1.45; }
.admin-hero-status { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.admin-role-panel { margin-bottom: 15px; }
.admin-role-panel details > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; list-style: none; }
.admin-role-panel details > summary::-webkit-details-marker { display: none; }
.admin-role-panel details[open] > summary { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.admin-role-panel h2 { margin-bottom: 0; }
.role-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.role-card-grid .detail-item p { margin-bottom: 0; line-height: 1.45; }
.admin-user-toolbar input { max-width: 300px; }
.organization-permission-box { margin-top: 14px; }
.organization-permission-box .panel-head label { min-width: 220px; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin-top: 12px; }
.admin-user-table table { min-width: 980px; }
.admin-user-table tr.is-selected { background: #eef9fb; }
.billing-overview { margin: 4px 0 18px; padding-top: 4px; }
.billing-overview .table-wrap { margin-top: 4px; }
.billing-overview form { margin: 0; }
.invoice-readiness { margin-bottom: 18px; }
.invoice-settings-panel details > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; list-style: none; }
.invoice-settings-panel details > summary::-webkit-details-marker { display: none; }
.invoice-settings-panel details[open] > summary { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.invoice-settings-form { margin-top: 0; }
.reason-list { display: grid; gap: 5px; }
.reason-list span { display: block; color: var(--muted); line-height: 1.35; }
.table-action { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--cyan-deep); background: var(--soft); font-size: 12px; font-weight: 900; white-space: nowrap; }
.user-admin-grid { grid-template-columns: minmax(320px, .75fr) minmax(0, 1.4fr); }
.member-admin-grid { grid-template-columns: minmax(320px, .7fr) minmax(0, 1.55fr); }
.document-admin-grid { grid-template-columns: minmax(320px, .68fr) minmax(0, 1.6fr); }
.compact-table table { min-width: 860px; }
.user-edit-list { display: grid; gap: 12px; }
.user-edit-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: var(--soft); }
.user-edit-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.user-edit-actions { display: flex; align-items: end; justify-content: space-between; gap: 10px; }
.user-edit-card > form + form { margin-top: 10px; }
.member-toolbar { align-items: flex-start; }
.toolbar-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.toolbar-actions form { margin: 0; }
.select-table tbody tr { cursor: pointer; }
.select-table tbody tr:hover { background: var(--soft); }
.select-table tbody tr.is-archived { color: var(--muted); background: #f4f6f7; }
.select-table input[type="radio"] { width: 18px; height: 18px; }
.member-dialog { width: min(780px, calc(100vw - 32px)); border: 0; border-radius: 8px; padding: 0; box-shadow: 0 22px 80px rgba(5, 94, 112, .25); }
.member-dialog::backdrop { background: rgba(10, 26, 31, .48); }
.dialog-card { padding: 22px; background: #fff; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin-bottom: 0; }
.dialog-close { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 8px; color: var(--cyan-deep); background: var(--soft); font-size: 24px; line-height: 1; cursor: pointer; }
.dialog-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.month-year-fields { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(110px, .8fr); gap: 12px; }
.month-year-fields label { min-width: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.document-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.group-cockpit-lists { margin-top: 16px; }
.document-detail-grid h3 { margin: 0 0 10px; font-size: 16px; }
.section-head-inline { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-head-inline h3 { margin-bottom: 0; }
#groupMemberVisibilityForm { display: none; margin: 0; }
#groupMemberVisibilityForm button { padding: 8px 10px; font-size: 12px; }
.group-section + .group-section { margin-top: 22px; }
.group-section h3 { margin: 0 0 12px; font-size: 18px; }
.group-card-grid { align-items: stretch; }
.group-card { position: relative; align-content: space-between; gap: 13px; min-height: 260px; cursor: pointer; }
.group-card.is-selected { border-color: rgba(6, 122, 146, .55); box-shadow: 0 0 0 2px rgba(103, 199, 221, .25); }
.group-card-radio { position: absolute; top: 12px; right: 12px; width: 18px; height: 18px; }
.group-card-head { display: flex; align-items: center; gap: 12px; padding-right: 28px; }
.group-card-head strong { display: block; font-size: 18px; line-height: 1.25; }
.group-card p { margin-bottom: 0; color: var(--muted); line-height: 1.45; }
.group-card-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.group-card-meta span, .group-card-next { display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 8px; padding: 9px; background: #fff; }
.group-card-meta strong { color: var(--cyan-deep); font-size: 18px; line-height: 1; }
.group-card-meta small, .group-card-next small { color: var(--muted); font-size: 12px; }
.group-card-next strong { font-size: 14px; }
.vendor-card-grid { align-items: stretch; }
.vendor-card { position: relative; align-content: space-between; gap: 13px; min-height: 260px; cursor: pointer; }
.vendor-card.is-selected { border-color: rgba(6, 122, 146, .55); box-shadow: 0 0 0 2px rgba(103, 199, 221, .25); }
.vendor-card-radio { position: absolute; top: 12px; right: 12px; width: 18px; height: 18px; }
.vendor-card > div:first-of-type { padding-right: 28px; }
.vendor-card strong { font-size: 18px; line-height: 1.25; }
.vendor-card p { margin-bottom: 0; color: var(--muted); line-height: 1.45; }
.vendor-condition { display: grid; gap: 3px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fff; }
.vendor-condition small { color: var(--muted); font-weight: 900; }
.vendor-condition strong { color: var(--cyan-deep); font-size: 15px; }
.vendor-filters { justify-content: flex-start; margin-bottom: 14px; }
.vendor-filters input { max-width: 420px; }
.vendor-filters select { width: auto; min-width: 220px; }
.vendor-list table { min-width: 1100px; }
.vendor-row { cursor: pointer; }
.vendor-row.is-selected { background: #eef9fb; }
.vendor-row.is-archived { opacity: .72; }
.vendor-row td { vertical-align: top; }
.vendor-list .select-table .vendor-row td:first-child { width: 70px; }
.vendor-row strong { display: block; color: var(--ink); line-height: 1.25; }
.vendor-row small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; margin-top: 4px; }
.vendor-row .status { width: max-content; max-width: 100%; white-space: nowrap; }
.vendor-row.is-general-offer { background: #fbfdfd; }
.vendor-row td:last-child { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.genetics-list table { min-width: 1040px; }
.genetics-row td { vertical-align: top; }
.genetics-row strong { display: block; color: var(--ink); line-height: 1.25; }
.genetics-row small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; margin-top: 4px; }
.genetics-row .inline-actions { justify-content: flex-start; gap: 6px; }
.genetics-row .ghost-action { padding: 7px 9px; }
.network-panel.is-hidden { display: none; }
.network-card { align-content: space-between; min-height: 210px; }
.network-card.is-muted { opacity: .65; background: #f1f4f5; }
.network-card p { margin-bottom: 0; line-height: 1.45; }
.network-tab.is-active { border-color: var(--cyan-dark); color: #fff; background: var(--cyan-dark); }
.network-thread-layout { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.4fr); gap: 16px; align-items: start; }
.network-thread-list { display: grid; gap: 9px; max-height: 680px; overflow: auto; padding-right: 4px; }
.network-thread-item { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); text-decoration: none; }
.network-thread-item:hover, .network-thread-item.is-active { border-color: rgba(6, 122, 146, .45); background: #eef9fb; }
.network-thread-item.is-unread { border-left: 4px solid var(--cyan-dark); }
.network-thread-item strong { line-height: 1.25; }
.network-thread-item small, .network-thread-item span, .network-thread-item p { color: var(--muted); font-size: 13px; line-height: 1.35; margin: 0; }
.network-thread-detail { min-width: 0; }
.network-message-stream { display: grid; gap: 10px; max-height: 540px; overflow: auto; padding: 2px 4px 12px; }
.network-message-bubble { display: grid; gap: 6px; max-width: 82%; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.network-message-bubble.is-mine { justify-self: end; background: #e5f8fc; border-color: rgba(6, 122, 146, .25); }
.network-message-bubble small { color: var(--muted); line-height: 1.35; }
.network-message-bubble p { margin: 0; line-height: 1.5; }
.network-reply-form { display: grid; gap: 10px; margin-top: 14px; }
.detail-list { display: grid; gap: 10px; max-height: 340px; overflow: auto; }
.detail-item { display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 11px; background: var(--soft); }
.detail-item small { color: var(--muted); line-height: 1.35; }
.cannathek-featured .detail-item { align-content: space-between; min-height: 190px; }
.cannathek-featured .detail-item strong { color: var(--ink); font-size: 20px; line-height: 1.25; }
.cannathek-featured .detail-item p:not(.eyebrow) { margin-bottom: 0; color: var(--muted); line-height: 1.45; }
.cannathek-searchbar { justify-content: flex-start; margin-bottom: 12px; }
.cannathek-searchbar input { max-width: 520px; }
.news-filters { justify-content: flex-start; margin-bottom: 12px; }
.news-filters input { max-width: 420px; }
.news-filters select { width: auto; min-width: 170px; }
.cannathek-tabs { justify-content: flex-start; margin-bottom: 14px; }
.cannathek-tab.is-active { border-color: var(--cyan-dark); color: #fff; background: var(--cyan-dark); }
.cannathek-tab-panel.is-hidden { display: none; }
.cannathek-filters { justify-content: flex-start; margin-bottom: 12px; }
.cannathek-filters select { width: auto; min-width: 180px; }
tr.is-selected { background: #eef9fb; }
.article-read-body { margin-top: 16px; white-space: pre-line; line-height: 1.58; }
.knowledge-card { cursor: pointer; }
.knowledge-card.is-selected { border-color: rgba(6, 122, 146, .55); box-shadow: 0 0 0 2px rgba(103, 199, 221, .25); }
.history-data { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 6px; font-size: 13px; line-height: 1.45; }
.history-data p { margin: 0; }
.inline-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.inline-actions input { min-width: 180px; width: auto; }
.member-edit-list { display: grid; gap: 12px; max-height: 78vh; overflow: auto; padding-right: 4px; }
.member-edit-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: var(--soft); }
.member-edit-card.is-archived { opacity: .72; background: #f1f4f5; }
.member-edit-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.member-edit-title { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 4px; }
.member-edit-title strong { font-size: 18px; }
.member-edit-actions { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.member-archive-form { display: flex; justify-content: flex-end; margin-top: 10px; }
.wide-field { grid-column: 1 / -1; }
.section-label { align-self: end; margin-top: 6px; color: var(--cyan-deep); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.status.warning { color: #7a4b04; background: #fff0c7; }
.status.danger { color: #7f1d1d; background: #fde8e7; }
.status.success { color: #075d24; background: #dff6e8; }
.status.muted { color: var(--muted); background: #edf3f4; }
.trust-result { display: grid; grid-template-columns: 54px 1fr; gap: 16px; align-items: start; margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.trust-light { width: 44px; height: 44px; border-radius: 50%; box-shadow: inset 0 0 0 4px rgba(255,255,255,.7), 0 8px 22px rgba(10,26,31,.12); }
.trust-green .trust-light { background: #1f9d55; }
.trust-yellow .trust-light { background: #f2b705; }
.trust-red .trust-light { background: #d64545; }
.trust-green { border-color: rgba(31,157,85,.35); }
.trust-yellow { border-color: rgba(242,183,5,.45); }
.trust-red { border-color: rgba(214,69,69,.4); }
.profile-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.profile-hero-main { display: flex; align-items: center; gap: 16px; min-width: 0; }
.profile-hero-main h2 { margin-bottom: 8px; }
.profile-logo { width: 82px; height: 82px; flex: 0 0 auto; }
.status-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.profile-overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.profile-data-list { display: grid; gap: 10px; margin: 0; }
.profile-data-list div { display: grid; grid-template-columns: minmax(0, 155px) minmax(0, 1fr); gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.profile-data-list div:last-child { border-bottom: 0; padding-bottom: 0; }
.profile-data-list dt { min-width: 0; max-width: 100%; color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; overflow-wrap: anywhere; word-break: break-word; hyphens: auto; line-height: 1.25; white-space: normal; }
.profile-data-list dd { min-width: 0; margin: 0; font-weight: 800; overflow-wrap: anywhere; }
.wide-dialog { width: min(980px, calc(100vw - 32px)); }
.review-drawer summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; list-style: none; }
.review-drawer summary::-webkit-details-marker { display: none; }
.review-drawer summary strong { display: block; margin-top: 2px; font-size: 20px; }
.review-drawer[open] summary { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.table-logo { display: inline-grid; place-items: center; width: 34px; height: 34px; margin-right: 8px; vertical-align: middle; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.table-logo img { width: 80%; height: 80%; object-fit: contain; }
.change-logo-preview { display: grid; place-items: center; width: 70px; height: 70px; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.change-logo-preview img { width: 82%; height: 82%; object-fit: contain; }
.change-logo-preview.small { width: 46px; height: 46px; margin-top: 0; }
.change-diff-list { display: grid; gap: 8px; min-width: 360px; }
.change-diff-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: start; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.change-diff-row > span { min-width: 0; overflow-wrap: anywhere; }
.change-diff-row small { margin-bottom: 3px; font-weight: 900; color: var(--muted); }
.approval-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.approval-column { display: grid; align-content: start; gap: 10px; min-width: 0; }
.approval-column h3 { margin: 0; font-size: 17px; }
.approval-item { display: grid; gap: 5px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.approval-item strong, .approval-item span, .approval-item small { min-width: 0; overflow-wrap: anywhere; }
.approval-item span, .approval-item small { color: var(--muted); }
@media (max-width: 1100px) { .metric-grid, .card-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } .card-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) {
    .login-page, .portal-shell, .portal-shell.sidebar-collapsed, .dashboard-grid, .split-grid, .profile-overview-grid, .user-edit-form, .member-edit-form, .dialog-form-grid, .month-year-fields, .document-detail-grid, .history-data, .approval-board { grid-template-columns: 1fr; }
    .login-page { display: flex; flex-direction: column; justify-content: center; gap: 14px; min-height: 100vh; min-height: 100svh; padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(5,94,112,.96), rgba(7,93,36,.90)), url("cad-hero.jpg") center / cover; }
    .login-hero { display: grid; gap: 14px; justify-content: stretch; padding: 0; color: #fff; background: transparent; }
    .login-brand { width: 100%; padding: 10px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(8px); }
    .login-logo { width: 52px; height: 52px; }
    .login-brand span:last-child { min-width: 0; color: #fff; font-size: 17px; font-weight: 900; line-height: 1.2; }
    .login-hero > div:last-child { display: grid; gap: 4px; max-width: 520px; }
    .login-title-desktop { display: none; }
    .login-title-mobile { display: inline; }
    .login-hero .eyebrow { margin-bottom: 0; color: rgba(255,255,255,.70); font-size: 10px; letter-spacing: 0; }
    .login-hero h1 { max-width: 520px; margin-bottom: 0; font-size: 25px; line-height: 1.12; }
    .login-hero > div:last-child > p:not(.eyebrow) { display: none; }
    .login-card { align-self: stretch; width: min(460px, 100%); margin: 0 auto; gap: 14px; padding: 22px; border-color: rgba(217,232,235,.85); border-radius: 8px; box-shadow: 0 18px 50px rgba(5,94,112,.22); }
    .login-card h2 { font-size: 25px; }
    .login-card .eyebrow { margin-bottom: 0; font-size: 10px; }
    .login-card label { gap: 7px; font-size: 14px; }
    .login-card input { min-height: 50px; padding: 13px 14px; font-size: 16px; }
    .login-card .primary-action, .login-card .ghost-action { display: grid; place-items: center; min-height: 50px; padding: 12px 14px; text-align: center; }
    .login-card .ghost-action { background: #fff; }
    .login-card .flash { margin-bottom: 2px; }
    .portal-shell, .portal-shell.sidebar-collapsed { display: block; min-height: 100vh; }
    .sidebar, .portal-shell.sidebar-collapsed .sidebar { display: none; }
    .mobile-bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(217,232,235,.9); background: rgba(255,255,255,.97); box-shadow: 0 -12px 30px rgba(5,94,112,.12); }
    .mobile-bottom-nav a, .mobile-bottom-nav button { display: grid; justify-items: center; align-content: center; gap: 3px; min-width: 0; min-height: 56px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 900; }
    .mobile-bottom-nav span { display: grid; place-items: center; width: 28px; height: 25px; border-radius: 8px; color: var(--cyan-deep); background: var(--soft); }
    .mobile-bottom-nav svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
    .mobile-bottom-nav small { display: block; max-width: 100%; color: inherit; font-size: 10px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .mobile-bottom-nav a.active { color: #fff; background: var(--cyan-dark); }
    .mobile-bottom-nav a.active span { color: #fff; background: rgba(255,255,255,.18); }
    .mobile-nav-dialog[open] { position: fixed; inset: auto 0 0 0; z-index: 80; display: block; width: 100%; max-width: none; max-height: calc(100vh - 28px); margin: 0; border: 0; border-radius: 16px 16px 0 0; padding: 0; color: #fff; background: linear-gradient(180deg, rgba(5,94,112,.98), rgba(7,93,36,.97)); box-shadow: 0 -18px 70px rgba(5,94,112,.28); }
    .mobile-nav-dialog::backdrop { background: rgba(10,26,31,.45); }
    .mobile-nav-sheet { display: grid; gap: 10px; max-height: calc(100vh - 28px); overflow: auto; padding: 14px 14px calc(20px + env(safe-area-inset-bottom)); }
    .mobile-nav-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -14px -14px 4px; padding: 14px; border-bottom: 1px solid rgba(255,255,255,.14); background: rgba(5,94,112,.98); }
    .mobile-nav-head strong { display: block; font-size: 18px; }
    .mobile-nav-head small { display: block; margin-top: 3px; color: rgba(255,255,255,.68); }
    .mobile-nav-head button { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.16); border-radius: 8px; color: #fff; background: rgba(255,255,255,.08); font-size: 24px; line-height: 1; }
    .mobile-nav-group { display: grid; gap: 4px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.10); }
    .mobile-nav-group:first-of-type { border-top: 0; padding-top: 0; }
    .mobile-nav-group > span { padding: 0 10px 2px; color: rgba(255,255,255,.48); font-size: 10px; font-weight: 900; text-transform: uppercase; }
    .mobile-nav-group a { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: center; gap: 9px; min-height: 39px; border: 0; border-radius: 8px; padding: 6px 10px; color: rgba(255,255,255,.80); background: transparent; }
    .mobile-nav-group a.active, .mobile-nav-group a:hover { color: #fff; background: rgba(103,199,221,.24); }
    .mobile-nav-group svg { display: block; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
    .mobile-nav-group a svg { justify-self: center; box-sizing: content-box; width: 17px; height: 17px; border-radius: 8px; padding: 6px; background: rgba(255,255,255,.10); }
    .mobile-nav-group a.active svg, .mobile-nav-group a:hover svg { background: rgba(255,255,255,.16); }
    .mobile-nav-group strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .mobile-nav-logout { display: block; margin-top: 4px; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; padding: 11px 12px; color: #fff; background: rgba(255,255,255,.08); text-align: center; font-weight: 900; }
    .content { padding: 18px 18px 96px; }
    .topbar, .member-toolbar, .cockpit-hero { align-items: stretch; flex-direction: column; }
    .admin-hero { align-items: stretch; flex-direction: column; }
    .admin-hero-status { justify-content: flex-start; }
    .role-card-grid, .permission-grid { grid-template-columns: 1fr; }
    .admin-role-panel details > summary { align-items: stretch; flex-direction: column; }
    .admin-user-toolbar input { max-width: none; }
    .topbar-actions { justify-content: space-between; }
    .sidebar-toggle { display: none; }
    .user-chip { min-width: 0; }
    .toolbar-actions, .dialog-actions, .quick-actions { justify-content: stretch; }
    .toolbar-actions > *, .toolbar-actions button, .dialog-actions button, .quick-actions > * { width: 100%; }
    .network-thread-layout { grid-template-columns: 1fr; }
    .network-thread-list { max-height: none; overflow: visible; padding-right: 0; }
    .network-message-stream { max-height: none; overflow: visible; }
    .network-message-bubble { max-width: 100%; }
    .cockpit-hero { gap: 14px; margin-bottom: 12px; padding: 18px; }
    .cockpit-hero::before { height: 4px; }
    .cockpit-hero .eyebrow { margin-bottom: 5px; font-size: 10px; }
    .cockpit-hero h2 { margin-bottom: 6px; font-size: 23px; line-height: 1.15; }
    .cockpit-hero p { font-size: 14px; line-height: 1.4; }
    .quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .quick-actions .primary-action, .quick-actions .ghost-action { display: grid; place-items: center; min-height: 56px; padding: 10px; text-align: center; line-height: 1.18; }
    .quick-actions .primary-action:first-child { grid-column: 1 / -1; min-height: 48px; }
    .cockpit-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 12px; }
    .cockpit-grid .panel { padding: 15px; }
    .cockpit-grid .panel h2 { margin-bottom: 8px; font-size: 18px; }
    .cockpit-list { gap: 7px; margin-top: 8px; }
    .cockpit-list div { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 8px; padding-bottom: 7px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 12px; }
    .metric { min-height: 108px; padding: 14px; }
    .metric span { font-size: 12px; font-weight: 900; line-height: 1.25; }
    .metric strong { margin: 7px 0 3px; font-size: 25px; line-height: 1; }
    .metric small { font-size: 12px; line-height: 1.3; }
    .dashboard-grid { gap: 12px; }
    .dashboard-grid .wide { min-height: 0; }
    .dashboard-grid .panel-head { align-items: stretch; flex-direction: column; margin-bottom: 12px; }
    .dashboard-grid .panel-head .ghost-action { width: 100%; text-align: center; }
    .timeline, .action-list { gap: 8px; }
    .timeline a, .action-list a { padding: 11px; }
    .timeline a strong { display: block; line-height: 1.25; }
    .timeline span { margin-top: 4px; font-size: 12px; line-height: 1.35; }
    .dashboard-lists { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }
    .profile-hero, .profile-hero-main, .review-drawer summary { align-items: stretch; flex-direction: column; }
    .profile-data-list div { grid-template-columns: 1fr; gap: 4px; }
    .member-edit-list { max-height: none; }
    table { min-width: 720px; }
}
@media (max-width: 620px) {
    .content { padding: 18px; }
    .content { padding-bottom: 96px; }
    .login-page { justify-content: flex-start; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom)); }
    .login-brand { padding: 8px; }
    .login-logo { width: 46px; height: 46px; }
    .login-hero h1 { font-size: 22px; }
    .login-card { width: 100%; margin: 0; padding: 18px; border-radius: 8px; box-shadow: 0 14px 42px rgba(5,94,112,.20); }
    .login-card h2 { font-size: 23px; }
    .card-grid.three, .card-grid.four, .event-row { grid-template-columns: 1fr; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric:nth-child(n+5) { display: none; }
    .panel { padding: 16px; }
    .topbar h1 { font-size: 24px; }
    .sidebar nav { grid-template-columns: 1fr; }
    .user-chip { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; }
    .user-chip strong, .user-chip small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .member-dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
    .dialog-card { padding: 16px; }
    .change-diff-list { min-width: 280px; }
    .change-diff-row { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .login-page {
        position: relative;
        isolation: isolate;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 0;
        min-height: 100vh;
        min-height: 100svh;
        padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
        background: #f4fbfc;
    }
    .login-page::before {
        content: "";
        position: fixed;
        inset: 0 0 auto 0;
        z-index: -1;
        height: 210px;
        background:
            linear-gradient(145deg, rgba(5,94,112,.94), rgba(8,127,46,.82)),
            url("cad-hero.jpg") center / cover;
    }
    .login-hero {
        display: block;
        width: min(430px, 100%);
        padding: 0;
        color: var(--ink);
        background: transparent;
    }
    .login-brand {
        width: fit-content;
        max-width: 100%;
        margin: 0 auto 18px;
        padding: 0;
        gap: 10px;
        border: 0;
        border-radius: 0;
        background: transparent;
        color: #fff;
        backdrop-filter: none;
    }
    .login-logo {
        width: 48px;
        height: 48px;
        border-color: rgba(255,255,255,.55);
        box-shadow: 0 10px 26px rgba(5,94,112,.22);
    }
    .login-brand span:last-child {
        color: #fff;
        font-size: 16px;
        font-weight: 900;
        line-height: 1.15;
        text-shadow: 0 1px 12px rgba(5,94,112,.24);
    }
    .login-hero > div:last-child {
        display: none;
    }
    .login-card {
        width: min(430px, 100%);
        margin: 0;
        gap: 13px;
        padding: 22px;
        border: 1px solid rgba(217,232,235,.92);
        border-radius: 8px;
        background: rgba(255,255,255,.98);
        box-shadow: 0 18px 42px rgba(5,94,112,.18);
    }
    .login-card .eyebrow {
        margin-bottom: -3px;
        color: var(--cyan-dark);
        font-size: 10px;
        letter-spacing: 0;
    }
    .login-card h2 {
        font-size: 24px;
        line-height: 1.12;
    }
    .login-card label {
        gap: 7px;
        font-size: 13px;
    }
    .login-card input {
        min-height: 48px;
        padding: 12px 13px;
        border-radius: 8px;
        font-size: 16px;
        background: #fff;
    }
    .login-card .primary-action,
    .login-card .ghost-action {
        display: grid;
        place-items: center;
        width: 100%;
        min-height: 48px;
        padding: 11px 13px;
        text-align: center;
    }
    .login-card .ghost-action {
        color: var(--cyan-deep);
        background: #fff;
    }
    .login-card .flash {
        margin-bottom: 0;
        padding: 11px 12px;
        font-size: 13px;
        line-height: 1.35;
    }
}

@media (max-width: 480px) {
    .login-page {
        padding: max(18px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom));
    }
    .login-page::before {
        height: 176px;
    }
    .login-brand {
        margin-bottom: 14px;
    }
    .login-logo {
        width: 42px;
        height: 42px;
    }
    .login-brand span:last-child {
        font-size: 15px;
    }
    .login-card {
        padding: 18px;
        gap: 12px;
    }
    .login-card h2 {
        font-size: 22px;
    }
}
