:root {
  color-scheme: dark;
  --bg: #07091a;
  --bg-2: #090d20;
  --panel: #0c0f22;
  --panel-2: #11162d;
  --panel-3: #151b36;
  --line: #202947;
  --line-2: #2a3558;
  --text: #f0f5ff;
  --muted: #97a3bd;
  --dim: #65718d;
  --brand: #004860;
  --accent: #0090c0;
  --dark: #003048;
  --cyan: #00c4ff;
  --green: #00e8a2;
  --orange: #ff6b35;
  --yellow: #ffbf47;
  --red: #ff4d6d;
  --purple: #9c7bff;
  --radius: 8px;
  --shadow: 0 20px 60px rgba(0, 0, 0, .35);
  --font-size: 15px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(0, 72, 96, .22), transparent 360px),
    radial-gradient(circle at top right, rgba(0, 144, 192, .14), transparent 420px),
    var(--bg);
  color: var(--text);
  font: 500 var(--font-size)/1.45 Rajdhani, Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.side-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid var(--line);
  background: rgba(8, 12, 28, .92);
  padding: 18px 14px;
  backdrop-filter: blur(14px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(0, 196, 255, .4);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(0, 72, 96, .95), rgba(0, 144, 192, .42));
  color: #dff8ff;
  font: 700 13px/1 JetBrains Mono, monospace;
}

.brand-block strong {
  display: block;
  color: var(--text);
  font-size: 17px;
  line-height: 1;
}

.brand-block span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

.nav-stack {
  display: grid;
  gap: 6px;
}

.expense-file-box {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 72, 96, .18);
  padding: 9px;
}

.new-file-btn {
  min-height: 38px;
  border: 1px solid rgba(0, 232, 162, .55);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(0, 144, 192, .35), rgba(0, 232, 162, .18));
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 800;
}

.expense-file-tools {
  display: grid;
  gap: 6px;
}

.expense-file-search {
  min-height: 32px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(0, 196, 255, .24);
  border-radius: 8px;
  background: rgba(5, 8, 20, .58);
  padding: 0 8px;
  color: var(--dim);
}

.expense-file-search input {
  width: 100%;
  min-width: 0;
  height: 30px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: 700 11px/1 JetBrains Mono, monospace;
}

.expense-file-search input::placeholder {
  color: rgba(174, 190, 214, .62);
}

.expense-file-search button {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 7px;
  background: rgba(255, 255, 255, .07);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.expense-file-search button:hover {
  color: var(--cyan);
  background: rgba(0, 196, 255, .14);
}

.expense-file-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.expense-file-filters button {
  min-height: 23px;
  border: 1px solid rgba(0, 196, 255, .18);
  border-radius: 7px;
  background: rgba(255, 255, 255, .035);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  font: 800 9px/1 JetBrains Mono, monospace;
  cursor: pointer;
}

.expense-file-filters button strong {
  color: var(--cyan);
  font: inherit;
}

.expense-file-filters button.active,
.expense-file-filters button:hover {
  color: var(--text);
  border-color: rgba(0, 232, 162, .48);
  background: rgba(0, 232, 162, .13);
}

.cache-reset-btn {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .035);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: 800 10px/1 JetBrains Mono, monospace;
}

.cache-reset-btn:hover {
  color: var(--cyan);
  border-color: rgba(0, 196, 255, .45);
  background: rgba(0, 196, 255, .12);
}

.file-box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--dim);
  font: 700 11px/1 JetBrains Mono, monospace;
  letter-spacing: .08em;
}

.file-box-head small {
  min-width: 24px;
  min-height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--cyan);
}

.expense-file-list {
  display: grid;
  gap: 6px;
  max-height: min(42vh, 430px);
  overflow: auto;
  padding-right: 2px;
}

.expense-file-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-left: 3px solid var(--file-color, var(--cyan));
  border-radius: var(--radius);
  background: rgba(5, 8, 20, .74);
  color: var(--text);
  padding: 7px 8px;
  display: grid;
  gap: 6px;
  cursor: pointer;
}

.expense-file-card:hover,
.expense-file-card.active {
  border-color: rgba(0, 196, 255, .5);
  background: rgba(0, 144, 192, .16);
}

.expense-file-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.expense-file-title {
  min-width: 0;
}

.expense-file-title strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  line-height: 1.05;
}

.expense-file-title small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 10px;
}

.expense-file-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.expense-file-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 6px;
  background: rgba(255, 255, 255, .035);
  color: var(--muted);
  padding: 3px 4px;
  text-align: center;
  font: 800 9px/1 JetBrains Mono, monospace;
}

.expense-file-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
}

.expense-file-bottom small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--dim);
  font: 700 9px/1.2 JetBrains Mono, monospace;
}

.expense-file-bottom strong {
  color: var(--cyan);
  white-space: nowrap;
  font: 800 10px/1 JetBrains Mono, monospace;
}

.expense-file-delete {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 77, 109, .42);
  border-radius: 8px;
  background: rgba(255, 77, 109, .10);
  color: #ff4d6d;
  cursor: pointer;
}

.expense-file-delete:hover {
  background: rgba(255, 77, 109, .22);
  border-color: rgba(255, 77, 109, .75);
}

.file-vessel {
  color: #07101b;
  background: var(--file-color, var(--cyan));
  border-radius: 999px;
  padding: 3px 7px;
  font: 800 10px/1.2 JetBrains Mono, monospace;
}

.advanced-nav {
  display: none;
  gap: 6px;
}

.advanced-expenses .advanced-nav {
  display: grid;
}

.advanced-toggle {
  width: 100%;
}

.nav-link {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 12px;
  transition: .18s ease;
}

.nav-link i {
  width: 18px;
  color: var(--dim);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  border-color: rgba(0, 196, 255, .25);
  background: rgba(0, 144, 192, .13);
}

.nav-link.active i {
  color: var(--cyan);
}

.rail-footer {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mini-stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .025);
  padding: 10px;
}

.mini-stat span,
.kpi-card span,
.panel-heading span,
label span,
.clock-chip span,
.status-chip span {
  color: var(--dim);
  font-size: 12px;
}

