:root {
  --brand-blue: #0d315f;
  --border: #d8dce2;
  --text: #2f3337;
  --muted: #6d737a;
  --page: #f3f6fa;
  --panel: #ffffff;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

.login-body {
  min-height: 100vh;
  background: #f4f4f6;
}

.login-shell {
  width: min(420px, calc(100vw - 32px));
  margin: 96px auto 0;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 38px;
  color: #4a5563;
  font-size: 24px;
}

.login-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  min-height: 350px;
  padding: 40px 36px;
  background: #fff;
  border: 1px solid #d5d7da;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.25);
}

.login-card h1 {
  margin: 0 0 22px;
  font-size: 14px;
}

.login-card label {
  color: #50627c;
  font-size: 13px;
}

.login-card input {
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 10px;
}

.login-card button {
  justify-self: end;
  min-width: 62px;
  height: 36px;
  margin-top: 28px;
  color: #fff;
  border: 0;
  border-radius: 4px;
  background: #1976c9;
  cursor: pointer;
}

.login-error {
  margin: -12px 0 8px;
  color: #9f1d2b;
}

.login-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 22px;
  color: #4d5865;
  font-size: 14px;
}

.login-links button {
  height: 31px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: #4d5865;
}

.menu-body,
.portal-body {
  min-height: 100vh;
  background: var(--page);
}

.menu-topbar,
.app-topbar {
  height: 39px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  background: #fff;
  border-top: 4px solid #eff5e8;
  border-bottom: 1px solid #dce0e5;
}

.menu-user {
  margin-left: auto;
}

.menu-layout {
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  gap: 24px;
  padding: 24px;
}

.menu-panel {
  background: #fff;
  border: 1px solid #e2e6eb;
  padding: 22px;
}

.menu-panel h1,
.menu-panel h2 {
  margin: 0 0 16px;
}

.menu-panel ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

.menu-panel a {
  display: block;
  padding: 12px 0;
  color: var(--brand-blue);
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

.app-title {
  font-size: 18px;
  color: #5a6067;
}

.app-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.mandant-select {
  height: 28px;
  display: inline-flex;
  align-items: center;
}

.mandant-select {
  padding: 0 10px;
  border-radius: 4px;
  border: 0;
  background: #d9e9ff;
  color: #062b54;
  font-size: 14px;
  font-weight: 700;
  min-width: 250px;
}

.program-select {
  width: 200px;
  height: 29px;
  border: 1px solid #b9bfc8;
  border-radius: 3px;
  color: #6f7277;
  background: #fff;
}

.toolbar {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding-left: 18px;
  background: #fff;
  border-bottom: 1px solid #e5e9ef;
}

.icon-button {
  width: 34px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  color: var(--brand-blue);
  background: transparent;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
}

.toolbar-divider {
  width: 1px;
  height: 42px;
  margin-left: 8px;
  background: #ced3da;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(280px, 1fr);
  gap: 12px;
  padding: 12px 12px calc(var(--editor-height, 250px) + 18px);
  overflow: hidden;
}

.filter-card,
.grid-panel,
.editor-panel {
  background: #fff;
  border-radius: 2px;
}

.filter-card {
  padding: 12px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 22px;
}

.journal-select,
.effective-select {
  height: 44px;
  border: 0;
  border-radius: 4px;
  padding: 0 14px;
  background: #f3f5f7;
  color: #2d3339;
  font-size: 16px;
}

.journal-select {
  min-width: 285px;
}

.status-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 5px 9px;
  border-radius: 3px;
  background: #dff3e5;
  color: #175227;
  font-weight: 700;
  font-size: 13px;
}

.filter-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input {
  height: 32px;
  width: 245px;
  border: 1px solid #9da6b2;
  border-radius: 4px;
  padding: 0 10px;
}

.expanded-filters {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 10px;
  background: #fafafa;
}

.filter-grid {
  display: grid;
  grid-template-columns: 200px 200px 200px 200px 200px;
  gap: 12px;
  align-items: end;
}

