:root {
  --gold: #c9a24a;
  --gold-mid: #b8893a;
  --gold-deep: #8a5a24;
  --brown: #4f2d10;
  --ink: #1a1714;
  --muted: #6f675c;
  --line: #e4dacb;
  --surface: #f6f1e8;
  --paper: #fffdf9;
  --ok: #0b6b2f;
  --bad: #a11919;
  --shadow: 0 12px 28px rgba(79, 45, 16, 0.07);
  --radius: 14px;
  --font: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --topbar-h: 68px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -8%, rgba(201, 162, 74, 0.16), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(138, 90, 36, 0.08), transparent 50%),
    linear-gradient(180deg, #fbf8f2 0%, #f1ebe1 100%);
}

body.is-auth {
  background:
    radial-gradient(800px 500px at 50% -20%, rgba(201, 162, 74, 0.22), transparent 60%),
    #f4efe6;
}

a { color: var(--gold-deep); text-decoration: none; }
a:hover { color: var(--brown); }

/* Chrome */
.top-accent {
  height: 4px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--gold-deep));
}
.topbar {
  background: rgba(255, 253, 249, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--brown);
  flex-shrink: 0;
}
.brand-logo { height: 40px; width: auto; display: block; }
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-text strong { font-size: 0.95rem; }
.brand-text span {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
}
.nav-link {
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
}
.nav-link:hover {
  background: var(--surface);
  color: var(--brown);
}
.nav-user { color: var(--gold-deep); }
.nav-sep {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 0.35rem;
}

.wrap {
  width: min(1180px, calc(100% - 2rem));
  margin: 1.5rem auto 3.5rem;
}
.auth-main { margin: 0; width: 100%; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.page-head.with-actions { align-items: center; }
.page-head h1 {
  margin: 0.15rem 0 0.3rem;
  font-size: clamp(1.45rem, 2.2vw, 1.85rem);
  color: var(--brown);
  letter-spacing: -0.01em;
}
.page-head p { margin: 0; color: var(--muted); max-width: 46rem; line-height: 1.45; }
.eyebrow {
  margin: 0 !important;
  font-size: 0.72rem !important;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-deep) !important;
  font-weight: 700;
}
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.flashes { display: grid; gap: 0.55rem; margin-bottom: 1rem; }
.flash {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.flash-ok { border-color: #8fd0a6; background: #e6f6ec; color: var(--ok); }
.flash-error { border-color: #f0a8a8; background: #fdecea; color: var(--bad); }
.flash-warning { border-color: #e6c98a; background: #fff7e6; color: var(--gold-deep); }

/* Auth */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}
.auth-card {
  position: relative;
  width: min(420px, 100%);
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 2rem 1.75rem 1.75rem;
  text-align: center;
}
.auth-accent {
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--gold-deep));
}
.auth-logo { width: 170px; height: auto; margin: 0.4rem auto 1rem; display: block; }
.auth-card h1 { margin: 0 0 0.35rem; color: var(--brown); font-size: 1.45rem; }
.lead { color: var(--muted); margin: 0 0 1.35rem; }

/* Workspace layout */
.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}
.workspace-main {
  display: grid;
  gap: 1rem;
  min-width: 0;
}
.profile-layout {
  display: grid;
  gap: 1rem;
  max-width: 860px;
}

.side-card,
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.side-card { padding: 1rem 1.05rem 1.1rem; position: sticky; top: calc(var(--topbar-h) + 12px); }
.side-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.side-card-head h2,
.card-head h2 {
  margin: 0;
  color: var(--brown);
  font-size: 1rem;
}
.card-head {
  padding: 1rem 1.15rem 0.75rem;
  border-bottom: 1px solid var(--line);
}
.card-head p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}
.card-body { padding: 1rem 1.15rem 1.15rem; }
.card-footer {
  padding: 0.85rem 1.15rem 1.05rem;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface), transparent);
  border-radius: 0 0 var(--radius) var(--radius);
}

