:root {
    --ink: #18323f;
    --accent: #e26d3d;
    --paper: #fffefa;
    --canvas: #f2f0ea;
    --line: #d9d5cb;
    --muted: #60727a;
}

html, body { margin: 0; background: var(--canvas); color: var(--ink); font-family: "DM Sans", sans-serif; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .16; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E"); }

.masthead { height: 96px; padding: 0 max(28px, calc((100vw - 1480px) / 2)); display: flex; align-items: center; gap: 18px; background: var(--ink); color: white; border-bottom: 4px solid var(--accent); }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid #88a0aa; font-family: "Newsreader", serif; font-size: 22px; transform: rotate(-3deg); }
.eyebrow { color: #f6cbaf; font-size: 10px; font-weight: 700; letter-spacing: .28em; }
.brand-title { font-family: "Newsreader", serif; font-size: 27px; line-height: 1.1; }
.logout-form { margin-left: 8px; }
.masthead-nav { display: flex; gap: 4px; margin-left: auto; }
.masthead-nav a { padding: 9px 12px; color: #cfdbde; border-bottom: 2px solid transparent; text-decoration: none; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.masthead-nav a:hover { color: white; border-color: var(--accent); }
.tenant-switcher { display: flex; align-items: center; gap: 5px; margin-left: 8px; }
.tenant-switcher select { max-width: 245px; height: 34px; padding: 0 8px; border: 1px solid #76909b; color: white; background: #18323f; font: 600 11px "DM Sans", sans-serif; }
.tenant-switcher button { height: 34px; padding: 0 9px; border: 1px solid #f6cbaf; color: #f6cbaf; background: transparent; cursor: pointer; font: 700 10px "DM Sans", sans-serif; text-transform: uppercase; }
.logout-form button { padding: 8px 12px; border: 1px solid #76909b; color: white; background: transparent; cursor: pointer; font: inherit; font-size: 12px; }
.logout-form button:hover { border-color: #f6cbaf; color: #f6cbaf; }
.workspace { position: relative; max-width: 1480px; margin: 0 auto; padding: 12px 28px 60px; }

.auth-shell { display: grid; grid-template-columns: minmax(320px, .9fr) minmax(360px, 520px); gap: 70px; align-items: center; max-width: 1100px; min-height: calc(100vh - 230px); margin: 0 auto; }
.auth-shell.single { grid-template-columns: minmax(360px, 620px); justify-content: center; }
.auth-story h1 { margin: 10px 0 22px; font-family: "Newsreader", serif; font-size: clamp(50px, 6vw, 86px); font-weight: 500; line-height: .91; letter-spacing: -.04em; }
.auth-story h1 em { color: var(--accent); font-weight: 500; }
.auth-story p { max-width: 420px; color: var(--muted); font-size: 16px; }
.auth-card { position: relative; padding: 38px !important; border: 1px solid var(--line); background: var(--paper) !important; box-shadow: 12px 12px 0 #dcd8ce !important; overflow: hidden; }
.auth-card.wide { width: 100%; }
.auth-card h4 { margin-bottom: 18px; font-family: "Newsreader", serif; font-size: 34px; }
.auth-form { position: relative; display: flex; flex-direction: column; gap: 15px; margin-top: 20px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; color: var(--ink); font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.auth-form input { height: 46px; padding: 0 13px; border: 1px solid #bfc4c2; border-radius: 0; outline: 0; color: var(--ink); background: #fff; font: 500 16px "DM Sans", sans-serif; text-transform: none; }
.auth-form .remember-row { flex-direction: row; align-items: center; gap: 10px; text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 600; color: var(--muted); }
.auth-form .remember-row input { width: 18px; height: 18px; padding: 0; accent-color: var(--accent); }
.auth-form input:focus { border-color: var(--ink); box-shadow: inset 4px 0 var(--accent); }
.auth-form button { display: flex; justify-content: space-between; align-items: center; height: 46px; padding: 0 17px; border: 0; color: white; background: var(--ink); cursor: pointer; font: 600 14px "DM Sans", sans-serif; }
.auth-form button:hover { background: #294754; }
.auth-form button:disabled { opacity: .4; cursor: not-allowed; }
.auth-form button span { color: #f6cbaf; font-size: 21px; }
.auth-form.compact { display: grid; grid-template-columns: 1fr auto; align-items: end; }
.auth-form.compact button { min-width: 170px; }
.auth-card > small { display: block; margin-top: 18px; color: var(--muted); }
.password-rule { padding: 12px; border-left: 4px solid var(--accent); background: #f0ede4; color: var(--muted); font-size: 12px; }
.totp-setup { display: grid; grid-template-columns: 210px 1fr; gap: 20px; align-items: center; margin: 18px 0; }
.totp-setup img { width: 210px; height: 210px; image-rendering: pixelated; }
.totp-setup span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.totp-setup code { display: block; padding: 10px; border: 1px dashed #9ba8ac; background: #f4f2eb; color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }

.intro-strip { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 20px; border: 1px solid var(--line); background: #ebe8df; }
.intro-strip > div { display: grid; grid-template-columns: 42px 1fr; grid-template-rows: auto auto; padding: 13px 18px; border-right: 1px solid var(--line); }
.intro-strip > div:last-child { border: 0; }
.step-index { grid-row: 1 / 3; align-self: center; font-family: "Newsreader", serif; font-size: 25px; color: var(--accent); }
.intro-strip strong { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.intro-strip small { color: var(--muted); }

.work-tabs .mud-tabs-tabbar { background: transparent !important; }
.work-tabs .mud-tab { min-height: 50px; letter-spacing: .04em; }
.work-tabs .mud-tab.mud-tab-active { background: var(--paper); border: 1px solid var(--line); border-bottom-color: var(--paper); }
.work-tabs .mud-tabs-panels { padding: 18px 0 0 !important; }
.two-column { display: grid; grid-template-columns: minmax(300px, 390px) 1fr; gap: 18px; }
.group-import-grid { display: grid; grid-template-columns: minmax(520px, 1.05fr) minmax(380px, .95fr); gap: 18px; }
.editor-card, .catalog-head, .assessment-head, .assessment-sheet { border: 1px solid var(--line); background: var(--paper) !important; padding: 24px; }
.list-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 10px; }
.nowrap-title { white-space: nowrap; }
.link-button { border: 0; padding: 0; color: var(--ink); background: transparent; cursor: pointer; font: inherit; font-weight: 800; text-decoration: underline; text-decoration-color: #d0a894; text-underline-offset: 3px; }
.row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; }
.row-icon-button { display: inline-grid; width: 32px; height: 32px; place-items: center; border-radius: 4px; color: var(--accent); cursor: pointer; }
.row-icon-button:hover { background: #f5e6df; }
.row-icon-button input { display: none; }
.group-table .mud-table-cell { vertical-align: middle; }
.section-kicker { margin-bottom: 6px; color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .2em; }
.editor-card h4 { margin-bottom: 24px; max-width: 310px; font-family: "Newsreader", serif; font-size: 28px; line-height: 1.05; }
.editor-card h4.group-people-title { max-width: none; margin-right: 12px; }
.editor-card .mud-input-control { margin: 7px 0; }
.helper { margin: 6px 0 14px !important; color: var(--muted); font-size: 13px !important; }
.group-helper { min-height: 38px; }
.rule { height: 1px; margin: 28px 0; background: var(--line); }
.file-trigger { display: inline-flex; align-items: center; gap: 9px; padding: 11px 17px; color: white; background: var(--ink); cursor: pointer; font-weight: 600; transition: transform .15s, background .15s; }
.file-trigger:hover { background: #294754; transform: translateY(-1px); }
.file-trigger input { display: none; }
.download-link { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 0 16px; border: 1px solid var(--accent); color: var(--accent); background: transparent; text-decoration: none; font-weight: 700; }
.download-link:hover { background: #fff1e8; color: var(--accent); }
.icon-download { display: inline-grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--accent); color: var(--accent); background: transparent; text-decoration: none; font-size: 23px; }
.icon-download:hover { background: #fff1e8; color: var(--accent); }
.selection-row { display: grid; grid-template-columns: 1fr 1fr 110px; gap: 12px; align-items: start; }
.count-block { display: flex; flex-direction: column; align-items: flex-end; padding-top: 4px; }
.count-block b { font-family: "Newsreader", serif; font-size: 32px; line-height: 1; }
.count-block span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.empty-state { padding: 50px 20px; text-align: center; color: var(--muted); }
.empty-state.spacious { padding: 100px 20px; }
.empty-state.spacious span { display: block; margin-bottom: 12px; font-size: 42px; color: #9cafb5; }

.admin-loading { min-height: 50vh; display: grid; place-content: center; gap: 14px; color: var(--muted); text-align: center; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; }
.admin-loading span { width: 44px; height: 44px; margin: auto; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: admin-spin .8s linear infinite; }
@keyframes admin-spin { to { transform: rotate(360deg); } }
.admin-hero { display: grid; grid-template-columns: 1fr minmax(260px, 360px); gap: 40px; align-items: end; padding: 42px 0 28px; border-bottom: 1px solid var(--ink); }
.admin-hero h1 { margin: 6px 0 0; font: 500 clamp(42px, 5vw, 70px)/.96 "Newsreader", serif; letter-spacing: -.035em; }
.admin-hero h1 em { color: var(--accent); font-weight: 500; }
.admin-scope { padding: 18px 0 4px 22px; border-left: 5px solid var(--accent); }
.admin-scope span, .admin-scope small { display: block; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.admin-scope strong { display: block; margin: 4px 0 8px; font: 600 25px "Newsreader", serif; }
.admin-metrics { display: grid; grid-template-columns: repeat(4, 1fr); margin: 18px 0; border: 1px solid var(--ink); background: var(--ink); gap: 1px; }
.admin-metrics article { position: relative; min-height: 110px; padding: 18px; background: var(--paper); }
.admin-metrics article > span { position: absolute; top: 10px; right: 12px; color: #b4b7b2; font: 500 13px "Newsreader", serif; }
.admin-metrics strong { display: block; font: 500 44px/1 "Newsreader", serif; }
.admin-metrics small { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.admin-ledger-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .7fr); gap: 18px; }
.membership-card { display: grid; grid-template-columns: minmax(220px, .5fr) 1fr; gap: 20px; margin-bottom: 18px; padding: 18px 20px; border: 1px solid var(--line); background: var(--paper); }
.membership-card > div > span { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.membership-card h2 { margin: 2px 0 0; font: 600 24px/1 "Newsreader", serif; }
.membership-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 9px; align-items: end; }
.membership-form label { display: grid; gap: 4px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.membership-form select { height: 39px; min-width: 0; padding: 0 8px; border: 1px solid #bfc4c2; border-radius: 0; background: white; color: var(--ink); font: 500 12px "DM Sans", sans-serif; }
.admin-create-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .7fr); gap: 18px; margin-bottom: 18px; }
.admin-create-card { display: grid; grid-template-columns: minmax(180px, .45fr) 1fr; gap: 20px; padding: 20px; border: 1px solid var(--line); border-top: 4px solid var(--accent); background: #e9e6dd; }
.admin-create-card > div > span { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.admin-create-card h2 { margin: 3px 0 0; font: 600 25px/1 "Newsreader", serif; }
.tenant-create-card { grid-template-columns: 1fr; background: var(--ink); color: white; border-top-color: #f6cbaf; }
.admin-form-grid { display: grid; grid-template-columns: repeat(2, minmax(140px, 1fr)); gap: 10px; }
.admin-form-grid label { display: grid; gap: 4px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.admin-form-grid input, .admin-form-grid select { min-width: 0; height: 39px; padding: 0 10px; border: 1px solid #bfc4c2; border-radius: 0; color: var(--ink); background: white; font: 500 13px "DM Sans", sans-serif; }
.admin-form-grid input:focus, .admin-form-grid select:focus { outline: 0; border-color: var(--ink); box-shadow: inset 3px 0 var(--accent); }
.compact-admin-form { grid-template-columns: 1fr; }
.admin-submit { display: flex; align-items: center; justify-content: space-between; min-height: 39px; align-self: end; padding: 0 13px; border: 0; color: white; background: var(--accent); cursor: pointer; font: 700 12px "DM Sans", sans-serif; }
.admin-submit:hover { background: #bd5128; }
.admin-submit:disabled { opacity: .45; cursor: wait; }
.admin-submit span { font-size: 18px; }
.admin-ledger { border: 1px solid var(--line); background: var(--paper); }
.admin-ledger > header { display: flex; justify-content: space-between; align-items: end; padding: 18px 20px 14px; border-bottom: 3px double var(--ink); }
.admin-ledger header span, .admin-ledger header small { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.admin-ledger h2 { margin: 1px 0 0; font: 600 27px/1 "Newsreader", serif; }
.ledger-table-wrap { overflow-x: auto; }
.ledger-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ledger-table th { padding: 10px 14px; color: var(--muted); background: #ebe8df; text-align: left; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.ledger-table td { padding: 13px 14px; border-top: 1px solid #e8e4da; }
.ledger-table td:first-child small { display: block; color: #99a2a3; }
.ledger-action-cell { text-align: right; }
.ledger-action-cell button, .tenant-line-action button { padding: 5px 7px; border: 1px solid #b9c1c2; color: var(--ink); background: transparent; cursor: pointer; font: 700 9px "DM Sans", sans-serif; text-transform: uppercase; }
.ledger-action-cell button:hover, .tenant-line-action button:hover { border-color: var(--accent); color: var(--accent); }
.role-mark { display: inline-block; padding: 3px 7px; border-left: 3px solid #80949c; background: #e8edef; }
.role-systemadmin { border-color: var(--accent); background: #f8e5d9; }
.role-tenantadmin { border-color: #47745a; background: #e1ece4; }
.ledger-role-select { height: 29px; padding: 0 24px 0 8px; border: 1px solid #9dacad; border-left: 3px solid #47745a; border-radius: 0; color: var(--ink); background: #f7f8f4; font: 700 10px "DM Sans", sans-serif; }
.ledger-role-select:focus { outline: 2px solid #e7ad8f; outline-offset: 1px; }
.ledger-role-select:disabled { opacity: .55; }
.membership-line { display: grid; grid-template-columns: minmax(90px, 1fr) auto 24px; gap: 6px; align-items: center; min-width: 260px; margin: 3px 0; }
.membership-line b { font-size: 11px; }
.membership-remove { width: 24px; height: 24px; padding: 0; border: 1px solid #d4aaa1; color: #8b3d31; background: transparent; cursor: pointer; font-size: 16px; }
.ledger-status { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.ledger-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #9e5a50; }
.ledger-status.on::before { background: #47745a; box-shadow: 0 0 0 3px #dce9df; }
.tenant-line { display: grid; grid-template-columns: 42px 1fr auto; gap: 11px; align-items: center; padding: 15px 18px; border-top: 1px solid #e8e4da; }
.tenant-line:first-of-type { border-top: 0; }
.tenant-monogram { display: grid; width: 40px; height: 40px; place-items: center; color: white; background: var(--ink); font: 600 15px "Newsreader", serif; transform: rotate(-2deg); }
.tenant-line small { display: block; color: var(--muted); font-size: 10px; }
.tenant-line-action { display: grid; justify-items: end; gap: 5px; }
.audit-ledger { margin-top: 18px; }
.audit-stream { display: grid; grid-template-columns: repeat(2, 1fr); }
.audit-stream article { display: grid; grid-template-columns: 82px 10px 1fr auto; gap: 10px; align-items: center; padding: 13px 18px; border-top: 1px solid #e8e4da; border-right: 1px solid #e8e4da; font-size: 11px; }
.audit-stream time, .audit-stream small { color: var(--muted); }
.audit-stream i { width: 8px; height: 8px; border-radius: 50%; background: #a65046; }
.audit-stream i.success { background: #47745a; }
.audit-stream small { display: block; }
.audit-stream article > span { color: var(--muted); font-size: 9px; font-weight: 800; }
.audit-empty { padding: 34px 20px; color: var(--muted); font: italic 18px "Newsreader", serif; }
.import-preview { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.preview-title { display: flex; justify-content: space-between; margin-bottom: 10px; }
.preview-title span { color: var(--muted); font-size: 12px; }
.state-toolbar { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 16px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.state-badge, .usage-badge { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.state-badge.active { color: #276441; background: #dcecdf; }
.state-badge.inactive { color: #8b3d31; background: #f4dfda; }
.usage-badge { margin-left: 6px; color: #52656d; background: #e5eaeb; }
.usage-badge.edit-lock { color: #8b2d2d; background: #f6dede; }
.usage-badge.edit-active { color: #245f38; background: #dcecdf; }

.catalog-head { display: grid; grid-template-columns: minmax(310px, 1fr) auto auto; gap: 12px; align-items: center; margin-bottom: 16px; }
.fab-add { display: inline-flex; align-items: center; gap: 9px; height: 54px; padding: 0 20px 0 14px; border: 0; border-radius: 999px; color: white; background: linear-gradient(135deg, var(--accent), #f09a5d); box-shadow: 0 10px 24px #c65d382e, 4px 4px 0 #d6cabe; cursor: pointer; font: 800 14px "DM Sans", sans-serif; letter-spacing: .03em; }
.fab-add span { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: #ffffff26; font-size: 20px; }
.fab-add:hover { transform: translateY(-1px); box-shadow: 0 13px 26px #c65d3838, 5px 5px 0 #d6cabe; }
.test-admin-bar { display: grid; grid-template-columns: minmax(260px, auto) 1fr auto auto auto; gap: 10px; align-items: center; margin: -4px 0 16px; padding: 12px 16px; border: 1px solid var(--line); border-left: 4px solid var(--accent); background: #f8f6ef !important; }
.catalog-grid { display: grid; grid-template-columns: .85fr .9fr 1.35fr; gap: 16px; }
.cluster-panel { margin-top: 16px; padding: 22px; border: 1px solid var(--line); background: var(--paper) !important; }
.cluster-area-list { display: flex; flex-wrap: wrap; gap: 4px 12px; max-width: 520px; }
.dialog-area-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; margin-top: 8px; }
.cluster-max-preview { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 16px; padding: 12px 14px; border: 1px solid #e4d3c5; background: #fff7f0; }
.cluster-max-preview span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.cluster-max-preview b { color: var(--accent); font-family: "Newsreader", serif; font-size: 24px; }
.threshold-editor-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 8px; }
.cluster-threshold-list { display: grid; gap: 8px; }
.cluster-threshold-row { display: grid; grid-template-columns: 1.2fr .7fr 52px 120px auto; gap: 8px; align-items: center; }
.cluster-threshold-row input[type=color] { width: 48px; height: 42px; border: 1px solid var(--line); background: white; }
.catalog-grid h5 { margin: 0 0 18px; font-family: "Newsreader", serif; font-size: 24px; }
.select-list { display: flex; flex-direction: column; margin: 22px -24px -24px; border-top: 1px solid var(--line); }
.select-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; border-bottom: 1px solid #e7e3da; }
.select-row:hover, .select-row.active { background: #e9eee9; }
.select-row.active { box-shadow: inset 4px 0 var(--accent); font-weight: 700; }
.select-main { display: flex; justify-content: space-between; padding: 14px 18px; border: 0; color: var(--ink); background: transparent; text-align: left; cursor: pointer; font: 600 16px "DM Sans", sans-serif; }
.item-title { display: inline-flex !important; align-items: center; gap: 7px; min-width: 0; background: transparent !important; }
.row-badges { display: inline-flex !important; align-items: center; gap: 6px; background: transparent !important; }
.own-options-icon { display: inline-grid !important; width: 22px !important; height: 22px !important; place-items: center; border-radius: 50%; color: #7b4a2f; background: #f5dccb !important; font-size: 15px !important; }
.select-row:hover .select-main, .select-row.active .select-main { padding-left: 24px; }
.inline-icons { display: inline-flex; align-items: center; padding-right: 8px; }
.order-controls { display: grid; grid-template-rows: 24px 22px 24px; width: 34px; min-height: 72px; place-items: center; border-right: 1px solid #e1ddd3; color: #52656d; font-size: 11px; font-weight: 800; }
.order-controls .mud-icon-button { width: 24px; height: 24px; padding: 2px; }
.order-controls .order-up { grid-row: 1; }
.order-controls .order-down { grid-row: 3; }
.order-controls > span { grid-row: 2; display: grid; min-width: 20px; height: 20px; place-items: center; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1px #cbc5b9; }
.count-badge { display: grid; min-width: 24px; height: 22px; place-items: center; border-radius: 20px; background: #dde4e5; font-size: 11px; }
.edit-box { margin: 22px -8px -8px; padding: 16px 8px 8px; border-top: 1px solid var(--line); }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.compact-fields { display: grid; grid-template-columns: 1.2fr .6fr .65fr; gap: 6px; }
.color-picker-row { display: grid; grid-template-columns: 132px 1fr 58px; gap: 10px; align-items: center; margin: 8px 0 4px; }
.spectrum-picker { display: grid; gap: 6px; color: var(--ink); font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.spectrum-picker input { width: 100%; height: 44px; padding: 2px; border: 1px solid #bfc4c2; background: white; cursor: pointer; }
.color-preview { display: grid; width: 52px; height: 52px; place-items: center; border: 3px solid var(--ink); color: white; font-weight: 800; box-shadow: 4px 4px 0 #d7d3c8; text-shadow: 0 1px 4px #0008; }
.color-swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.color-swatch { width: 34px; height: 34px; border: 2px solid white; border-radius: 50%; box-shadow: 0 0 0 1px #b9b3a8; cursor: pointer; }
.color-swatch.selected { box-shadow: 0 0 0 3px var(--ink); }
.threshold-swatches { grid-column: 1 / -1; margin: -2px 0 4px; }
.option-list { margin-top: 18px; }
.option-list > div { display: grid; grid-template-columns: 16px 36px 1fr 36px auto auto; gap: 8px; align-items: center; padding: 8px 2px; border-top: 1px solid var(--line); font-size: 13px; }
.option-list i { width: 14px; height: 14px; border-radius: 50%; }
.option-list small { color: var(--muted); text-align: right; }

.assessment-head { display: grid; grid-template-columns: 1fr 1fr 1.3fr auto auto; gap: 9px; align-items: center; margin-bottom: 16px; }
.assessment-sheet, .assessment-overview { padding: 0; overflow: hidden; border: 1px solid var(--line); background: var(--paper) !important; }
.assessment-overview { padding: 10px 18px 18px; }
.assessment-table .mud-table-cell { vertical-align: middle; }
.score-pill { display: inline-flex; min-width: 58px; justify-content: center; padding: 5px 10px; border-radius: 999px; color: var(--ink); background: #f6dfcc; font-weight: 800; }
.threshold-pill { display: inline-flex; min-width: 72px; justify-content: center; padding: 5px 10px; border-radius: 999px; font-weight: 800; }
.scissors-icon, .info-icon { display: inline-grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; font-size: 17px; }
.scissors-icon { color: #8b3d31; background: #f4dfda; }
.info-icon { color: #18323f; background: #dce8ec; }
.muted { color: var(--muted); }
.dialog-title { display: flex; flex-direction: column; gap: 2px; }
.dialog-title span { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.dialog-title b { font-family: "Newsreader", serif; font-size: 26px; color: var(--ink); }
.dialog-assessment-sheet { max-height: 68vh; overflow: auto; border: 1px solid var(--line); }
.remark-field { margin-top: 16px !important; }
.exercise-block { border-bottom: 1px solid var(--line); }
.exercise-block > header { display: grid; grid-template-columns: 220px 1fr; align-items: baseline; padding: 18px 24px 10px; background: #e9e6dd; }
.exercise-block > header span { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.exercise-block h3 { margin: 0; font-family: "Newsreader", serif; font-size: 22px; }
.rating-row { display: grid; grid-template-columns: 54px 150px 1fr; align-items: center; min-height: 62px; padding: 7px 24px; border-top: 1px solid #ebe8df; }
.rating-row > b { font-family: "Newsreader", serif; font-size: 22px; }
.rating-row > span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.rating-options { display: flex; flex-wrap: wrap; gap: 8px; }
.rating-option-wrap { position: relative; display: inline-flex; }
.rating-options button { min-width: 54px; height: 38px; padding: 0 13px; border: 3px solid transparent; border-radius: 3px; color: white; background: var(--option); opacity: .58; cursor: pointer; font-weight: 700; transition: opacity .15s, transform .15s, box-shadow .15s; }
.rating-options button:hover { opacity: .85; transform: translateY(-1px); }
.rating-options button.selected { border-color: var(--ink); opacity: 1; box-shadow: 3px 3px 0 #b9b5ab; }
.touch-rating-tooltip { position: absolute; left: 50%; bottom: calc(100% + 9px); z-index: 30; width: max-content; max-width: min(280px, 70vw); padding: 8px 11px; transform: translateX(-50%); border-radius: 3px; color: white; background: #263f4b; box-shadow: 0 5px 16px #172d3660; font-size: 12px; font-weight: 600; line-height: 1.3; pointer-events: none; animation: touch-tooltip-in .12s ease-out; }
.touch-rating-tooltip::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border: 5px solid transparent; border-top-color: #263f4b; }
@keyframes touch-tooltip-in { from { opacity: 0; transform: translate(-50%, 4px); } }
.save-bar { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; background: #f8f6efee; backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.save-bar span { color: var(--muted); font-size: 12px; }

#blazor-error-ui { display: none; position: fixed; inset: auto 0 0; padding: 12px; background: #fff3cd; z-index: 2000; }

@media (max-width: 950px) {
    .workspace { padding: 10px 12px 40px; }
    .intro-strip { display: none; }
    .two-column, .group-import-grid, .catalog-grid { grid-template-columns: 1fr; }
    .catalog-head, .assessment-head { grid-template-columns: 1fr 1fr; }
    .test-admin-bar { grid-template-columns: 1fr 1fr; }
    .selection-row { grid-template-columns: 1fr 1fr; }
    .count-block { display: none; }
    .compact-fields { grid-template-columns: 1fr 1fr; }
    .color-picker-row { grid-template-columns: 120px 1fr 58px; }
    .auth-shell { grid-template-columns: 1fr; gap: 30px; }
    .admin-hero, .admin-ledger-grid, .admin-create-grid { grid-template-columns: 1fr; }
    .membership-card, .membership-form { grid-template-columns: 1fr; }
    .admin-metrics { grid-template-columns: repeat(2, 1fr); }
    .audit-stream { grid-template-columns: 1fr; }
    .auth-story { display: none; }
}

@media (max-width: 600px) {
    .masthead { height: 78px; padding: 0 14px; }
    .brand-mark { width: 42px; height: 42px; }
    .brand-title { font-size: 21px; }
    .eyebrow { font-size: 8px; }
    .masthead-nav { display: none; }
    .tenant-switcher { margin-left: auto; }
    .tenant-switcher select { max-width: 150px; }
    .admin-hero { padding-top: 24px; }
    .admin-hero h1 { font-size: 39px; }
    .admin-metrics { grid-template-columns: 1fr 1fr; }
    .admin-create-card, .admin-form-grid { grid-template-columns: 1fr; }
    .catalog-head, .assessment-head, .selection-row { grid-template-columns: 1fr; }
    .test-admin-bar { grid-template-columns: 1fr; }
    .editor-card { padding: 18px; }
    .editor-card h4.group-people-title { overflow-wrap: anywhere; }
    .group-helper { min-height: 0; }
    .rating-row { grid-template-columns: 42px 1fr; padding: 10px 14px; }
    .rating-row > span { display: none; }
    .exercise-block > header { grid-template-columns: 1fr; }
    .auth-card { padding: 24px !important; box-shadow: 6px 6px 0 #dcd8ce !important; }
    .auth-form.compact, .totp-setup { grid-template-columns: 1fr; }
    .color-picker-row { grid-template-columns: 1fr; }
    .color-preview { width: 100%; }
    .totp-setup img { width: 180px; height: 180px; }
}
