:root {
  color-scheme: dark;
  --bg: #140810;
  --panel: #241018;
  --line: rgba(255, 105, 180, 0.45);
  --text: #ffe9f4;
  --muted: #e8a0c4;
  --accent: #ff69b4;
  --accent-strong: #e0218a;
  --green: #ff69b4;
  --red: #ff1493;
  font-family: "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(255, 105, 180, 0.42), transparent 38%),
    radial-gradient(circle at bottom left, rgba(224, 33, 138, 0.22), transparent 36%),
    var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px 40px;
  border-bottom: 1px solid var(--line);
  background: rgba(32, 8, 22, 0.94);
  position: sticky;
  top: 0;
  z-index: 10;
}

.session {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.session .help {
  margin: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.logo-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

nav { display: flex; gap: 8px; flex-wrap: wrap; }

.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.tab.active,
.tab:hover {
  color: var(--accent);
  border-color: var(--accent);
}

main { padding: 48px 48px 88px; max-width: 1280px; margin: 0 auto; }

.page { display: none; }
.page.active { display: block; }
.page.active > .hero,
.page.active > .cards,
.page.active > .editor,
.page.active > .table-wrap,
.page.active > .split,
.page.active > .actions,
.page.active > .catalog,
.page.active > .flash,
.page.active > p.help,
.page.active > p.status {
  margin-bottom: 40px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: 40px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
}

h1, h2 { margin: 0 0 8px; color: var(--accent); }
.help, .status { color: var(--muted); }

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 40px;
}

.cards article,
.table-wrap,
.editor,
.panel-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.cards article { padding: 22px 24px; }
.cards span { color: var(--muted); font-size: 13px; }
.cards strong { display: block; margin-top: 8px; font-size: 28px; color: var(--accent); }
.cards article.wide { grid-column: 1 / -1; }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-bottom: 40px;
}

.pay-field[hidden] { display: none; }
.pay-rule-row { cursor: pointer; }
.grade-input { width: 140px; padding: 6px 8px; }
.table-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 22px;
}

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}
th { color: var(--accent); font-size: 12px; }

.kind {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
}
.kind.recette, .kind.vente, .kind.facture,
.kind.depense, .kind.transfert,
.kind.service_in, .kind.service_out, .kind.recrutement, .kind.rh, .kind.service {
  background: rgba(255, 105, 180, 0.18);
  color: var(--accent);
}
.raw { margin: 6px 0 0; color: var(--muted); font-size: 12px; white-space: pre-wrap; }

input, select, textarea {
  background: #1a0c14;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
}

.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 24px; }
label { display: grid; gap: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.primary, .button-link {
  background: var(--accent);
  color: #3b0030;
  border: 0;
  font-weight: 700;
  border-radius: 10px;
  padding: 10px 14px;
  text-decoration: none;
  cursor: pointer;
}
.ghost, .danger { border-radius: 10px; padding: 10px 14px; cursor: pointer; }
.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.danger { background: rgba(224, 33, 138, 0.28); color: var(--accent); border: 0; }
.flash { padding: 12px 14px; border-radius: 12px; background: rgba(255, 105, 180, 0.16); color: var(--accent); }
.flash.error { background: rgba(224, 33, 138, 0.28); color: var(--accent); }
.layout { display: grid; grid-template-columns: 260px 1fr; gap: 28px; }
.panel-card { padding: 16px 18px; cursor: pointer; }
.panel-card.active { border-color: var(--accent); }
.editor { padding: 28px; }
.type-card { border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin: 16px 0; }
.check { display: flex; align-items: center; gap: 8px; }
.catalog { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.bot-profile { margin-top: 40px; }
.bot-profile h2 { margin-bottom: 8px; }
.span-2 { grid-column: 1 / -1; }
.bot-preview {
  position: relative;
  margin: 16px 0 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #1a0c14;
  min-height: 160px;
  padding-bottom: 16px;
}
.bot-banner {
  height: 90px;
  background: linear-gradient(90deg, rgba(255, 105, 180, 0.55), transparent);
  background-size: cover;
  background-position: center;
}
.bot-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid var(--panel);
  object-fit: cover;
  margin: -36px 0 0 18px;
  background: #3b0030;
  display: block;
}
.bot-tag {
  margin: 10px 18px 0;
  font-weight: 700;
  color: var(--accent);
}

.product-bars { padding: 8px 18px 18px; display: grid; gap: 10px; }
.product-bar {
  display: grid;
  grid-template-columns: minmax(120px, 220px) 1fr auto;
  gap: 12px;
  align-items: center;
}
.product-bar span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-bar strong { font-size: 13px; color: var(--accent); }
.bar-track {
  height: 10px;
  background: #1a0c14;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  border-radius: 999px;
}
.period-btn.active,
.archive-kind-btn.active,
.move-kind-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 900px) {
  .cards, .split, .layout, .grid-form, .catalog, .topbar { display: block; }
  main, .topbar { padding: 16px; }
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 24px;
}

