:root {
  color-scheme: light;
  font-family: "DM Sans", "PingFang SC", "Microsoft YaHei UI", "Noto Sans CJK SC", sans-serif;
  color: #1d302d;
  background: #f7f8f3;
  font-synthesis: none;
  --ink: #1d302d;
  --muted: #52645f;
  --quiet: #63746e;
  --paper: #fff;
  --line: #dce4dc;
  --teal: #176354;
  --teal-deep: #124b40;
  --rail: #142522;
  --rail-width: 230px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, textarea, select { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button, summary { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 3px solid #35a38a; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 750; letter-spacing: -.025em; }
.skip-link { position: fixed; z-index: 10; left: 10px; top: -100px; padding: 12px; background: white; }
.skip-link:focus { top: 10px; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 2;
  width: var(--rail-width);
  background: var(--rail);
  color: #edf5ef;
  padding: 27px 18px 23px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 7px; font-size: 16px; font-weight: 750; white-space: nowrap; }
.brand-mark, .workspace-mark { display: grid; place-items: center; flex: none; width: 35px; height: 35px; border-radius: 10px; }
.brand-mark { color: #163e33; background: #c8edcf; font-size: 25px; line-height: 1; }
.navigation { margin-top: 48px; }
.nav-label { color: #9eb3ac; padding: 0 10px 12px; font-size: 11px; letter-spacing: .1em; }
.history-label { margin-top: 30px; }
.navigation a { display: flex; align-items: center; gap: 13px; min-height: 45px; margin: 2px 0; padding: 8px 11px; border: 1px solid transparent; border-radius: 8px; color: #cedbd5; font-size: 14px; }
.navigation a:hover { background: #1e3630; }
.navigation a[aria-current] { background: #27473e; color: #f0f9f1; border-color: #395c50; font-weight: 700; }
.navigation a[aria-current] .icon { color: #b8e9cb; }
.sidebar-bottom { display: flex; gap: 10px; align-items: center; border-top: 1px solid #344843; padding: 19px 5px 0; margin-top: auto; flex-shrink: 0; }
.workspace-mark { width: 31px; height: 31px; border-radius: 8px; background: #38544b; color: #e9f5ed; font-size: 13px; }
.sidebar-bottom strong, .sidebar-bottom small { display: block; }
.sidebar-bottom strong { font-size: 12px; }
.sidebar-bottom small { color: #a4b7af; font-size: 10px; margin-top: 5px; white-space: nowrap; }

.icon { display: inline-block; position: relative; width: 17px; height: 17px; flex: none; color: currentColor; font-style: normal; }
.icon::before, .icon::after { content: ""; position: absolute; }
.grid-icon::before { width: 5px; height: 5px; top: 1px; left: 1px; border-radius: 1px; background: currentColor; box-shadow: 9px 0, 0 9px, 9px 9px; }
.meeting-icon::before { inset: 2px 0 4px; border: 1.5px solid; border-radius: 4px; }
.meeting-icon::after { width: 4px; height: 4px; left: 4px; bottom: 2px; border: solid; border-width: 0 0 1.5px 1.5px; transform: skewY(-30deg); background: inherit; }
.doc-icon::before { inset: 0 2px 0 2px; border: 1.5px solid; border-radius: 2px 4px 2px 2px; }
.doc-icon::after { width: 6px; height: 1.5px; background: currentColor; left: 5.5px; top: 6px; box-shadow: 0 4px; }
.table-icon::before { inset: 1px 0; border: 1.5px solid; border-radius: 2px; }
.table-icon::after { left: 1px; right: 1px; top: 5px; bottom: 2px; border-top: 1.5px solid; background: linear-gradient(90deg, transparent calc(50% - .6px), currentColor calc(50% - .6px), currentColor calc(50% + .6px), transparent calc(50% + .6px)); }
.time-icon::before { inset: 0; border: 1.5px solid; border-radius: 50%; }
.time-icon::after { width: 4px; height: 5px; top: 4px; left: 8px; border: solid; border-width: 0 0 1.5px 1.5px; }

.main-shell { margin-left: var(--rail-width); }
.topbar { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px clamp(25px, 3.55vw, 60px); border-bottom: 1px solid #e2e8de; }
.breadcrumb { display: flex; align-items: center; gap: 10px; color: var(--quiet); font-size: 13px; }
.breadcrumb strong { color: var(--ink); }
.connection { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid #dfe7dc; border-radius: 99px; color: var(--muted); background: #fff; font-size: 11px; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #87958e; }
.connection[data-mode="model"] .status-dot { background: #299767; }
.connection[data-mode="local"] .status-dot { background: #a87825; }
.connection[data-mode="offline"] .status-dot { background: #b94d3b; }
.main { max-width: 1360px; margin: 0 auto; padding: 32px clamp(25px, 3.55vw, 60px) 55px; }
.main:focus { outline: none; }

.hero {
  position: relative;
  min-height: 294px;
  padding: clamp(25px, 4vw, 54px);
  overflow: hidden;
  border-radius: 19px;
  border: 1px solid #d8e8d5;
  background: radial-gradient(ellipse at 82% 38%, #d5e8d2, transparent 52%), linear-gradient(112deg, #e9f3e4, #e5eee0 60%, #dcead7);
  display: grid;
  align-items: center;
}
.hero-copy { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(33px, 4.25vw, 63px); line-height: 1.18; margin-bottom: 14px; letter-spacing: -.065em; color: #172d27; }
.hero p { color: #3e5e52; font-size: clamp(14px, 1.4vw, 17px); }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  gap: 8px;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s;
}
.primary { background: var(--teal); color: #fff; }
.primary:not(:disabled):hover { background: var(--teal-deep); }
.secondary, .subtle { background: var(--paper); border-color: #d5e0d8; color: var(--teal-deep); }
.secondary:not(:disabled):hover, .subtle:hover { background: #eef6ee; border-color: #b6cebf; }
.subtle { font-weight: 650; min-height: 33px; }
.hero-button { margin-top: 24px; min-height: 42px; padding-inline: 16px; }
.hero-button span { margin-left: 4px; font-size: 17px; }

.hero-art { position: absolute; pointer-events: none; width: min(43%, 455px); height: 100%; top: 0; right: 3%; }
.art-grid {
  position: absolute;
  inset: 10% 0;
  opacity: .55;
  background-image: linear-gradient(#b7d1bc 1px, transparent 1px), linear-gradient(90deg, #b7d1bc 1px, transparent 1px);
  background-size: 23px 23px;
  mask-image: radial-gradient(ellipse, #000 25%, transparent 72%);
}
.art-sheet { position: absolute; width: 39%; min-width: 116px; max-width: 165px; height: 56%; padding: 17px; border: 1px solid #a8cbb2; border-radius: 11px; box-shadow: 0 12px 24px #20463b1a; }
.art-sheet-back { left: 49%; top: 16%; background: #b8d9ba; transform: rotate(13deg); }
.art-sheet-main { left: 22%; top: 24%; background: #f8fff4; transform: rotate(-12deg); }
.art-sheet i, .art-sheet b { display: block; height: 6px; margin-bottom: 8px; border-radius: 6px; background: #d0e6d0; }
.art-sheet-back i { background: #9fc6a6; }
.art-sheet i:nth-of-type(2) { width: 72%; }
.art-sheet i:nth-of-type(3) { width: 85%; }
.art-sheet-main span { display: grid; place-items: center; width: 33px; height: 33px; margin-bottom: 13px; background: #d9efdb; border-radius: 8px; color: #35765e; font-size: 23px; }
.art-sheet b { display: inline-block; height: 17px; width: 36%; margin: 3px 5px 0 0; }
.art-chart { display: flex; align-items: end; gap: 5px; position: absolute; right: 9%; bottom: 15%; height: 73px; padding: 11px 13px; background: #205947; border: 1px solid #194b3c; border-radius: 10px; box-shadow: 0 12px 20px #194b3c33; transform: rotate(7deg); }
.art-chart span { width: 9px; height: 32%; background: #a0d7aa; border-radius: 2px; }
.art-chart span:nth-child(2) { height: 60%; }
.art-chart span:nth-child(3) { height: 48%; }
.art-chart span:nth-child(4) { height: 94%; background: #d9f4ca; }
.art-spark { position: absolute; left: 14%; top: 14%; color: #4d8d71; font-size: 30px; }
.art-small-spark { position: absolute; right: 5%; top: 24%; color: #609a7c; font-size: 23px; }

.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin: 33px 0 15px; }
.section-heading h2 { font-size: 22px; }
.task-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.task-card, .panel { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 2px 3px #193a2a06; }
.task-card { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: clamp(16px, 2vw, 26px); transition: border-color .16s, transform .16s, box-shadow .16s; }
.task-card:hover { border-color: #9fc5b2; transform: translateY(-2px); box-shadow: 0 6px 18px #21473613; }
.tile-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; flex: none; }
.tile-icon .icon { transform: scale(1.12); }
.mint { background: #e3f3e6; color: #216c55; }
.blue { background: #e9effa; color: #435e90; }
.sand { background: #f7eed9; color: #835d26; }
.task-card h3 { margin-top: 5px; font-size: 18px; }
.task-card p { flex: 1; font-size: 13px; line-height: 1.75; color: var(--muted); }
.task-link, .text-link { color: var(--teal-deep); font-size: 13px; font-weight: 750; }
.task-link { margin-top: 7px; }
.task-link span, .text-link span { padding-left: 3px; }
.text-link:hover { text-decoration: underline; }
.recent-heading { margin-top: 31px; }
.recent-panel { overflow: hidden; }
.empty-recent { display: flex; align-items: center; gap: 13px; padding: 20px; }
.empty-recent strong { font-size: 14px; }
.empty-recent p { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.history-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 20px; border: 0; background: white; color: var(--ink); text-align: left; }
.history-item + .history-item { border-top: 1px solid var(--line); }
.history-item:hover { background: #f6faf5; }
.history-item > div { flex: 1; min-width: 0; }
.history-item strong { font-size: 14px; overflow-wrap: anywhere; }
.history-item small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }

.page-intro { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 13px; row-gap: 10px; margin: 7px 0 22px; }
.page-intro h1 { font-size: clamp(26px, 3vw, 38px); }
.page-intro p { grid-column: 1 / -1; color: var(--muted); font-size: 14px; line-height: 1.7; }
.input-panel, .result-panel { padding: clamp(15px, 2.3vw, 28px); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 19px; }
.panel-heading h2 { font-size: 18px; }
.input-panel label:not(.upload) { display: block; min-width: 0; font-size: 13px; font-weight: 700; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.three-fields, .sheet-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.date-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sheet-fields { align-items: end; margin-top: 16px; }
.sheet-fields .button { justify-self: start; }
.input-panel input:not([type="checkbox"], [type="file"]), .input-panel textarea, .input-panel select {
  display: block; width: 100%; min-height: 40px; margin-top: 7px; padding: 9px 10px;
  border: 1px solid #cddbd2; border-radius: 7px; color: var(--ink); background: #fff; font-size: 14px; font-weight: 400;
}
.input-panel textarea { line-height: 1.65; resize: vertical; }
.input-panel :is(input, textarea)::placeholder { color: #657670; }
.input-panel > label:not(:first-child), .input-panel > .field-grid + label { margin-top: 16px; }
.optional { font-size: 11px; font-weight: 400; margin-left: 3px; color: var(--quiet); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--teal); }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.form-footer p { font-size: 12px; color: var(--muted); line-height: 1.65; }
.form-error, .result-warnings { margin-top: 15px; padding: 11px 13px; border-radius: 7px; background: #fff1e7; color: #7a3a20; font-size: 13px; line-height: 1.6; white-space: pre-line; }
.tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 15px; background: #e8efe7; border-radius: 9px; width: max-content; max-width: 100%; }
.tabs button { padding: 8px 15px; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 7px; font-size: 13px; font-weight: 700; }
.tabs button[aria-pressed="true"] { background: #fff; border-color: #d8e3d7; color: var(--teal-deep); }
.upload { display: grid; position: relative; place-items: center; gap: 5px; padding: 18px 10px; border: 1px dashed #9bb5a7; border-radius: 9px; background: #f4f8f3; color: var(--teal-deep); text-align: center; cursor: pointer; }
.upload:hover, .upload:focus-within { border-color: var(--teal); background: #ecf6ed; }
.upload strong { font-size: 14px; }
.upload small { color: var(--muted); font-size: 12px; }
.upload input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-name { font-size: 12px; overflow-wrap: anywhere; }
.upload-name:empty { display: none; }
.remove-file, .retry-preview { margin-top: 7px; }
.retry-preview { margin-left: 6px; }
.version-input .upload { margin-bottom: 15px; }
.version-input .remove-file { margin: -7px 0 12px; }
.form-subheading { margin: 21px 0 12px; font-size: 16px; }
.sheet-preview { margin-top: 14px; font-size: 12px; color: var(--muted); }
.sheet-preview > p { margin-bottom: 7px; }
.analysis-options { padding: 11px 0 0; margin-top: 16px; border-top: 1px solid var(--line); }
.analysis-options > summary { font-size: 13px; color: var(--teal-deep); font-weight: 750; }
.analysis-options .field-grid, .threshold-field { margin-top: 13px; }
.threshold-field { max-width: 300px; }

.result-panel { margin-top: 20px; scroll-margin-top: 16px; }
.result-meta { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.result-header { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.result-header h2 { font-size: 23px; min-width: 0; overflow-wrap: anywhere; }
.result-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.result-group { margin-top: 19px; padding-top: 16px; border-top: 1px solid var(--line); }
.result-group h3 { font-size: 16px; margin-bottom: 9px; }
.result-group p { color: var(--ink); font-size: 14px; line-height: 1.72; white-space: pre-wrap; overflow-wrap: anywhere; }
.result-group p + .table-container { margin-top: 11px; }
[contenteditable="plaintext-only"] { background: #f5f9f4; border-radius: 3px; outline: 1px dashed #8db7a4; outline-offset: -2px; }
[contenteditable="plaintext-only"]:focus-visible { outline: 2px solid #35a38a; }
.table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 9px; margin-top: 8px; }
.pager span { color: var(--muted); font-size: 12px; }
.pager button { min-height: 30px; padding: 4px 8px; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 13px; }
th { background: #f1f6ef; color: #334e43; font-weight: 750; }
th, td { padding: 8px 10px; border-bottom: 1px solid #e5ebe4; min-width: 75px; overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
.action-done { min-width: 55px; }
.result-sources { margin-top: 11px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.result-sources summary { color: var(--teal-deep); font-weight: 700; }
.result-sources ul { margin: 7px 0 0; padding-left: 20px; overflow-wrap: anywhere; }
.result-sources li + li { margin-top: 4px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 9px; margin-top: 15px; }
.metric { padding: 12px; background: #eff6ed; border-radius: 8px; }
.metric span, .metric strong { display: block; overflow-wrap: anywhere; }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { font-size: 20px; margin-top: 6px; }
.chart { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.chart li { display: grid; align-items: center; grid-template-columns: minmax(55px, 125px) 1fr minmax(52px, auto); gap: 10px; color: var(--muted); font-size: 12px; }
.chart-label { overflow-wrap: anywhere; }
.chart-track { height: 12px; position: relative; background: #eef5ef; border-radius: 3px; }
.chart-axis { position: absolute; width: 1px; top: -2px; bottom: -2px; background: #637e70; z-index: 1; }
.chart-bar { position: absolute; height: 100%; border-radius: 3px; background: #428d72; }
.chart-bar.negative { background: #a66a4c; }
.toast { position: fixed; z-index: 3; bottom: 20px; right: 20px; max-width: min(370px, calc(100% - 40px)); background: #193c33; color: white; padding: 12px 16px; border-radius: 9px; box-shadow: 0 7px 20px #0003; font-size: 13px; }
.clipboard-field { position: fixed; opacity: 0; inset: 0 auto auto 0; }

.boot-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 15px; padding: 20px; text-align: center; color: var(--muted); }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: clamp(16px, 4vw, 58px); background: radial-gradient(ellipse at 13% 10%, #e0eee1, transparent 50%), #f4f7f0; }
.login-layout { width: min(920px, 100%); display: grid; grid-template-columns: 1.08fr 1fr; min-height: 538px; overflow: hidden; border: 1px solid #d5e1d6; border-radius: 22px; box-shadow: 0 16px 46px #21473616; }
.login-brand { position: relative; overflow: hidden; background: #173830; color: #f3f9ef; padding: clamp(24px, 4.5vw, 60px); }
.login-mark { width: 50px; height: 50px; border-radius: 13px; font-size: 34px; }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: contain; border-radius: inherit; background: #edf5ef; }
.login-brand > p:first-of-type { margin-top: 24px; color: #bfdec8; font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.login-brand > h1 { margin: 7px 0 13px; font-size: clamp(27px, 3.5vw, 47px); line-height: 1.2; }
.login-brand > p:last-of-type { max-width: 320px; font-size: 14px; color: #d3e7db; line-height: 1.7; }
.login-art { position: absolute; inset: auto 6% 2% 11%; height: 47%; pointer-events: none; }
.login-art .art-grid { opacity: .3; }
.login-art .art-chart { right: 13%; }
.login-art .art-spark { color: #a6d9b5; }
.login-content { display: flex; flex-direction: column; justify-content: center; background: white; padding: clamp(24px, 4.2vw, 56px); }
.login-content h2 { font-size: 26px; margin-bottom: 8px; }
.login-content form > p:not(.form-error) { color: var(--muted); font-size: 13px; margin-bottom: 21px; }
.login-content label { display: block; margin-bottom: 15px; font-size: 13px; font-weight: 700; }
.login-content input { width: 100%; margin-top: 7px; min-height: 43px; border: 1px solid #cddbd2; border-radius: 8px; padding: 9px 11px; color: var(--ink); }
.login-submit { width: 100%; margin-top: 7px; min-height: 44px; }
.login-content .form-error { margin: 8px 0 10px; }
.login-copyright { margin-top: 25px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); overflow-wrap: anywhere; white-space: pre-line; }
.login-brand > h1 { overflow-wrap: anywhere; }
.row-actions { display: flex; flex-wrap: wrap; gap: 5px; min-width: 135px; }
.row-actions .button { min-height: 32px; font-size: 12px; }
.tenant-members-back { display: inline-block; margin-bottom: 12px; }
.brand-upload { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px 12px; align-items: start; margin-top: 15px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.brand-upload :is(h3, .result-tools, p) { grid-column: 1 / -1; }
.brand-upload h3 { font-size: 14px; }
.brand-upload-preview { width: 54px; height: 54px; object-fit: contain; border-radius: 7px; background: #eef6ed; }
.brand-upload input { display: block; max-width: 100%; margin-top: 5px; font-size: 12px; }
.brand-upload p:not(.form-error) { color: var(--muted); font-size: 12px; }
.demo-logins { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding-top: 16px; }
.demo-logins p { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.header-tools { display: flex; align-items: center; gap: 8px; }
.text-model-picker { display: flex; align-items: center; gap: 5px; font-size: 11px; white-space: nowrap; color: var(--muted); }
.text-model-picker select { max-width: 142px; min-height: 31px; border: 1px solid #d5e0d8; border-radius: 7px; color: var(--ink); background: white; }
.brand > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sidebar-bottom > div:last-child { min-width: 0; overflow-wrap: anywhere; }
.portal-dialog { width: min(630px, calc(100% - 28px)); border: 1px solid var(--line); border-radius: 14px; padding: 0; color: var(--ink); }
.portal-dialog::backdrop { background: #102f27a6; }
.editor-footer { justify-content: flex-end; }
.editor-description { color: var(--muted); font-size: 13px; line-height: 1.65; }
.editor-fields select[multiple] { min-height: 115px; }
.admin-empty, .admin-status p { color: var(--muted); font-size: 13px; line-height: 1.65; }
.admin-status { display: flex; align-items: center; justify-content: space-between; padding: 16px; gap: 8px; }
.bill-panel { margin-top: 18px; }
.bill-usage-breakdown { display: grid; gap: 5px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.invoice-scope { display: flex; align-items: end; gap: 14px; margin-bottom: 17px; flex-wrap: wrap; }
.invoice-scope label { width: min(100%, 340px); }
.invoice-scope-status { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.invoice-tabs { margin-bottom: 14px; }
.invoice-fees { margin-top: 17px; padding-top: 13px; border-top: 1px solid var(--line); }
.invoice-fees .panel-heading { margin-bottom: 0; }
.invoice-fees h3 { font-size: 14px; }
.invoice-fee-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .72fr) minmax(0, 1.3fr) auto; gap: 9px; align-items: end; margin-top: 10px; }
.invoice-metrics { grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr)); }
.invoice-metrics .metric:last-child { color: white; background: var(--teal); }
.invoice-metrics .metric:last-child span { color: #def4e8; }
.invoice-adjustment { margin-top: 10px; color: var(--muted); font-size: 12px; }
#invoice-result, #historical-batch-detail { scroll-margin-top: 10px; }
#historical-batch-detail .table-container { margin-top: 12px; }
.bill-review-list { margin-top: 10px; }
.bill-refresh-notice { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.bill-total { width: max-content; max-width: 100%; padding: 13px 17px; background: #eef6ed; border-radius: 8px; }
.bill-total strong, .bill-total span { display: block; overflow-wrap: anywhere; }
.bill-total span { font-size: 12px; color: var(--muted); }
.bill-total strong { margin: 6px 0; font-size: 24px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(245px, 100%), 1fr)); gap: 12px; }
.media-job { min-width: 0; padding: 15px; }
.media-job-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 9px; }
.media-job-heading h3 { font-size: 16px; overflow-wrap: anywhere; }
.media-status { white-space: nowrap; color: var(--teal-deep); background: #eaf5ea; border-radius: 20px; padding: 4px 8px; font-size: 11px; }
.media-options { min-width: 0; margin: 15px 0 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.media-options legend { padding: 0 5px; color: var(--teal-deep); font-size: 13px; font-weight: 700; }
.media-options > label { margin-top: 12px; }
.media-checks { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 9px; }
.input-panel .media-checks label:not([hidden]) { display: flex; align-items: center; }
.media-progress { width: 100%; accent-color: var(--teal); }
.media-job .result-warnings { color: #7a3a20; }
.media-job p, .media-job small { color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.media-job > :not(:first-child) { margin-top: 9px; }
.media-job :is(img, video) { display: block; width: 100%; max-height: 320px; object-fit: contain; background: #edf3ec; border-radius: 8px; }

@media (max-width: 1050px) {
  :root { --rail-width: 191px; }
  .sidebar { padding-inline: 12px; }
  .hero { min-height: 260px; }
  .hero-art { right: 1%; }
  .date-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  .sidebar { position: static; width: 100%; padding: 12px 16px 7px; }
  .brand { padding-left: 2px; gap: 8px; font-size: 14px; }
  .brand-mark { width: 29px; height: 29px; font-size: 21px; }
  .navigation { display: flex; flex-wrap: wrap; margin-top: 9px; gap: 2px; }
  .navigation a { margin: 0; gap: 5px; padding: 5px 8px; min-height: 34px; font-size: 12px; }
  .navigation a .icon { display: none; }
  .nav-label, .sidebar-bottom { display: none; }
  .main-shell { margin-left: 0; }
  .topbar { min-height: 51px; padding-inline: 16px; }
  .main { padding: 19px 16px 40px; }
}
@media (max-width: 560px) {
  .invoice-fee-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-layout { grid-template-columns: 1fr; min-height: auto; border-radius: 14px; }
  .login-brand { min-height: 195px; }
  .login-brand > p:first-of-type { margin-top: 12px; }
  .login-art { display: none; }
  .header-tools { gap: 4px; }
  .header-tools { flex-wrap: wrap; justify-content: flex-end; }
  .text-model-picker select { max-width: 115px; }
  .header-tools .button, .connection { font-size: 10px; padding-inline: 5px; }
  .breadcrumb { gap: 5px; font-size: 11px; }
  .hero { min-height: 212px; }
  .hero-art { display: none; }
  .section-heading { margin-top: 24px; }
  .task-grid { grid-template-columns: 1fr; gap: 9px; }
  .task-card { display: grid; grid-template-columns: auto 1fr; column-gap: 11px; row-gap: 6px; }
  .task-card .tile-icon { grid-row: span 3; }
  .task-card h3 { margin-top: 0; }
  .task-link { margin-top: 2px; }
  .field-grid, .three-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compare-fields { grid-template-columns: 1fr; }
  .form-footer, .result-header { flex-wrap: wrap; }
  .result-tools .button { min-height: 33px; }
}
@media (max-width: 370px) {
  .field-grid:not(.sheet-fields) { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; }
}