.mini-stat strong {
  display: block;
  font: 700 22px/1 JetBrains Mono, monospace;
  color: var(--cyan);
  margin-top: 5px;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 64px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 9, 26, .86);
  padding: 10px 18px;
  backdrop-filter: blur(14px);
}

.topbar-title h1 {
  margin: 0;
  color: var(--text);
  font-size: 26px;
  line-height: 1;
}

.topbar-title span {
  color: var(--cyan);
  font: 700 12px/1.2 JetBrains Mono, monospace;
}

.topbar-tools,
.button-row,
.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.panel-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.clock-chip,
.status-chip,
.font-ctrl {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(12, 15, 34, .92);
  padding: 0 10px;
}

.clock-chip strong {
  font: 700 12px/1 JetBrains Mono, monospace;
  color: var(--text);
}

.status-chip {
  color: var(--muted);
  font-size: 13px;
}

.status-chip.ok i {
  color: var(--green);
}

.font-ctrl input {
  width: 76px;
  accent-color: var(--cyan);
}

.icon-btn,
.btn {
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--panel-3);
  color: var(--text);
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  font-weight: 700;
  transition: .18s ease;
}

.icon-btn {
  width: 34px;
  padding: 0;
}

.btn:hover,
.icon-btn:hover {
  border-color: rgba(0, 196, 255, .65);
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #eaffff;
}

.btn.success {
  background: rgba(0, 232, 162, .14);
  border-color: rgba(0, 232, 162, .5);
  color: var(--green);
}

.btn.warn {
  background: rgba(255, 191, 71, .12);
  border-color: rgba(255, 191, 71, .48);
  color: var(--yellow);
}

.btn.ai,
.mobile-big-btn.ai {
  background: linear-gradient(135deg, rgba(156, 123, 255, .18), rgba(0, 196, 255, .12));
  border-color: rgba(156, 123, 255, .55);
  color: var(--text);
}

.btn.ai i,
.mobile-big-btn.ai i {
  color: var(--purple);
}

.btn.danger,
.icon-btn.danger {
  background: rgba(255, 77, 109, .12);
  border-color: rgba(255, 77, 109, .45);
  color: var(--red);
}

.currency-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
}

.currency-add-btn {
  width: 42px;
  min-height: 42px;
  border: 1px solid rgba(0, 232, 162, .48);
  border-radius: var(--radius);
  background: rgba(0, 232, 162, .12);
  color: var(--green);
  font-weight: 800;
  cursor: pointer;
}

.currency-add-btn:hover {
  border-color: rgba(0, 232, 162, .82);
  background: rgba(0, 232, 162, .2);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 18px 0;
}

.expense-desk {
  margin: 12px 18px 0;
  border: 1px solid rgba(0, 196, 255, .26);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(0, 72, 96, .52), rgba(12, 15, 34, .96)),
    var(--panel);
  box-shadow: 0 14px 36px rgba(0, 0, 0, .22);
  overflow: hidden;
}

.desk-head {
  min-height: 66px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.desk-head span,
.desk-total span,
.desk-progress span,
.desk-action span {
  color: var(--muted);
  font: 700 12px/1.2 JetBrains Mono, monospace;
  letter-spacing: .05em;
}

.desk-head h2 {
  margin: 3px 0 2px;
  font-size: 22px;
  line-height: 1;
}

.desk-head p {
  margin: 0;
  color: var(--muted);
  max-width: 70vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desk-total {
  min-width: 168px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(5, 8, 20, .58);
  padding: 9px 11px;
}

.desk-total strong {
  display: block;
  margin-top: 4px;
  color: var(--green);
  font: 800 18px/1 JetBrains Mono, monospace;
}

.desk-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 14px;
}

.desk-action {
  min-height: 48px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: rgba(5, 8, 20, .64);
  color: var(--text);
  display: flex;
  align-items: center;
  text-align: left;
  padding: 8px 10px;
  gap: 10px;
}

.desk-action i {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(0, 196, 255, .12);
  color: var(--cyan);
  font-size: 14px;
}

.desk-action strong {
  font-size: 16px;
  line-height: 1;
}

.desk-action span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desk-action.primary i {
  color: var(--green);
  background: rgba(0, 232, 162, .13);
}

.desk-action.success i {
  color: var(--yellow);
  background: rgba(255, 191, 71, .12);
}

.desk-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  background: rgba(5, 8, 20, .22);
}

.desk-progress div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  border-right: 1px solid var(--line);
}

.desk-progress div:last-child {
  border-right: 0;
}

.desk-progress strong {
  display: block;
  color: var(--cyan);
  font: 800 16px/1 JetBrains Mono, monospace;
  margin-top: 0;
}

.simple-expenses:not(.advanced-expenses) .summary-strip,
.simple-expenses:not(.advanced-expenses) .rates-panel,
.simple-expenses:not(.advanced-expenses) .policy-panel,
.simple-expenses:not(.advanced-expenses) .accounting-panel,
.simple-expenses:not(.advanced-expenses) .audit-panel,
.simple-expenses:not(.advanced-expenses) .archive-panel {
  display: none;
}

.mobile-home,
.mobile-upload-actions,
.mobile-lines,
.mobile-bottom-actions {
  display: none;
}

.kpi-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(17, 22, 45, .96), rgba(12, 15, 34, .96));
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}

.kpi-card {
  min-height: 104px;
  padding: 16px;
  border-left: 3px solid var(--cyan);
}

.kpi-card.warning {
  border-left-color: var(--yellow);
}

.kpi-card strong {
  display: block;
  margin: 8px 0;
  font: 700 30px/1 JetBrains Mono, monospace;
}

.kpi-card small {
  color: var(--muted);
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  padding: 14px 18px 24px;
  align-items: start;
}

.left-column,
.right-column {
  display: grid;
  gap: 14px;
}

