/* Agentur-Tool — Design-System (Web Werk Wagner CI), reines CSS ohne Build-Schritt. */

:root {
  --brand-dark: #1B3A32;
  --brand-dark2: #123028;
  --brand-darker: #0E211C;
  --brand-accent: #9CAF6E;
  --brand-accent2: #7E9B57;
  --brand-cream: #F5F1E3;
  --brand-cream-muted: #EAE4CF;
  --brand-orange: #E8963C;
  --brand-line: #DCD3B8;
  --muted: #6B7563;

  --bg: var(--brand-cream);
  --surface: #FFFFFF;
  --text: var(--brand-dark);
  --text-muted: var(--muted);
  --border: var(--brand-line);
  --radius: 1rem;
  --radius-lg: 1.25rem;
  --shadow: 0 1px 2px rgba(27, 58, 50, 0.06);
  --font-heading: "Poppins", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
}

html.dark {
  --bg: var(--brand-darker);
  --surface: rgba(27, 58, 50, 0.6);
  --text: var(--brand-cream);
  --text-muted: rgba(245, 241, 227, 0.6);
  --border: rgba(255, 255, 255, 0.1);
  --shadow: none;
  color-scheme: dark;
}

html { color-scheme: light; }
html.dark { color-scheme: dark; }

/* Manche Browser (v. a. Chrome/Edge unter Windows) berücksichtigen bei
   aufgeklappten <select>-Listen nicht automatisch das Farbschema der Seite —
   Hintergrund/Text der <option>-Elemente daher explizit setzen, sonst sind
   sie im Dark Mode kaum lesbar (heller Text auf hellem Grund). */
select option {
  background-color: #ffffff;
  color: #1b3a32;
}
html.dark select option {
  background-color: #16332c;
  color: #f5f1e3;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  transition: background .15s ease, color .15s ease;
}
h1, h2, h3, .heading { font-family: var(--font-heading); color: var(--text); }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }

.app-shell { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--brand-dark);
  color: var(--brand-cream);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
html.dark .sidebar { background: var(--brand-darker); border-right: 1px solid rgba(255,255,255,.08); }
.sidebar .logo { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; font-family: var(--font-heading); font-weight: 700; font-size: 1.05rem; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar .nav-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  color: rgba(245,241,227,.75); text-decoration: none; font-size: .9rem; transition: background .15s, color .15s;
}
.sidebar .nav-link:hover { background: rgba(245,241,227,.08); color: var(--brand-cream); }
.sidebar-version { text-align: center; font-size: .7rem; color: rgba(245,241,227,.4); padding-top: 10px; }
.sidebar .nav-link.active { background: var(--brand-accent); color: var(--brand-dark); font-weight: 600; }
.sidebar .nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: rgba(245,241,227,.4); margin: 16px 12px 6px; }

/* Main area */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 20;
}
.topbar .search-wrap { position: relative; width: 320px; max-width: 40vw; }
.content { padding: 28px; flex: 1; }