.meta-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}
.meta-list li {
  display: grid;
  gap: 0.15rem;
}
.meta-list span,
.side-note span,
.preview-strip span {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.meta-list strong,
.side-note strong,
.preview-strip strong {
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--ink);
  word-break: break-word;
}
.break { overflow-wrap: anywhere; }
.side-note {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--line);
  display: grid;
  gap: 0.65rem;
}
.side-note p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.preview-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.fields-1,
.fields-2 {
  display: grid;
  gap: 0.9rem 1rem;
}
.fields-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: 1 / -1; }

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 650;
}
.field-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 650;
}
.stack { display: grid; gap: 0.9rem; text-align: left; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.72rem 0.85rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
textarea {
  resize: vertical;
  line-height: 1.45;
  min-height: 96px;
}
input:focus,
textarea:focus {
  outline: 2px solid rgba(201, 162, 74, 0.28);
  border-color: var(--gold-mid);
}
.hint {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.status-pick { grid-column: 1 / -1; }
.status-options { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.status-option {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-weight: 700;
  margin: 0;
}
.status-option input { accent-color: currentColor; }
.status-aktiv { color: var(--ok); }
.status-inaktiv { color: var(--bad); }
.status-option:has(input:checked) {
  box-shadow: inset 0 0 0 1.5px currentColor;
  background: var(--surface);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}
.sticky-actions {
  position: sticky;
  bottom: 0.75rem;
  padding: 0.75rem 0 0.15rem;
  background: linear-gradient(180deg, transparent, rgba(241, 235, 225, 0.92) 35%);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 11px;
  padding: 0.62rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 1.25rem; }
.btn-block { width: 100%; }
.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  color: #fff;
  box-shadow: 0 8px 18px rgba(138, 90, 36, 0.22);
}
.btn-secondary {
  background: var(--surface);
  color: var(--brown);
  border: 1px solid var(--line);
}
.btn-ghost {
  background: transparent;
  color: var(--gold-deep);
  border: 1px solid transparent;
}
.btn-danger {
  background: #fdecea;
  color: var(--bad);
  border: 1px solid #f0a8a8;
}
.btn-danger-outline {
  background: transparent;
  color: var(--bad);
  border: 1px solid #e8b4b4;
}
.btn:hover { filter: brightness(0.985); }
button.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td {
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
th {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface);
}
tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); text-align: center; padding: 1.6rem; }
.actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* Archive bulk panel */
.archive-panel { display: grid; gap: 0.75rem; }
.archive-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.archive-toolbar-left,
.archive-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--brown);
  cursor: pointer;
  margin: 0;
}
.check-inline input { width: 1rem; height: 1rem; accent-color: var(--gold-deep); }
.selection-count {
  font-size: 0.8rem;
  color: var(--muted);
  padding-left: 0.55rem;
  border-left: 1px solid var(--line);
}
.archive-table .col-check {
  width: 2.4rem;
  padding-right: 0;
}
.archive-table .col-actions {
  width: 1%;
  white-space: nowrap;
}
.cell-title { font-weight: 650; color: var(--brown); }
.cell-sub { font-size: 0.78rem; color: var(--muted); margin-top: 0.12rem; }
.cell-muted { color: var(--muted); font-variant-numeric: tabular-nums; }

.row-actions {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 0 rgba(79, 45, 16, 0.03);
}
.row-actions a,
.row-actions button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.42rem 0.7rem;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--brown);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
}
.row-actions a:last-child,
.row-actions button:last-child { border-right: 0; }
.row-actions a:hover,
.row-actions button:hover {
  background: var(--surface);
  color: var(--gold-deep);
}
.row-actions .danger { color: var(--bad); }
.row-actions .danger:hover {
  background: #fdecea;
  color: var(--bad);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}
.pill-aktiv { background: #e6f6ec; color: var(--ok); }
.pill-inaktiv { background: #fdecea; color: var(--bad); }

.preview-card { min-width: 0; overflow: hidden; }
.preview-frame {
  padding: 0 1rem 1rem;
}
.preview-frame iframe {
  width: 100%;
  height: min(78vh, 920px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 0.84rem;
}
.stat span {
  display: block;
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--brown);
  margin-bottom: 0.15rem;
}
.stat span.ok { color: var(--ok); }
.stat span.bad { color: var(--bad); }
.admin-links { display: flex; gap: 0.55rem; flex-wrap: wrap; margin-bottom: 1rem; }

.split {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--ink);
}
.search-bar {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.search-bar input { flex: 1; }
.muted { color: var(--muted); }

/* Legacy panel helpers still used by admin pages */
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 0.8rem; color: var(--brown); font-size: 1.05rem; }
.detail-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1rem;
}
dl {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0.45rem 0.75rem;
  margin: 0 0 1rem;
}
dt { color: var(--muted); font-size: 0.8rem; }
dd { margin: 0; font-weight: 600; }

@media (max-width: 980px) {
  .workspace,
  .split,
  .detail-grid,
  .stat-row,
  .fields-2,
  .preview-strip {
    grid-template-columns: 1fr;
  }
  .side-card { position: static; }
  .page-head,
  .page-head.with-actions {
    flex-direction: column;
    align-items: flex-start;
  }
  .topbar-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.7rem 0;
  }
  .nav { justify-content: flex-start; }
  .nav-sep { display: none; }
}
