:root {
  color-scheme: light;
  --ink: #101713;
  --muted: #68736c;
  --paper: #eceee9;
  --panel: #fff;
  --lime: #dfff78;
  --accent-strong: #b8df4b;
  --accent-deep: #6f9620;
  --accent-soft: #eff8cf;
  --expense-increase: #b52d38;
  --expense-increase-soft: #fff0f2;
  --expense-decrease: #1d63a5;
  --expense-decrease-soft: #eef6ff;
  --line: #d9ded8;
  font-family: Inter, "Noto Sans JP", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; }
body { margin: 0; overflow: hidden; color: var(--ink); background: var(--paper); }
button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  display: flex;
  height: 56px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: white;
  background: var(--ink);
}

.brand-area, .brand, .topbar-actions, .connection { display: flex; align-items: center; }
.brand-area { gap: 18px; }
.brand { gap: 10px; font-size: 13px; }
.brand-mark { display: grid; width: 32px; height: 32px; place-items: center; color: var(--ink); background: var(--lime); border-radius: 9px; font-size: 11px; font-weight: 900; }
.topbar-actions { gap: 10px; }
.connection { gap: 7px; font-size: 10px; color: rgba(255,255,255,.72); }
.connection i { width: 7px; height: 7px; border-radius: 50%; background: #dca63a; }
.connection.is-online i { background: #54d79a; }
.connection.is-local i { background: var(--lime); }
.text-button { min-height: 32px; padding: 0 12px; color: white; background: transparent; border: 1px solid rgba(255,255,255,.23); border-radius: 7px; font-size: 10px; font-weight: 800; }
.auth-status { color: rgba(255,255,255,.62); font-size: 8px; font-weight: 800; }
.auth-status.is-authenticated { color: var(--lime); }
.auth-button { min-height: 32px; padding: 0 13px; color: var(--ink); background: var(--lime); border: 0; border-radius: 7px; font-size: 9px; font-weight: 900; }
.menu-button { display: flex; min-height: 34px; align-items: center; gap: 9px; padding: 0 12px; color: var(--ink); background: var(--lime); border: 0; border-radius: 8px; font-size: 9px; font-weight: 900; }
.menu-icon { display: grid; width: 16px; gap: 3px; }
.menu-icon i { display: block; height: 2px; background: var(--ink); border-radius: 99px; transition: transform .24s ease, opacity .2s ease; }
.menu-button[aria-expanded="true"] .menu-icon i:first-child { transform: translateY(5px) rotate(45deg); }
.menu-button[aria-expanded="true"] .menu-icon i:nth-child(2) { opacity: 0; }
.menu-button[aria-expanded="true"] .menu-icon i:last-child { transform: translateY(-5px) rotate(-45deg); }

.workspace {
  display: grid;
  grid-template-columns: minmax(285px, 320px) minmax(0, 1fr);
  gap: 10px;
  height: calc(100vh - 56px);
  padding: 10px;
  transition: grid-template-columns .28s ease, gap .28s ease;
}
.workspace.is-menu-collapsed { grid-template-columns: 0 minmax(0, 1fr); gap: 0; }

.control-panel, .result-area { min-width: 0; min-height: 0; border: 1px solid var(--line); border-radius: 14px; }
.control-panel { display: flex; flex-direction: column; padding: 20px; overflow: hidden; background: var(--panel); opacity: 1; transform: translateX(0); transition: opacity .2s ease, transform .28s ease, padding .28s ease, border-color .28s ease; }
.workspace.is-menu-collapsed .control-panel { padding-right: 0; padding-left: 0; pointer-events: none; border-color: transparent; opacity: 0; transform: translateX(-18px); }
.control-heading { display: flex; align-items: end; justify-content: space-between; }
.kicker { color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .14em; }
h1, h2, h3, p { margin-top: 0; }
.control-heading h1 { margin: 0; font-size: 29px; letter-spacing: -.06em; }
.panel-close { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; color: var(--ink); background: var(--accent-soft); border: 0; border-radius: 8px; font-size: 17px; }

.upload-form { display: grid; gap: 9px; margin-top: 18px; }
.drop-zone { position: relative; display: grid; grid-template-columns: 24px 46px 1fr; min-height: 90px; align-items: center; gap: 10px; padding: 12px; border: 1px dashed #9ea79f; border-radius: 11px; cursor: pointer; }
.drop-zone:hover { background: #f7f8f4; border-color: var(--ink); }
.step-number { display: grid; width: 22px; height: 22px; place-items: center; color: white; background: var(--ink); border-radius: 50%; font-size: 9px; font-weight: 900; }
.file-icon { display: grid; width: 43px; height: 50px; place-items: center; background: var(--lime); border-radius: 8px 8px 13px 8px; font-size: 9px; font-weight: 900; }
.file-copy { min-width: 0; }
.file-copy strong, .file-copy small { display: block; }
.file-copy strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.file-copy small { margin-top: 5px; color: var(--muted); font-size: 8px; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.primary-button { min-height: 43px; color: white; background: var(--ink); border: 0; border-radius: 8px; font-size: 11px; font-weight: 900; }
.primary-button span { display: inline-grid; width: 19px; height: 19px; margin-right: 6px; place-items: center; color: var(--ink); background: var(--lime); border-radius: 50%; font-size: 8px; }
.upload-message { min-height: 15px; margin: 0; color: var(--muted); font-size: 8px; text-align: center; }
.upload-message.is-error { color: #b52d38; }
.upload-message.is-success { color: #16764f; }

.analysis-controls { margin-top: 17px; padding-top: 16px; border-top: 1px solid var(--line); }
.month-field span { display: block; margin-bottom: 7px; font-size: 9px; font-weight: 900; }
.month-field select { width: 100%; height: 38px; padding: 0 10px; color: var(--ink); background: #f4f5f1; border: 1px solid var(--line); border-radius: 7px; font-size: 11px; font-weight: 800; }
.coverage-text, .integrity-note { color: var(--muted); font-size: 8px; line-height: 1.5; }
.coverage-text { margin: 7px 0 11px; }
.integrity-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.integrity-grid div { padding: 8px 4px; background: #f3f5f0; border-radius: 7px; text-align: center; }
.integrity-grid span, .integrity-grid strong { display: block; }
.integrity-grid span { color: var(--muted); font-size: 7px; }
.integrity-grid strong { margin-top: 4px; font-size: 12px; }
.integrity-note { margin: 8px 0 0; }
.privacy-chip { margin-top: auto; padding: 10px; color: #4d5a52; background: #eff7e2; border-radius: 8px; font-size: 8px; font-weight: 700; }
.privacy-chip span { margin-right: 5px; color: #1b855c; }

.result-area { position: relative; overflow: hidden; background: #f6f7f4; }
.empty-state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 13px; color: var(--muted); }
.empty-state span { display: grid; width: 28px; height: 28px; place-items: center; color: var(--ink); background: var(--lime); border-radius: 50%; font-size: 8px; font-weight: 900; }
.empty-state strong { font-size: 12px; }
.empty-state i { width: 42px; height: 1px; background: var(--line); }
.result-content { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 8px; height: 100%; padding: 12px; }
.result-heading { display: flex; min-height: 45px; align-items: center; justify-content: space-between; gap: 12px; }
.result-heading h2 { margin: 4px 0 0; font-size: 23px; letter-spacing: -.05em; }
.report-title-block { min-width: 0; }
.report-title-row { display: flex; align-items: end; gap: 12px; }
.report-period-field { display: grid; min-width: 170px; gap: 4px; }
.report-period-field > span { color: var(--muted); font-size: 7px; font-weight: 900; }
.report-period-field select { width: 100%; height: 32px; padding: 0 9px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 7px; font-size: 9px; font-weight: 900; }
.heading-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
.comparison-control, .scope-control { display: flex; align-items: center; gap: 6px; }
.switch-label { color: var(--muted); font-size: 7px; font-weight: 900; white-space: nowrap; }
.comparison-switch, .scope-switch { display: flex; padding: 3px; background: #e6e9e3; border-radius: 9px; }
.comparison-switch button, .scope-switch button { min-height: 29px; padding: 0 9px; color: var(--muted); background: transparent; border: 0; border-radius: 7px; font-size: 8px; font-weight: 900; transition: color .2s ease, background .2s ease, transform .2s ease, box-shadow .2s ease; }
.comparison-switch button { display: flex; min-width: 126px; align-items: center; gap: 7px; padding: 5px 9px; text-align: left; }
.comparison-switch button > i { display: grid; width: 21px; height: 21px; flex: 0 0 auto; place-items: center; color: var(--ink); background: var(--accent-soft); border-radius: 6px; font-style: normal; font-size: 10px; }
.comparison-switch button span, .comparison-switch button small { display: block; }
.comparison-switch button small { margin-top: 2px; color: inherit; font-size: 6px; opacity: .7; }
.comparison-switch button.is-active, .scope-switch button.is-active { color: var(--ink); background: var(--lime); box-shadow: 0 3px 10px rgba(111,150,32,.18); transform: translateY(-1px); }
.comparison-switch button.is-active > i { background: white; }
.scope-switch { background: #e6f5cf; }
.dataset-badge, .comparison-status { padding: 7px 9px; border-radius: 999px; font-size: 8px; font-weight: 900; }
.dataset-badge { color: #526f19; background: var(--accent-soft); }
.comparison-status { color: #3f5912; background: #e4f4ae; }
.detail-button { min-height: 31px; padding: 0 10px; color: var(--ink); background: var(--lime); border: 0; border-radius: 7px; font-size: 8px; font-weight: 900; }
.category-review-button { color: white; background: var(--ink); }

.metric-grid { display: grid; grid-template-columns: 1.35fr repeat(3, 1fr); gap: 7px; }
.metric { min-width: 0; min-height: 96px; padding: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.metric-main { color: white; background: var(--ink); border-color: var(--ink); }
.metric > span, .metric small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metric > span { color: var(--muted); font-size: 8px; font-weight: 800; }
.metric-main > span { color: rgba(255,255,255,.55); }
.metric strong { display: block; margin-top: 10px; overflow: hidden; font-size: clamp(21px, 2.4vw, 34px); letter-spacing: -.055em; text-overflow: ellipsis; white-space: nowrap; }
.metric small { margin-top: 5px; color: var(--muted); font-size: 8px; font-weight: 700; }
.metric-main small { color: var(--lime); }
.metric-change { transition: color .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease; }
.metric-change.is-increase { background: var(--expense-increase-soft); border-color: #efb8be; box-shadow: inset 4px 0 0 var(--expense-increase); }
.metric-change.is-increase strong, .metric-change.is-increase small { color: var(--expense-increase); }
.metric-change.is-decrease { background: var(--expense-decrease-soft); border-color: #b7d4ed; box-shadow: inset 4px 0 0 var(--expense-decrease); }
.metric-change.is-decrease strong, .metric-change.is-decrease small { color: var(--expense-decrease); }
#comparison-note { line-height: 1.35; white-space: normal; }

.analysis-grid { display: grid; grid-template-columns: 1.12fr 1fr .9fr; gap: 7px; min-height: 0; }
.panel { min-width: 0; min-height: 0; padding: 14px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.panel-heading span { color: var(--muted); font-size: 7px; font-weight: 900; letter-spacing: .12em; }
.panel-heading h3 { margin: 3px 0 0; font-size: 14px; }
.panel-heading small { color: var(--muted); font-size: 7px; }
.category-layout { display: grid; grid-template-columns: 105px 1fr; height: calc(100% - 34px); align-items: center; gap: 13px; }
.donut { position: relative; display: grid; width: 94px; height: 94px; place-items: center; background: conic-gradient(var(--line) 0 100%); border-radius: 50%; }
.donut::after { position: absolute; width: 58px; height: 58px; background: white; border-radius: 50%; content: ""; }
.donut > span { position: relative; z-index: 1; width: 58px; text-align: center; }
.donut small, .donut b { display: block; }
.donut small { color: var(--muted); font-size: 6px; }
.donut b { margin-top: 3px; font-size: 9px; letter-spacing: -.04em; white-space: nowrap; }
.donut b.is-long { font-size: 7px; }
.donut b.is-very-long { font-size: 6px; }
.category-list { display: grid; gap: 7px; }
.category-item { display: grid; grid-template-columns: minmax(52px, 1fr) auto; align-items: center; gap: 4px 7px; }
.category-item > span, .source-item > span { display: flex; min-width: 0; align-items: center; gap: 5px; overflow: hidden; font-size: 8px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.color-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 2px; }
.category-item b, .source-item b { font-size: 8px; }
.category-bar { grid-column: 1 / 3; height: 3px; overflow: hidden; background: #eef0ec; border-radius: 99px; }
.category-bar i { display: block; width: var(--width); height: 100%; background: var(--color); }
.category-item small { grid-column: 1 / 3; margin-top: -2px; color: var(--muted); font-size: 7px; }

.monthly-trend { position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr); height: calc(100% - 36px); gap: 6px; padding-top: 12px; }
.trend-scale { display: flex; height: 100%; box-sizing: border-box; flex-direction: column; justify-content: space-between; padding-bottom: 13px; color: var(--muted); font-size: 6px; font-weight: 800; line-height: 1; text-align: right; white-space: nowrap; }
.trend-plot { position: relative; display: flex; height: 100%; align-items: end; gap: 4px; background-image: repeating-linear-gradient(to top, rgba(111,150,32,.22) 0 1px, transparent 1px 25%); background-size: 100% calc(100% - 20px); background-position: left top; background-repeat: no-repeat; }
.trend-item { position: relative; z-index: 1; display: grid; min-width: 0; height: 100%; flex: 1; grid-template-rows: 1fr auto; align-items: end; gap: 5px; }
.trend-bar-wrap { display: flex; height: 100%; align-items: end; justify-content: center; }
.trend-bar { width: min(17px, 70%); min-height: 4px; background: var(--lime); border: 1px solid var(--accent-strong); border-radius: 4px 4px 2px 2px; box-shadow: 0 2px 8px rgba(111,150,32,.12); }
.trend-item.is-selected .trend-bar { background: var(--accent-strong); border-color: var(--accent-deep); box-shadow: 0 0 0 2px rgba(223,255,120,.55); }
.trend-item.is-partial .trend-bar { opacity: .45; background-image: repeating-linear-gradient(45deg, transparent 0 3px, rgba(255,255,255,.8) 3px 5px); }
.trend-label { overflow: hidden; color: var(--muted); font-size: 6px; text-align: center; text-overflow: clip; white-space: nowrap; }

.insight-panel { min-width: 0; min-height: 155px; padding: 15px; overflow: hidden; color: white; background: var(--ink); border: 2px solid var(--lime); border-radius: 10px; }
.insight-panel > span { color: var(--lime); font-size: 7px; font-weight: 900; letter-spacing: .12em; }
.insight-panel h3 { margin: 8px 0 0; font-size: 17px; }
.insight-content { display: grid; gap: 7px; margin-top: 10px; }
.insight-row { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 7px; font-size: 9px; font-weight: 700; line-height: 1.45; }
.insight-row strong { color: var(--lime); font-size: 8px; }
.insight-row span { color: rgba(255,255,255,.9); }
.result-content.is-switching .metric, .result-content.is-switching .analysis-grid > * { animation: comparisonReveal .34s ease both; }
.result-content.is-switching .analysis-grid > :nth-child(2) { animation-delay: .04s; }
.result-content.is-switching .analysis-grid > :nth-child(3) { animation-delay: .08s; }
@keyframes comparisonReveal { from { opacity: .35; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.generated-at { margin: 0; color: var(--muted); font-size: 7px; text-align: right; }

.transaction-dialog { width: min(880px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 80px rgba(16,23,19,.3); }
.transaction-dialog::backdrop { background: rgba(16,23,19,.62); backdrop-filter: blur(3px); }
.transaction-dialog-shell { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: min(620px, calc(100vh - 30px)); }
.transaction-dialog-header { display: flex; align-items: start; justify-content: space-between; gap: 14px; padding: 18px 20px 13px; border-bottom: 1px solid var(--line); }
.transaction-dialog-header h2 { margin: 4px 0 0; font-size: 24px; letter-spacing: -.05em; }
.transaction-dialog-header p { margin: 4px 0 0; color: var(--muted); font-size: 9px; font-weight: 800; }
.transaction-filters { display: flex; align-items: end; gap: 8px; margin-left: auto; }
.transaction-filter { display: grid; min-width: 150px; gap: 5px; color: var(--muted); font-size: 8px; font-weight: 900; }
.transaction-filter select { height: 34px; padding: 0 9px; color: var(--ink); background: #f4f6f1; border: 1px solid var(--line); border-radius: 7px; font-size: 9px; font-weight: 800; }
.transaction-filter-summary { display: grid; min-width: 105px; min-height: 34px; align-content: center; padding: 5px 9px; color: var(--ink); background: var(--accent-soft); border-radius: 7px; }
.transaction-filter-summary span, .transaction-filter-summary small { color: var(--muted); font-size: 6px; font-weight: 900; }
.transaction-filter-summary strong { margin: 1px 0; font-size: 11px; }
.transaction-dialog-header > button { display: grid; width: 32px; height: 32px; place-items: center; color: white; background: var(--ink); border: 0; border-radius: 8px; font-size: 18px; }
.transaction-table { min-height: 0; padding: 0 20px; overflow: hidden; }
.transaction-table-head, .transaction-row { display: grid; grid-template-columns: 88px minmax(170px, 1fr) 130px 110px; align-items: center; gap: 10px; }
.transaction-table-head { height: 34px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 7px; font-weight: 900; }
.transaction-table-head span:last-child { text-align: right; }
#transaction-rows { display: grid; }
.transaction-row { min-height: 51px; border-bottom: 1px solid #edf0eb; font-size: 9px; }
.transaction-row time, .transaction-row span { color: var(--muted); }
.transaction-row strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.transaction-row b { text-align: right; }
.transaction-category-select { width: 100%; min-width: 0; height: 29px; padding: 0 5px; color: var(--ink); background: #f4f6f1; border: 1px solid var(--line); border-radius: 6px; font-size: 9px; font-weight: 800; }
.transaction-dialog-footer { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 20px; background: #f3f5f0; border-radius: 0 0 14px 14px; }
.transaction-footer-copy { min-width: 180px; flex: 1; }
.transaction-dialog-footer p { margin: 0; color: var(--muted); font-size: 8px; line-height: 1.5; }
.transaction-footer-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 7px; line-height: 1.4; }
.category-correction-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.category-correction-actions button, .category-correction-actions label { display: inline-flex; min-height: 31px; align-items: center; padding: 0 9px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 6px; font-size: 8px; font-weight: 900; cursor: pointer; }
.category-correction-actions button:disabled { cursor: default; opacity: .45; }
.category-correction-actions input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.transaction-pagination { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.transaction-pagination button { min-height: 29px; padding: 0 10px; color: white; background: var(--ink); border: 0; border-radius: 6px; font-size: 8px; font-weight: 800; }
.transaction-pagination button:disabled { cursor: default; opacity: .3; }
.transaction-pagination span { min-width: 36px; color: var(--muted); font-size: 8px; font-weight: 900; text-align: center; }

.category-review-dialog { width: min(960px, calc(100vw - 28px)); max-width: none; height: min(760px, calc(100vh - 28px)); max-height: none; padding: 0; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 80px rgba(16,23,19,.34); }
.category-review-dialog::backdrop { background: rgba(16,23,19,.68); backdrop-filter: blur(4px); }
.category-review-shell { display: grid; height: 100%; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.category-review-header { display: flex; align-items: start; justify-content: space-between; gap: 18px; padding: 20px 22px 16px; color: white; background: var(--ink); border-radius: 13px 13px 0 0; }
.category-review-header h2 { margin: 5px 0 4px; font-size: 27px; letter-spacing: -.05em; }
.category-review-header p { max-width: 640px; margin: 0; color: rgba(255,255,255,.72); font-size: 9px; line-height: 1.6; }
.category-review-header .kicker { color: var(--lime); }
.category-review-header > button { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; color: var(--ink); background: var(--lime); border: 0; border-radius: 8px; font-size: 18px; }
.category-review-toolbar { display: flex; min-height: 62px; align-items: end; justify-content: space-between; gap: 16px; padding: 12px 22px; background: #f5f7f1; border-bottom: 1px solid var(--line); }
.category-review-toolbar label { display: grid; min-width: 220px; gap: 5px; color: var(--muted); font-size: 8px; font-weight: 900; }
.category-review-toolbar select { height: 33px; padding: 0 9px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 7px; font-size: 9px; font-weight: 900; }
.category-review-toolbar strong { padding-bottom: 7px; font-size: 10px; }
.category-review-table { min-height: 0; padding: 0 22px; overflow: auto; }
.category-review-table-head, .category-review-row { display: grid; grid-template-columns: minmax(210px, 1fr) 120px 70px 170px; align-items: center; gap: 12px; }
.category-review-table-head { position: sticky; z-index: 1; top: 0; height: 38px; color: var(--muted); background: white; border-bottom: 1px solid var(--line); font-size: 8px; font-weight: 900; }
.category-review-row { min-height: 52px; border-bottom: 1px solid #edf0eb; font-size: 9px; }
.category-review-row strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.category-review-row span { color: var(--muted); }
.category-review-select { width: 100%; height: 31px; padding: 0 7px; color: var(--ink); background: var(--accent-soft); border: 1px solid #cedaa9; border-radius: 7px; font-size: 9px; font-weight: 900; }
.category-review-footer { display: flex; min-height: 82px; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 22px; background: #f3f5f0; border-radius: 0 0 13px 13px; }
.category-review-footer > div:first-child { min-width: 220px; flex: 1; }
.category-review-message { margin: 0; font-size: 8px; font-weight: 900; line-height: 1.5; }
.category-review-message.is-error { color: var(--expense-increase); }
.category-review-message.is-success { color: #16764f; }
.category-review-footer small { display: block; margin-top: 4px; color: var(--muted); font-size: 7px; line-height: 1.45; }
.category-review-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.category-review-actions button, .category-review-actions label { display: inline-flex; min-height: 34px; align-items: center; justify-content: center; padding: 0 11px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 7px; font-size: 8px; font-weight: 900; cursor: pointer; }
.category-review-actions input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.category-review-actions .category-review-save { color: var(--ink); background: var(--lime); border-color: var(--accent-strong); }
.category-review-actions .category-review-save:disabled { cursor: default; opacity: .45; }

.auth-dialog { width: min(440px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 80px rgba(16,23,19,.32); }
.auth-dialog::backdrop { background: rgba(16,23,19,.65); backdrop-filter: blur(3px); }
.auth-dialog-shell { padding: 20px; }
.auth-dialog-header { display: flex; align-items: start; justify-content: space-between; }
.auth-dialog-header h2 { margin: 4px 0 0; font-size: 24px; letter-spacing: -.05em; }
.auth-dialog-header > button { display: grid; width: 32px; height: 32px; place-items: center; color: white; background: var(--ink); border: 0; border-radius: 8px; font-size: 18px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 18px; padding: 4px; background: #edf0eb; border-radius: 9px; }
.auth-tabs button { min-height: 33px; color: var(--muted); background: transparent; border: 0; border-radius: 7px; font-size: 9px; font-weight: 900; }
.auth-tabs button.is-active { color: white; background: var(--ink); }
.auth-form { display: grid; gap: 11px; margin-top: 16px; }
.auth-form label { display: grid; gap: 6px; font-size: 8px; font-weight: 900; }
.auth-form input[type="email"], .auth-form input[type="password"], .auth-form input[type="text"] { width: 100%; height: 40px; padding: 0 11px; color: var(--ink); background: #f6f7f4; border: 1px solid var(--line); border-radius: 8px; font-size: 11px; }
.auth-form input:focus { border-color: var(--ink); outline: 2px solid rgba(121,223,184,.45); }
.auth-form > small, .auth-form > p { margin: 0; color: var(--muted); font-size: 8px; line-height: 1.5; }
.auth-form .consent-field { display: grid; grid-template-columns: 18px 1fr; align-items: start; font-size: 8px; font-weight: 700; line-height: 1.5; }
.consent-field input { width: 15px; height: 15px; margin: 1px 0 0; accent-color: var(--ink); }
.auth-link-button { min-height: 31px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 7px; font-size: 8px; font-weight: 900; }
.auth-message { min-height: 18px; margin: 12px 0 0; font-size: 8px; font-weight: 800; text-align: center; }
.auth-message.is-error { color: #b52d38; }
.auth-message.is-success { color: #16764f; }
.auth-privacy { margin: 7px 0 0; color: var(--muted); font-size: 7px; line-height: 1.5; text-align: center; }

@media (max-height: 720px) and (min-width: 901px) {
  .workspace { grid-template-columns: 270px minmax(0, 1fr); }
  .control-panel { padding: 14px; }
  .upload-form { margin-top: 12px; }
  .analysis-controls { margin-top: 10px; padding-top: 10px; }
  .privacy-chip { padding: 7px; }
  .result-content { padding: 8px; }
  .metric { min-height: 82px; padding: 10px; }
  .metric strong { margin-top: 6px; }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .connection, .auth-status, #run-demo { display: none; }
  .workspace, .workspace.is-menu-collapsed { grid-template-columns: 1fr; height: auto; }
  .workspace.is-menu-collapsed .control-panel { display: none; }
  .control-panel, .result-area { min-height: auto; }
  .result-area { min-height: 720px; }
  .privacy-chip { margin-top: 14px; }
  .analysis-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .category-panel, .trend-panel { min-height: 300px; }
}

@media (max-width: 540px) {
  .brand strong, .connection, .auth-status, #run-demo { display: none; }
  .brand-area { gap: 8px; }
  .menu-button { padding: 0 9px; }
  #data-menu-label { display: none; }
  .workspace { padding: 6px; }
  .metric-grid { grid-template-columns: 1fr; }
  .result-heading { align-items: start; flex-direction: column; }
  .report-title-row { align-items: start; flex-direction: column; }
  .heading-status { flex-wrap: wrap; }
  .category-layout { grid-template-columns: 90px 1fr; }
  .transaction-dialog-shell { min-height: calc(100vh - 28px); }
  .transaction-dialog-header { flex-wrap: wrap; gap: 10px; }
  .transaction-filters { width: 100%; flex-wrap: wrap; order: 3; margin-left: 0; }
  .transaction-filter { min-width: 135px; flex: 1; }
  .transaction-filter-summary { min-width: 105px; }
  .transaction-table { padding: 0 12px; }
  .transaction-table-head, .transaction-row { grid-template-columns: 65px minmax(90px, 1fr) 88px 76px; gap: 6px; }
  .transaction-dialog-footer { align-items: start; flex-direction: column; }
  .category-correction-actions { width: 100%; flex-wrap: wrap; }
  .category-correction-actions button, .category-correction-actions label { flex: 1; justify-content: center; }
  .transaction-pagination { width: 100%; justify-content: flex-end; }
  .category-review-dialog { width: calc(100vw - 12px); height: calc(100vh - 12px); }
  .category-review-header, .category-review-toolbar, .category-review-footer { padding-right: 14px; padding-left: 14px; }
  .category-review-table { padding: 0 14px; }
  .category-review-table-head, .category-review-row { grid-template-columns: minmax(130px, 1fr) 74px 42px 112px; gap: 6px; }
  .category-review-footer { align-items: stretch; flex-direction: column; }
  .category-review-actions { width: 100%; justify-content: stretch; }
  .category-review-actions button, .category-review-actions label { min-width: 120px; flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
