:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --muted: #64748b;
    --text: #0f172a;
    --accent: #0ea5e9;
    --accent-2: #22c55e;
    --danger: #dc2626;
    --border: #dbe3ee;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.4 Inter, Segoe UI, Roboto, Arial, sans-serif;
}

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    border-bottom: 1px solid var(--border);
}

.app-navbar { background: #ffffff; min-height: 58px; }
.app-navbar .nav-link { color: #0f172a; }
.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus { color: #0b5ed7; }
.app-navbar .dropdown-menu { background: #ffffff; border: 1px solid var(--border); }
.app-navbar .dropdown-item { color: #0f172a; }
.app-navbar .dropdown-item:hover,
.app-navbar .dropdown-item:focus { background: #f1f5f9; color: #0f172a; }

.main-wrap-fluid { width: 100%; margin: 76px 0 18px; padding: 0 12px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
h1 { font-size: 18px; margin: 0 0 10px; font-weight: 600; }
.muted { color: var(--muted); }
.error {
    color: #7f1d1d;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 10px;
}

.grid { display: grid; gap: 8px; }
.label { color: var(--muted); font-size: 12px; }
input, select {
    width: 100%;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: var(--text);
    padding: 0 10px;
}

.btn { height: 34px; border-radius: 8px; border: 0; padding: 0 12px; background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; }
a.btn.alt { background: var(--accent-2); color: #fff; text-decoration: none; display: inline-flex; align-items: center; }
a.btn.alt:hover, a.btn.alt:focus-visible { color: #fff; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.small { font-size: 12px; }

.journal-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.journal-toolbar-one-line {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.journal-title {
    font-size: 14px;
    font-weight: 600;
    margin-right: 4px;
}

.journal-link {
    font-size: 12px;
    color: #0b5ed7;
    text-decoration: underline;
}

.journal-search-input {
    width: 160px;
    max-width: 160px;
    height: 24px;
    border-radius: 4px;
    padding: 0 8px;
    font-size: 12px;
    margin-left: auto;
}

.journal-footer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
    font-size: 12px;
    color: #334155;
}

.journal-info,
.journal-rate-info {
    white-space: nowrap;
}

.table-scroll-wrapper {
    max-height: calc(100vh - 190px);
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}

.compact-table { margin-bottom: 0; }
.compact-table th,
.compact-table td {
    white-space: nowrap;
    padding: 2px;
    vertical-align: middle;
    font-size: 12px;
    line-height: 1.2;
}

.compact-more th,
.compact-more td {
    padding: 2px;
    font-size: 11px;
}

.table-header-sticky th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
}

.user-row-inactive > td { background: #f6e9ee !important; }

table.dataTable tbody th,
table.dataTable tbody td {
    padding: 2px;
}

#invoiceTable tbody tr:nth-child(odd):not(.invoice-row-storno) > td {
    background-color: #ddffdd;
}

#invoiceTable tbody tr:nth-child(even):not(.invoice-row-storno) > td {
    background-color: #eeffee;
}

#invoiceTable tbody tr.invoice-row-storno:nth-child(odd) > td {
    background-color: #ffdddd !important;
}

#invoiceTable tbody tr.invoice-row-storno:nth-child(even) > td {
    background-color: #ffeeee !important;
}

#journalTable tbody tr:nth-child(odd):not(.journal-row-storno) > td {
    background-color: #ddffdd;
}

#journalTable tbody tr:nth-child(even):not(.journal-row-storno) > td {
    background-color: #eeffee;
}

#journalTable tbody tr.journal-row-storno:nth-child(odd) > td {
    background-color: #ffdddd !important;
}

#journalTable tbody tr.journal-row-storno:nth-child(even) > td {
    background-color: #ffeeee !important;
}

#invoiceTable td.js-tip-cell {
    cursor: help;
}

.invoice-cell-tooltip {
    position: fixed;
    z-index: 9999;
    min-width: 260px;
    max-width: 420px;
    background: #ffffff;
    border: 1px solid #94a3b8;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
    padding: 8px 10px;
    font-size: 12px;
    color: #0f172a;
    pointer-events: none;
}

.invoice-cell-tooltip .line {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px;
    margin-bottom: 2px;
}

.invoice-cell-tooltip .lbl {
    text-align: left;
    color: #334155;
}

.invoice-cell-tooltip .lbl.right {
    text-align: right;
}

.invoice-cell-tooltip .val {
    text-align: left;
}

.invoice-cell-tooltip .val.right {
    text-align: right;
}

.invoice-cell-tooltip .tip-currency {
    font-weight: 700;
    text-align: right;
    margin-bottom: 4px;
    color: #0b5ed7;
}

.invoice-cell-tooltip .mini {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    font-style: italic;
    color: #64748b;
    text-align: right;
}

.invoice-cell-tooltip .sep {
    border-top: 1px solid #94a3b8;
    margin: 3px 0 4px;
}
