/* ==========================================================================
   Pflichtenheft UI — ODOO4projects
   Design-System von odoo4projects.com: Midnight / Brass / Cream, Marcellus + Inter
   ========================================================================== */

:root {
  --midnight: #0d1b2e;
  --midnight-2: #12233c;
  --midnight-3: #162a45;
  --brass: #c9a227;
  --brass-bright: #ddb84a;
  --brass-deep: #8a6f1f;
  --cream: #f4f0e8;
  --cream-2: #ece6da;
  --ivory: #faf7f1;
  --ink: #171c26;
  --success: #4ade80;
  --danger: #ff6b6b;
  --info: #8fb4e0;

  --text: #f4f0e8;
  --text-soft: rgba(244, 240, 232, 0.62);
  --text-faint: rgba(244, 240, 232, 0.38);
  --line: rgba(244, 240, 232, 0.12);
  --line-strong: rgba(244, 240, 232, 0.2);
  --line-brass: rgba(201, 162, 39, 0.35);

  --radius: 0.5rem;
  --radius-lg: 1rem;
  --radius-pill: 2rem;
  --shadow-rest: 0 2px 10px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 18px 40px rgba(0, 0, 0, 0.45);
  --shadow-brass: 0 10px 26px rgba(201, 162, 39, 0.28);

  --font-body: Inter, "Segoe UI", sans-serif;
  --font-display: Marcellus, Georgia, serif;
}

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

body {
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(201, 162, 39, 0.10), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(22, 42, 69, 0.9), transparent 55%),
    var(--midnight);
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------------------------------------------------------------- Topline */
.topline {
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--brass) 20%, var(--brass-bright) 50%, var(--brass) 80%, transparent);
  opacity: 0.85;
}

/* ---------------------------------------------------------------- Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(13, 27, 46, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-brass);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.brand { display: inline-flex; align-items: center; text-decoration: none; }

.brand-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 0.6rem;
  padding: 5px 9px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.brand-chip img { height: 34px; width: auto; display: block; }
.brand-chip-lg { padding: 8px 14px; border-radius: 0.75rem; }
.brand-chip-lg img { height: 46px; }

.header-title { flex: 1; min-width: 0; }

.kicker {
  display: block;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass);
}

.header-title h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  margin: 0.05rem 0 0;
  color: #fff;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.header-actions { display: flex; align-items: center; gap: 0.85rem; }

.conn-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 4px rgba(244, 240, 232, 0.06);
  transition: background 0.3s, box-shadow 0.3s;
}
.conn-dot.ok { background: var(--success); box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.16); }
.conn-dot.error { background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.16); }
.conn-dot.loading { background: var(--brass); box-shadow: 0 0 0 4px rgba(201, 162, 39, 0.18); animation: pulse 1s infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.72rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}
.btn:active { transform: translateY(1px); }

.btn-brass { background: var(--brass); color: var(--midnight); }
.btn-brass:hover { background: var(--brass-bright); box-shadow: var(--shadow-brass); }

.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--brass); color: var(--brass-bright); }

.btn-block { width: 100%; }

.btn-icon { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- Toolbar */
main.container { flex: 1; padding-top: 1.75rem; padding-bottom: 3rem; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: flex-end;
  background: linear-gradient(180deg, rgba(22, 42, 69, 0.75), rgba(18, 35, 60, 0.75));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.05rem 1.15rem;
  box-shadow: var(--shadow-rest);
}

.search-wrap { position: relative; flex: 1 1 340px; min-width: 220px; }

.search-icon {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--text-faint);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

#search {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.98rem;
  padding: 0.8rem 2.6rem 0.8rem 2.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 27, 46, 0.65);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
#search::placeholder { color: var(--text-faint); }
#search:focus {
  outline: none;
  border-color: var(--brass);
  background: rgba(13, 27, 46, 0.9);
  box-shadow: 0 0 0 3px var(--line-brass);
}

.clear-search {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(244, 240, 232, 0.1);
  color: var(--text-soft);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.clear-search:hover { background: rgba(244, 240, 232, 0.2); color: var(--text); }

.toolbar-actions { display: flex; gap: 0.6rem; align-items: flex-end; }

.select-wrap { display: flex; flex-direction: column; gap: 0.35rem; }

.select-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft);
}

#odooFilter {
  font-family: var(--font-body);
  font-size: 0.92rem;
  padding: 0.8rem 2.2rem 0.8rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 27, 46, 0.65) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c9a227' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 0.85rem center;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#odooFilter:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px var(--line-brass); }
#odooFilter option { background: var(--midnight-2); color: var(--text); }

/* ---------------------------------------------------------------- Meta row */
.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.1rem 0 0.65rem;
  min-height: 1.4rem;
}

.count { font-size: 0.85rem; color: var(--text-soft); }
.count strong { color: var(--brass-bright); font-weight: 700; }

.status { font-size: 0.85rem; color: var(--text-soft); }
.status.error { color: var(--danger); }
.status.ok { color: var(--success); }

/* ---------------------------------------------------------------- Table */
.table-wrap {
  background: linear-gradient(180deg, rgba(22, 42, 69, 0.55), rgba(13, 27, 46, 0.55));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-rest);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  background: rgba(13, 27, 46, 0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line-brass);
  padding: 0.95rem 1.1rem;
  white-space: nowrap;
}

th.sortable { cursor: pointer; user-select: none; transition: color 0.2s; }
th.sortable:hover { color: var(--brass-bright); }
th.sortable::after {
  content: "\2195";
  display: inline-block;
  margin-left: 0.4em;
  opacity: 0.3;
  font-size: 0.85em;
}
th.sortable[data-dir="asc"]::after { content: "\25B2"; opacity: 0.95; }
th.sortable[data-dir="desc"]::after { content: "\25BC"; opacity: 0.95; }

