/* Ortho-Aktiv Portal – interner Bereich */

:root {
  --blue: #0C4DA2;
  --blue-dark: #093c7e;
  --blue-light: #e8f0fb;
  --ink: #152238;
  --ink-soft: #415572;
  --muted: #6b7a90;
  --line: #d9e2ef;
  --bg: #f2f5fa;
  --card: #fff;
  --error: #b3261e;
  --error-bg: #fdeceb;
  --success: #1e7f43;
  --success-bg: #e7f5ec;
  --info-bg: #e8f0fb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(21,34,56,.08), 0 4px 16px rgba(21,34,56,.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.p-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 10px 20px;
  background: var(--blue); color: #fff;
}
.p-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 1.05rem; }
.p-brand img { width: 34px; height: 34px; border-radius: 8px; }
.p-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.p-nav a, .p-nav .linklike {
  color: #fff; text-decoration: none; font: inherit;
  background: none; border: 0; cursor: pointer;
  padding: 8px 12px; border-radius: 8px;
}
.p-nav a:hover, .p-nav .linklike:hover { background: rgba(255,255,255,.14); }
.inline { display: inline; }

/* ===== Layout ===== */
.p-main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; }
.p-footer { text-align: center; padding: 14px; color: var(--muted); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 1.5rem; color: var(--blue); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.back { color: var(--muted); text-decoration: none; font-size: .9rem; }
.back:hover { color: var(--blue); }

/* ===== Karten / Panels ===== */
.auth-card {
  max-width: 440px; margin: 6vh auto 0;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 30px 28px;
}
.auth-card h1 { margin: 0 0 8px; font-size: 1.3rem; color: var(--blue); }
.lead { color: var(--ink-soft); margin: 0 0 18px; }

.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.panel h2 { margin: 0 0 12px; font-size: 1.02rem; color: var(--blue); }
.panel h2 + .kv { margin-bottom: 20px; }
.panel h2:not(:first-child) { margin-top: 22px; }

.detail-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .detail-grid { grid-template-columns: 3fr 2fr; } }

/* ===== Formulare ===== */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 5px; color: var(--ink-soft); }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 9px;
  padding: 10px 12px; min-height: 44px; background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(12,77,162,.15);
}
.code-input { font-size: 1.3rem; letter-spacing: .25em; text-align: center; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; cursor: pointer; font-size: .92rem; }
.check input { width: 20px; height: 20px; min-height: 0; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--blue); }

/* ===== Buttons ===== */
.btn {
  display: inline-block; text-align: center; text-decoration: none;
  font: inherit; font-weight: 600;
  border: 0; border-radius: 10px;
  padding: 11px 18px; min-height: 44px;
  cursor: pointer; transition: filter .15s;
}
.btn:active { filter: brightness(.92); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-secondary { background: var(--blue-light); color: var(--blue); }
.btn-danger { background: var(--error-bg); color: var(--error); }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 6px 12px; min-height: 34px; font-size: .85rem; }

/* ===== Flash ===== */
.flash { border-radius: 10px; padding: 11px 14px; margin-bottom: 14px; font-size: .93rem; }
.flash-error { background: var(--error-bg); color: var(--error); }
.flash-success { background: var(--success-bg); color: var(--success); }
.flash-info { background: var(--info-bg); color: var(--blue-dark); }
.flash-code { background: var(--success-bg); color: var(--ink); font-size: 1.02rem; border: 1.5px dashed var(--success); }

.tab-hint { margin: -6px 0 14px; }
.tab-hint a { color: var(--blue); }
.advisor-cell { color: var(--ink-soft); }

