/* ── Admin Layout ──────────────────────────────────────── */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
@media (max-width: 768px) {
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  background: #1e293b;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-logo {
  padding: 1.5rem 1.25rem 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid #334155;
}
.sidebar-nav {
  list-style: none;
  padding: .75rem 0;
  flex: 1;
}
.sidebar-nav li a {
  display: block;
  padding: .65rem 1.25rem;
  color: #94a3b8;
  font-size: .9rem;
  font-weight: 500;
  border-radius: 6px;
  margin: .1rem .5rem;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.sidebar-nav li a:hover { background: #334155; color: #fff; }
.sidebar-nav li a.active { background: #2563eb; color: #fff; }
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid #334155;
}
.sidebar-footer a { color: #94a3b8; font-size: .85rem; }
.sidebar-footer a:hover { color: #fff; }

/* ── Main Content ──────────────────────────────────────── */
.admin-content {
  padding: 2rem;
  max-width: 1100px;
}
.page-header {
  margin-bottom: 1.75rem;
}
.page-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-text);
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.card h2 { font-size: 1.1rem; margin-bottom: 0; }
.card h3 { font-size: 1rem; margin-bottom: 1rem; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

/* ── Stats ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 768px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.stat-number { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-label  { font-size: .82rem; color: var(--color-muted); }
.stat-pending .stat-number { color: var(--color-primary); }
.stat-signed  .stat-number { color: var(--color-success); }
.stat-draft   .stat-number { color: var(--color-muted); }

/* ── Tabelle ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead tr { border-bottom: 2px solid var(--color-border); }
th { padding: .6rem .75rem; text-align: left; font-weight: 600;
     color: var(--color-muted); font-size: .8rem; text-transform: uppercase;
     letter-spacing: .05em; }
td { padding: .75rem; border-bottom: 1px solid var(--color-border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--color-bg); }
small { color: var(--color-muted); font-size: .8rem; }
td.actions { white-space: nowrap; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-muted);
}

/* ── Contract Detail ───────────────────────────────────── */
.contract-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) { .contract-layout { grid-template-columns: 1fr; } }

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  font-size: .9rem;
}
.meta-label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-muted);
  margin-bottom: .2rem;
}

.contract-body-view {
  max-height: 500px;
  overflow-y: auto;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  font-size: .9rem;
  line-height: 1.75;
  white-space: pre-line;
}

.signatures-display {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.sig-box {
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  text-align: center;
}
.sig-img { max-height: 80px; max-width: 200px; }
.sig-date { font-size: .8rem; color: var(--color-muted); margin-top: .4rem; }
.sig-missing { color: var(--color-muted); font-style: italic; font-size: .88rem; padding: 1rem 0; }

/* ── Sidebar Aktionen ──────────────────────────────────── */
.status-info { margin-bottom: 1rem; font-size: .9rem; color: var(--color-muted); }
.status-ok   { color: var(--color-success); font-weight: 600; }

.delete-section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
}

/* ── Audit-Log ─────────────────────────────────────────── */
.audit-list { list-style: none; font-size: .82rem; }
.audit-list li {
  padding: .5rem 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.audit-list li:last-child { border-bottom: none; }
.audit-event { font-weight: 600; }
.audit-date  { color: var(--color-muted); }
.audit-ip    { color: var(--color-muted); font-size: .78rem; font-family: monospace; }
.audit-note  { color: #475569; font-size: .8rem; }
.hash-info   { margin-top: 1rem; font-size: .78rem; color: var(--color-muted); word-break: break-all; }

/* ── Variablen-Section ─────────────────────────────────── */
.variables-section {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.variables-section h3 { font-size: .95rem; margin-bottom: 1rem; color: #1e40af; }
