/* =========================================================
   ERP OZID.it – Stylesheet
   Modernes, schlichtes Flat-Design: viel Weißraum, dezente
   Farbakzente, feine statt schwere Schatten.
   ========================================================= */
:root {
    --primary: #14747a;
    --primary-dark: #0d5359;
    --primary-soft: #eaf3f3;
    --bg: #fafbfb;
    --surface: #ffffff;
    --border: #e5e9ea;
    --text: #1c2526;
    --text-muted: #6b7677;
    --error: #c0392b;
    --error-bg: #fdecea;
    --success: #1e7d46;
    --success-bg: #eaf7ee;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(20, 30, 30, 0.04), 0 1px 8px rgba(20, 30, 30, 0.04);
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

h1 { font-size: 1.5rem; font-weight: 650; letter-spacing: -0.01em; margin: 0 0 4px; }
h2 { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.005em; }

/* --- Auth-Seiten (Login, Registrierung, Passwort) --- */
.auth-container {
    max-width: 420px;
    margin: 64px auto;
    background: var(--surface);
    padding: 36px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.auth-container h1 { margin-top: 0; }
.hint { color: var(--text-muted); font-size: 0.88rem; }

/* --- Formulare --- */
label { display: block; margin-bottom: 14px; font-size: 0.85rem; font-weight: 600; color: #3a4445; }
label.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--text); }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=file], select, textarea {
    width: 100%;
    padding: 9px 11px;
    margin-top: 5px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

button, .btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.15s ease, transform 0.05s ease;
}
button:hover, .btn:hover { background: var(--primary-dark); }
button:active, .btn:active { transform: translateY(1px); }
.btn-secondary { background: #eef0f0; color: #3a4445; }
.btn-secondary:hover { background: #e2e6e6; }
.btn-danger { background: var(--error); }
.btn-danger:hover { background: #a3291d; }

.error { background: var(--error-bg); color: var(--error); padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.9rem; }
.success { background: var(--success-bg); color: var(--success); padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.9rem; }

/* --- Navigation --- */
.topnav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    flex-wrap: wrap;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topnav .brand { font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; color: var(--primary-dark); }
.topnav .search-form input {
    max-width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}
.topnav .search-form input::placeholder { color: var(--text-muted); }
.topnav .links { display: flex; flex-wrap: wrap; align-items: center; }
.topnav .links a { color: var(--text-muted); text-decoration: none; margin-left: 16px; font-size: 0.85rem; font-weight: 500; transition: color 0.15s ease; }
.topnav .links a:hover { color: var(--primary-dark); }
.topnav .links a.logout { opacity: 0.7; }

/* --- Layout --- */
.container { max-width: 1000px; margin: 28px auto; padding: 0 16px; }
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}
.card h2 { margin-top: 0; margin-bottom: 12px; }

/* --- Tabellen --- */
/* Auf schmalen Bildschirmen (iPhone etc.) scrollt die Tabelle horizontal
   innerhalb ihrer Karte, statt die ganze Seite zu sprengen. Funktioniert
   automatisch für JEDE Tabelle im Projekt, ohne dass an den ~20 Stellen
   im Code, an denen Tabellen vorkommen, etwas geändert werden musste. */
table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 0.88rem; white-space: nowrap; }
th { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.02em; }
tr:last-child td { border-bottom: none; }

/* --- Status-Badges --- */
.status-badge { padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 650; letter-spacing: 0.01em; }
.status-draft { background: #eef0f0; color: #5a6465; }
.status-sent { background: #fef3d6; color: #8a5a00; }
.status-partially_paid { background: #dbeafe; color: #1d4ed8; }
.status-paid { background: var(--success-bg); color: var(--success); }
.status-overdue { background: var(--error-bg); color: var(--error); }
.status-cancelled { background: #eef0f0; color: #8a9293; text-decoration: line-through; }

/* --- Passwort-Stärke-Anzeige --- */
.pw-strength-bar { height: 5px; border-radius: 3px; background: var(--border); margin-top: 6px; overflow: hidden; }
.pw-strength-fill { height: 100%; width: 0%; border-radius: 3px; transition: width 0.2s ease, background 0.2s ease; }
.pw-strength-label { font-size: 0.76rem; margin-top: 4px; color: var(--text-muted); }

/* --- Positions-/Item-Zeilen --- */
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.item-row { display: grid; grid-template-columns: 3fr 1fr 1fr 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 10px; }
.item-row.has-catalog { grid-template-columns: 1.5fr 2.5fr 1fr 1fr 1fr 1fr auto; }
.item-row label { margin-bottom: 0; font-size: 0.78rem; }
.remove-item { background: var(--error-bg); color: var(--error); border: none; border-radius: var(--radius-sm); padding: 8px 10px; cursor: pointer; height: 40px; font-weight: 600; }
.remove-item:hover { background: #f9d9d5; }

@media (max-width: 900px) {
    /* Tablet-Zwischenstufe: die sehr breite Katalog-Positionszeile (7 Spalten)
       wird schon hier etwas kompakter, bevor sie bei 700px ganz umbricht. */
    .item-row.has-catalog { grid-template-columns: 1fr 1fr 1fr 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
    .item-row { grid-template-columns: 1fr 1fr; }
    .item-row.has-catalog { grid-template-columns: 1fr 1fr; }
    .topnav { flex-direction: column; align-items: flex-start; gap: 8px; }
    .topnav .links a { margin-left: 0; margin-right: 14px; }
    .topnav .search-form { order: 3; width: 100%; }
    .topnav .search-form input { width: 100%; }
    .container { padding: 0 10px; margin: 16px auto; }
    .card { padding: 16px 14px; }
    .grid-3, .grid-2, .grid-2-wide { grid-template-columns: 1fr; }
    h1 { font-size: 1.3rem; }
}

/* --- Utility-Klassen --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid-2-wide { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.inline-form { display: inline; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-tight { margin-top: -8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.btn-xs { padding: 4px 9px; font-size: 0.76rem; }
.text-lg { font-size: 1.15rem; font-weight: 650; }
.nowrap { white-space: nowrap; }
.form-inline-actions { margin-bottom: 16px; display: flex; gap: 8px; }
.logo-preview { max-height: 60px; max-width: 200px; display: block; margin-bottom: 8px; border-radius: var(--radius-sm); }
.chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; margin-top: 16px; }
.chart-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.chart-bar-label { font-size: 0.68rem; color: var(--text-muted); margin-top: 4px; }
.btn-submit-inline { height: 40px; align-self: end; }
.grid-payment-row { display: grid; grid-template-columns: 1fr 1fr 2fr auto; gap: 8px; align-items: end; }
.grid-gutschrift-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 8px; align-items: end; }
