:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --border: #e2e8f0;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
  font-family: "Inter", "Segoe UI", sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

header {
  background: var(--card);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
}

nav .brand {
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

nav .brand .logo {
  height: 32px;
  width: auto;
}

nav .nav-links {
  display: flex;
  gap: 16px;
}

nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
}

nav a.active {
  color: var(--accent);
}

main {
  padding: 32px;
  max-width: 1240px;
  margin: 0 auto;
}

.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-title h1 {
  font-size: 28px;
  margin: 0;
}

.subtle {
  color: var(--muted);
  font-size: 14px;
}

.card-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card .value {
  font-size: 22px;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge.success {
  background: rgba(22, 163, 74, 0.12);
  color: var(--success);
}

.badge.warning {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
}

.badge.neutral {
  background: var(--accent-soft);
  color: var(--accent);
}

.section {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-header h2 {
  margin: 0;
  font-size: 18px;
}

.filters {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.filters label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.filters input,
.filters select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
}

.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table-tools {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.table-tools .pill {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: #f8fafc;
  text-align: left;
}

th,
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:last-child td {
  border-bottom: none;
}

.text-success {
  color: var(--success);
  font-weight: 600;
}

.text-danger {
  color: var(--danger);
  font-weight: 600;
}

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

.layout-two {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

footer {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 900px) {
  .layout-two {
    grid-template-columns: 1fr;
  }
  nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* Pagination Styles */
.pagination-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

.pagination-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.pagination-info select {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-pagination {
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-pagination:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.btn-pagination:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-pagination.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

#page-numbers {
  display: flex;
  gap: 4px;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: var(--card);
  border-radius: 8px;
  max-width: 1000px;
  max-height: 80vh;
  width: 90%;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.btn-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-close:hover {
  background: var(--border);
}

.modal-body {
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: 600;
  color: var(--muted);
  min-width: 150px;
}

.detail-value {
  text-align: right;
  font-family: monospace;
  word-break: normal;
  flex: 1;
  margin-left: 20px;
}

.detail-value.accounting-entries {
  font-size: 0.9em;
  line-height: 1.4;
  white-space: pre-line;
  max-width: none;
}

.btn-details {
  background: var(--accent);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.btn-details:hover {
  background: #1d4ed8;
}

/* Accounting entries column styles */
.accounting-entries {
  font-size: 0.67em; /* 1.5 times smaller than normal */
  line-height: 1.3;
  font-family: 'Courier New', monospace;
  white-space: pre-line;
  max-width: 120px;
  padding: 4px;
}

/* Operation Direction Styles */
.operation-cell {
  text-align: center;
  padding: 8px 4px;
}

.operation-icon {
  font-size: 20px;
  margin-bottom: 4px;
  display: block;
}

.operation-icon.incoming {
  color: var(--success);
}

.operation-icon.outgoing {
  color: var(--danger);
}

.operation-text {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
}

/* Button styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-secondary {
  background: var(--bg);
  color: var(--muted);
}

.btn-secondary:hover {
  background: var(--card);
  color: var(--text);
}

/* Language Selector */
.language-selector {
  position: relative;
  margin-left: 20px;
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 20px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  min-width: 120px;
  justify-content: space-between;
  white-space: nowrap;
}

.lang-toggle:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.current-lang {
  font-weight: 500;
  font-size: 13px;
  line-height: 1.2;
}

.lang-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
  padding: 8px;
}

.language-selector:hover .lang-dropdown,
.lang-dropdown:hover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  text-align: left;
  transition: all 0.2s ease;
  width: 100%;
}

.lang-option:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.lang-option.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.flag-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}