tbody td {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--text);
}

tbody tr { transition: background 0.15s; }
tbody tr:nth-child(even) { background: rgba(244, 240, 232, 0.018); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(201, 162, 39, 0.09); }

td.col-text, th.col-text { max-width: 400px; }

th.col-actions, td.col-actions { width: 1%; white-space: nowrap; text-align: right; }

.row-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.row-edit:hover { border-color: var(--brass); color: var(--brass-bright); background: rgba(201, 162, 39, 0.08); }
.row-edit svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ODOO-Version: Dropdown in der Tabelle (gleiche Einträge wie der Filter) */
th.col-odoo, td.col-odoo { white-space: nowrap; }

.ver-select {
  font-family: var(--font-body);
  font-size: 0.82rem;
  padding: 0.32rem 1.7rem 0.32rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(13, 27, 46, 0.6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c9a227' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 0.5rem center;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ver-select:hover { border-color: var(--brass); }
.ver-select:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px var(--line-brass); }
.ver-select option { background: var(--midnight-2); color: var(--text); }

/* Info-Zeile: ausgegraut, nur PSP / Text / ODOO Version */
tbody tr.row-info td { color: var(--text-faint); font-style: italic; }
tbody tr.row-info td.mono:first-child { color: var(--text-faint); }
tbody tr.row-info td.col-odoo { font-style: normal; }
tbody tr.row-info:hover { background: rgba(244, 240, 232, 0.03); }

.cell-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}
.cell-text.expanded { -webkit-line-clamp: unset; }

.expand-btn {
  margin-top: 0.4rem;
  background: none;
  border: none;
  padding: 0;
  color: var(--brass);
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.expand-btn:hover { color: var(--brass-bright); text-decoration: underline; }

.mono { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
td.mono:first-child { color: var(--brass-bright); font-weight: 600; }

mark {
  background: rgba(221, 184, 74, 0.32);
  color: #fff;
  border-radius: 2px;
  padding: 0 2px;
}

/* ODOO-Version Badges */
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.26rem 0.65rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-community { background: rgba(74, 222, 128, 0.14); color: #86e8ab; border-color: rgba(74, 222, 128, 0.32); }
.badge-enterprise { background: rgba(201, 162, 39, 0.18); color: var(--brass-bright); border-color: var(--line-brass); }
.badge-module { background: rgba(143, 180, 224, 0.14); color: #a9c8ec; border-color: rgba(143, 180, 224, 0.32); }
.badge-system { background: rgba(186, 143, 224, 0.14); color: #cbb0ec; border-color: rgba(186, 143, 224, 0.32); }
.badge-default { background: rgba(244, 240, 232, 0.08); color: var(--text-soft); border-color: var(--line); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 3.5rem 1rem;
  color: var(--text-faint);
}
.empty[hidden] { display: none; }
.empty svg { width: 36px; height: 36px; fill: none; stroke: var(--text-faint); stroke-width: 1.6; stroke-linecap: round; }
.empty p { margin: 0; font-size: 0.95rem; }

/* ---------------------------------------------------------------- Footer */
.site-footer {
  color: var(--text-faint);
  font-size: 0.8rem;
  padding: 1.2rem 0;
  border-top: 1px solid var(--line);
}

/* ---------------------------------------------------------------- Overlay / Login */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(6, 13, 24, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.overlay[hidden] { display: none; }

.login-card {
  width: 100%;
  max-width: 410px;
  background: linear-gradient(180deg, var(--midnight-3), var(--midnight-2));
  border: 1px solid var(--line-brass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover);
  padding: 2.1rem 1.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  text-align: center;
}

.login-card .brand-chip { align-self: center; margin-bottom: 0.35rem; }

.login-card h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.6rem;
  margin: 0;
  color: #fff;
}

.login-sub { margin: 0 0 0.5rem; font-size: 0.88rem; color: var(--text-soft); }

.field { display: flex; flex-direction: column; gap: 0.35rem; text-align: left; }
.field span { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-soft); }

.field input {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.78rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 27, 46, 0.7);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px var(--line-brass); }

.login-error {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.35);
  color: #ffb3b3;
  font-size: 0.85rem;
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  text-align: left;
}

/* ---------------------------------------------------------------- Modal (Formular) */
.modal-card {
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 2.5rem);
  overflow-y: auto;
  background: linear-gradient(180deg, var(--midnight-3), var(--midnight-2));
  border: 1px solid var(--line-brass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover);
  padding: 1.6rem 1.7rem 1.7rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.modal-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
  margin: 0;
  color: #fff;
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--brass-bright); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.1rem;
}

.field-full { grid-column: 1 / -1; }

.field textarea {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.78rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 27, 46, 0.7);
  color: var(--text);
  resize: vertical;
  min-height: 96px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px var(--line-brass); }

.field select {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.78rem 2.2rem 0.78rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 27, 46, 0.7) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c9a227' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 0.85rem center;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field select:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px var(--line-brass); }
.field select option { background: var(--midnight-2); color: var(--text); }

.field input[type="date"] { color-scheme: dark; }

.modal-actions { display: flex; justify-content: flex-end; gap: 0.7rem; margin-top: 0.2rem; }

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; }
  .header-actions { width: 100%; justify-content: flex-end; }
  .table-wrap { overflow-x: auto; }
  table { min-width: 820px; }
  .toolbar { padding: 0.9rem; }
}