/* ===== Suche ===== */
.search-form { display: flex; gap: 8px; }
.search-form input { min-width: 260px; }
.tabs .tab-count {
  display: inline-block; min-width: 20px; text-align: center;
  background: var(--blue-light); color: var(--blue);
  border-radius: 999px; padding: 0 6px; margin-left: 4px;
  font-size: .78rem;
}
.tabs a.active .tab-count { background: rgba(255,255,255,.22); color: #fff; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a {
  text-decoration: none; color: var(--ink-soft);
  padding: 8px 14px; border-radius: 999px;
  background: var(--card); box-shadow: var(--shadow);
  font-size: .9rem; font-weight: 600;
}
.tabs a.active { background: var(--blue); color: #fff; }

/* ===== Tabelle ===== */
.order-table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.order-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.order-table th {
  text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 12px 14px; border-bottom: 2px solid var(--line);
}
.order-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.order-table tbody tr { cursor: pointer; }
.order-table tbody tr:hover { background: var(--blue-light); }
.order-table tbody tr:last-child td { border-bottom: 0; }
.order-table a { color: var(--blue); font-weight: 700; text-decoration: none; }
.mono { font-variant-numeric: tabular-nums; }
.center { text-align: center; }

.badge {
  display: inline-block; border-radius: 999px; padding: 3px 11px;
  font-size: .78rem; font-weight: 700; white-space: nowrap;
}
.badge-neu { background: #fff3e0; color: #b45c00; }
.badge-in_bearbeitung { background: var(--blue-light); color: var(--blue); }
.badge-erledigt { background: var(--success-bg); color: var(--success); }

.empty { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 40px; text-align: center; color: var(--muted); }

/* ===== Detailansicht ===== */
.status-form { display: flex; gap: 8px; flex-wrap: wrap; }
.kv { width: 100%; border-collapse: collapse; }
.kv th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 14px 6px 0; vertical-align: top; white-space: nowrap; width: 1%; }
.kv td { padding: 6px 0; }
.kv a { color: var(--blue); }
.muted { color: var(--muted); }
.small { font-size: .84rem; }

.file-list { display: flex; flex-wrap: wrap; gap: 12px; }
.dl-row { display: flex; gap: 8px; flex-wrap: wrap; }
.file-item { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.btn-download { text-align: center; }
.file-thumb {
  display: block; width: 180px; border-radius: 10px; overflow: hidden;
  border: 1.5px solid var(--line);
}
.file-thumb img { width: 100%; display: block; }
.file-thumb:hover { border-color: var(--blue); }
.file-pdf {
  display: flex; align-items: center; gap: 8px;
  background: var(--blue-light); color: var(--blue);
  border-radius: 10px; padding: 14px 16px; text-decoration: none; font-weight: 600;
}

/* ===== 2FA-Setup ===== */
.setup-steps { padding-left: 20px; color: var(--ink-soft); }
.setup-steps li { margin-bottom: 6px; }
.qr-wrap { text-align: center; margin: 14px 0; }
.qr-wrap img { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; }
.manual-secret { margin: 0 0 16px; color: var(--ink-soft); font-size: .9rem; }
.manual-secret code { display: block; margin-top: 6px; background: var(--bg); border-radius: 8px; padding: 10px; font-size: 1.05rem; letter-spacing: .08em; }

.backup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 22px; }
.backup-grid code {
  background: var(--bg); border: 1px dashed var(--line); border-radius: 8px;
  padding: 10px; text-align: center; font-size: 1.02rem; letter-spacing: .06em;
}

/* ===== Admin ===== */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; font-size: .8rem; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--line); }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 1100px) { .admin-grid { grid-template-columns: 1fr 1fr; } }
/* Breiter Inhalt (Log, Tabellen) darf die Spalten nie aufblähen */
.admin-grid > .panel { min-width: 0; }
.log-panel { margin-top: 16px; }
.code-reveal {
  background: var(--success-bg); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px;
  font-size: 1.05rem;
}
.code-reveal code { font-size: 1.2rem; font-weight: 800; letter-spacing: .06em; }
.form-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 160px; margin-bottom: 0; }
.no-shadow { box-shadow: none; }
.log-view {
  background: #1b2537; color: #cfd8e6;
  border-radius: 10px; padding: 12px 14px;
  font-family: Consolas, monospace; font-size: .78rem;
  overflow-x: auto; max-height: 320px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all;
}
.panel h2:not(:first-child) { margin-top: 22px; }
code { background: #eef2f8; border-radius: 4px; padding: 1px 5px; font-size: .85em; }
