:root {
  --bg: #f4f6f9; --panel: #fff; --ink: #1c2530; --muted: #6b7684;
  --line: #e3e8ee; --brand: #91B848; --brand-d: #7ba03d;
  --danger: #d64545; --warn: #b8860b; --ok: #2e8b57;
  --radius: 10px; --shadow: 0 1px 3px rgba(20,30,45,.08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--brand); color: #24310f; display: flex;
  flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 18px; color: #fff; padding: 18px 20px; letter-spacing: .3px; }
.brand.center { text-align: center; color: var(--ink); }
.brand-logo { display: block; max-width: 100%; height: auto; }
/* Sidebar brand: light plaque so the dark logo stays legible */
.sidebar .brand { background: #fff; margin: 10px; padding: 12px; border-radius: 8px; }
.sidebar .brand-logo { max-height: 110px; margin: 0 auto; }
.login-logo { max-height: 150px; margin: 0 auto 6px; }
.sidebar nav { display: flex; flex-direction: column; padding: 6px; gap: 2px; flex: 1; }
.sidebar nav a { color: #24310f; font-weight: 500; padding: 10px 14px; border-radius: 8px; }
.sidebar nav a:hover { background: rgba(0,0,0,.10); text-decoration: none; }
.sidebar nav a.active { background: #56761f; color: #fff; }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(0,0,0,.15); }
.who { font-size: 13px; display: flex; flex-direction: column; }
.who span { color: rgba(0,0,0,.5); font-size: 11px; text-transform: uppercase; }
.logout { display: inline-block; margin-top: 8px; color: #2f3d16; font-size: 13px; }
.content { flex: 1; padding: 26px 32px; max-width: 1200px; }

/* Head */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; margin: 0; }
.head-actions { display: flex; gap: 8px; align-items: center; }

/* Buttons */
.btn { display: inline-block; padding: 8px 14px; border: 1px solid var(--line);
  background: #fff; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--ink); }
.btn:hover { border-color: #c4ccd6; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--brand-d); border-color: var(--brand-d); }
.btn.danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.small { padding: 5px 9px; font-size: 12px; }
.btn.full { width: 100%; }

/* Cards / panels */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); }
.stat span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
.stat strong { display: block; font-size: 22px; margin-top: 4px; }
.stat.warn strong { color: var(--danger); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.panel h2 { font-size: 15px; margin: 0 0 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

@media (max-width: 900px) {
  /* Sidebar wird zur oberen Navigationsleiste */
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar .brand { display: inline-block; margin: 8px 12px; padding: 6px 10px; }
  .sidebar .brand-logo { max-height: 48px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }
  .sidebar nav a { padding: 8px 12px; }
  .sidebar-foot { display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; }
  .logout { margin-top: 0; }
  .content { padding: 18px 16px; max-width: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .page-head { flex-wrap: wrap; gap: 10px; }
  .form .row { flex-direction: column; gap: 0; }
  .toolbar { max-width: none; }
}
@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .sidebar nav a { flex: 1 1 40%; text-align: center; }
}

/* Tables */
.table { width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.table th { background: #fafbfc; font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .3px; }
.table tr:last-child td { border-bottom: none; }
.table tr.done td { color: var(--muted); text-decoration: line-through; }
.muted { color: var(--muted); }
.overdue { color: var(--danger); font-weight: 600; }

/* Forms */
.form { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); max-width: 780px; }
.form label, .login-card label { display: block; margin-bottom: 14px; font-size: 13px; color: #445; }
.form .row { display: flex; gap: 14px; }
.form .row label { flex: 1; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; margin-top: 5px; font-family: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(145,184,72,.25); }
textarea { resize: vertical; }
.check { display: flex !important; align-items: center; gap: 8px; }
.check input { width: auto; margin: 0; }
.actions { display: flex; gap: 10px; margin-top: 8px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; max-width: 480px; }
.toolbar input { margin: 0; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 32px; width: 340px; box-shadow: 0 8px 30px rgba(20,30,45,.10); }
.login-card .brand { padding: 0 0 18px; }
.login-card h2 { font-size: 17px; margin: 4px 0 10px; }
.login-card .center, .center { text-align: center; }
.wide-card { width: 440px; max-width: 92vw; }
.qr-box { display: flex; justify-content: center; margin: 10px 0; }
.qr-box svg { width: 200px; height: 200px; }
.secret { display: inline-block; background: #f1f4f8; padding: 4px 8px; border-radius: 6px;
  letter-spacing: 2px; font-size: 13px; word-break: break-all; }
.link.center { display: block; margin-top: 12px; font-size: 13px; }
.consent-text { text-align: left; max-height: 260px; overflow: auto; border: 1px solid var(--line);
  border-radius: 8px; padding: 12px 14px; background: #fafbfc; font-size: 13px; margin-bottom: 14px; }
.consent-text p { margin: 0 0 10px; }
.consent-check { text-align: left; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.consent-check input { margin-top: 3px; }

/* Alerts / badges / tags */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert.error { background: #fdecec; color: var(--danger); border: 1px solid #f5c2c2; }
.alert.warn { background: #fdf6e3; color: var(--warn); border: 1px solid #e6d8a8; }
.alert.info { background: #eef4ff; color: #234; border: 1px solid #cfe0ff; }
.mfa-note { text-align: left; font-size: 13px; line-height: 1.45; }
.store-details { margin-top: 14px; text-align: left; }
.store-details summary { cursor: pointer; font-size: 13px; color: var(--brand); }
.store-grid { display: flex; gap: 14px; justify-content: center; margin-top: 12px; }
.store-item { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.store-qr svg { width: 120px; height: 120px; }
.tag { display: inline-block; background: #eef2f8; color: #45566b; padding: 2px 8px;
  border-radius: 999px; font-size: 12px; margin: 0 4px 2px 0; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.badge.draft { background: #eef2f8; color: #55636f; }
.badge.sending { background: #fdf6e3; color: var(--warn); }
.badge.sent, .badge.sent { background: #e6f4ec; color: var(--ok); }
.badge.failed { background: #fdecec; color: var(--danger); }
.badge.pending { background: #eef2f8; color: #55636f; }

/* Detail */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.link { display: inline-block; margin-top: 10px; font-size: 13px; }

/* Activities */
.inline-form { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.inline-form input, .inline-form select { margin: 0; width: auto; }
.inline-form input[name=subject] { flex: 1; min-width: 160px; }
.inline-form.wide input[name=subject], .inline-form.wide input:first-child { flex: 1; }
form.inline { display: inline; }
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.activity-list li.done .a-body strong { text-decoration: line-through; color: var(--muted); }
.a-body { flex: 1; display: flex; flex-direction: column; }
.check-btn { background: none; border: 1px solid var(--line); border-radius: 50%; width: 26px;
  height: 26px; cursor: pointer; font-size: 13px; color: var(--ok); }
.x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 18px; }
.x:hover { color: var(--danger); }
.row-actions { display: flex; gap: 6px; align-items: center; }
.mb { margin-bottom: 14px; }
.row-actions input { width: 110px; margin: 0; }
.tabs { display: flex; gap: 4px; margin: 4px 0 16px; }
.tabs a { padding: 6px 14px; border-radius: 8px; color: var(--muted); }
.tabs a.active { background: var(--brand); color: #fff; }

/* Kanban board */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.board-col { background: #eef1f5; border-radius: var(--radius); min-width: 240px; width: 240px; flex-shrink: 0; }
.col-head { display: flex; justify-content: space-between; padding: 12px 14px; font-weight: 600; font-size: 13px; }
.col-total { color: var(--muted); font-weight: 500; }
.col-body { padding: 0 10px 12px; min-height: 60px; display: flex; flex-direction: column; gap: 8px; }
.deal-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  box-shadow: var(--shadow); cursor: grab; }
.deal-card:active { cursor: grabbing; }
.deal-title { font-weight: 600; display: block; }
.deal-meta { display: flex; justify-content: space-between; font-size: 12px; margin-top: 4px; }
.email-preview { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fafbfc; max-height: 320px; overflow: auto; }

/* Task cards on the Kanban board */
.task-card { cursor: grab; }
.task-card:active { cursor: grabbing; }
.task-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.task-top .deal-title { font-weight: 600; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; font-size: 12px; }
.assign-form { margin-top: 4px; }
.assign-form select { width: 100%; font-size: 12px; padding: 5px 8px; margin: 0; }
.task-card .x { line-height: 1; }

/* Project cards */
.project-card .deal-title { display: block; margin-bottom: 4px; }
.small { font-size: 12px; }
.team-row { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border-radius: 50%; background: var(--brand); color: #fff; font-size: 11px; font-weight: 600; }

/* Documents / OCR */
.upload-tile { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border: 2px dashed var(--line);
  border-radius: var(--radius); cursor: pointer; margin-bottom: 12px; font-weight: 600; color: #445; transition: border-color .15s; }
.upload-tile:hover { border-color: var(--brand); }
.tile-icon { font-size: 26px; }
.form.flat { box-shadow: none; border: none; padding: 0; max-width: none; }
.doc-preview { width: 100%; max-height: 420px; object-fit: contain; border: 1px solid var(--line);
  border-radius: 8px; background: #fafbfc; margin-bottom: 12px; }
embed.doc-preview, iframe.doc-preview { height: 480px; border: 1px solid var(--line); }
.ocr-text { white-space: pre-wrap; word-break: break-word; background: #fafbfc; border: 1px solid var(--line);
  border-radius: 8px; padding: 12px; max-height: 260px; overflow: auto; font-size: 12px; color: #445; }
