/* Bitxafe DMS – modernes UI (2026) */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

:root {
  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.08);
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-glass: rgba(255, 255, 255, 0.72);
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-glow: rgba(79, 70, 229, 0.35);
  --success: #059669;
  --danger: #e11d48;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
  --sidebar-w: 280px;
}

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

html { scroll-behavior: smooth; }
html, body { margin: 0; min-height: 100%; }

body.app {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(99, 102, 241, 0.12), transparent 55%),
    radial-gradient(900px 500px at 10% 20%, rgba(14, 165, 233, 0.08), transparent 50%),
    linear-gradient(165deg, #f8fafc 0%, #eef2ff 45%, #f1f5f9 100%);
  background-attachment: fixed;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-2); text-decoration: none; }

/* ——— Layout ——— */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #0b1020 0%, #111827 48%, #0f172a 100%);
  color: #e2e8f0;
  padding: 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

.sidebar-brand {
  padding: 1.5rem 1.35rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.sidebar-brand__mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #4338ca 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  letter-spacing: -0.03em;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.45);
  margin-bottom: 0.85rem;
}
.sidebar-brand__text {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  line-height: 1.25;
}
.sidebar-brand__text span {
  display: block;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #94a3b8;
  margin-top: 0.2rem;
}

.sidebar-nav {
  padding: 0.75rem 0.65rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  color: #cbd5e1;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}
.sidebar-nav a svg {
  flex-shrink: 0;
  opacity: 0.85;
}
.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  transform: translateX(2px);
}
.sidebar-nav a.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(79, 70, 229, 0.15) 100%);
  color: #fff;
  border-color: rgba(129, 140, 248, 0.35);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.2);
}
.sidebar-nav a.active svg { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: 1.1rem 1.25rem 1.35rem;
  font-size: 0.82rem;
  color: #94a3b8;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.15);
}
.sidebar-footer strong {
  display: block;
  color: #f1f5f9;
  font-weight: 600;
  font-size: 0.9rem;
}
.sidebar-footer small { color: #64748b; }
.sidebar-footer .logout {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.65rem;
  color: #a5b4fc !important;
  font-weight: 600;
  font-size: 0.88rem;
}
.sidebar-footer .logout:hover { color: #c7d2fe !important; }

.main-wrap {
  flex: 1;
  padding: 2rem 2rem 3rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ——— Page ——— */
.page-head {
  margin-bottom: 1.75rem;
}
.page-head h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.5rem, 2.5vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--ink);
}
.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  max-width: 52ch;
}

/* ——— Cards & tables ——— */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 1.5rem 1.65rem;
  margin-bottom: 1.35rem;
}
.card h2 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.table-wrap {
  overflow-x: auto;
  margin: 0 -0.25rem;
  border-radius: 12px;
}
table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}
table.data th,
table.data td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
table.data th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-2);
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: rgba(79, 70, 229, 0.04); }
table.data td a { font-weight: 600; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  color: #4338ca;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1.15rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.88rem;
  font-family: inherit;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-2) 0%, var(--accent) 100%);
  color: #fff !important;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover {
  box-shadow: 0 8px 22px rgba(79, 70, 229, 0.45);
  filter: brightness(1.05);
  text-decoration: none;
}
.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft) !important;
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover {
  border-color: rgba(79, 70, 229, 0.25);
  background: #fafafa;
  text-decoration: none;
}
.btn-danger {
  background: #fff1f2;
  color: var(--danger) !important;
  border: 1px solid #fecdd3;
}

/* ——— Flash ——— */
.flash {
  padding: 0.9rem 1.1rem;
  border-radius: 14px;
  margin-bottom: 1.25rem;
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
}
.flash.ok {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  color: #047857;
  border-color: #a7f3d0;
}
.flash.err {
  background: linear-gradient(135deg, #fef2f2 0%, #ffe4e6 100%);
  color: #be123c;
  border-color: #fecdd3;
}

/* ——— Forms ——— */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-weight: 700;
  font-size: 0.82rem;
  margin-bottom: 0.4rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.form-group input[type='text'],
.form-group input[type='email'],
.form-group input[type='password'],
.form-group input[type='search'],
.form-group input[type='file'],
.form-group select,
.form-group textarea {
  width: 100%;
  max-width: 440px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: rgba(79, 70, 229, 0.45);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.form-group textarea { min-height: 110px; max-width: 100%; }

/* ——— Dashboard ——— */
.dash-hero {
  position: relative;
  padding: 2rem 1.75rem;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(14, 165, 233, 0.06) 100%),
    var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: 1.75rem;
  overflow: hidden;
}
.dash-hero::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -15%;
  width: 55%;
  height: 140%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 65%);
  pointer-events: none;
}
.dash-hero__inner { position: relative; z-index: 1; }
.dash-hero h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.65rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  color: var(--ink);
}
.dash-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  max-width: 42ch;
}
.dash-hero__meta {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.dash-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(79, 70, 229, 0.1);
  color: #4338ca;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  position: relative;
  padding: 1.15rem 1.2rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #22d3ee);
  opacity: 0.85;
}
.stat-card .lbl {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.stat-card .num {
  margin-top: 0.35rem;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.1;
}

/* Kachel-Navigation */
.dash-section-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin: 0 0 1rem;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.15rem;
  margin-bottom: 2rem;
}

