/* =========================================================================
   Hardok & Partner – Design System (neu, lokal, kein CDN)
   Farbwelt: Dark + Gold (#D4AF37)
   ========================================================================= */
:root {
  --bg: #0f0f12;
  --surface: #17181d;
  --surface-2: #1d1f26;
  --surface-3: #262933;
  --border: #2b2e38;
  --border-soft: #23262e;
  --text: #e8e8ec;
  --text-muted: #9a9ca6;
  --text-dim: #6d6f79;

  --gold: #D4AF37;
  --gold-hover: #e2c257;
  --gold-soft: rgba(212, 175, 55, 0.12);
  --gold-border: rgba(212, 175, 55, 0.35);

  --green: #46b06e;
  --red: #e05a52;
  --amber: #e0a72e;
  --blue: #52a6e0;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --sidebar-w: 258px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }

.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.gold { color: var(--gold); }
.small { font-size: 0.82rem; }
.mono { font-family: "SF Mono", "Cascadia Code", Consolas, monospace; }
.nowrap { white-space: nowrap; }
.text-center { text-align: center; }
.text-end { text-align: right; }

/* ---------- App Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  position: fixed; top: 0; left: 0; bottom: 0;
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column;
  padding: 22px 16px;
  z-index: 40;
}
.sidebar__logo { padding: 6px 10px 20px; }
.sidebar__logo img { height: 42px; width: auto; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav__label {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-dim); padding: 16px 12px 6px;
}
.nav__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav__item:hover { background: var(--surface-2); color: var(--text); }
.nav__item.active { background: var(--gold-soft); color: var(--gold); }
.nav__item.active svg { color: var(--gold); }
.nav__item svg { width: 19px; height: 19px; flex-shrink: 0; }

.sidebar__foot {
  border-top: 1px solid var(--border-soft); padding-top: 14px; margin-top: 8px;
}
.sidebar__user { display: flex; align-items: center; gap: 11px; padding: 6px 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gold-soft); color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}

/* ---------- Main ---------- */
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.topbar {
  height: 66px; border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; position: sticky; top: 0;
  background: rgba(15, 15, 18, 0.8); backdrop-filter: blur(8px); z-index: 30;
}
.topbar__title { font-size: 1.05rem; font-weight: 600; }
.content { padding: 30px 32px 60px; max-width: 1240px; }

.menu-toggle { display: none; background: none; border: none; color: var(--text); cursor: pointer; }

/* ---------- Page head ---------- */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 26px; flex-wrap: wrap;
}
.page-head h1 { font-size: 1.6rem; }
.page-head p { margin: 4px 0 0; color: var(--text-muted); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 22px;
}
.card + .card { margin-top: 20px; }
.card__title {
  font-size: 0.95rem; color: var(--gold); font-weight: 600;
  padding-bottom: 12px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 8px;
}
.card--flush { padding: 0; overflow: hidden; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-7-5 { grid-template-columns: 7fr 5fr; }
.grid-8-4 { grid-template-columns: 8fr 4fr; }

/* ---------- Stat cards ---------- */
.stat {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 22px;
  display: flex; align-items: center; justify-content: space-between;
}
.stat--gold { border-color: var(--gold-border); }
.stat__label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.stat--gold .stat__label { color: var(--gold); }
.stat__value { font-size: 2rem; font-weight: 800; margin-top: 4px; }
.stat__icon { width: 46px; height: 46px; border-radius: 12px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--gold); }
.stat__icon svg { width: 24px; height: 24px; }

