/* ============================================================
   MAISON GLENCAIRN — PIF System Stylesheet
   ============================================================ */

:root {
  --gold:     #B8860B;
  --gold-lt:  #D4A017;
  --dark:     #1A1A2E;
  --dark2:    #16213E;
  --cream:    #F5F0E8;
  --cream2:   #EDE8DF;
  --grey:     #666666;
  --grey-lt:  #AAAAAA;
  --white:    #FFFFFF;
  --green:    #2D6A4F;
  --green-lt: #D4EDDA;
  --red:      #CC3333;
  --red-lt:   #FDECEA;
  --warn:     #856404;
  --warn-lt:  #FFF3CD;
  --blue-lt:  #E8F4FD;
  --border:   #DDD8CE;
  --shadow:   0 2px 12px rgba(26,26,46,.10);
  --radius:   6px;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-head: 'Cormorant Garamond', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: #222;
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
}

/* ── Navigation ───────────────────────────────────────────── */
.topnav {
  display: flex;
  align-items: center;
  background: var(--dark);
  padding: 0 28px;
  height: 60px;
  border-bottom: 2px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 20px;
}

.nav-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 200px;
}
.brand-main {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--white);
  letter-spacing: 1.5px;
}
.brand-sub {
  font-size: 0.65rem;
  color: var(--gold);
  letter-spacing: 3px;
  font-weight: 500;
}

.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}
.nav-link {
  color: #BBBBCC;
  text-decoration: none;
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: var(--radius);
  transition: all .2s;
  font-weight: 400;
}
.nav-link:hover { color: var(--white); background: rgba(255,255,255,.07); }
.nav-link.active { color: var(--gold); background: rgba(184,134,11,.12); }

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
}
.user-name { color: #AAAACC; }
.btn-logout {
  background: rgba(204,51,51,.15);
  color: #FF8888;
  border: 1px solid rgba(204,51,51,.3);
  padding: 5px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.8rem;
  transition: all .2s;
}
.btn-logout:hover { background: var(--red); color: var(--white); }

/* ── Language Switcher ──────────────────────────────────────── */
.lang-switcher { display:flex;align-items:center;gap:2px;margin-right:6px }
.lang-btn { text-decoration:none;opacity:.4;transition:all .15s;padding:3px 7px;border-radius:4px;border:1px solid transparent }
.lang-btn:hover { opacity:.85;background:rgba(255,255,255,.08) }
.lang-btn.lang-active { opacity:1;background:rgba(201,168,76,.2);border-color:rgba(201,168,76,.4) }
.lang-label { font-family:monospace;font-size:.72rem;font-weight:700;color:rgba(255,255,255,.75);letter-spacing:.04em }
.lang-btn.lang-active .lang-label { color:#C9A84C }

/* ── Layout ───────────────────────────────────────────────── */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.page-title {
  font-family: var(--font-head);
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--dark);
  margin: 0;
}
.page-subtitle {
  font-size: 0.85rem;
  color: var(--grey);
  margin: 2px 0 0;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  background: var(--dark);
  padding: 14px 20px;
  border-bottom: 2px solid var(--gold);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header h3 {
  font-family: var(--font-head);
  font-size: 1.1rem;
  color: var(--white);
  margin: 0;
  font-weight: 400;
}
.card-body { padding: 20px; }

/* ── Section Cards (PIF/Safety Forms) ────────────────────── */
.section-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 24px;
  overflow: hidden;
}
.section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark2) 100%);
  border-bottom: 2px solid var(--gold);
}
.section-nr {
  background: var(--gold);
  color: var(--dark);
  font-weight: 700;
  font-size: 0.85rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.section-title {
  font-family: var(--font-head);
  font-size: 1.15rem;
  color: var(--white);
  margin: 0;
  font-weight: 600;
}
.section-body { padding: 24px; }

/* ── Form Fields ──────────────────────────────────────────── */
.field-group {
  margin-bottom: 16px;
}
.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--dark);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.req { color: var(--gold); }
.field-input {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: #333;
  background: var(--white);
  transition: border-color .2s, box-shadow .2s;
}
.field-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184,134,11,.12);
}
textarea.field-input { resize: vertical; min-height: 80px; }
select.field-input { cursor: pointer; }
.field-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--grey);
  margin-top: 4px;
  line-height: 1.4;
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0 20px;
}
.field-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0 16px;
}
.field-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all .2s;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--gold);
  color: var(--dark);
  border-color: var(--gold);
}
.btn-primary:hover { background: var(--gold-lt); }
.btn-secondary {
  background: var(--white);
  color: var(--dark);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--cream2); border-color: var(--gold); }