.right-column {
  position: sticky;
  top: 78px;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-heading {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

.panel-heading.compact {
  min-height: 52px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1;
}

.ai-panel {
  border-color: rgba(156, 123, 255, .34);
  background:
    linear-gradient(135deg, rgba(156, 123, 255, .08), transparent 42%),
    linear-gradient(180deg, rgba(17, 22, 45, .98), rgba(12, 15, 34, .98));
}

.ai-score-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
}

.ai-score-card {
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(5, 8, 20, .54);
  padding: 9px;
}

.ai-score-card span,
.ai-score-card small {
  display: block;
  color: var(--muted);
}

.ai-score-card span,
.ai-summary-editor span {
  font: 700 11px/1 JetBrains Mono, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.ai-score-card strong {
  display: block;
  margin: 5px 0 4px;
  font: 700 20px/1 JetBrains Mono, monospace;
  color: var(--cyan);
}

.ai-score-card.clean strong {
  color: var(--green);
}

.ai-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 12px 10px;
  max-height: 190px;
  overflow: auto;
}

.ai-box {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(5, 8, 20, .42);
  padding: 9px;
}

.ai-box h3 {
  margin: 0 0 7px;
  color: var(--text);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ai-list {
  display: grid;
  gap: 6px;
}

.ai-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, .025);
  padding: 7px 8px;
}

.ai-item strong {
  display: block;
  color: var(--text);
}

.ai-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.35;
}

.ai-item.bad {
  border-color: rgba(255, 77, 109, .45);
  background: rgba(255, 77, 109, .07);
}

.ai-item.warn {
  border-color: rgba(255, 191, 71, .45);
  background: rgba(255, 191, 71, .07);
}

.ai-item.ok {
  border-color: rgba(0, 232, 162, .38);
  background: rgba(0, 232, 162, .06);
}

.ai-item.info {
  border-color: rgba(0, 196, 255, .34);
  background: rgba(0, 196, 255, .05);
}

.ai-summary-editor {
  display: grid;
  gap: 6px;
  padding: 0 12px 10px;
}

.ai-summary-editor span {
  color: var(--muted);
}

.ai-summary-editor textarea {
  min-height: 66px;
  resize: vertical;
}

.form-grid,
.modal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

input,
select,
textarea {
  width: 100%;
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: rgba(5, 8, 20, .82);
  outline: 0;
  min-height: 38px;
  padding: 7px 10px;
}

input:not([type="number"]):not([type="date"]):not([type="range"]),
textarea {
  letter-spacing: 0;
  word-spacing: normal;
  white-space: pre-wrap;
}

textarea {
  min-height: 74px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 196, 255, .1);
}

select option {
  background: var(--panel);
}

.notes-field {
  padding: 0 14px 14px;
}

.report-panel {
  border-color: rgba(0, 196, 255, .32);
  background:
    linear-gradient(135deg, rgba(0, 196, 255, .08), transparent 30%),
    linear-gradient(180deg, rgba(17, 22, 45, .98), rgba(9, 13, 32, .98));
}

.report-panel .panel-heading {
  min-height: 64px;
  border-bottom-color: rgba(0, 196, 255, .18);
  background:
    linear-gradient(90deg, rgba(0, 196, 255, .1), rgba(0, 232, 162, .06) 48%, transparent);
}

.report-panel .panel-heading h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
}

.report-panel .panel-heading h2::before {
  content: "\f15c";
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(0, 196, 255, .38);
  border-radius: 8px;
  background: rgba(0, 196, 255, .1);
  color: var(--cyan);
  font: 900 15px/1 "Font Awesome 6 Free";
}

.report-panel .panel-heading span {
  color: var(--muted);
}

.report-panel .button-row .btn {
  min-height: 36px;
  border-color: rgba(0, 196, 255, .24);
  background: rgba(5, 8, 20, .58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.report-panel .button-row .btn.primary {
  border-color: rgba(0, 196, 255, .5);
  background: linear-gradient(135deg, rgba(0, 144, 192, .95), rgba(0, 196, 255, .62));
}

.report-panel .button-row .btn.success {
  border-color: rgba(0, 232, 162, .55);
  background: linear-gradient(135deg, rgba(0, 232, 162, .14), rgba(0, 196, 255, .08));
  color: var(--green);
}

.report-panel .form-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(5, 8, 20, .2), transparent);
}

.report-panel .form-grid label {
  position: relative;
  grid-column: span 3;
  min-height: 82px;
  gap: 6px;
  border: 1px solid rgba(42, 53, 88, .82);
  border-radius: 8px;
  background: rgba(5, 8, 20, .42);
  padding: 8px;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.report-panel .form-grid label::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 999px;
  background: rgba(0, 196, 255, .45);
  opacity: .55;
}

.report-panel .form-grid label:focus-within {
  border-color: rgba(0, 196, 255, .72);
  background: rgba(0, 72, 96, .18);
  transform: translateY(-1px);
}

