:root {
  --bg: #f4f6f5;
  --panel: #ffffff;
  --line: #dfe5e1;
  --text: #1d2b24;
  --muted: #68766f;
  --green: #1f8a57;
  --green-dark: #14643f;
  --red: #b83a3a;
  --blue: #2367a6;
  --shadow: 0 18px 45px rgba(30, 55, 42, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
}

.topbar p,
.drop-subtitle,
.metric span,
.table-title span {
  color: var(--muted);
}

.panel,
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.upload-panel,
.result-head,
.table-panel {
  padding: 22px;
}

.upload-panel form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: stretch;
}

.dropzone {
  display: grid;
  gap: 6px;
  min-height: 104px;
  align-content: center;
  padding: 18px;
  border: 1px dashed #9ab8a8;
  background: #fbfdfc;
  cursor: pointer;
}

.dropzone input {
  max-width: 100%;
}

.drop-title {
  font-size: 18px;
  font-weight: 700;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  background: var(--green);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.mode-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 128px));
  gap: 4px;
  padding: 4px;
  border: 1px solid #b9d8c8;
  background: #ffffff;
}

.mode-tab {
  min-height: 36px;
  padding: 0 12px;
  background: transparent;
  color: var(--green-dark);
  border: 0;
}

.mode-tab.active {
  background: #e9f5ee;
}

.mode-tab:hover {
  background: #f1faf5;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

button.secondary {
  border: 1px solid #b9d8c8;
  background: #ffffff;
  color: var(--green-dark);
}

button:hover {
  background: var(--green-dark);
}

button.secondary:hover {
  background: #e9f5ee;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.notice {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid #bdd6c7;
  background: #f1faf5;
  color: var(--green-dark);
}

.notice.error {
  border-color: #e1bdba;
  background: #fff4f2;
  color: #8f2727;
}

.grid {
  display: grid;
  gap: 14px;
  margin: 16px 0;
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.metric {
  display: grid;
  gap: 8px;
  min-height: 88px;
  padding: 16px;
}

.metric strong {
  font-size: 24px;
  line-height: 1.1;
}

.metric.income strong {
  color: var(--green-dark);
}

.metric.expense strong {
  color: var(--red);
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--green-dark);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
}

.table-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef4f0;
  font-size: 13px;
}

td {
  line-height: 1.35;
}

.num {
  text-align: right;
  white-space: nowrap;
}

.signed {
  font-weight: 700;
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 18px;
  }

  .topbar,
  .result-head,
  .table-title,
  .result-actions,
  .upload-panel form {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .grid.four,
  .grid.six {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }
}
