/* ══════════════════════════════════════════════════════
   PCOS Angebot — Design System
   Aesthetic: Clean minimal / PSIS-inspired
   ══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Variables ─────────────────────────────────────── */
:root {
  --bg:          #f0f2f5;
  --surface:     #ffffff;
  --surface-2:   #f7f8fa;
  --sidebar-bg:  #ffffff;
  --sidebar-2:   #f0f2f5;
  --border:      #e2e5eb;
  --border-dark: #e2e5eb;

  --text:        #1a1d26;
  --text-2:      #4a4e5a;
  --text-3:      #717889;
  --text-inv:    #1a1d26;

  --blue:        #6366f1;
  --blue-light:  #eef2ff;
  --blue-dark:   #4f46e5;

  --amber:       #B45309;
  --amber-light: #FEF3C7;
  --amber-bg:    #FFFBEB;

  --green:       #059669;
  --green-light: #ECFDF5;
  --red:         #DC2626;
  --red-light:   #FEF2F2;

  --radius:      8px;
  --radius-lg:   12px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.03);
  --shadow:      0 4px 12px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.04);
  --shadow-lg:   0 12px 32px rgba(0,0,0,.10);

  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', -apple-system, sans-serif;
}

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── App Shell ─────────────────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ────────────────────────────────────────── */
.sidebar {
  width: 230px;
  min-width: 230px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
  box-shadow: 1px 0 4px rgba(0,0,0,.03);
}
.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-mark {
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  letter-spacing: -.01em;
}
.sidebar-logo .logo-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  letter-spacing: .03em;
  text-transform: uppercase;
  font-weight: 500;
}
.sidebar-nav { flex: 1; padding: 14px 10px; }
.nav-section {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 8px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: all .15s;
  cursor: pointer;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--sidebar-2); color: var(--text); }
.nav-item.active { background: var(--blue); color: #fff; }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid var(--border);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13px;
}
.user-avatar {
  width: 30px; height: 30px;
  background: var(--blue);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.lang-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 8px;
}
.lang-btn {
  flex: 1;
  padding: 5px;
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  transition: all .15s;
}
.lang-btn.active { background: var(--blue); color: #fff; }

/* ── Main area ──────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  flex-shrink: 0;
}
.topbar-title {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -.01em;
  flex: 1;
}
.page-content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  border: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary   { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost     { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger    { background: var(--red-light); color: var(--red); border: 1px solid #FCA5A5; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { padding: 7px; border-radius: var(--radius); }
.btn svg { width: 14px; height: 14px; }

/* ── Forms ──────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-input {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── Cards & Panels ─────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.01em;
  flex: 1;
}
.card-body { padding: 20px; }

/* ── Table ──────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--blue-light); }
.data-table .num {
  font-family: var(--mono);
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}
.data-table .code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
}

/* ── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
}
.badge-blue  { background: var(--blue-light); color: var(--blue); }
.badge-amber { background: var(--amber-light); color: var(--amber); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-gray  { background: var(--bg); color: var(--text-2); border: 1px solid var(--border); }

/* ── Price display ──────────────────────────────────── */
.price {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--amber);
}
.price-range {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 13px;
  background: var(--amber-bg);
  border: 1px solid #FDE68A;
  border-radius: var(--radius);
  padding: 3px 10px;
  color: var(--amber);
}

/* ── Modal ──────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,20,35,.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn .15s ease;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 520px;
  max-width: 95vw;
  max-height: 90vh;
  overflow: auto;
  animation: slideUp .25s ease;
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.modal-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -.01em;
  flex: 1;
}
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Toast ──────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 500;
  animation: slideInRight .2s ease;
  min-width: 260px;
}
.toast-success { background: var(--green-light); color: var(--green); border-left: 3px solid var(--green); }
.toast-error   { background: var(--red-light);   color: var(--red);   border-left: 3px solid var(--red); }
.toast-info    { background: var(--blue-light);  color: var(--blue);  border-left: 3px solid var(--blue); }
.toast-undo-btn {
  margin-left: auto;
  background: none;
  border: 1px solid currentColor;
  border-radius: 4px;
  color: inherit;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  white-space: nowrap;
  opacity: .8;
}
.toast-undo-btn:hover { opacity: 1; }

/* ── Split pane ─────────────────────────────────────── */
.split-pane {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 0;
  height: 100%;
  overflow: hidden;
}
.split-left {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.split-right {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Search panel ───────────────────────────────────── */
.search-box {
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-box input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.search-result-item {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
}
.search-result-item:hover { background: var(--blue-light); }
.search-result-item.selected { background: var(--blue-light); border-left: 3px solid var(--blue); }
.search-result-item .item-title { font-size: 13px; font-weight: 500; line-height: 1.4; }
.search-result-item .item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-3);
}

/* ── LV position row ────────────────────────────────── */
.lv-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -.01em;
  position: sticky;
  top: 0;
  z-index: 1;
}
.lv-group-sum {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--amber);
}
.lv-pos-row {
  display: grid;
  grid-template-columns: 44px 1fr 70px 90px 90px 90px 44px;
  gap: 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background .1s;
}
.lv-pos-row:hover { background: var(--blue-light); }
.lv-pos-row.langtext-row {
  grid-template-columns: 44px 1fr;
  background: var(--surface-2);
}
.lv-pos-row > div { padding: 9px 10px; font-size: 13px; }
.lv-pos-row .pos-nr {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
}
.lv-pos-row .pos-title { font-size: 13px; font-weight: 500; line-height: 1.4; }
.lv-pos-row .pos-langtext {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
  padding: 4px 10px 8px;
  grid-column: 2;
}
.lv-cell-input {
  width: 100%;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 13px;
  text-align: right;
  background: transparent;
  outline: none;
  transition: all .1s;
}
.lv-cell-input:focus {
  border-color: var(--blue);
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(99,102,241,.12);
}
.ep-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
}
.ep-modified { background: #FEF3C7; color: #92400E; }

/* ── Totals bar ─────────────────────────────────────── */
.totals-bar {
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 12px rgba(0,0,0,.04);
}
.totals-breakdown {
  flex: 1;
  padding: 14px 24px;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.totals-summary {
  min-width: 260px;
  padding: 14px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}
.totals-label {
  font-size: 13px;
  color: var(--text-2);
}
.totals-value {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-align: right;
}
.totals-summary .totals-label {
  font-size: 14px;
}
.totals-summary .totals-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.totals-brutto {
  border-top: 2px solid var(--blue);
  padding-top: 8px;
  margin-top: 4px;
}
.totals-brutto .totals-label {
  font-weight: 700;
  color: var(--blue-dark);
}
.totals-brutto .totals-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--blue-dark);
}
.ep-label { color: #92400E; }
.ep-value { color: #92400E; }

/* ── Empty state ─────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-3);
  text-align: center;
}
.empty-state svg { width: 48px; height: 48px; opacity: .4; }
.empty-state p { font-size: 14px; max-width: 260px; }

/* ── Spinner ─────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  flex-shrink: 0;
}

/* ── Status indicator ───────────────────────────────── */
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.draft    { background: var(--text-3); }
.status-dot.sent     { background: var(--blue); }
.status-dot.accepted { background: var(--green); }
.status-dot.rejected { background: var(--red); }

/* ── Animations ─────────────────────────────────────── */
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp   { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes spin      { to { transform: rotate(360deg); } }

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 900px) {
  .split-pane { grid-template-columns: 1fr; }
  .split-left { display: none; }
  .sidebar { display: none; }
}