.action-card {
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius); padding: 26px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; transition: border-color 0.15s, transform 0.15s;
}
.action-card:hover { border-color: var(--gold-border); transform: translateY(-2px); }
.action-card__icon { width: 52px; height: 52px; border-radius: 50%; background: var(--gold-soft); color: var(--gold); display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.action-card__icon svg { width: 24px; height: 24px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 1px solid transparent; border-radius: 999px;
  padding: 9px 18px; font-size: 0.88rem; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-gold { background: var(--gold); color: #17140a; }
.btn-gold:hover { background: var(--gold-hover); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; border-color: rgba(224,90,82,0.5); color: var(--red); }
.btn-danger:hover { background: rgba(224,90,82,0.12); }
.btn-success { background: var(--green); color: #08210f; }
.btn-success:hover { filter: brightness(1.08); }
.btn-sm { padding: 6px 13px; font-size: 0.8rem; }
.btn-icon { padding: 8px; border-radius: 10px; }
.btn-icon.btn-sm { padding: 6px; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.form-label { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.form-control, .form-select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 11px 14px; font-size: 0.92rem; font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control::placeholder { color: var(--text-dim); }
.form-control:focus, .form-select:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
textarea.form-control { resize: vertical; }
input[type="file"].form-control { padding: 9px 12px; }
.form-row { display: grid; gap: 16px; margin-bottom: 16px; }
.form-hint { font-size: 0.78rem; color: var(--text-dim); margin-top: 6px; }

.input-with-btn { display: flex; gap: 8px; }
.input-with-btn .form-control { flex: 1; }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { display: none; }
.switch__track {
  width: 44px; height: 24px; border-radius: 999px; background: var(--surface-3);
  position: relative; transition: background 0.15s; flex-shrink: 0;
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--text-muted); transition: transform 0.15s, background 0.15s;
}
.switch input:checked + .switch__track { background: var(--gold-soft); }
.switch input:checked + .switch__track::after { transform: translateX(20px); background: var(--gold); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table thead th {
  text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-dim); font-weight: 600; padding: 15px 18px;
  background: var(--surface-2); border-bottom: 1px solid var(--border-soft);
}
.table tbody td { padding: 15px 18px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table .strong { font-weight: 600; color: var(--text); }

.empty { text-align: center; padding: 54px 20px; color: var(--text-dim); }
.empty svg { width: 34px; height: 34px; margin-bottom: 12px; opacity: 0.6; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 999px; font-size: 0.74rem; font-weight: 600;
  border: 1px solid transparent;
}
.badge svg { width: 12px; height: 12px; }
.badge-green { background: rgba(70,176,110,0.14); color: var(--green); border-color: rgba(70,176,110,0.4); }
.badge-amber { background: rgba(224,167,46,0.14); color: var(--amber); border-color: rgba(224,167,46,0.4); }
.badge-blue { background: rgba(82,166,224,0.14); color: var(--blue); border-color: rgba(82,166,224,0.4); }
.badge-gray { background: var(--surface-3); color: var(--text-muted); border-color: var(--border); }
.badge-gold { background: var(--gold-soft); color: var(--gold); border-color: var(--gold-border); }
.badge-red { background: rgba(224,90,82,0.14); color: var(--red); border-color: rgba(224,90,82,0.4); }

/* ---------- Alerts / Flash ---------- */
.flash-wrap { margin-bottom: 22px; display: flex; flex-direction: column; gap: 10px; }
.alert {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 16px; border-radius: var(--radius-sm);
  border-left: 3px solid var(--text-muted); background: var(--surface-2);
  font-size: 0.9rem;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.alert-success { border-left-color: var(--green); color: #a7e0bd; }
.alert-danger { border-left-color: var(--red); color: #f0b3ae; }
.alert-warning { border-left-color: var(--amber); color: #f0d59a; }
.alert-info { border-left-color: var(--blue); color: #b3d7f0; }

/* ---------- Doc list ---------- */
.doc {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 15px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  background: var(--surface-2); margin-bottom: 10px;
}
.doc__main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.doc__main svg { color: var(--gold); width: 22px; height: 22px; flex-shrink: 0; }
.doc__name { color: var(--text); font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc__actions { display: flex; gap: 7px; }

/* ---------- Bank rows / repeatable ---------- */
.subrow {
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 15px; margin-bottom: 13px; background: var(--surface-2); position: relative;
}
.subrow__remove { position: absolute; top: 8px; right: 8px; }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--border-soft); border-radius: 20px;
  padding: 40px 32px; box-shadow: var(--shadow); text-align: center;
}
.auth-card img.logo { max-width: 170px; margin-bottom: 22px; }
.auth-card h1 { font-size: 1.25rem; margin-bottom: 22px; }
.auth-icon { width: 74px; height: 74px; border-radius: 50%; background: var(--gold-soft); color: var(--gold); display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; }
.auth-icon svg { width: 34px; height: 34px; }

/* ---------- Statistics bars ---------- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-top: 10px; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bars__bar { width: 100%; background: linear-gradient(180deg, var(--gold), rgba(212,175,55,0.35)); border-radius: 6px 6px 0 0; min-height: 3px; transition: height 0.6s; }
.bars__label { font-size: 0.7rem; color: var(--text-dim); }
.bars__val { font-size: 0.68rem; color: var(--text-muted); min-height: 14px; }

/* ---------- Utilities ---------- */
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--border-soft); margin: 22px 0; border: none; }

/* ---------- Modal ---------- */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 60; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay:target { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; width: 100%; max-width: 420px;
}
.modal h3 { font-size: 1.05rem; margin-bottom: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-7-5, .grid-8-4 { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 22px 18px 50px; }
  .topbar { padding: 0 18px; }
}