.nav-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 148px;
  padding: 1.35rem 1.4rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-decoration: none !important;
  color: inherit !important;
  overflow: hidden;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}
.nav-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.25s ease;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.5) 100%);
  pointer-events: none;
}
.nav-tile:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--shadow-lg);
  border-color: rgba(79, 70, 229, 0.2);
}
.nav-tile:hover::before { opacity: 1; }
.nav-tile > * { position: relative; z-index: 1; }

.nav-tile__icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.9rem;
  flex-shrink: 0;
}
.nav-tile__icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-tile__title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 0 0 0.35rem;
}
.nav-tile__desc {
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
  flex: 1;
}
.nav-tile__arrow {
  margin-top: 1rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Akzent-Varianten */
.nav-tile--indigo .nav-tile__icon {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  color: #4f46e5;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}
.nav-tile--sky .nav-tile__icon {
  background: linear-gradient(135deg, #e0f2fe 0%, #cffafe 100%);
  color: #0284c7;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}
.nav-tile--emerald .nav-tile__icon {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  color: #059669;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.18);
}
.nav-tile--amber .nav-tile__icon {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: #d97706;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}
.nav-tile--rose .nav-tile__icon {
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
  color: #e11d48;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.15);
}
.nav-tile--slate .nav-tile__icon {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  color: #475569;
  box-shadow: 0 4px 12px rgba(71, 85, 105, 0.15);
}

.breadcrumb {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.breadcrumb a { font-weight: 600; }

.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.tree { list-style: none; padding-left: 0; margin: 0; }
.tree ul { list-style: none; padding-left: 1.25rem; margin: 0.35rem 0; }
.tree li { margin: 0.25rem 0; }
.tree-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* ——— Login ——— */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.35), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(14, 165, 233, 0.2), transparent),
    linear-gradient(165deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
}
.login-card {
  width: 100%;
  max-width: 420px;
  padding: 2.25rem 2rem;
  border-radius: 24px;
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}
.login-card__brand {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.45);
}
.login-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--ink);
}
.login-card .sub {
  color: var(--muted);
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
  line-height: 1.5;
}
.login-card .form-group input[type='email'],
.login-card .form-group input[type='password'] {
  max-width: 100%;
}

/* ——— Dokument-Vorschau (PDF / Bild) ——— */
#vorschau {
  scroll-margin-top: 1.25rem;
}

.doc-preview-card {
  overflow: hidden;
}

.doc-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.doc-preview-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.doc-preview-badge {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  color: #4338ca;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.doc-preview {
  border-radius: 14px;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid var(--line);
}

.doc-preview--pdf iframe {
  display: block;
  width: 100%;
  min-height: min(78vh, 900px);
  height: 78vh;
  border: none;
  background: #334155;
}

.doc-preview--image {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: min(78vh, 900px);
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.doc-preview--image img {
  max-width: 100%;
  max-height: min(78vh, 900px);
  width: auto;
  height: auto;
  object-fit: contain;
  vertical-align: middle;
}

.doc-preview-hint {
  margin: 0.85rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.card__title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 1.25rem !important;
}

.doc-actions__form {
  display: inline;
}

.search-preview-badge {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.12rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 6px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  vertical-align: middle;
}

@media (max-width: 640px) {
  .doc-preview--pdf iframe {
    height: 60vh;
    min-height: 320px;
  }
}

/* ——— Responsive ——— */
@media (max-width: 960px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    min-height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }
  .sidebar-brand {
    padding: 0;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 200px;
  }
  .sidebar-brand__mark { margin-bottom: 0; }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0;
    width: 100%;
    gap: 0.35rem;
  }
  .sidebar-nav a { flex: 1 1 auto; justify-content: center; min-width: 120px; }
  .sidebar-footer {
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    margin-top: 0.5rem;
  }
  .main-wrap { padding: 1.25rem 1rem 2rem; }
  .tile-grid { grid-template-columns: 1fr; }
}
