/* ============================================================
   Kassarollen Backend – Admin-Oberfläche
   Markenfarbe: #3AAA35 (wie im alten Shop)
   ============================================================ */
:root {
    --brand:      #3AAA35;
    --brand-dark: #2e8a2a;
    --ink:        #1f2733;
    --muted:      #6b7684;
    --line:       #e3e7ec;
    --bg:         #f4f6f8;
    --card:       #ffffff;
    --danger:     #d9342b;
    --danger-dark:#b4271f;
    --warn:       #e08a00;
    --radius:     8px;
    --shadow:     0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; }
code { background: #f0f2f5; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 230px; flex-shrink: 0; background: #1f2733; color: #cdd5df;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark {
    display: inline-grid; place-items: center; width: 34px; height: 34px;
    background: var(--brand); color: #fff; font-weight: 800; border-radius: 7px; letter-spacing: -.5px;
}
.brand-name { font-weight: 700; color: #fff; font-size: 16px; }
.nav { display: flex; flex-direction: column; padding: 10px 0; flex: 1; }
.nav a { color: #cdd5df; padding: 10px 18px; border-left: 3px solid transparent; }
.nav a:hover { background: rgba(255,255,255,.05); text-decoration: none; color: #fff; }
.nav a.active { color: #fff; border-left-color: var(--brand); background: rgba(58,170,53,.14); font-weight: 600; }
.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.user strong { display: block; color: #fff; }
.user small { color: var(--muted); }
.logout { display: inline-block; margin-top: 8px; color: #cdd5df; font-size: 13px; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { padding: 20px 28px 0; }
.topbar h1 { margin: 0; font-size: 22px; }
.page { padding: 18px 28px 40px; }
.flash-area { padding: 12px 28px 0; }

/* ---------- Flash ---------- */
.flash { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 10px; border: 1px solid transparent; }
.flash-success { background: #e8f6e8; border-color: #bce3ba; color: #1f6b1c; }
.flash-error   { background: #fdeceb; border-color: #f3c2bf; color: #a11910; }
.flash-info    { background: #e9f1fb; border-color: #c2d8f0; color: #1a4f8a; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card h2 { margin: 0 0 14px; font-size: 16px; }
.card h3 { font-size: 14px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.empty { color: var(--muted); padding: 16px 0; text-align: center; }
.hint { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.warn-text { color: var(--danger); font-weight: 700; }

/* ---------- Dashboard stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.stat-card.stat-warn { border-color: #f3c2bf; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.stat-link { font-size: 13px; }

/* ---------- Columns ---------- */
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.columns .wide { grid-column: span 1; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.table tbody tr:hover { background: #fafbfc; }
.table .r { text-align: right; }
.table.compact th, .table.compact td { padding: 6px 8px; }
.table tfoot td { border-bottom: none; padding: 5px 10px; }
.table tfoot .grand td { border-top: 2px solid var(--line); font-size: 15px; padding-top: 10px; }
.actions { white-space: nowrap; }
.inline { display: inline; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef1f4; color: var(--ink); }
.badge.big { font-size: 13px; padding: 5px 12px; }
.badge-ok { background: #e8f6e8; color: #1f6b1c; }
.badge-muted { background: #eef1f4; color: var(--muted); }
.status-pending    { background: #fff4d6; color: #8a6400; }
.status-processing { background: #e9f1fb; color: #1a4f8a; }
.status-on-hold    { background: #f0eaf9; color: #5a3a9a; }
.status-completed  { background: #e8f6e8; color: #1f6b1c; }
.status-cancelled  { background: #f1f3f5; color: #6b7684; }
.status-refunded   { background: #fdeceb; color: #a11910; }
.status-failed     { background: #fdeceb; color: #a11910; }
.pay-paid   { background: #e8f6e8; color: #1f6b1c; }
.pay-pending{ background: #fff4d6; color: #8a6400; }
.pay-failed, .pay-refunded, .pay-partially_refunded { background: #fdeceb; color: #a11910; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 6px; cursor: pointer; font-size: 13.5px; font-weight: 600; transition: .12s; }
.btn:hover { background: #f4f6f8; text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { background: #fff; border-color: #f3c2bf; color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* Lösch-/Gefahrenzone */
.card.danger-zone { border-color: #f3c2bf; }
.card.danger-zone h2 { color: var(--danger); }
.inline-form { display: inline; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Forms ---------- */
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], input[type=date], input[type=file], select, textarea {
    width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(58,170,53,.15); }
.filters input, .filters select { width: auto; }
textarea { resize: vertical; }
.field { margin-bottom: 14px; }
.field > label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 13px; }
.field.checkbox label { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.field.checkbox input { width: auto; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }
.checkbox-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow: auto; }
.checkbox-list label { display: flex; gap: 8px; align-items: center; font-weight: 500; }

/* ---------- Product form grid ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.form-actions-top { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.thumb { max-width: 100%; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 10px; }

/* ---------- Order detail ---------- */
address { font-style: normal; line-height: 1.6; }
.note-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.note-form .checkbox { font-weight: 500; display: flex; gap: 8px; align-items: center; }
.note-form .checkbox input { width: auto; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline li.customer { background: #fffaf0; margin: 0 -8px; padding: 10px 8px; border-radius: 6px; }
.tl-meta { color: var(--muted); font-size: 12px; margin-bottom: 3px; }

/* ---------- Inventory ---------- */
.stock-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stock-form select, .stock-form input { width: auto; }
.stock-form input[type=text] { min-width: 150px; }
.log-list { list-style: none; margin: 0; padding: 0; }
.log-list li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.log-change { font-weight: 800; min-width: 38px; }
.log-change.pos { color: var(--brand-dark); }
.log-change.neg { color: var(--danger); }
.howto { padding-left: 18px; color: var(--muted); font-size: 13px; }
.howto li { margin-bottom: 6px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; flex-wrap: wrap; gap: 10px; }
.pg-info { color: var(--muted); font-size: 13px; }
.pg-links { display: flex; gap: 5px; }

/* ---------- Login ---------- */
.login-body { background: linear-gradient(160deg, #2e8a2a, #1f2733); min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { background: #fff; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.25); padding: 32px; width: 100%; max-width: 380px; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .brand-mark { width: 52px; height: 52px; font-size: 20px; margin: 0 auto 10px; }
.login-brand h1 { font-size: 20px; margin: 0; }
.login-brand p { color: var(--muted); margin: 4px 0 0; }
.login-card form label { display: block; margin-bottom: 14px; }
.login-card form label span { display: block; font-weight: 600; margin-bottom: 5px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .form-grid, .columns { grid-template-columns: 1fr; }
    .sidebar { width: 68px; }
    .brand-name, .user, .logout, .nav a span { display: none; }
    .nav a { text-align: center; padding: 12px 0; font-size: 11px; }
}
