/* fibu.abstraqt.at — main.css */
/* Cleanes, tabellenorientiertes Design. Keine Spielereien. */

:root {
    --bg:           #f5f4f0;
    --bg-card:      #ffffff;
    --bg-hover:     #f0efe9;
    --bg-input:     #ffffff;
    --border:       #e0ddd6;
    --border-light: #ece9e1;
    --text:         #1a1a18;
    --text-2:       #5a5a52;
    --text-3:       #9a9a8e;
    --accent:       #1a1a18;
    --green:        #1a7a3c;
    --green-bg:     #e8f5ee;
    --orange:       #c25a00;
    --orange-bg:    #fef3e8;
    --red:          #c0261a;
    --red-bg:       #fdecea;
    --blue:         #1a4a8a;
    --blue-bg:      #e8eef8;
    --mono:         'JetBrains Mono', 'Fira Mono', monospace;
    --sans:         'IBM Plex Sans', 'Helvetica Neue', sans-serif;
    --radius:       6px;
    --shadow:       0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ---- Navigation ---- */
.nav {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    padding: 14px 20px 14px 0;
    margin-right: 8px;
    border-right: 1px solid var(--border);
    text-decoration: none;
    white-space: nowrap;
}

.nav-item {
    padding: 14px 14px;
    font-size: 13px;
    color: var(--text-2);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color .15s;
}

.nav-item:hover { color: var(--text); }
.nav-item.active { color: var(--text); border-bottom-color: var(--text); font-weight: 500; }
.nav-logout { margin-left: auto; color: var(--text-3); }
.nav-logout:hover { color: var(--red); }

/* ---- Layout ---- */
.main { padding: 24px; max-width: 1400px; margin: 0 auto; }

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

.page-title { font-size: 18px; font-weight: 600; }
.page-sub   { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ---- Metriken ---- */
.metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

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

.metric-label { font-size: 11px; color: var(--text-3); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.metric-value { font-size: 22px; font-weight: 600; font-family: var(--mono); }
.metric-sub   { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.metric-value.warn   { color: var(--orange); }
.metric-value.danger { color: var(--red); }
.metric-value.ok     { color: var(--green); }

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
}

.card-title { font-size: 13px; font-weight: 600; }
.card-action { font-size: 12px; color: var(--blue); text-decoration: none; }
.card-action:hover { text-decoration: underline; }
.card-body { padding: 0; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

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

thead th {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    background: var(--bg);
}

thead th:hover { color: var(--text); }
thead th.sort-asc::after  { content: ' ↑'; }
thead th.sort-desc::after { content: ' ↓'; }

tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-hover); }

td.mono { font-family: var(--mono); font-size: 12px; }
td.right, th.right { text-align: right; }
td.amount { font-family: var(--mono); font-size: 13px; font-weight: 500; text-align: right; }

/* Direkt editierbare Felder in Tabelle */
td input.inline {
    border: none;
    background: transparent;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-3);
    width: 88px;
    outline: none;
    cursor: pointer;
}

td input.inline:focus {
    background: var(--orange-bg);
    border-radius: 4px;
    padding: 2px 6px;
    color: var(--text);
    cursor: text;
}

/* ---- Badges ---- */
.badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
    font-weight: 500;
}

.badge-ok      { background: var(--green-bg);  color: var(--green); }
.badge-warn    { background: var(--orange-bg); color: var(--orange); }
.badge-danger  { background: var(--red-bg);    color: var(--red); }
.badge-info    { background: var(--blue-bg);   color: var(--blue); }
.badge-neutral { background: var(--bg-hover);  color: var(--text-2); }

/* ---- Firma-Pill ---- */
.firma {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--bg-hover);
    color: var(--text-2);
    border: 1px solid var(--border);
    font-family: var(--mono);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-family: var(--sans);
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    text-decoration: none;
    transition: background .15s, border-color .15s;
}

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

.btn-primary {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

.btn-primary:hover { background: #333; }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }

/* ---- KI-Hinweis ---- */
.ki-hint {
    background: var(--blue-bg);
    color: var(--blue);
    font-size: 12px;
    padding: 8px 12px;
    border-radius: var(--radius);
    margin: 8px 12px 12px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

/* ---- Filter-Leiste ---- */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-pill {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-2);
    background: var(--bg-card);
    text-decoration: none;
    transition: all .15s;
}

.filter-pill:hover, .filter-pill.active {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

.filter-search {
    margin-left: auto;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    font-family: var(--sans);
    background: var(--bg-card);
    color: var(--text);
    width: 180px;
}

.filter-search:focus { outline: none; border-color: var(--text); }

/* ---- Login ---- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 360px;
    box-shadow: var(--shadow);
}

.login-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 24px;
}

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field input {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: var(--sans);
    background: var(--bg-input);
    color: var(--text);
}
.field input:focus { outline: none; border-color: var(--text); }

.error-msg {
    background: var(--red-bg);
    color: var(--red);
    font-size: 12px;
    padding: 8px 10px;
    border-radius: var(--radius);
    margin-bottom: 12px;
}

/* ---- Totals-Leiste ---- */
.totals {
    display: flex;
    gap: 24px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    align-items: center;
}

.total-item { display: flex; flex-direction: column; gap: 2px; }
.total-lbl  { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.total-val  { font-weight: 600; font-family: var(--mono); }

/* ---- Utility ---- */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.flex { display: flex; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.ml-auto { margin-left: auto; }
.text-3 { color: var(--text-3); }
.text-ok { color: var(--green); }
.text-warn { color: var(--orange); }
.text-danger { color: var(--red); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .metrics { grid-template-columns: 1fr 1fr; }
    .grid2   { grid-template-columns: 1fr; }
}

/* ---- Searchable Select ---- */
.ss-wrap { display: flex; flex-direction: column; }
.ss-search {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    font-size: 13px;
    font-family: var(--sans);
    background: var(--bg-input);
    color: var(--text);
}
.ss-search:focus { outline: none; border-color: var(--text); }
.ss-list {
    border-radius: 0 0 var(--radius) var(--radius);
    border: 1px solid var(--border);
    font-size: 13px;
    font-family: var(--sans);
    background: var(--bg-input);
    color: var(--text);
    padding: 2px 0;
    width: 100%;
}
.ss-list option { padding: 4px 10px; }

/* ---- Custom Searchable Dropdown v2 ---- */
.csd-wrap { position: relative; }
.csd-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: var(--sans);
    background: var(--bg-input);
    color: var(--text);
    cursor: pointer;
}
.csd-input:focus { outline: none; border-color: var(--text); }
.csd-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--bg-card);
    border: 1px solid var(--text);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 200px;
    overflow-y: auto;
    z-index: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.csd-wrap.open .csd-dropdown { display: block; }
.csd-wrap.open .csd-input { border-radius: var(--radius) var(--radius) 0 0; border-color: var(--text); }
.csd-item {
    padding: 7px 10px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
}
.csd-item:hover, .csd-item.focused { background: var(--bg-hover); }
.csd-item.selected { background: var(--text); color: var(--bg); }
.csd-empty { padding: 7px 10px; font-size: 12px; color: var(--text-3); }

/* Demo-Modus */
.demo-blur { filter: blur(5px); user-select: none; color: var(--text-3); pointer-events: none; }

/* Select und Textarea wie Input stylen */
.field select, .field textarea {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: var(--sans);
    background: var(--bg-input);
    color: var(--text);
}
.field select:focus, .field textarea:focus { outline: none; border-color: var(--text); }