.report-panel .form-grid label span,
.report-panel .notes-field span {
  color: #8fa0c3;
  font: 800 10px/1.2 JetBrains Mono, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.report-panel .form-grid input,
.report-panel .form-grid select,
.report-panel .notes-field textarea {
  min-height: 34px;
  border-color: rgba(42, 53, 88, .76);
  border-radius: 7px;
  background: rgba(3, 6, 17, .72);
  color: #f7fbff;
  font-weight: 700;
}

.report-panel .form-grid input[readonly] {
  color: #9feaff;
  background: rgba(0, 196, 255, .08);
}

.report-panel .form-grid label:nth-child(11) {
  grid-column: span 6;
}

.report-panel .form-grid label:nth-child(14),
.report-panel .form-grid label:nth-child(15),
.report-panel .form-grid label:nth-child(16) {
  grid-column: span 2;
}

.report-panel .notes-field {
  margin: 0 12px 12px;
  padding: 10px;
  border: 1px solid rgba(42, 53, 88, .82);
  border-radius: 8px;
  background: rgba(5, 8, 20, .42);
}

.report-panel .notes-field textarea {
  min-height: 86px;
  line-height: 1.4;
  resize: vertical;
}

.drop-zone {
  margin: 14px;
  min-height: 154px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 2px dashed rgba(0, 196, 255, .32);
  border-radius: var(--radius);
  background: rgba(0, 144, 192, .07);
  transition: .18s ease;
}

.drop-zone.dragging,
.drop-zone:hover {
  background: rgba(0, 144, 192, .13);
  border-color: var(--cyan);
}

.drop-zone i {
  color: var(--cyan);
  font-size: 32px;
}

.drop-zone strong {
  font-size: 20px;
}

.drop-zone span {
  color: var(--muted);
}

.upload-progress {
  display: grid;
  gap: 10px;
  margin: 0 14px 14px;
  border: 1px solid rgba(0, 196, 255, .35);
  border-radius: var(--radius);
  background: rgba(0, 72, 96, .24);
  padding: 12px;
}

.upload-progress[hidden] {
  display: none;
}

.upload-progress strong {
  display: block;
  color: var(--text);
  font: 800 15px/1.2 Rajdhani, Arial, sans-serif;
}

.upload-progress span {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.upload-progress-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
}

.upload-progress-bar i {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  animation: uploadPulse 1.1s ease-in-out infinite alternate;
}

@keyframes uploadPulse {
  from {
    transform: translateX(-10%);
  }
  to {
    transform: translateX(150%);
  }
}

.mobile-action-card {
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: rgba(5, 8, 20, .68);
  color: var(--text);
  padding: 13px;
  text-align: left;
}

.mobile-action-card i {
  color: var(--cyan);
  font-size: 20px;
  margin-bottom: 8px;
}

.mobile-action-card strong,
.mobile-action-card span {
  display: block;
}

.mobile-action-card span {
  color: var(--muted);
  font-size: 12px;
}

.mobile-action-card.primary-upload {
  min-height: 82px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "icon title"
    "icon meta";
  align-items: center;
  column-gap: 14px;
  border-color: rgba(0, 196, 255, .58);
  background: linear-gradient(135deg, rgba(0, 144, 192, .34), rgba(0, 232, 162, .12));
}

.mobile-action-card.primary-upload i {
  grid-area: icon;
  width: 44px;
  height: 44px;
  margin: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(0, 196, 255, .14);
  color: var(--cyan);
  font-size: 22px;
}

.mobile-action-card.primary-upload strong {
  grid-area: title;
  font-size: 18px;
  line-height: 1.1;
}

.mobile-action-card.primary-upload span {
  grid-area: meta;
  margin-top: 4px;
}

.thumb-strip {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding: 0 14px 14px;
}

.thumb {
  flex: 0 0 92px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #050814;
  position: relative;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb span {
  position: absolute;
  left: 4px;
  bottom: 4px;
  max-width: calc(100% - 8px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 5px;
  background: rgba(5, 8, 20, .8);
  color: var(--text);
  padding: 2px 4px;
  font-size: 10px;
}

.thumb-line-no {
  position: absolute;
  left: 4px;
  top: 4px;
  z-index: 2;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(0, 232, 162, .96), rgba(0, 196, 255, .92));
  color: #03111b;
  padding: 2px 6px;
  font: 900 10px/1.2 Rajdhani, sans-serif;
  letter-spacing: .02em;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .32);
}

.thumb-line-no.inbox {
  background: rgba(255, 191, 71, .95);
}

.table-actions {
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.expense-workbook {
  border-color: rgba(0, 196, 255, .3);
}

.workbook-heading {
  min-height: 50px;
  padding: 10px 12px;
}

.workbook-heading h2 {
  font-size: 18px;
}

.workbook-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 8, 20, .42);
}

.workbook-summary-card {
  min-width: 0;
  border: 1px solid rgba(49, 70, 114, .78);
  border-radius: 8px;
  background: rgba(8, 13, 30, .82);
  padding: 9px 10px;
  border-left: 3px solid var(--cyan);
}

.workbook-summary-card.advance {
  border-left-color: var(--yellow);
}

.workbook-summary-card.balance {
  border-left-color: var(--green);
}

.workbook-summary-card.balance.receivable {
  border-left-color: var(--cyan);
  background: linear-gradient(135deg, rgba(0, 196, 255, .12), rgba(8, 13, 30, .86));
}

.workbook-summary-card.balance.return {
  border-left-color: var(--yellow);
  background: linear-gradient(135deg, rgba(255, 191, 71, .12), rgba(8, 13, 30, .86));
}

.workbook-summary-card.balance.balanced {
  border-left-color: var(--green);
}

.workbook-summary-card.status {
  border-left-color: var(--purple);
}

.workbook-summary-card span,
.workbook-summary-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbook-summary-card span {
  color: var(--dim);
  font: 700 10px/1 JetBrains Mono, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.workbook-summary-card strong {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font: 700 18px/1.05 JetBrains Mono, monospace;
}

.workbook-summary-card small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.workbook-toolbar {
  align-items: center;
  background: rgba(8, 13, 30, .6);
}

.sheet-sort-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: auto;
  min-height: 32px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: rgba(5, 8, 20, .58);
  padding: 0 8px;
}

.sheet-sort-control span {
  color: var(--dim);
  font: 800 11px/1 JetBrains Mono, monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.sheet-sort-control select {
  min-height: 28px;
  width: 150px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0 18px 0 0;
  font-size: 12px;
}

.sheet-sort-control select:focus {
  outline: none;
}

.workbook-heading .btn,
.workbook-toolbar .btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  overflow: hidden;
}

.segmented button {
  min-height: 30px;
  border: 0;
  border-right: 1px solid var(--line-2);
  background: rgba(5, 8, 20, .78);
  color: var(--muted);
  padding: 0 10px;
  font-weight: 700;
  font-size: 12px;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: rgba(0, 144, 192, .2);
  color: var(--cyan);
}

.expense-table-wrap {
  overflow: auto;
  max-height: min(62vh, 720px);
  background: rgba(5, 8, 20, .36);
}

.expense-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  table-layout: fixed;
}

.expense-table .col-no {
  width: 44px;
}

.expense-table .col-date {
  width: 126px;
}

.expense-table .col-vendor {
  width: 180px;
}

.expense-table .col-category {
  width: 150px;
}

.expense-table .col-scope {
  width: 160px;
}

.expense-table .col-original {
  width: 150px;
}

.expense-table .col-rate {
  width: 110px;
}

.expense-table .col-total {
  width: 105px;
}

.expense-table .col-flags {
  width: 126px;
}

.expense-table .col-actions {
  width: 88px;
}

.expense-table th,
.expense-table td {
  border-bottom: 1px solid rgba(32, 41, 71, .75);
  padding: 5px 6px;
  text-align: left;
  vertical-align: middle;
}