/* Cards / layout primitives */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-hover:hover { border-color: rgba(156,175,110,.6); }
.divide > * + * { border-top: 1px solid var(--border); }
.muted { font-size: .85rem; color: var(--text-muted); }
.page-heading { font-size: 1.5rem; font-weight: 600; }
.section-heading { font-size: 1.05rem; font-weight: 600; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; text-decoration: none; color: inherit; transition: background .15s; }
.row:hover { background: rgba(156,175,110,.08); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* Forms */
label.field-label { display: block; font-size: .78rem; font-weight: 600; color: var(--text-muted); margin: 0 0 6px; }
input, select, textarea {
  width: 100%; border-radius: .8rem; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); padding: .6rem .85rem; font-size: .9rem; font-family: inherit;
}
html.dark input, html.dark select, html.dark textarea { background: rgba(255,255,255,.05); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(156,175,110,.5); outline-offset: 1px; border-color: var(--brand-accent); }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; font-size: .85rem; font-weight: 500; padding: .6rem 1.2rem; border: none; text-decoration: none; transition: opacity .15s, background .15s; }
.btn-primary { background: var(--brand-dark); color: var(--brand-cream); }
html.dark .btn-primary { background: var(--brand-accent); color: var(--brand-dark); }
.btn-primary:hover { opacity: .9; }
.btn-secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { background: rgba(156,175,110,.08); }
.btn-ghost { background: none; border: none; color: var(--text-muted); font-size: .85rem; }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: none; border: none; color: #dc2626; font-size: .85rem; }
html.dark .btn-danger { color: #f87171; }
.btn-sm { padding: .35rem .7rem; font-size: .78rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Pills / badges */
.pill { display: inline-flex; align-items: center; font-size: .72rem; font-weight: 600; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.pill-active { background: rgba(156,175,110,.2); color: var(--brand-accent2); }
.pill-paused { background: rgba(232,150,60,.15); color: var(--brand-orange); }
.pill-done { background: rgba(27,58,50,.1); color: var(--brand-dark); }
html.dark .pill-done { background: rgba(255,255,255,.1); color: var(--brand-cream); }
.pill-high { background: rgba(220,38,38,.12); color: #dc2626; }
html.dark .pill-high { background: rgba(248,113,113,.15); color: #f87171; }
.pill-medium { background: rgba(232,150,60,.15); color: var(--brand-orange); }
.pill-low { background: rgba(156,175,110,.15); color: var(--brand-accent2); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.tab { padding: 10px 16px; font-size: .88rem; border-bottom: 2px solid transparent; color: var(--text-muted); text-decoration: none; white-space: nowrap; }
.tab.active { border-color: var(--brand-accent); color: var(--text); font-weight: 600; }
.tab:hover { color: var(--text); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(14,33,28,.5); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.modal { background: var(--surface); background-color: var(--bg); border-radius: var(--radius-lg); border: 1px solid var(--border); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; padding: 24px; animation: modal-pop .15s ease-out; }
.modal.modal-lg { max-width: 680px; }
@keyframes modal-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-close { background: none; border: none; font-size: 1.3rem; color: var(--text-muted); line-height: 1; }

/* Toasts */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--brand-dark); color: var(--brand-cream); padding: 12px 18px; border-radius: 12px; font-size: .85rem; box-shadow: 0 4px 12px rgba(0,0,0,.2); animation: modal-pop .15s ease-out; }
.toast.error { background: #b91c1c; }
.toast.success { background: var(--brand-accent2); }

/* Globales Zeiterfassungs-Widget */
.time-widget { position: fixed; bottom: 90px; right: 24px; display: flex; align-items: center; gap: 10px; z-index: 90; }
.tw-btn { border: none; cursor: pointer; box-shadow: 0 4px 14px rgba(14,33,28,.25); transition: transform .1s ease; }
.tw-btn:hover { transform: translateY(-1px); }
.tw-btn:disabled { opacity: .6; cursor: default; transform: none; }
.tw-btn-main { display: flex; align-items: center; gap: 8px; background: var(--brand-dark); color: var(--brand-cream); border-radius: 999px; padding: 12px 16px; font-weight: 600; font-size: .9rem; }
html.dark .tw-btn-main { background: var(--brand-accent); color: var(--brand-dark); }
.time-widget.tw-active .tw-btn-main { background: var(--brand-accent2); color: #fff; }
.time-widget.tw-paused .tw-btn-main { background: var(--brand-orange); color: #fff; }
.tw-btn-finalize { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%; background: var(--surface); color: var(--text); border: 1px solid var(--border) !important; }
.tw-icon { display: flex; }
.tw-elapsed { font-variant-numeric: tabular-nums; min-width: 2.5em; }
.time-widget.tw-pulse .tw-btn-main { animation: tw-pulse-anim 1.6s ease-in-out; }
@keyframes tw-pulse-anim {
  0%, 100% { box-shadow: 0 4px 14px rgba(14,33,28,.25); }
  25%, 75% { box-shadow: 0 0 0 8px rgba(232,150,60,.35); }
  50% { box-shadow: 0 0 0 4px rgba(232,150,60,.55); }
}

/* Board (Kanban) */
.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1100px) { .board { grid-template-columns: repeat(2, 1fr); } }
.board-col { background: rgba(156,175,110,.08); border-radius: var(--radius); padding: 12px; min-height: 120px; display: flex; flex-direction: column; }
html.dark .board-col { background: rgba(255,255,255,.03); }
.board-col-title { font-size: .8rem; font-weight: 600; margin-bottom: 10px; display: flex; justify-content: space-between; color: var(--text-muted); }
.board-col-body { flex: 1; min-height: 70px; }
.task-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: grab; font-size: .85rem; }
.task-card.dragging { opacity: .4; }
.task-card .title { font-weight: 500; margin-bottom: 6px; }
.task-card-excerpt { font-size: .78rem; margin-bottom: 6px; line-height: 1.35; }
.task-card .meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.board-col.drop-hover { outline: 2px dashed var(--brand-accent); outline-offset: 2px; }

/* Board-Kategorien (Accordion) */
.board-category { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 4px 16px 16px; }
.board-category-summary { cursor: pointer; list-style: none; padding: 14px 0; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.board-category-summary::-webkit-details-marker { display: none; }
.board-category-summary::before { content: "▸"; margin-right: 8px; display: inline-block; transition: transform .15s ease; }
.board-category[open] .board-category-summary::before { transform: rotate(90deg); }
.board-category-summary > span:first-child { display: flex; align-items: center; }

/* Dateisystem (Explorer) */
.fm-breadcrumb { font-size: .9rem; }
.fm-breadcrumb a { color: var(--text); text-decoration: none; font-weight: 500; padding: 2px 4px; border-radius: 4px; }
.fm-breadcrumb a:hover { background: rgba(156,175,110,.15); }
.fm-breadcrumb a.fm-row-drop-hover { outline: 2px dashed var(--brand-accent); }
#fm-dropzone { padding: 4px; transition: outline .1s ease; }
#fm-dropzone.fm-drop-hover { outline: 2px dashed var(--brand-accent); outline-offset: -2px; background: rgba(156,175,110,.06); }
.fm-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.fm-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.fm-table td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.fm-table tr:last-child td { border-bottom: none; }
.fm-row:hover { background: rgba(156,175,110,.06); }
.fm-row.dragging { opacity: .4; }
.fm-row.fm-row-drop-hover { outline: 2px dashed var(--brand-accent); outline-offset: -2px; }
.fm-name { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 500; }
.fm-name-btn { background: none; border: none; cursor: pointer; padding: 0; font-size: inherit; font-family: inherit; }
.fm-name:hover { text-decoration: underline; }
.fm-actions { white-space: nowrap; text-align: right; }
.fm-actions button { margin-left: 4px; }

/* Gantt */
.gantt-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.gantt-label { width: 190px; flex-shrink: 0; min-width: 0; }
.gantt-label .t { font-size: .78rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-label .u { font-size: .68rem; color: var(--text-muted); }
.gantt-track { position: relative; flex: 1; height: 24px; border-radius: 6px; background: var(--brand-cream-muted); overflow: hidden; }
html.dark .gantt-track { background: rgba(255,255,255,.05); }
.gantt-bar { position: absolute; top: 2px; bottom: 2px; border-radius: 4px; }
.gantt-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(220,211,184,.5); }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: #f87171; z-index: 5; }

/* misc */
.empty-state { padding: 24px; color: var(--text-muted); font-size: .9rem; }
.avatar { width: 34px; height: 34px; border-radius: 999px; background: var(--brand-dark); color: var(--brand-cream); display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 600; flex-shrink: 0; }
html.dark .avatar { background: var(--brand-accent); color: var(--brand-dark); }
.icon-circle { width: 44px; height: 44px; border-radius: 999px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hidden { display: none !important; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.inline-flex { display: inline-flex; align-items: center; gap: 8px; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.mb-0{margin-bottom:0}.mb-2{margin-bottom:8px}.mb-3{margin-bottom:12px}.mb-4{margin-bottom:16px}.mb-6{margin-bottom:24px}
.mt-2{margin-top:8px}.mt-4{margin-top:16px}.mt-6{margin-top:24px}
table.simple { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.simple th { text-align: left; font-size: .72rem; text-transform: uppercase; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.simple td { padding: 10px; border-bottom: 1px solid var(--border); }

/* Login page */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--brand-dark), var(--brand-dark2)); padding: 20px; }
.login-card { background: var(--brand-cream); border-radius: 24px; padding: 40px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-card h1 { margin: 0 0 4px; font-size: 1.4rem; }
.login-card p.sub { color: var(--muted); font-size: .85rem; margin: 0 0 24px; }

/* Search dropdown */
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 340px; overflow-y: auto; z-index: 50; }
.search-results .group-title { font-size: .68rem; text-transform: uppercase; color: var(--text-muted); padding: 8px 12px 2px; }
.search-results a { display: block; padding: 8px 12px; font-size: .85rem; text-decoration: none; color: var(--text); }
.search-results a:hover { background: rgba(156,175,110,.1); }

@media (max-width: 800px) {
  .sidebar { position: fixed; left: -240px; z-index: 90; transition: left .2s; }
  .sidebar.open { left: 0; }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
}
