:root {
  color-scheme: light;
  --navy: #102a43;
  --navy-2: #183b56;
  --blue: #1d4ed8;
  --cyan: #0891b2;
  --teal: #0f766e;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #dbe4ee;
  --surface: #ffffff;
  --soft: #f3f7fb;
  --danger: #b42318;
  --shadow: 0 16px 42px rgba(16, 42, 67, 0.1);
  font-family: "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #eef4f8; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: linear-gradient(145deg, #edf4f8 0%, #f9fbfd 58%, #eef7f7 100%); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.ambient { position: fixed; border-radius: 50%; filter: blur(2px); pointer-events: none; opacity: .35; }
.ambient-one { width: 420px; height: 420px; right: -180px; top: -160px; background: radial-gradient(circle, #7dd3fc, transparent 70%); }
.ambient-two { width: 360px; height: 360px; left: -180px; bottom: -160px; background: radial-gradient(circle, #5eead4, transparent 70%); }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; position: relative; z-index: 1; }
.login-panel { width: min(450px, 100%); padding: 48px; background: rgba(255,255,255,.9); border: 1px solid rgba(203,213,225,.85); border-radius: 24px; box-shadow: 0 30px 80px rgba(16,42,67,.16); backdrop-filter: blur(18px); text-align: center; }
.brand-mark { width: 62px; height: 62px; margin: 0 auto 20px; display: grid; place-items: center; border-radius: 18px 6px 18px 6px; background: linear-gradient(135deg, var(--navy), var(--cyan)); color: #fff; box-shadow: 0 10px 24px rgba(8,145,178,.25); transform: rotate(-2deg); }
.brand-mark span { font-weight: 800; letter-spacing: -.04em; transform: rotate(2deg); }
.brand-mark.small { width: 42px; height: 42px; margin: 0; border-radius: 13px 4px 13px 4px; flex: 0 0 auto; }
.login-panel h1 { color: var(--navy); font-size: 29px; margin: 5px 0 10px; letter-spacing: -.03em; }
.eyebrow { color: var(--cyan); font-size: 11px; letter-spacing: .16em; font-weight: 800; text-transform: uppercase; margin: 0; }
.muted { color: var(--muted); line-height: 1.7; }
.login-form { margin-top: 28px; text-align: left; }
.login-form label, .field-grid label > span { display: block; color: var(--navy); font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.password-row { display: flex; border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; transition: .2s; }
.password-row:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(8,145,178,.09); }
.password-row input { border: 0; outline: 0; flex: 1; min-width: 0; padding: 13px 14px; color: var(--ink); }
.icon-button { border: 0; background: transparent; color: var(--blue); padding: 0 14px; font-size: 12px; font-weight: 700; }
.primary-button { border: 0; border-radius: 12px; background: linear-gradient(135deg, var(--blue), #0e7490); color: #fff; padding: 13px 20px; font-weight: 750; display: inline-flex; align-items: center; justify-content: center; gap: 14px; box-shadow: 0 10px 22px rgba(29,78,216,.2); transition: transform .2s, box-shadow .2s; }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(29,78,216,.26); }
.primary-button:disabled { opacity: .6; cursor: wait; transform: none; }
.wide { width: 100%; margin-top: 18px; }
.login-note { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; display: flex; align-items: center; justify-content: center; gap: 8px; line-height: 1.5; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 4px rgba(16,185,129,.12); flex: 0 0 auto; }
.form-error { color: var(--danger); min-height: 20px; font-size: 12px; margin: 10px 0 0; line-height: 1.5; }
.form-error.center { text-align: center; font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px 1fr; position: relative; z-index: 1; }
.sidebar { position: sticky; top: 0; height: 100vh; background: linear-gradient(175deg, #0b2239, #123d52 68%, #0c4a4a); color: #fff; padding: 28px 20px 22px; display: flex; flex-direction: column; box-shadow: 8px 0 30px rgba(15,23,42,.09); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 28px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand div:last-child { display: flex; flex-direction: column; gap: 3px; }
.brand strong { font-size: 16px; }
.brand span { color: #a7c4d2; font-size: 11px; }
nav { margin-top: 24px; display: grid; gap: 7px; }
.nav-item { width: 100%; border: 0; background: transparent; color: #b7cbd7; border-radius: 10px; padding: 11px 13px; display: flex; align-items: center; gap: 12px; text-align: left; font-weight: 650; transition: .2s; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: linear-gradient(100deg, rgba(14,165,233,.24), rgba(45,212,191,.12)); color: #fff; box-shadow: inset 3px 0 #22d3ee; }
.nav-icon { width: 22px; font-size: 18px; text-align: center; }
.sidebar-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); }
.engine-state { display: flex; align-items: center; gap: 10px; padding: 6px; }
.engine-state div { display: flex; flex-direction: column; gap: 2px; }
.engine-state strong { font-size: 12px; }
.engine-state small { color: #9fb9c7; font-size: 10px; }
.text-button { margin-top: 12px; width: 100%; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.04); color: #cbdbe4; border-radius: 9px; padding: 8px; font-size: 12px; }

.main { min-width: 0; padding: 0 38px 48px; }
.topbar { height: 112px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(203,213,225,.75); }
.topbar h1 { margin: 6px 0 0; color: var(--navy); font-size: 25px; letter-spacing: -.03em; }
.topbar-badge { color: var(--teal); border: 1px solid #99f6e4; background: #ecfdf5; border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 700; }
.view { display: none; padding-top: 30px; }
.view.active { display: block; }
.intro-grid { display: grid; grid-template-columns: minmax(280px, 1.4fr) repeat(3, minmax(150px, .6fr)); gap: 15px; align-items: stretch; margin-bottom: 20px; }
.intro-grid > div:first-child { padding: 4px 20px 4px 0; }
.intro-grid h2 { color: var(--navy); margin: 0 0 9px; font-size: 21px; line-height: 1.35; }
.intro-grid p { color: var(--muted); margin: 0; font-size: 13px; line-height: 1.7; }
.security-pill { display: flex; align-items: center; gap: 11px; padding: 15px; background: rgba(255,255,255,.75); border: 1px solid var(--line); border-radius: 14px; }
.security-pill > span { color: var(--cyan); font-size: 11px; font-weight: 800; border: 1px solid #bae6fd; background: #ecfeff; border-radius: 8px; padding: 6px; }
.security-pill div { display: flex; flex-direction: column; gap: 4px; }
.security-pill strong { color: var(--navy); font-size: 12px; }
.security-pill small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.panel { background: rgba(255,255,255,.91); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 24px rgba(16,42,67,.05); padding: 23px; margin-bottom: 17px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.panel-heading > div { display: flex; align-items: center; gap: 10px; }
.panel h3, .panel-heading h3 { margin: 0; color: var(--navy); font-size: 16px; }
.step { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; background: var(--navy); color: #fff; font-size: 12px; font-weight: 800; }
.hint { color: var(--muted); font-size: 11px; }
.upload-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.folder-upload-layout { display: grid; grid-template-columns: minmax(300px, .95fr) minmax(360px, 1.4fr); gap: 18px; }
.folder-drop-zone { min-height: 210px; }
.folder-summary { border: 1px solid var(--line); border-radius: 14px; background: #f8fbfd; padding: 15px; display: grid; gap: 9px; }
.folder-summary > div { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 13px; border: 1px solid #dbe4ee; border-radius: 10px; background: #fff; }
.folder-summary b { color: var(--navy); font-size: 13px; }
.folder-summary span { color: var(--muted); font-size: 11px; }
.folder-summary > div.ready { border-color: #5eead4; background: #f0fdfa; }
.folder-summary > div.ready span { color: var(--teal); font-weight: 700; }
.folder-summary p { margin: 2px 3px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.drop-zone { position: relative; min-height: 177px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border: 1.5px dashed #a8bdcc; background: linear-gradient(145deg, #fbfdff, #f4f8fb); border-radius: 14px; cursor: pointer; transition: .2s; padding: 18px; text-align: center; overflow: hidden; }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--cyan); background: #f0fdff; transform: translateY(-1px); }
.drop-zone.selected { border-style: solid; border-color: #5eead4; background: #f0fdfa; }
.drop-zone input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--navy); color: #fff; font-size: 16px; font-weight: 800; box-shadow: 0 8px 16px rgba(16,42,67,.15); }
.drop-zone:nth-child(2) .file-icon { background: var(--blue); }
.drop-zone:nth-child(3) .file-icon { background: var(--teal); }
.drop-zone strong { color: var(--navy); font-size: 14px; }
.file-prompt { color: var(--muted); font-size: 11px; }
.file-name { width: 100%; color: var(--blue); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.field-grid input, .field-grid select { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: #fbfdff; color: var(--ink); outline: 0; padding: 11px 12px; transition: .2s; }
.field-grid input:focus, .field-grid select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(8,145,178,.08); background: #fff; }
.archive-selector { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(130px, .6fr); }
.archive-selector label { min-width: 0; }
#viewArchiveDocuments { color: var(--teal); width: auto; padding-left: 0; text-align: left; }
#viewArchiveDocuments:disabled { color: var(--muted); }
.archive-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 24px; margin: 0 0 24px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.archive-facts dt { color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.archive-facts dd { margin: 0; color: var(--navy); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.archive-document-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.archive-document { min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #fbfdff; }
.archive-document > div { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.archive-document strong { font-size: 13px; color: var(--navy); }
.archive-document-state { font-size: 11px; white-space: nowrap; color: #9a6700; }
.archive-document.ready { border-color: #bce5df; background: #f5fbf9; }
.archive-document.ready .archive-document-state { color: var(--teal); }
.archive-document a, .archive-document small { display: block; font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.archive-document a { color: #176b80; text-underline-offset: 3px; }
.archive-document small { color: var(--muted); }
.archive-status { margin: 18px 0 10px; border-radius: 10px; padding: 13px 16px; font-size: 13px; line-height: 1.6; }
.archive-status.ready { background: #e9f7f2; color: #16634e; }
.archive-status.attention { background: #fff6e7; color: #855816; }
.field-grid small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.submit-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border-radius: 15px; background: linear-gradient(110deg, #102a43, #164e63); color: #fff; box-shadow: var(--shadow); }
.submit-bar > div { display: flex; flex-direction: column; gap: 4px; }
.submit-bar strong { font-size: 14px; }
.submit-bar span { color: #c7dce7; font-size: 11px; }
.submit-bar .primary-button { background: linear-gradient(135deg, #0ea5e9, #14b8a6); white-space: nowrap; }
.submit-bar .primary-button span { color: #fff; font-size: 13px; }
.submit-bar .archive-submit-actions { flex-direction: row; flex-wrap: wrap; gap: 12px; flex-shrink: 0; }
.archive-submit-actions .secondary-button { white-space: nowrap; }
.archive-submit-actions [hidden], #regenerateHint[hidden] { display: none; }

.processing { min-height: 510px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.processing h2 { color: var(--navy); margin: 12px 0 8px; }
.processing p:not(.eyebrow) { color: var(--muted); font-size: 13px; }
.loader { display: flex; gap: 7px; margin-bottom: 22px; }
.loader span { width: 11px; height: 11px; background: var(--cyan); border-radius: 50%; animation: bounce 1.25s infinite ease-in-out; }
.loader span:nth-child(2) { animation-delay: .15s; }
.loader span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,80%,100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }
.progress { width: min(520px, 80%); height: 7px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin: 25px 0 16px; }
.progress i { display: block; height: 100%; width: 35%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #22d3ee, #14b8a6); animation: progress 2.2s infinite ease-in-out; }
@keyframes progress { 0% { transform: translateX(-110%); } 100% { transform: translateX(320%); } }
.process-steps { width: min(600px, 92%); display: flex; justify-content: space-between; color: #94a3b8; font-size: 11px; }
.process-steps .active { color: var(--blue); font-weight: 700; }

.result-hero { display: grid; grid-template-columns: 210px 1fr; gap: 24px; align-items: center; padding: 27px; border-radius: 19px; color: #fff; background: linear-gradient(135deg, #102a43, #0e7490 72%, #0f766e); box-shadow: var(--shadow); }
.score-ring { --score: 85; width: 155px; height: 155px; margin: auto; border-radius: 50%; background: conic-gradient(#5eead4 calc(var(--score) * 1%), rgba(255,255,255,.16) 0); display: grid; place-items: center; position: relative; }
.score-ring::before { content: ""; position: absolute; inset: 12px; background: #12384d; border-radius: 50%; }
.score-ring div { position: relative; text-align: center; display: flex; flex-direction: column; }
.score-ring strong { font-size: 34px; line-height: 1; }
.score-ring span { color: #bae6fd; font-size: 11px; margin-top: 7px; }
.result-copy .eyebrow { color: #67e8f9; }
.result-copy h2 { margin: 8px 0; font-size: 25px; }
.result-copy p { color: #c9e3eb; font-size: 13px; line-height: 1.7; }
.result-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.result-badges span { padding: 7px 10px; border-radius: 8px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.12); font-size: 11px; }
.result-actions { display: flex; gap: 10px; margin-top: 18px; }
.download-button, .new-button { display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; padding: 11px 15px; text-decoration: none; font-size: 12px; font-weight: 750; }
.download-button { background: #fff; color: var(--navy); }
.download-button.secondary-download { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.3); }
.new-button { border: 1px solid rgba(255,255,255,.25); color: #fff; background: transparent; }
.result-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 17px; margin-top: 17px; }
.dimension-list { display: grid; gap: 15px; margin-top: 17px; }
.dimension-row { display: grid; grid-template-columns: 145px 1fr 42px; gap: 12px; align-items: center; }
.dimension-row span { color: var(--navy); font-size: 12px; font-weight: 650; }
.dimension-row b { color: var(--navy); font-size: 12px; text-align: right; }
.bar { height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.bar i { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.check-list, .risk-list { display: grid; gap: 10px; margin-top: 15px; }
.check-item, .risk-item { padding: 12px; border: 1px solid var(--line); background: #fbfdff; border-radius: 10px; }
.check-item div, .risk-item div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.check-item strong, .risk-item strong { color: var(--navy); font-size: 12px; }
.check-item p, .risk-item p { color: var(--muted); font-size: 11px; margin: 6px 0 0; line-height: 1.5; }
.tag { border-radius: 999px; padding: 4px 7px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.tag.pass { color: #047857; background: #d1fae5; }
.tag.warn { color: #b45309; background: #fef3c7; }
.tag.risk { color: #b42318; background: #fee2e2; }
.warning-box { margin-top: 17px; padding: 15px; border: 1px solid #fed7aa; background: #fff7ed; border-radius: 12px; color: #9a3412; font-size: 11px; line-height: 1.7; }
.warning-box strong { display: block; margin-bottom: 4px; }

.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.section-heading h2 { color: var(--navy); margin: 0 0 7px; font-size: 22px; }
.section-heading p { color: var(--muted); margin: 0; font-size: 13px; }
.tax-section-heading { align-items: flex-end; }
.tax-section-heading .eyebrow { margin-bottom: 7px; }
.tax-safety-badge { flex: 0 0 auto; padding: 8px 12px; border: 1px solid #99f6e4; border-radius: 999px; color: #0f766e; background: #ecfdf5; font-size: 11px; font-weight: 750; }
.tax-safety-notice { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 17px; padding: 16px 18px; border: 1px solid #a7f3d0; border-radius: 14px; background: linear-gradient(105deg, #ecfdf5, #f0fdfa); }
.tax-shield { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px 4px 11px 4px; color: #fff; background: var(--teal); font-weight: 900; }
.tax-safety-notice strong { color: #065f46; font-size: 12px; }
.tax-safety-notice p { margin: 4px 0 0; color: #3f5f59; font-size: 11px; line-height: 1.65; }
.tax-flow-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.tax-flow-card { display: grid; grid-template-columns: auto 1fr; gap: 14px; min-height: 190px; margin-bottom: 17px; }
.tax-step-number { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: linear-gradient(135deg, var(--navy), var(--cyan)); font-size: 11px; font-weight: 850; }
.tax-flow-card h3 { margin-top: 2px; }
.tax-flow-card p { min-height: 58px; margin: 9px 0 16px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.tax-action { display: inline-flex; width: fit-content; text-decoration: none; }
.tax-workspace { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr); gap: 17px; align-items: start; }
.tax-import-panel, .tax-history-panel { margin-bottom: 17px; }
.tax-json-drop { min-height: 165px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 20px; border: 1.5px dashed #a8bdcc; border-radius: 14px; background: linear-gradient(145deg, #fbfdff, #f4f8fb); text-align: center; cursor: pointer; transition: .2s; }
.tax-json-drop:hover, .tax-json-drop.dragover { border-color: var(--cyan); background: #f0fdff; }
.tax-json-drop.selected { border-style: solid; border-color: #5eead4; background: #f0fdfa; }
.tax-json-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.tax-file-icon { padding: 8px 10px; border-radius: 9px; color: #fff; background: var(--navy); font-size: 10px; font-weight: 850; letter-spacing: .08em; }
.tax-json-drop strong { color: var(--navy); font-size: 12px; }
.tax-json-drop span:last-child { color: var(--blue); font-size: 10px; }
.tax-consent { display: flex; gap: 9px; align-items: flex-start; margin-top: 14px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.tax-consent input { margin-top: 2px; accent-color: var(--teal); }
.tax-import-actions { display: flex; gap: 13px; align-items: center; margin-top: 14px; }
.tax-import-actions > span { color: var(--muted); font-size: 9px; line-height: 1.45; }
.tax-profile-history { display: grid; gap: 8px; max-height: 315px; overflow-y: auto; }
.tax-history-item { width: 100%; display: flex; flex-direction: column; gap: 4px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fbfdff; text-align: left; }
.tax-history-item:hover { border-color: #67e8f9; background: #ecfeff; }
.tax-history-item strong { color: var(--navy); font-size: 11px; }
.tax-history-item span { color: var(--blue); font-size: 9px; overflow-wrap: anywhere; }
.tax-history-item small, .tax-history-empty { color: var(--muted); font-size: 9px; }
.tax-history-empty { padding: 45px 12px; border: 1px dashed var(--line); border-radius: 10px; text-align: center; }
.tax-profile-result { scroll-margin-top: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.94); box-shadow: 0 12px 30px rgba(16,42,67,.07); }
.tax-profile-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px; border-bottom: 1px solid var(--line); background: linear-gradient(110deg, #f0f9ff, #f0fdfa); }
.tax-profile-hero h2 { margin: 7px 0 5px; color: var(--navy); font-size: 20px; }
.tax-profile-hero p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 10px; }
.tax-profile-tabs { display: flex; gap: 4px; padding: 10px 14px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tax-profile-tab { min-width: max-content; padding: 11px 14px; border: 0; border-bottom: 3px solid transparent; color: var(--muted); background: transparent; font-size: 11px; font-weight: 750; }
.tax-profile-tab.active { color: var(--blue); border-bottom-color: #3b82f6; }
.tax-profile-fields { padding: 20px 22px 24px; }
.tax-field-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.tax-field-heading strong { color: var(--navy); font-size: 12px; }
.tax-field-heading span { color: var(--muted); font-size: 9px; }
.tax-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.tax-field-row { min-width: 0; display: grid; grid-template-columns: minmax(130px, .42fr) minmax(0, 1fr); margin: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tax-field-row dt, .tax-field-row dd { min-width: 0; margin: 0; padding: 11px 12px; overflow-wrap: anywhere; font-size: 10px; line-height: 1.55; }
.tax-field-row dt { color: var(--muted); background: #f8fafc; }
.tax-field-row dd { color: var(--ink); background: #fff; }
.tax-field-row.empty dd { color: #94a3b8; }
.secondary-button { border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 10px; padding: 9px 13px; font-weight: 700; font-size: 12px; }
.history-list { display: grid; gap: 10px; }
.history-item { background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 13px; padding: 16px 18px; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 20px; transition: .2s; }
.history-item:hover { box-shadow: 0 9px 22px rgba(16,42,67,.07); transform: translateY(-1px); }
.history-company strong { display: block; color: var(--navy); font-size: 14px; margin-bottom: 5px; }
.history-company span { color: var(--muted); font-size: 11px; }
.history-score { text-align: center; }
.history-score strong { color: var(--blue); font-size: 19px; }
.history-score span { display: block; color: var(--muted); font-size: 9px; }
.history-link { color: var(--blue); text-decoration: none; border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 8px; padding: 8px 10px; font-size: 11px; font-weight: 700; }
.history-open { cursor: pointer; }
.history-links { display: flex; gap: 7px; }
.tax-enterprise-detail { display: grid; gap: 16px; margin-top: 22px; }
.tax-enterprise-detail[hidden] { display: none; }
.tax-enterprise-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.tax-enterprise-heading h2 { margin: 4px 0 6px; color: var(--navy); }
.tax-enterprise-heading p { margin: 0; color: var(--muted); }
.tax-enterprise-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tax-document-facts { margin: 0; }
.tax-document-facts div { display: grid; grid-template-columns: 155px minmax(0, 1fr); gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.tax-document-facts dt { color: var(--muted); }
.tax-document-facts dd { margin: 0; overflow-wrap: anywhere; }
.tax-document-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
.tax-document-link { display: flex; min-width: 0; flex-direction: column; gap: 4px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; background: #f8fbff; color: var(--blue); text-decoration: none; font-size: 12px; }
.tax-document-link span { overflow-wrap: anywhere; }
.tax-document-link small { color: var(--muted); font-size: 10px; }
.tax-report-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.tax-report-main { min-width: 0; overflow-wrap: anywhere; }
.tax-report-missing { margin-top: 7px; color: var(--muted); }
.tax-report-missing summary { width: fit-content; color: var(--blue); cursor: pointer; }
.tax-report-missing ul { margin: 7px 0 0; padding-left: 18px; line-height: 1.7; }
.empty-state { padding: 80px 20px; text-align: center; color: var(--muted); background: rgba(255,255,255,.7); border: 1px dashed #cbd5e1; border-radius: 14px; }
.rule-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.rule-layout .panel { margin: 0; }
.rule-layout .full { grid-column: 1 / -1; }
.weight-list { display: grid; gap: 13px; margin-top: 18px; }
.weight-list div { display: grid; grid-template-columns: 1fr auto; gap: 7px; color: var(--navy); font-size: 12px; }
.weight-list b { color: var(--blue); }
.weight-list i { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--cyan) var(--w), #e2e8f0 var(--w)); }
.principle-list { list-style: none; padding: 0; margin: 17px 0 0; display: grid; gap: 13px; }
.principle-list li { display: flex; flex-direction: column; gap: 4px; padding-left: 12px; border-left: 3px solid #67e8f9; }
.principle-list strong { color: var(--navy); font-size: 12px; }
.principle-list span { color: var(--muted); font-size: 11px; line-height: 1.55; }
.boundary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.boundary-grid div { padding: 16px; border-radius: 11px; background: var(--soft); border: 1px solid var(--line); }
.boundary-grid b { color: var(--navy); font-size: 12px; }
.boundary-grid p { color: var(--muted); font-size: 11px; line-height: 1.65; margin: 7px 0 0; }

.governance-badge { color: #075985; border: 1px solid #bae6fd; background: #f0f9ff; border-radius: 999px; padding: 8px 12px; font-size: 11px; font-weight: 750; }
.expert-lock { display: grid; grid-template-columns: 1fr minmax(360px, .85fr); gap: 34px; align-items: center; padding: 32px; }
.expert-lock-copy { display: flex; align-items: flex-start; gap: 18px; }
.expert-lock-copy h3 { margin: 2px 0 8px; font-size: 20px; }
.expert-lock-copy p { color: var(--muted); margin: 0; line-height: 1.7; font-size: 12px; }
.expert-shield { width: 52px; height: 52px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 16px 5px 16px 5px; color: #fff; font-size: 23px; background: linear-gradient(135deg, var(--navy), var(--cyan)); box-shadow: 0 12px 24px rgba(8,145,178,.2); }
.expert-login-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.expert-login-form label > span, .draft-form label > span, .change-note-field > span { display: block; color: var(--navy); font-size: 11px; font-weight: 750; margin-bottom: 7px; }
.expert-login-form input, .draft-form input, .draft-form textarea, .change-note-field textarea, .rule-field input, .rule-field select { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: #fbfdff; color: var(--ink); padding: 9px 10px; outline: 0; }
.expert-login-form input:focus, .draft-form input:focus, .draft-form textarea:focus, .change-note-field textarea:focus, .rule-field input:focus, .rule-field select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(8,145,178,.08); background: #fff; }
.expert-login-form .form-error { grid-column: 1 / -1; }
.governance-flow { display: grid; grid-template-columns: repeat(9, auto); align-items: center; justify-content: space-between; gap: 10px; padding: 15px 18px; margin-bottom: 17px; border: 1px solid #bae6fd; border-radius: 14px; background: linear-gradient(100deg, rgba(239,246,255,.94), rgba(240,253,250,.94)); }
.governance-flow div { display: flex; align-items: center; gap: 8px; }
.governance-flow b { color: var(--cyan); font-size: 11px; }
.governance-flow span { color: var(--navy); font-size: 11px; font-weight: 700; white-space: nowrap; }
.governance-flow i { color: #94a3b8; font-style: normal; }
.expert-workspace { display: grid; grid-template-columns: 285px minmax(0, 1fr); gap: 17px; align-items: start; }
.expert-sidebar-stack, .expert-editor-stack { display: grid; gap: 17px; }
.compact-panel { padding: 18px; }
.draft-form { display: grid; gap: 10px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.draft-form textarea, .change-note-field textarea { resize: vertical; }
.wide-button { width: 100%; }
.rule-set-list { display: grid; gap: 8px; margin-top: 15px; max-height: 580px; overflow-y: auto; padding-right: 3px; }
.rule-set-item { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fbfdff; padding: 11px; text-align: left; transition: .2s; }
.rule-set-item:hover, .rule-set-item.active { border-color: #67e8f9; background: #ecfeff; }
.rule-set-item.active { box-shadow: inset 3px 0 var(--cyan); }
.rule-set-item header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.rule-set-item strong { color: var(--navy); font-size: 12px; overflow-wrap: anywhere; }
.rule-set-item small { display: block; color: var(--muted); font-size: 9px; line-height: 1.5; margin-top: 6px; }
.status-chip, .revision-chip { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; font-size: 9px; font-weight: 800; }
.status-chip.published { color: #047857; background: #d1fae5; }
.status-chip.draft { color: #1d4ed8; background: #dbeafe; }
.status-chip.archived { color: #64748b; background: #e2e8f0; }
.revision-chip { color: #6d28d9; background: #ede9fe; }
.rule-editor-panel { padding: 21px; }
.rule-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.rule-version-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.rule-version-line h3 { font-size: 18px; }
.checksum-line { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; margin: 7px 0 0; overflow-wrap: anywhere; }
.formula-boundary { display: flex; flex-direction: column; gap: 4px; margin: 15px 0; padding: 12px 14px; border-left: 3px solid #0ea5e9; background: #f0f9ff; border-radius: 0 9px 9px 0; }
.formula-boundary strong { color: var(--navy); font-size: 11px; }
.formula-boundary span { color: var(--muted); font-size: 10px; line-height: 1.55; }
.rule-structured-editor { display: grid; gap: 15px; }
.rule-group { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.rule-group > header { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 11px 14px; background: #f6f9fc; border-bottom: 1px solid var(--line); }
.rule-group > header h4 { color: var(--navy); margin: 0; font-size: 12px; }
.rule-group > header span { color: var(--muted); font-size: 9px; }
.rule-group-body { padding: 13px; display: grid; gap: 11px; }
.rule-field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.rule-field-grid.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.rule-field { min-width: 0; }
.rule-field label, .rule-field > span { display: block; color: var(--muted); font-size: 9px; line-height: 1.4; margin-bottom: 5px; }
.rule-field input { font-size: 11px; padding: 8px; }
.rule-field input:disabled { color: #64748b; background: #f1f5f9; cursor: not-allowed; }
.band-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.band-table th { color: var(--muted); background: #f8fafc; font-size: 9px; text-align: left; padding: 7px; }
.band-table td { border-top: 1px solid #edf2f7; padding: 6px 7px; }
.band-table input { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 7px; color: var(--ink); font-size: 10px; }
.change-note-field { display: block; margin-top: 16px; }
.rule-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.accent-button { color: #075985; border-color: #7dd3fc; background: #f0f9ff; }
.danger-outline { color: #b42318; border-color: #fecaca; background: #fff7f7; }
.test-summary { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: center; }
.test-score { padding: 18px; border-radius: 13px; color: #fff; text-align: center; background: linear-gradient(135deg, var(--navy), var(--teal)); }
.test-score strong { display: block; font-size: 26px; }
.test-score span { font-size: 10px; color: #ccfbf1; }
.test-checks { display: grid; gap: 7px; }
.test-check { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid #d1fae5; border-radius: 8px; background: #f0fdf4; }
.test-check strong { color: #065f46; font-size: 10px; }
.test-check span { color: #64748b; font-size: 9px; text-align: right; }
.audit-list { display: grid; gap: 8px; max-height: 330px; overflow-y: auto; }
.audit-item { display: grid; grid-template-columns: 120px 1fr auto; gap: 12px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfdff; }
.audit-item time { color: var(--muted); font-size: 9px; }
.audit-item strong { color: var(--navy); display: block; font-size: 10px; }
.audit-item p { color: var(--muted); margin: 3px 0 0; font-size: 9px; line-height: 1.5; }
.audit-item code { color: var(--blue); font-size: 9px; }

.expert-rule-tabs { display: inline-flex; gap: 4px; margin-bottom: 17px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.72); }
.expert-rule-tab { min-width: 118px; border: 0; border-radius: 9px; padding: 10px 16px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 750; }
.expert-rule-tab.active { color: #fff; background: linear-gradient(135deg, var(--navy), #0e7490); box-shadow: 0 7px 16px rgba(16,42,67,.16); }
.expert-rule-panel { display: none; }
.expert-rule-panel.active { display: block; }
.text-rule-intro { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 18px; margin-bottom: 17px; border: 1px solid #bae6fd; border-radius: 14px; background: linear-gradient(100deg, rgba(239,246,255,.94), rgba(240,253,250,.94)); }
.text-rule-intro > div { display: flex; flex-direction: column; gap: 5px; }
.text-rule-intro strong { color: var(--navy); font-size: 12px; }
.text-rule-intro span:not(.governance-badge) { color: var(--muted); font-size: 10px; line-height: 1.5; }
.text-rule-form { display: grid; gap: 12px; }
.text-rule-form label > span, .text-rule-card label > span, .inline-text-field > span { display: block; margin-bottom: 6px; color: var(--navy); font-size: 9px; font-weight: 750; }
.text-rule-form input, .text-rule-form textarea, .text-rule-card input, .text-rule-card textarea, .chat-compose textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; outline: 0; resize: vertical; color: var(--ink); background: #fbfdff; font-size: 10px; line-height: 1.55; }
.text-rule-form input:focus, .text-rule-form textarea:focus, .text-rule-card input:focus, .text-rule-card textarea:focus, .chat-compose textarea:focus { border-color: var(--cyan); background: #fff; box-shadow: 0 0 0 3px rgba(8,145,178,.08); }
.text-rule-form input:disabled, .text-rule-form textarea:disabled, .text-rule-card input:disabled, .text-rule-card textarea:disabled, .chat-compose textarea:disabled { color: #64748b; background: #f1f5f9; cursor: not-allowed; }
.text-rule-two, .rating-text-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.rating-text-grid { grid-template-columns: repeat(4, 1fr); }
.text-rule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.text-rule-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.text-rule-card { min-width: 0; padding: 12px; border: 1px solid #e3ebf2; border-radius: 10px; background: #fbfdff; }
.text-rule-card h5 { margin: 0 0 10px; color: var(--navy); font-size: 10px; }
.text-rule-card label { display: block; margin-top: 9px; }
.risk-state-block { padding-top: 10px; margin-top: 10px; border-top: 1px dashed #d8e3ec; }
.risk-state-block > strong { color: var(--cyan); font-size: 9px; }
.assistant-orb { width: 29px; height: 29px; display: inline-grid; place-items: center; flex: 0 0 auto; border-radius: 10px 3px 10px 3px; color: #fff; background: linear-gradient(135deg, var(--blue), var(--teal)); font-size: 12px; font-weight: 850; box-shadow: 0 6px 14px rgba(8,145,178,.18); }
.text-assistant-panel .panel-heading > div, .report-chat-heading > div { align-items: center; }
.text-assistant-panel .panel-heading p, .report-chat-heading p { margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.chat-messages { display: grid; gap: 11px; max-height: 420px; overflow-y: auto; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(145deg, #f8fbfd, #f3f8fa); }
.compact-chat { min-height: 150px; max-height: 310px; }
.chat-empty { align-self: center; padding: 25px 12px; text-align: center; color: var(--muted); font-size: 10px; line-height: 1.6; }
.chat-welcome { display: flex; gap: 11px; align-items: center; padding: 10px; color: var(--navy); }
.chat-welcome p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.chat-message { display: flex; align-items: flex-start; gap: 8px; }
.chat-message > span { width: 25px; height: 25px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; color: #fff; background: var(--navy); font-size: 9px; font-weight: 800; }
.chat-message > div { max-width: min(82%, 760px); padding: 9px 11px; border: 1px solid #dbe7ef; border-radius: 4px 11px 11px 11px; background: #fff; box-shadow: 0 3px 9px rgba(16,42,67,.04); }
.chat-message.user { flex-direction: row-reverse; }
.chat-message.user > span { background: var(--teal); }
.chat-message.user > div { border-color: #a7f3d0; border-radius: 11px 4px 11px 11px; background: #ecfdf5; }
.chat-message p { margin: 0; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 10px; line-height: 1.65; }
.chat-message small { display: block; margin-top: 6px; color: var(--muted); font-size: 8px; line-height: 1.5; }
.chat-message em { display: block; margin-top: 6px; color: var(--cyan); font-size: 8px; font-style: normal; font-weight: 700; }
.chat-message.pending { opacity: .72; }
.proposal-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 11px; padding: 11px 13px; border: 1px solid #7dd3fc; border-radius: 10px; background: #f0f9ff; }
.proposal-bar > div { display: flex; flex-direction: column; gap: 3px; }
.proposal-bar strong { color: var(--navy); font-size: 10px; }
.proposal-bar span { color: var(--muted); font-size: 9px; line-height: 1.5; }
.chat-compose { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-top: 11px; }
.chat-compose textarea { min-height: 58px; font-size: 11px; }
.chat-compose .primary-button { min-height: 44px; white-space: nowrap; }
.text-test-summary { grid-template-columns: minmax(240px, .75fr) 1.25fr; }
.text-sample-copy { text-align: left; }
.text-sample-copy strong { font-size: 12px; margin-bottom: 8px; }
.text-sample-copy span { display: block; line-height: 1.6; }
.report-chat-panel { margin-top: 17px; }
.report-chat-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.report-chat-heading > div { display: flex; gap: 10px; }
.report-chat-heading h3 { margin: 0; }
.chat-scope { padding: 6px 9px; border: 1px solid #99f6e4; border-radius: 999px; color: var(--teal); background: #ecfdf5; font-size: 9px; font-weight: 750; }
.report-chat-messages { min-height: 220px; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.chat-suggestions button { border: 1px solid #bfdbfe; border-radius: 999px; padding: 7px 10px; color: var(--blue); background: #eff6ff; font-size: 9px; }
.chat-suggestions button:hover { border-color: #60a5fa; background: #dbeafe; }

@media (max-width: 1100px) {
  .intro-grid { grid-template-columns: 1fr 1fr 1fr; }
  .intro-grid > div:first-child { grid-column: 1 / -1; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .expert-workspace { grid-template-columns: 245px minmax(0, 1fr); }
  .rule-field-grid.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .text-rule-grid.three { grid-template-columns: 1fr 1fr; }
  .rating-text-grid { grid-template-columns: 1fr 1fr; }
  .tax-flow-grid { grid-template-columns: 1fr; }
  .tax-flow-card { min-height: 0; }
  .tax-flow-card p { min-height: 0; }
}
@media (max-width: 820px) {
  .archive-selector, .archive-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .archive-selector label:nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
  .tax-enterprise-grid, .tax-document-list { grid-template-columns: 1fr; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 15px 18px; flex-direction: row; align-items: center; gap: 15px; overflow-x: auto; }
  .brand { border: 0; padding: 0; min-width: 175px; }
  .brand div:last-child span { display: none; }
  .sidebar nav { margin: 0; display: flex; gap: 5px; }
  .nav-item { width: auto; white-space: nowrap; padding: 9px 11px; }
  .sidebar-foot { border: 0; padding: 0; margin: 0 0 0 auto; }
  .engine-state { display: none; }
  .text-button { margin: 0; width: auto; white-space: nowrap; }
  .main { padding: 0 18px 38px; }
  .topbar { height: 92px; }
  .intro-grid { grid-template-columns: 1fr; }
  .intro-grid > div:first-child { grid-column: auto; }
  .security-pill { display: none; }
  .upload-grid { grid-template-columns: 1fr; }
  .folder-upload-layout { grid-template-columns: 1fr; }
  .drop-zone { min-height: 140px; }
  .result-grid, .rule-layout { grid-template-columns: 1fr; }
  .rule-layout .full { grid-column: auto; }
  .boundary-grid { grid-template-columns: 1fr; }
  .expert-lock { grid-template-columns: 1fr; }
  .expert-workspace { grid-template-columns: 1fr; }
  .governance-flow { display: flex; overflow-x: auto; justify-content: flex-start; }
  .governance-flow div { min-width: max-content; }
  .rule-field-grid { grid-template-columns: 1fr 1fr; }
  .text-rule-grid, .text-rule-grid.three { grid-template-columns: 1fr; }
  .tax-workspace { grid-template-columns: 1fr; }
  .tax-field-grid { grid-template-columns: 1fr; }
}
@media (max-width: 570px) {
  .archive-facts, .archive-document-grid { grid-template-columns: 1fr; }
  .login-panel { padding: 34px 24px; }
  .brand div:last-child { display: none; }
  .sidebar { gap: 8px; }
  .nav-item { font-size: 0; }
  .nav-icon { font-size: 18px; }
  .topbar-badge { display: none; }
  .field-grid { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  .panel-heading { align-items: flex-start; }
  .panel-heading .hint { display: none; }
  .submit-bar { align-items: stretch; flex-direction: column; }
  .result-hero { grid-template-columns: 1fr; text-align: center; }
  .result-badges, .result-actions { justify-content: center; }
  .dimension-row { grid-template-columns: 110px 1fr 35px; }
  .history-item { grid-template-columns: 1fr auto; }
  .history-links { grid-column: 1 / -1; }
  .history-link { flex: 1; text-align: center; }
  .expert-login-form { grid-template-columns: 1fr; }
  .expert-login-form .form-error { grid-column: auto; }
  .rule-editor-head { flex-direction: column; }
  .rule-field-grid, .rule-field-grid.six { grid-template-columns: 1fr; }
  .test-summary { grid-template-columns: 1fr; }
  .audit-item { grid-template-columns: 1fr; }
  .expert-rule-tabs { width: 100%; }
  .expert-rule-tab { flex: 1; min-width: 0; }
  .text-rule-intro, .proposal-bar, .report-chat-heading { align-items: flex-start; flex-direction: column; }
  .text-rule-two, .rating-text-grid { grid-template-columns: 1fr; }
  .chat-compose { grid-template-columns: 1fr; }
  .chat-compose .primary-button { width: 100%; }
  .chat-message > div { max-width: 88%; }
  .text-test-summary { grid-template-columns: 1fr; }
  .tax-section-heading, .tax-profile-hero, .tax-import-actions { align-items: flex-start; flex-direction: column; }
  .tax-flow-card { grid-template-columns: 1fr; }
  .tax-field-row { grid-template-columns: 120px minmax(0, 1fr); }
}

/* Persisted enterprise facts browser. */
.enterprise-data-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 22px; align-items: start; }
.enterprise-data-companies { position: sticky; top: 24px; padding: 20px; max-height: calc(100vh - 60px); overflow: auto; }
.enterprise-data-companies label, .enterprise-data-toolbar label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 650; color: var(--navy); }
.enterprise-data-companies input, .enterprise-data-toolbar input, .enterprise-data-toolbar select { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); padding: 11px; }
.enterprise-data-companies input { margin: 10px 0 15px; }
.enterprise-company { width: 100%; text-align: left; display: grid; gap: 7px; border: 1px solid transparent; border-radius: 10px; background: transparent; padding: 14px 10px; margin-bottom: 8px; color: var(--ink); overflow-wrap: anywhere; }
.enterprise-company.selected { border-color: #67c8d3; background: #eaf8fa; box-shadow: inset 3px 0 var(--cyan); }
.enterprise-company:hover { background: #f0f7fa; }
.enterprise-company small, .enterprise-company span { font-size: 11px; color: var(--muted); }
.enterprise-data-main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.enterprise-data-main > .panel { min-width: 0; margin-bottom: 0; }
.enterprise-data-main h2 { margin: 12px 0 0; color: var(--navy); }
.enterprise-data-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 22px 0; padding: 18px 0; border-block: 1px solid var(--line); }
.enterprise-data-stats div { display: grid; gap: 5px; }
.enterprise-data-stats strong { font-size: 28px; color: var(--navy); font-variant-numeric: tabular-nums; }
.enterprise-data-stats span { font-size: 12px; color: var(--muted); }
.enterprise-data-main summary { cursor: pointer; color: var(--cyan); font-size: 13px; }
.enterprise-data-toolbar { display: grid; grid-template-columns: 130px 160px minmax(160px, 1fr); gap: 12px; }
.enterprise-values-scroll { overflow: auto; max-height: 620px; }
.enterprise-values { width: 100%; min-width: 640px; table-layout: fixed; border-collapse: collapse; font-size: 12px; }
.enterprise-values th:nth-child(1) { width: 24%; }
.enterprise-values th:nth-child(2) { width: 21%; }
.enterprise-values th:nth-child(3) { width: 30%; }
.enterprise-values th:nth-child(4) { width: 25%; }
.enterprise-values th { position: sticky; top: 0; background: var(--soft); color: var(--muted); text-align: left; padding: 12px 10px; font-weight: 600; white-space: nowrap; }
.enterprise-values td { padding: 9px 10px; vertical-align: middle; border-bottom: 1px solid var(--line); line-height: 18px; }
.enterprise-values td:first-child { min-width: 145px; }
.enterprise-values small, .enterprise-dataset small { display: block; color: var(--muted); font-size: 11px; margin-top: 5px; }
.enterprise-values small { margin-top: 2px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.enterprise-indicator-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.enterprise-indicator-heading { display: flex; align-items: center; gap: 5px; min-width: 0; }
.enterprise-indicator-heading .enterprise-indicator-name { min-width: 0; }
.enterprise-period-badge { flex-shrink: 0; padding: 0 4px; border-radius: 4px; background: #eaf8fa; color: #0e7490; font-size: 10px; line-height: 18px; white-space: nowrap; }
.enterprise-values .enterprise-indicator-context { font-size: 10px; }
.enterprise-value-id { display: flex; align-items: center; gap: 6px; }
.enterprise-values code { flex: 1; min-width: 0; font-size: 11px; line-height: 17px; color: #155e75; overflow-wrap: anywhere; user-select: all; }
.enterprise-copy-button { flex: 0 0 22px; width: 22px; height: 26px; padding: 0; border: 0; border-radius: 4px; color: var(--cyan); background: transparent; font-size: 17px; }
.enterprise-copy-button:hover { background: #eaf8fa; }
.enterprise-copy-button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.enterprise-value-period { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.enterprise-source-line { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 11px; line-height: 18px; white-space: nowrap; color: var(--muted); }
.enterprise-source-table { flex-shrink: 0; color: var(--navy); }
.enterprise-source-location { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.enterprise-source-line a { flex-shrink: 0; }
.enterprise-value-number { font-variant-numeric: tabular-nums; white-space: nowrap; }
.enterprise-value-number strong { font-size: 13px; }
.enterprise-values a, .enterprise-dataset a { color: var(--cyan); }
.enterprise-values .enterprise-source-note { color: #9a6700; max-width: 170px; }
.enterprise-data-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 18px; font-size: 12px; color: var(--muted); }
.enterprise-data-pagination button { padding: 8px 12px; }
.enterprise-data-main button:disabled { opacity: .45; cursor: not-allowed; }
.enterprise-dataset { display: flex; justify-content: space-between; gap: 18px; padding: 16px 0; border-top: 1px solid var(--line); font-size: 12px; overflow-wrap: anywhere; }
.enterprise-dataset > div:first-child { min-width: 0; }
.enterprise-dataset > div:last-child { display: flex; align-items: start; gap: 12px; flex-shrink: 0; }
.enterprise-data-main .section-heading { align-items: start; }
.enterprise-data-main .section-heading p { font-size: 12px; }
@media (max-width: 1200px) { .enterprise-data-layout { grid-template-columns: 205px minmax(0, 1fr); gap: 16px; } .enterprise-data-toolbar { grid-template-columns: 1fr 1fr; } .enterprise-field-search { grid-column: 1 / -1; } }
@media (max-width: 780px) { .enterprise-data-layout { grid-template-columns: minmax(0, 1fr); } .enterprise-data-companies { position: static; max-height: 260px; } .enterprise-dataset { flex-direction: column; } .enterprise-data-pagination { flex-wrap: wrap; } }