.expense-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--dim);
  font-size: 11px;
  font-weight: 700;
  background: #090f20;
  letter-spacing: .02em;
}

.expense-table td {
  color: var(--text);
}

.expense-table tr {
  transition: .16s ease;
}

.expense-table tbody tr:hover,
.expense-table tbody tr.selected {
  background: rgba(0, 144, 192, .09);
}

.editable {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 12px;
}

.editable.short {
  min-width: 0;
}

.amount-cell,
.rate-cell,
.total-cell {
  font-family: JetBrains Mono, monospace;
  font-size: 12px;
}

.expense-table td .amount-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  gap: 5px;
  align-items: center;
}

.total-cell {
  color: var(--green);
  font-weight: 800;
  line-height: 1.2;
}

.flag-row {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.flag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--muted);
  padding: 0 5px;
  font-size: 10px;
  font-weight: 700;
}

.flag.green {
  color: var(--green);
  border-color: rgba(0, 232, 162, .35);
  background: rgba(0, 232, 162, .08);
}

.flag.yellow {
  color: var(--yellow);
  border-color: rgba(255, 191, 71, .4);
  background: rgba(255, 191, 71, .08);
}

.flag.red {
  color: var(--red);
  border-color: rgba(255, 77, 109, .42);
  background: rgba(255, 77, 109, .08);
}

.line-actions {
  display: flex;
  gap: 6px;
}

.preview-stage {
  margin: 14px;
  min-height: 350px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(5, 8, 20, .72);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  overflow: hidden;
  color: var(--muted);
}

.preview-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #030610;
}

.preview-frame-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 350px;
  display: grid;
  place-items: center;
  background: #030610;
}

.preview-line-badge {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 2;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(0, 232, 162, .98), rgba(0, 196, 255, .95));
  color: #03111b;
  padding: 5px 11px;
  font: 900 13px/1 Rajdhani, sans-serif;
  letter-spacing: .03em;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .42);
}

.preview-stage iframe {
  width: 100%;
  height: 350px;
  border: 0;
  background: #fff;
}

.preview-stage i {
  color: var(--dim);
  font-size: 42px;
}

.summary-list,
.allocation-list,
.rate-list,
.archive-list,
.inbox-list,
.policy-list,
.audit-list {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.summary-row,
.allocation-row,
.rate-row,
.archive-row,
.policy-row,
.audit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(5, 8, 20, .52);
  padding: 10px;
}

.inbox-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(5, 8, 20, .54);
  padding: 10px;
}

.inbox-preview {
  width: 88px;
  height: 68px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: #040716;
  color: var(--cyan);
}

.inbox-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.inbox-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.inbox-title strong {
  font-size: 17px;
}

.inbox-title span {
  color: var(--muted);
  font: 700 11px/1 JetBrains Mono, monospace;
}

.inbox-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 7px 0;
}

.inbox-meta span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  padding: 0 7px;
  font-size: 12px;
}

.inbox-correction-grid {
  display: grid;
  grid-template-columns: minmax(150px, 1.5fr) minmax(96px, .8fr) minmax(92px, .7fr) minmax(130px, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.inbox-correction-grid label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.inbox-correction-grid span {
  color: var(--dim);
  font: 800 10px/1 Rajdhani, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.inbox-correction-grid input,
.inbox-correction-grid select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(5, 8, 20, .62);
  color: var(--text);
  padding: 7px 8px;
  font: 700 13px/1.15 Rajdhani, sans-serif;
}

.inbox-correction-grid input:focus,
.inbox-correction-grid select:focus {
  outline: 2px solid rgba(0, 196, 255, .25);
  border-color: rgba(0, 196, 255, .55);
}

.inbox-actions {
  display: flex;
  gap: 7px;
  align-items: center;
}

.policy-row.blocker,
.policy-row.bad {
  border-color: rgba(255, 77, 109, .4);
  background: rgba(255, 77, 109, .08);
}

.policy-row.warn {
  border-color: rgba(255, 191, 71, .4);
  background: rgba(255, 191, 71, .07);
}

.accounting-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.account-card {
  min-height: 98px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(5, 8, 20, .54);
  padding: 12px;
}

.account-card span,
.account-card small {
  display: block;
  color: var(--muted);
}

.account-card strong {
  display: block;
  margin: 8px 0 5px;
  font: 700 22px/1.05 JetBrains Mono, monospace;
  overflow-wrap: anywhere;
}

.account-card.ok {
  border-color: rgba(0, 232, 162, .35);
}

.account-card.bad {
  border-color: rgba(255, 77, 109, .45);
}

.audit-row span {
  color: var(--muted);
  font: 700 11px/1 JetBrains Mono, monospace;
}

.summary-row strong,
.allocation-row strong,
.rate-row strong,
.archive-row strong {
  font-family: JetBrains Mono, monospace;
}

.row-meta {
  color: var(--muted);
  font-size: 12px;
}

.vessel-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 50%;
  margin-right: 7px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, .68);
}

.modal-backdrop.show {
  display: grid;
}

.line-modal {
  width: min(920px, 100%);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.crop-modal {
  width: min(980px, 100%);
  max-height: 94vh;
  overflow: auto;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.crop-body {
  display: grid;
  gap: 8px;
  padding: 14px;
}

#cropCanvas {
  width: 100%;
  max-height: 68vh;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: #020410;
  touch-action: none;
}

.crop-help {
  color: var(--muted);
  font-size: 13px;
}

.crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 12px 14px;
  flex-wrap: wrap;
}

.modal-head {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
}

.modal-head h2 {
  margin: 0;
}

.modal-notes {
  display: grid;
  padding: 0 14px 14px;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 12px 14px;
}

.simple-file-modal {
  width: min(760px, 100%);
}

.simple-file-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.modal-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
}

.receipt-review-modal {
  width: min(1120px, 100%);
  max-height: 94vh;
  overflow: auto;
}

.receipt-review-body {
  display: grid;
  grid-template-columns: minmax(280px, .86fr) minmax(420px, 1.14fr);
  gap: 14px;
  padding: 14px;
}

.receipt-review-preview {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: color-mix(in srgb, var(--panel-2) 82%, transparent);
}