.auth-body main.auth-shell {
  width: min(980px, calc(100% - 24px));
  max-width: 980px;
  padding: 0;
  margin: 0;
}

.auth-card {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 0;
  background: rgba(32, 8, 22, 0.94);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 0;
}

.auth-pane {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 36px 40px 40px;
}

.auth-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-head .brand { margin-bottom: 4px; }
.auth-head .eyebrow { margin: 0; }
.auth-head h1 { margin: 0; font-size: 28px; line-height: 1.25; }
.auth-head .help { margin: 2px 0 0; line-height: 1.5; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #1a0c14;
}

.auth-tab {
  margin: 0;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.auth-tab.active {
  background: rgba(255, 105, 180, 0.22);
  color: var(--accent);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
}

.auth-form label { gap: 8px; }
.auth-form input { padding: 12px 14px; width: 100%; }
.password-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
}
.password-field input { padding-right: 10px; }
.password-toggle {
  margin-left: 8px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.auth-form .primary {
  margin-top: 6px;
  width: 100%;
  padding: 14px 16px;
}

.auth-divider {
  width: 1px;
  background: var(--line);
  position: relative;
  margin: 28px 0;
}

.auth-divider span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(32, 8, 22, 0.94);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 8px;
  border-radius: 999px;
}

.auth-social {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 36px 40px 40px 32px;
}

.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  border: 1px solid transparent;
}

.oauth-btn:hover {
  filter: brightness(1.08);
}

.oauth-discord {
  background: #5865f2;
  color: #fff;
}

.oauth-google {
  background: #fff;
  color: #1f1f1f;
  border-color: rgba(255, 105, 180, 0.35);
}

.oauth-microsoft {
  background: #2f2f2f;
  color: #fff;
}

.oauth-apple {
  background: #000;
  color: #fff;
}

.oauth-github {
  background: #161b22;
  color: #fff;
  border-color: rgba(255, 105, 180, 0.28);
}

.auth-body main.auth-shell.wait-shell {
  width: min(640px, calc(100% - 24px));
  max-width: 640px;
}

.wait-card {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 36px 40px 40px;
  min-height: 0;
}

.wait-screen h1 { margin: 0 0 10px; }
.wait-screen .help { margin: 0; line-height: 1.55; }

.wait-pulse {
  width: 10px;
  height: 10px;
  margin-top: 18px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: waitPulse 1.4s ease-in-out infinite;
}

@keyframes waitPulse {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.25); }
}

.tos-box {
  margin: 16px 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #1a0c14;
  max-height: 240px;
  overflow: auto;
}

.tos-box h2 { margin: 0 0 10px; font-size: 16px; }
.tos-box ol { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.5; }
.tos-check { margin: 8px 0 12px; }
.wait-card .primary[disabled] { opacity: 0.45; cursor: not-allowed; }

@media (max-width: 900px) {
  .auth-card {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .auth-divider {
    width: auto;
    height: 1px;
    margin: 0 32px;
  }
  .auth-social { padding: 8px 32px 36px; }
}