.filter-grid label,
.editor-grid label {
  display: grid;
  gap: 4px;
  color: #5d646d;
  font-weight: 700;
  font-size: 14px;
}

.filter-grid input,
.filter-grid select,
.editor-grid input,
.editor-grid select {
  height: 32px;
  min-width: 0;
  border: 1px solid #b9bfc8;
  border-radius: 4px;
  padding: 0 9px;
  background: #fff;
  color: #2f3337;
}

.wide-filter {
  grid-column: 1 / -1;
}

.reset-button,
.save-button,
.modal-actions button {
  height: 32px;
  border: 0;
  border-radius: 4px;
  padding: 0 12px;
  font-weight: 700;
  cursor: pointer;
}

.reset-button {
  justify-self: end;
  border: 1px solid #d6dbe1;
  background: #fff;
  color: var(--brand-blue);
}

.grid-panel {
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
}

.ledger-table thead {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ledger-table th,
.ledger-table td {
  height: 32px;
  border-bottom: 1px solid #e2e5e9;
  padding: 0 10px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ledger-table th {
  color: #666b70;
  font-size: 14px;
}

.ledger-table td.numeric,
.ledger-table th.numeric {
  text-align: right;
}

.ledger-table tr {
  cursor: pointer;
}

.ledger-table tr.selected {
  background: #eef5ff;
  color: #082a52;
  font-weight: 700;
}

.ledger-table.striped tbody tr:nth-child(even) {
  background: #f8fafc;
}

.grid-scroll {
  overflow: auto;
}

.editor-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  height: var(--editor-height, 250px);
  min-height: 180px;
  padding: 14px 12px 8px;
  display: grid;
  grid-template-columns: 216px 1fr;
  gap: 16px;
  box-shadow: 0 -4px 14px rgba(15, 23, 42, 0.12);
  overflow: auto;
}

.editor-resize-handle {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ns-resize;
}

.editor-resize-handle::before {
  content: "";
  width: 32px;
  height: 4px;
  border-radius: 999px;
  background: #9ba2ab;
}

.voucher-box {
  display: grid;
  align-content: start;
  gap: 6px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--brand-blue);
  font-weight: 700;
}

.new-pill {
  padding: 4px 9px;
  border-radius: 3px;
  background: #d9f5cc;
  color: #2f6b1f;
  font-size: 12px;
}

.upload-box {
  height: 112px;
  border: 1px dashed #bfc5ce;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5c6672;
  text-align: center;
  line-height: 1.4;
}

.editor-main {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
}

.editor-grid {
  display: grid;
  grid-template-columns: 215px 215px 215px 1fr 215px;
  gap: 16px;
  align-items: start;
}

.amount-badge {
  justify-self: end;
  min-width: 44px;
  height: 22px;
  padding: 3px 7px;
  border-radius: 3px;
  background: #ececec;
  text-align: right;
  font-size: 12px;
  color: #333;
}

.text-stack {
  display: grid;
  gap: 4px;
}

.save-line {
  display: flex;
  justify-content: flex-end;
}

.save-button,
.modal-primary {
  color: #fff;
  background: #245da2;
}

.empty-state,
.form-message {
  color: #6f7680;
}

.form-message.error {
  color: #9f1d2b;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.62);
}

.settings-modal {
  width: 400px;
  background: #fff;
  border-radius: 7px;
  overflow: hidden;
}

.settings-modal h2 {
  margin: 0;
  padding: 18px 16px;
  font-size: 18px;
}

.settings-modal label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
}

.settings-modal input {
  width: 18px;
  height: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  background: #f0f2f4;
}

.modal-secondary {
  background: transparent;
  color: var(--brand-blue);
}

@media (max-width: 900px) {
  .app-right,
  .program-select {
    display: none;
  }

  .filter-grid,
  .editor-grid,
  .editor-panel {
    grid-template-columns: 1fr;
  }

  .journal-select {
    min-width: 0;
    width: 100%;
  }
}