.receipt-review-image-wrap {
  display: grid;
  place-items: center;
  min-height: 360px;
  border-radius: calc(var(--radius) - 2px);
  background: rgba(0, 0, 0, .22);
  overflow: hidden;
}

.receipt-review-image-wrap img {
  max-width: 100%;
  max-height: 64vh;
  object-fit: contain;
  border-radius: 8px;
}

.receipt-review-file,
.receipt-review-help {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.receipt-review-file-icon {
  display: grid;
  place-items: center;
  min-height: 280px;
  color: var(--accent);
  font-size: 80px;
  border-radius: 12px;
  background: rgba(0, 144, 192, .08);
}

.receipt-review-form {
  display: grid;
  gap: 12px;
  align-content: start;
}

.receipt-review-alert {
  display: grid;
  gap: 5px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 12px;
  padding: 12px;
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
}

.receipt-review-alert strong {
  color: var(--text);
}

.receipt-review-alert span {
  color: var(--muted);
  font-size: 13px;
}

.receipt-review-notes {
  padding: 0;
}

.receipt-review-notes textarea {
  min-height: 110px;
}

.receipt-review-save-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.pdf-sheet {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 794px;
  background: #ffffff;
  color: #111827;
  font-family: Arial, sans-serif;
  padding: 34px;
}

.pdf-sheet h1,
.pdf-sheet h2,
.pdf-sheet h3 {
  margin: 0 0 10px;
  color: #003048;
}

.pdf-sheet table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 10px;
}

.pdf-sheet th,
.pdf-sheet td {
  border: 1px solid #cbd5e1;
  padding: 5px;
  text-align: left;
}

.pdf-sheet th {
  background: #e6f3f7;
}

.pdf-image {
  max-width: 100%;
  max-height: 530px;
  object-fit: contain;
  border: 1px solid #cbd5e1;
  display: block;
  margin: 8px auto 18px;
}

.pdf-expense-onepage {
  width: 794px;
  height: 1123px;
  overflow: hidden;
  padding: 20px;
  background: #f4f8fb;
  color: #082033;
  font-family: Arial, sans-serif;
}

.pdf-cover {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 12px;
  min-height: 86px;
  padding: 14px 16px;
  color: #ffffff;
  background: linear-gradient(135deg, #003048 0%, #004860 58%, #0090c0 100%);
  border-radius: 12px;
}

.pdf-kicker {
  font-size: 10px;
  letter-spacing: 3px;
  font-weight: 800;
  color: #9de8ff;
}

.pdf-cover h1 {
  margin: 5px 0 3px;
  color: #ffffff;
  font-size: 26px;
  letter-spacing: 1px;
}

.pdf-cover p {
  margin: 0;
  font-size: 10.5px;
  color: #d7eff8;
}

.pdf-cover-total {
  min-width: 154px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}

.pdf-cover-total span,
.pdf-cover-total small,
.pdf-info-grid span,
.pdf-score-row span {
  text-transform: uppercase;
  color: #7c94a8;
  font-size: 8px;
  letter-spacing: 1.1px;
  font-weight: 800;
}

.pdf-cover-total strong {
  color: #ffffff;
  font-size: 17px;
}

.pdf-cover-total small {
  color: #b6efff;
}

.pdf-info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin: 7px 0;
}

.pdf-info-grid div,
.pdf-card,
.pdf-notes {
  border: 1px solid #c6d8e3;
  border-radius: 10px;
  background: #ffffff;
}

.pdf-info-grid div {
  min-height: 34px;
  padding: 6px 7px;
}

.pdf-info-grid b {
  display: block;
  margin-top: 3px;
  font-size: 8.5px;
  color: #082033;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-settlement {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0 0 7px;
}

.pdf-settlement div {
  min-height: 50px;
  padding: 7px 9px;
  border: 1px solid #c6d8e3;
  border-radius: 8px;
  background: #ffffff;
}

.pdf-settlement span {
  display: block;
  text-transform: uppercase;
  color: #64748b;
  font-size: 8px;
  letter-spacing: 1.1px;
  font-weight: 800;
}

.pdf-settlement b {
  display: block;
  margin: 3px 0 2px;
  color: #004860;
  font-size: 13px;
}

.pdf-settlement small {
  color: #64748b;
  font-size: 7.5px;
}

.pdf-settlement .return-company {
  border-color: #ffb020;
  background: #fff8e8;
}

.pdf-settlement .pay-staff {
  border-color: #0090c0;
  background: #e9f8ff;
}

.pdf-settlement .balanced {
  border-color: #00a878;
  background: #eafbf5;
}

.pdf-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 7px;
}

.pdf-card {
  padding: 8px 9px;
}

.pdf-card h3 {
  margin: 0 0 5px;
  color: #004860;
  font-size: 12px;
}

.pdf-score-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  margin-bottom: 5px;
}

.pdf-score-row div {
  border-radius: 7px;
  background: #eef7fb;
  padding: 5px;
}

.pdf-score-row strong {
  display: block;
  font-size: 14px;
  color: #0090c0;
}

.pdf-score-row small {
  display: block;
  color: #536878;
  font-size: 9px;
}

.pdf-card p {
  margin: 0;
  color: #2a4051;
  font-size: 8.6px;
  line-height: 1.22;
}

.pdf-rate-list {
  display: grid;
  gap: 4px;
}

.pdf-rate-row {
  display: grid;
  grid-template-columns: 1fr 62px 86px;
  align-items: center;
  gap: 5px;
  padding: 4px 5px;
  border-radius: 6px;
  background: #eef7fb;
  color: #30495b;
  font-size: 8px;
}

.pdf-rate-row strong {
  color: #004860;
  font-size: 8.5px;
  white-space: nowrap;
}

.pdf-rate-row b {
  color: #082033;
  font-size: 8.5px;
  text-align: right;
}

.pdf-rate-row span {
  color: #64748b;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-policy-bars {
  display: grid;
  gap: 9px;
}

.pdf-policy-row {
  display: grid;
  grid-template-columns: 64px 1fr 26px;
  align-items: center;
  gap: 9px;
  min-height: 22px;
  color: #30495b;
  font-size: 10px;
  font-weight: 800;
}