.btn-dark {
  background: var(--dark);
  color: var(--white);
  border-color: var(--dark);
}
.btn-dark:hover { background: var(--dark2); }
.btn-danger {
  background: var(--red-lt);
  color: var(--red);
  border-color: rgba(204,51,51,.3);
}
.btn-danger:hover { background: var(--red); color: var(--white); }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 13px 28px; font-size: 0.95rem; }
.btn-icon { padding: 7px 10px; }

.actions-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* ── Tables ───────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th {
  background: var(--dark);
  color: var(--white);
  padding: 10px 14px;
  text-align: left;
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.data-table th:first-child { border-radius: var(--radius) 0 0 0; }
.data-table th:last-child { border-radius: 0 var(--radius) 0 0; }
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--cream2);
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--cream); }
.data-table tr:last-child td { border-bottom: none; }
.data-table .col-actions { white-space: nowrap; text-align: right; }

/* Dynamische Tabellenzeilen (Inhaltsstoffe) */
.dyn-table { width: 100%; border-collapse: collapse; }
.dyn-table th {
  background: var(--dark);
  color: var(--white);
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
}
.dyn-table td { padding: 6px 6px; vertical-align: top; }
.dyn-table td input, .dyn-table td select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.83rem;
}
.dyn-table .row-del { width: 36px; text-align: center; }
.btn-del-row {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
}
.btn-del-row:hover { color: #aa0000; }

/* ── Badge ────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: .4px;
}
.badge-draft    { background: #EEE; color: #666; }
.badge-progress { background: var(--blue-lt); color: #0C5460; }
.badge-done     { background: var(--green-lt); color: var(--green); }
.badge-archive  { background: #F0E8FF; color: #5A3D8E; }
.badge-danger   { background: var(--red-lt); color: var(--red); }
.badge-warn     { background: var(--warn-lt); color: var(--warn); }

/* ── Flash Messages ───────────────────────────────────────── */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.9rem;
  font-weight: 500;
}
.flash span { font-weight: 700; font-size: 1.1rem; }
.flash-success { background: var(--green-lt); color: var(--green); border: 1px solid #A3D9BE; }
.flash-error   { background: var(--red-lt); color: var(--red); border: 1px solid #F5C0BB; }
.flash-info    { background: var(--blue-lt); color: #0C5460; border: 1px solid #B8E0EE; }
.flash-warn    { background: var(--warn-lt); color: var(--warn); border: 1px solid #FFE083; }

/* ── Info Box ─────────────────────────────────────────────── */
.info-box {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.87rem;
  line-height: 1.5;
  margin-bottom: 16px;
}
.info-box-warn  { background: var(--warn-lt); color: var(--warn); border-left: 4px solid #FFD700; }
.info-box-info  { background: var(--blue-lt); color: #0C5460; border-left: 4px solid #5DBBDD; }
.info-box-green { background: var(--green-lt); color: var(--green); border-left: 4px solid var(--green); }

/* ── Login Page ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark2) 60%, #0F3460 100%);
  padding: 20px;
}
.login-card {
  background: var(--white);
  border-radius: 10px;
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand .b1 {
  font-family: var(--font-head);
  font-size: 1.7rem;
  color: var(--dark);
  letter-spacing: 2px;
  display: block;
}
.login-brand .b2 {
  font-size: 0.7rem;
  color: var(--gold);
  letter-spacing: 4px;
  font-weight: 600;
  display: block;
  margin-top: 2px;
}
.login-brand .b3 {
  font-size: 0.8rem;
  color: var(--grey);
  margin-top: 8px;
  display: block;
}
.login-separator {
  width: 60px;
  height: 2px;
  background: var(--gold);
  margin: 16px auto;
}
.login-card h2 {
  font-family: var(--font-head);
  font-size: 1.2rem;
  color: var(--dark);
  margin: 0 0 24px;
  font-weight: 400;
}
.otp-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 16px 0;
}
.otp-digit {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: monospace;
  transition: border-color .2s;
}
.otp-digit:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(184,134,11,.15); }

/* ── Dashboard Stats ──────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-number {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 600;
  color: var(--dark);
  line-height: 1;
}
.stat-label {
  font-size: 0.78rem;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 2px;
}

/* ── Progress Steps ───────────────────────────────────────── */
.steps-bar { display: flex; gap: 0; margin-bottom: 28px; overflow-x: auto; padding-bottom: 4px; }
.step-item { display: flex; align-items: center; flex: 1; min-width: 80px; }
.step-dot {
  width: 30px; height: 30px; border-radius: 50%; background: #DDD; color: #888;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700; flex-shrink: 0; cursor: pointer; transition: all .2s;
}
.step-item.active .step-dot { background: var(--gold); color: var(--dark); }
.step-item.done .step-dot   { background: var(--green); color: var(--white); }
.step-label { font-size: 0.72rem; color: var(--grey); margin-left: 6px; white-space: nowrap; }
.step-item.active .step-label { color: var(--dark); font-weight: 500; }
.step-line { flex: 1; height: 2px; background: #DDD; margin: 0 4px; }
.step-item.done + .step-item .step-line { background: var(--green); }

/* ── Formular Tabs ────────────────────────────────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; }
.form-footer {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 20px 0; border-top: 1px solid var(--border); margin-top: 20px;
}

/* ── Admin ────────────────────────────────────────────────── */
.admin-header {
  background: linear-gradient(135deg, var(--dark) 0%, #0F3460 100%);
  border-radius: var(--radius); padding: 24px 28px; margin-bottom: 24px;
  border-bottom: 3px solid var(--gold);
}
.admin-header h1 { font-family: var(--font-head); color: var(--white); margin: 0; font-size: 1.6rem; }
.admin-header p  { color: #AAAACC; margin: 4px 0 0; font-size: 0.85rem; }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 28px; background: var(--dark); font-size: 0.75rem;
  color: #666688; border-top: 1px solid #333;
}
.footer-right { color: var(--gold); opacity: .6; }

/* ── Utility ──────────────────────────────────────────────── */
.text-gold  { color: var(--gold); }
.text-grey  { color: var(--grey); }
.text-small { font-size: 0.82rem; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-16 { margin-top: 16px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── Checkbox ─────────────────────────────────────────────── */
.checkbox-group { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.checkbox-group input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--gold); }
.checkbox-group label { font-size: 0.88rem; color: var(--dark); margin: 0; cursor: pointer; }

/* ── Anlagen Checkliste ───────────────────────────────────── */
.anlage-row {
  display: grid;
  grid-template-columns: 30px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--cream2);
  font-size: 0.87rem;
}
.anlage-nr { font-weight: 700; color: var(--gold); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .topnav { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 8px; }
  .nav-links { order: 3; width: 100%; flex-wrap: wrap; }
  .main-content { padding: 16px 12px; }
  .field-grid, .field-grid-2, .field-grid-3 { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .site-footer { flex-direction: column; gap: 4px; text-align: center; }
}

@media print {
  .topnav, .site-footer, .actions-bar, .btn, .form-footer { display: none !important; }
  .main-content { padding: 0; max-width: 100%; }
  .section-header { background: var(--dark) !important; -webkit-print-color-adjust: exact; }
}

/* ============================================================
   V3 — INCI Autocomplete, Anhänge, Archiv, Status-Fluss
   ============================================================ */

/* ── INCI Autocomplete ────────────────────────────────────── */
.inci-dropdown div:hover { background: var(--cream) !important; }
.inci-dropdown { border-top: none !important; border-radius: 0 0 4px 4px !important; }

/* ── Anhänge ──────────────────────────────────────────────── */
.attachment-block {
  background: var(--cream);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-top: 8px;
  min-height: 42px;
}
.attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dotted var(--border);
  font-size: .84rem;
  flex-wrap: wrap;
}
.attachment-item:last-of-type { border-bottom: none; }
.att-icon { font-size: 1.1rem; flex-shrink: 0; }
.att-name {
  color: var(--dark);
  text-decoration: none;
  font-weight: 500;
  flex: 1;
  min-width: 120px;
  word-break: break-all;
}
.att-name:hover { color: var(--gold); text-decoration: underline; }
.att-size  { color: var(--grey); font-size: .75rem; white-space: nowrap; }
.att-desc  { color: var(--grey); font-style: italic; font-size: .78rem; }
.att-date  { color: var(--grey-lt); font-size: .75rem; white-space: nowrap; }
.btn-del-att {
  background: none; border: none; color: var(--red); cursor: pointer;
  font-size: .9rem; padding: 2px 6px; border-radius: 3px;
  flex-shrink: 0; opacity: .6; transition: opacity .2s;
}
.btn-del-att:hover { opacity: 1; background: var(--red-lt); }
.att-upload-row {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap;
}
.att-file-input {
  font-size: .82rem; flex: 1; min-width: 160px;
  padding: 5px; border: 1px dashed var(--border);
  border-radius: var(--radius); background: var(--white); cursor: pointer;
}
.att-file-input:hover { border-color: var(--gold); }
.att-desc-input { max-width: 200px !important; font-size: .82rem !important; padding: 6px 10px !important; }

/* ── Anlage-Zeile v3 (aufklappbar) ───────────────────────── */
.anlage-row-v3 {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.anlage-row-v3-header {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: var(--white);
  cursor: pointer;
}
.anlage-row-v3-header:hover { background: var(--cream); }
.anlage-nr-v3 { font-weight: 700; color: var(--gold); font-size: .9rem; }
.anlage-body-v3 {
  padding: 0 14px 12px;
  background: var(--white);
  border-top: 1px solid var(--cream2);
}
.anlage-toggle { font-size: .75rem; color: var(--grey); }

/* ── Archiv ───────────────────────────────────────────────── */
.archive-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: #F0E8FF; color: #5A3D8E; border: 1px solid #D0B8FF;
  padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 600;
}
.version-chain { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--grey); margin-top: 4px; }
.version-link { color: var(--gold); text-decoration: none; font-size: .78rem; }
.version-link:hover { text-decoration: underline; }
.archived-row td { opacity: .65; }
.archived-row:hover td { opacity: .85; }

/* ── Status-Fluss Banner ──────────────────────────────────── */
.status-flow {
  display: flex; align-items: center; gap: 0;
  background: var(--cream); border-radius: var(--radius);
  padding: 10px 16px; margin-bottom: 20px; overflow-x: auto;
}
.status-flow-step { display: flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--grey); white-space: nowrap; }
.status-flow-step.current { color: var(--dark); font-weight: 700; }
.status-flow-step.done    { color: var(--green); }
.status-flow-arrow { color: var(--grey-lt); margin: 0 8px; }

/* ── Neue Version ─────────────────────────────────────────── */
.new-version-box {
  background: linear-gradient(135deg, var(--cream) 0%, #FFF 100%);
  border: 2px dashed var(--gold);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-top: 20px;
}
.new-version-box h3 {
  font-family: var(--font-head); font-size: 1.1rem; color: var(--dark); margin: 0 0 8px;
}

/* ── INCI Bibliothek Admin ────────────────────────────────── */
.inci-lib-count {
  display: inline-block; background: var(--gold); color: var(--dark);
  border-radius: 20px; padding: 2px 10px; font-size: .75rem; font-weight: 700; margin-left: 8px;
}