.pdf-policy-row::before {
  content: "";
  grid-column: 2;
  grid-row: 1;
  height: 12px;
  border-radius: 999px;
  background: #e6eef4;
}

.pdf-policy-row i {
  grid-column: 2;
  grid-row: 1;
  height: 12px;
  min-width: 4px;
  border-radius: 999px;
  z-index: 1;
}

.pdf-policy-row.blocker i { background: #ff3b5c; }
.pdf-policy-row.warn i { background: #ffb020; }
.pdf-policy-row.info i { background: #0090c0; }

.pdf-bar-row {
  display: grid;
  grid-template-columns: 108px 1fr 92px;
  align-items: center;
  gap: 7px;
  margin: 4px 0;
  font-size: 8.8px;
}

.pdf-bar-row span {
  font-weight: 800;
  color: #263f50;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-bar-row b {
  color: #004860;
  text-align: right;
}

.pdf-bar-track {
  height: 9px;
  border-radius: 999px;
  background: #e4eef5;
  overflow: hidden;
}

.pdf-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #00e8a2, #0090c0);
}

.pdf-lines-card {
  margin-top: 7px;
  padding-bottom: 6px;
}

.pdf-lines-card h3 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.pdf-lines-card h3 small {
  color: #64748b;
  font-size: 8px;
}

.pdf-expense-onepage table {
  margin: 0;
  font-size: 7.7px;
}

.pdf-expense-onepage th,
.pdf-expense-onepage td {
  padding: 2.6px 3.4px;
}

.pdf-rate-cell small {
  display: block;
  margin-top: 1px;
  color: #64748b;
  font-size: 6.5px;
  line-height: 1;
}

.pdf-notes {
  margin-top: 6px;
  padding: 6px 8px;
  font-size: 8.5px;
  line-height: 1.2;
  color: #263f50;
}

.pdf-footer {
  margin-top: 5px;
  color: #64748b;
  font-size: 7.5px;
  text-align: center;
}

.pdf-muted {
  color: #64748b;
  font-size: 8.5px;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: grid;
  gap: 8px;
}

.toast {
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  min-width: 240px;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 22px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
}

@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .brand-block div:not(.brand-mark),
  .expense-file-box,
  .nav-link span,
  .rail-footer {
    display: none;
  }

  .brand-block {
    justify-content: center;
  }

  .nav-link {
    justify-content: center;
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

  .summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .report-panel .form-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .report-panel .form-grid label,
  .report-panel .form-grid label:nth-child(14),
  .report-panel .form-grid label:nth-child(15),
  .report-panel .form-grid label:nth-child(16) {
    grid-column: span 3;
  }

  .report-panel .form-grid label:nth-child(11) {
    grid-column: span 6;
  }

  .workbook-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .right-column {
    position: static;
  }
}

@media (max-width: 820px) {
  html,
  body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }

  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  }

  .app-shell {
    display: block;
  }

  .workspace,
  .topbar,
  .mobile-home,
  .main-grid,
  .panel {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .ai-score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbook-summary {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .workbook-summary-card strong {
    font-size: 16px;
  }

  .ai-two-col {
    grid-template-columns: 1fr;
  }

  .side-rail {
    display: none;
  }

  .topbar {
    min-height: 48px;
    padding: 8px 10px;
    gap: 8px;
  }

  .topbar-title h1 {
    font-size: 18px;
    white-space: nowrap;
  }

  .topbar-title span {
    font-size: 10px;
    display: block;
    max-width: calc(100vw - 22px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .clock-chip,
  .status-chip,
  .font-ctrl {
    display: none;
  }

  .mobile-home {
    display: block;
    padding: 8px 8px 2px;
  }

  .expense-desk {
    display: none;
  }

  .desk-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: auto;
    padding: 8px;
    gap: 8px;
  }

  .desk-head > div:first-child {
    min-width: 0;
  }

  .desk-head h2 {
    margin: 2px 0;
    font-size: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .desk-head p {
    max-width: 100%;
    font-size: 12px;
  }

  .desk-total {
    min-width: 112px;
    padding: 7px 8px;
    text-align: right;
  }

  .desk-total strong {
    font-size: 14px;
    white-space: nowrap;
  }

  .desk-actions {
    display: none;
  }

  .desk-progress {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .desk-head span,
  .desk-total span,
  .desk-progress span {
    font-size: 9px;
    letter-spacing: .03em;
  }

  .desk-progress div {
    min-width: 0;
    display: grid;
    gap: 3px;
    justify-items: center;
    padding: 7px 4px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .desk-progress strong {
    font-size: 13px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .desk-progress div:last-child {
    border-right: 0;
  }

  .mobile-hero {
    display: none;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
      linear-gradient(135deg, rgba(0, 72, 96, .76), rgba(12, 15, 34, .96)),
      var(--panel);
    padding: 18px;
  }

  .mobile-hero span {
    color: var(--cyan);
    font: 700 11px/1 JetBrains Mono, monospace;
  }

  .mobile-hero h2 {
    margin: 6px 0 8px;
    font-size: 31px;
    line-height: 1;
  }

  .mobile-hero p {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    overflow-wrap: anywhere;
  }

  .mobile-file-switcher {
    min-width: 0;
    margin-top: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(12, 15, 34, .94);
    padding: 9px;
  }

  .mobile-file-switcher label {
    display: block;
    margin-bottom: 7px;
    color: var(--dim);
    font: 700 11px/1 JetBrains Mono, monospace;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .mobile-file-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 7px;
  }

  .mobile-file-row select,
  .mobile-file-row button {
    min-width: 0;
    min-height: 42px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: #0b1226;
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
  }

  .mobile-file-row select {
    padding: 0 12px;
  }

  .mobile-file-row button {
    display: grid;
    place-items: center;
    background: var(--cyan);
    color: #001320;
  }

  .mobile-file-switcher small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
  }

  .mobile-primary-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 7px;
    width: 100%;
  }

  .mobile-big-btn {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(17, 22, 45, .98), rgba(8, 12, 28, .98));
    color: var(--text);
    font-weight: 700;
    padding: 0 11px;
    box-shadow: none;
  }

  .mobile-big-btn i {
    font-size: 17px;
    color: var(--cyan);
  }

  .mobile-big-btn span {
    max-width: 100%;
    overflow-wrap: anywhere;
    text-align: left;
  }

  .mobile-big-btn.primary {
    grid-column: 1 / -1;
    border-color: rgba(0, 196, 255, .6);
    background: linear-gradient(135deg, rgba(0, 144, 192, .46), rgba(0, 72, 96, .92));
  }

  .mobile-primary-actions [data-mobile-action="review"],
  .mobile-primary-actions [data-mobile-action="ai"] {
    display: none;
  }

  .mobile-big-btn.success {
    border-color: rgba(0, 232, 162, .55);
  }

  .mobile-big-btn.success i {
    color: var(--green);
  }

  .mobile-status-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 7px;
  }

  .mobile-status-strip div {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(12, 15, 34, .92);
    padding: 8px;
  }

  .mobile-status-strip span,
  .mobile-status-strip strong {
    display: block;
  }

  .mobile-status-strip span {
    color: var(--dim);
    font-size: 11px;
  }

  .mobile-status-strip strong {
    margin-top: 4px;
    color: var(--text);
    font: 700 13px/1 JetBrains Mono, monospace;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-bottom-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(0, 196, 255, .24);
    background: rgba(7, 9, 26, .96);
    box-shadow: 0 -12px 26px rgba(0, 0, 0, .32);
    backdrop-filter: blur(14px);
  }

  .mobile-bottom-actions button {
    min-width: 0;
    min-height: 46px;
    border: 1px solid var(--line-2);
    border-radius: 12px;
    background: rgba(12, 18, 38, .96);
    color: var(--muted);
    display: grid;
    place-items: center;
    gap: 3px;
    font-weight: 800;
  }

  .mobile-bottom-actions button:first-child {
    border-color: rgba(0, 196, 255, .64);
    background: linear-gradient(135deg, rgba(0, 144, 192, .54), rgba(0, 72, 96, .92));
    color: var(--text);
  }

  .mobile-bottom-actions i {
    font-size: 16px;
    color: var(--cyan);
  }

  .mobile-bottom-actions span {
    font-size: 11px;
    line-height: 1;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .summary-strip,
  .form-grid,
  .modal-grid,
  .simple-file-grid {
    grid-template-columns: 1fr;
  }

  .report-panel .form-grid {
    grid-template-columns: 1fr;
  }

  .report-panel .form-grid label,
  .report-panel .form-grid label:nth-child(11),
  .report-panel .form-grid label:nth-child(14),
  .report-panel .form-grid label:nth-child(15),
  .report-panel .form-grid label:nth-child(16) {
    grid-column: 1;
  }

  .receipt-review-body {
    grid-template-columns: 1fr;
  }

  .receipt-review-preview {
    min-height: auto;
  }

  .receipt-review-image-wrap {
    min-height: 260px;
  }

  .receipt-review-save-actions {
    width: 100%;
  }

  .receipt-review-save-actions .btn {
    flex: 1 1 180px;
  }

  .summary-strip {
    display: none;
  }

  .main-grid,
  .summary-strip {
    padding-left: 10px;
    padding-right: 10px;
  }

  .main-grid {
    display: block;
  }

  .left-column,
  .right-column {
    gap: 10px;
  }

  .left-column {
    display: flex;
    flex-direction: column;
  }

  .upload-panel {
    order: 1;
  }

  .inbox-panel {
    order: 2;
  }

  .review-panel {
    order: 3;
  }

  .report-panel {
    order: 4;
  }

  .policy-panel {
    order: 5;
  }

  .accounting-panel {
    order: 6;
  }

  .rates-panel {
    order: 7;
  }

  .audit-panel {
    order: 8;
  }

  .archive-panel {
    order: 9;
  }

  .right-column {
    display: none;
  }

  .panel {
    margin-bottom: 10px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-heading .button-row {
    width: 100%;
  }

  .panel-heading .btn,
  .table-actions .btn {
    flex: 1;
    min-height: 42px;
  }

  .mobile-upload-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 14px 14px 0;
  }

  .upload-panel .panel-heading .upload-single-btn,
  .drop-zone {
    display: none;
  }

  .mobile-action-card.primary-upload {
    min-height: 78px;
    padding: 14px;
  }

  .table-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1;
    padding: 0 6px;
  }

  .expense-table-wrap {
    display: none;
  }

  .mobile-lines {
    display: grid;
    gap: 10px;
    padding: 12px 14px 14px;
  }

  .mobile-line-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(5, 8, 20, .58);
    padding: 12px;
  }

  .mobile-line-card.selected {
    border-color: rgba(0, 196, 255, .6);
    background: rgba(0, 144, 192, .11);
  }

  .mobile-line-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  .mobile-line-top strong {
    display: block;
    font-size: 17px;
    line-height: 1.15;
  }

  .mobile-line-top span {
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-line-total {
    color: var(--cyan);
    font: 700 15px/1 JetBrains Mono, monospace;
    white-space: nowrap;
  }

  .mobile-line-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 12px 0;
  }

  .mobile-line-meta div {
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 8px;
    background: rgba(255, 255, 255, .025);
  }

  .mobile-line-meta span,
  .mobile-line-meta strong {
    display: block;
  }

  .mobile-line-meta span {
    color: var(--dim);
    font-size: 11px;
  }

  .mobile-line-meta strong {
    color: var(--text);
  }

  .mobile-line-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 8px;
    margin-top: 10px;
  }

  .mobile-line-actions button {
    min-height: 40px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .line-modal {
    width: 100%;
    max-height: 92vh;
    overflow: auto;
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .inbox-card {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .inbox-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  }

  .inbox-correction-grid {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }

  .inbox-preview {
    width: 72px;
    height: 72px;
  }

  .inbox-title {
    display: block;
  }

  .accounting-grid {
    grid-template-columns: 1fr;
  }

  .crop-modal {
    width: 100%;
    max-height: 94vh;
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .crop-actions .btn {
    flex: 1;
    min-width: 126px;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .side-rail,
  .topbar,
  .summary-strip,
  .right-column,
  .upload-panel,
  .table-actions,
  .modal-backdrop,
  .toast-stack {
    display: none !important;
  }

  .app-shell,
  .main-grid {
    display: block;
  }
}
