@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #020617;
  --surface-1: rgba(15, 23, 42, 0.9);
  --surface-2: rgba(30, 41, 59, 0.85);
  --border: rgba(51, 65, 85, 0.85);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #06b6d4;
  --link: #93c5fd;
  --danger-bg: rgba(220, 38, 38, 0.14);
  --danger-border: rgba(220, 38, 38, 0.35);
  --success-bg: rgba(16, 185, 129, 0.14);
  --success-border: rgba(16, 185, 129, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(to right, rgba(59, 130, 246, 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(59, 130, 246, 0.07) 1px, transparent 1px),
    radial-gradient(circle at 18% 8%, rgba(6, 182, 212, 0.26), transparent 34%),
    radial-gradient(circle at 82% 12%, rgba(59, 130, 246, 0.3), transparent 32%),
    radial-gradient(circle at 52% 100%, rgba(14, 116, 144, 0.24), transparent 42%),
    var(--bg);
  background-size: 40px 40px, 40px 40px, auto, auto, auto, auto;
}

.container {
  max-width: 1040px;
  margin: 34px auto;
  padding: 0 16px 28px;
}

.narrow {
  max-width: 560px;
}

main.container {
  position: relative;
}

main.container::before {
  content: "";
  position: absolute;
  top: -18px;
  right: 8px;
  width: 180px;
  height: 180px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.18), transparent 68%);
  pointer-events: none;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(30px, 5vw, 38px);
  line-height: 1.12;
}

h2 {
  font-size: clamp(20px, 3vw, 24px);
}

p {
  color: var(--muted);
  margin: 10px 0 0;
}

.card {
  margin-top: 18px;
  padding: 20px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(to bottom, rgba(15, 23, 42, 0.94), rgba(15, 23, 42, 0.82));
  box-shadow:
    0 18px 40px rgba(2, 6, 23, 0.45),
    inset 0 1px 0 rgba(148, 163, 184, 0.06);
  backdrop-filter: blur(6px);
}

.auth-switch {
  display: flex;
  gap: 10px;
  margin: 14px 0 8px;
}

.chip {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  background: rgba(15, 23, 42, 0.66);
}

.chip.active {
  border-color: rgba(59, 130, 246, 0.75);
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.2) inset,
    0 6px 18px rgba(30, 64, 175, 0.28);
}

label {
  display: block;
  margin-top: 14px;
  margin-bottom: 7px;
  font-size: 14px;
  font-weight: 500;
  color: #dbeafe;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  color: var(--text);
  background: rgba(2, 6, 23, 0.72);
}

input::placeholder {
  color: #64748b;
}

input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.82);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

button,
.button-link {
  margin-top: 14px;
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.28);
}

button:hover,
.button-link:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.secondary {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border);
  box-shadow: none;
}

.small {
  margin-top: 0;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: none;
}

.danger {
  background: linear-gradient(90deg, #b91c1c, #dc2626);
}

.notice,
.alert {
  margin-top: 12px;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

.notice {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: #d1fae5;
}

.alert {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: #fecaca;
}

.helper-links {
  margin-top: 14px;
}

.helper-links a,
.file-list a {
  color: var(--link);
  text-decoration: none;
}

.helper-links a:hover,
.file-list a:hover {
  color: #bfdbfe;
  text-decoration: underline;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hint {
  margin-top: 8px;
  font-size: 13px;
}

.file-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid rgba(51, 65, 85, 0.75);
}

.file-list li:first-child {
  border-top: 0;
}

.table-wrap {
  overflow-x: auto;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.users-table th,
.users-table td {
  padding: 10px 8px;
  text-align: left;
  border-top: 1px solid rgba(51, 65, 85, 0.75);
  font-size: 14px;
}

.users-table th {
  color: #cbd5e1;
  font-weight: 600;
}

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid transparent;
  font-size: 12px;
}

.status.ok {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.3);
  color: #a7f3d0;
}

.status.ko {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.3);
  color: #fecaca;
}

.action-row {
  display: flex;
  gap: 8px;
}

@media (max-width: 760px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .container {
    margin-top: 24px;
  }
}

.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.tab-link {
  display: inline-block;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  background: rgba(15, 23, 42, 0.7);
  font-weight: 500;
}

.tab-link.active {
  border-color: rgba(59, 130, 246, 0.75);
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.2) inset,
    0 8px 20px rgba(30, 64, 175, 0.25);
}

.grid-wrap {
  overflow-x: auto;
}

.doc-grid {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.doc-grid th,
.doc-grid td {
  border-top: 1px solid rgba(51, 65, 85, 0.75);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.doc-grid thead th {
  color: #cbd5e1;
  font-weight: 600;
}

.doc-grid tbody > tr > th {
  color: #dbeafe;
  width: 18%;
}

.grid-cell {
  width: 100%;
  margin: 0;
  text-align: left;
  padding: 10px;
  border: 1px solid rgba(51, 65, 85, 0.85);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.86), rgba(2, 6, 23, 0.75));
  box-shadow: none;
}

.grid-cell:hover {
  border-color: rgba(59, 130, 246, 0.65);
  box-shadow: 0 10px 20px rgba(30, 64, 175, 0.2);
}

.cell-title {
  display: block;
  font-size: 13px;
  color: #dbeafe;
  margin-bottom: 6px;
}

.cell-count {
  display: inline-block;
  font-size: 12px;
  color: #93c5fd;
}

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(3px);
}

.modal-content {
  position: relative;
  margin: 4vh auto;
  width: min(980px, calc(100vw - 30px));
  max-height: 92vh;
  overflow-y: auto;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(to bottom, rgba(2, 6, 23, 0.97), rgba(15, 23, 42, 0.97));
  box-shadow: 0 24px 45px rgba(2, 6, 23, 0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.compact-card {
  margin-top: 12px;
  padding: 14px;
}

.compact-card h3 {
  margin: 0;
  font-size: 17px;
}

.modal-file-table {
  min-width: 640px;
}

.dropzone {
  border: 1px dashed rgba(59, 130, 246, 0.6);
  border-radius: 10px;
  padding: 14px;
  background: rgba(15, 23, 42, 0.55);
}

.dropzone.drag-active {
  border-color: rgba(34, 211, 238, 0.9);
  background: rgba(8, 47, 73, 0.35);
}

.dropzone p {
  margin: 0;
}

.dropzone .small {
  margin-top: 10px;
}

.cell-count-large {
  display: block;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #bfdbfe;
}

.grid-cell {
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
}

.site-footer {
  margin-top: 24px;
  padding: 16px;
}

.site-footer-inner {
  margin: 0 auto;
  max-width: 1040px;
  border-top: 1px solid rgba(51, 65, 85, 0.7);
  padding-top: 14px;
  text-align: center;
}

.site-footer p {
  margin: 4px 0;
  font-size: 12px;
  color: #94a3b8;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-links a {
  color: #93c5fd;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.grid-scroller {
  position: relative;
}

.grid-wrap {
  overflow-x: auto;
  padding: 0 46px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
}

.grid-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.9);
  background: rgba(6, 182, 212, 0.18);
  color: #67e8f9;
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.5);
  z-index: 30;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.grid-arrow.left {
  left: 8px;
}

.grid-arrow.right {
  right: 8px;
}

.grid-arrow:hover {
  background: rgba(34, 211, 238, 0.25);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.65);
}

.grid-arrow.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.doc-grid thead th:first-child,
.doc-grid tbody > tr > th {
  position: sticky;
  left: 0;
  background: rgba(2, 6, 23, 0.94);
  z-index: 6;
  box-shadow: 1px 0 0 rgba(51, 65, 85, 0.8), 8px 0 14px rgba(2, 6, 23, 0.35);
  min-width: 300px;
  max-width: 300px;
}

.doc-grid thead th:first-child {
  z-index: 8;
}

@media (max-width: 900px) {
  .grid-wrap {
    padding: 0 40px;
  }

  .doc-grid thead th:first-child,
  .doc-grid tbody > tr > th {
    min-width: 230px;
    max-width: 230px;
  }
}

.add-affaire-row th {
  color: #bfdbfe;
}

.inline-affaire-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-affaire-form input[type="text"] {
  min-width: 260px;
  max-width: 420px;
}

.inline-affaire-form .small {
  margin-top: 0;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.overview-card {
  border: 1px solid rgba(51, 65, 85, 0.85);
  border-radius: 12px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.7), rgba(2, 6, 23, 0.55));
}

.overview-card h2 {
  margin: 0;
  font-size: 18px;
}

.overview-metrics {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.overview-metrics p {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.overview-metrics span {
  color: #cbd5e1;
  font-size: 13px;
}

.overview-metrics strong {
  color: #e2e8f0;
  font-size: 15px;
}

.metric-up {
  color: #34d399;
}

.overall-card {
  margin-top: 16px;
  border: 1px solid rgba(34, 211, 238, 0.45);
  border-radius: 14px;
  padding: 22px 18px;
  text-align: center;
  background: radial-gradient(circle at 50% 0%, rgba(6, 182, 212, 0.2), rgba(15, 23, 42, 0.55));
}

.overall-label {
  margin: 0;
  font-size: 14px;
  color: #67e8f9;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.overall-value {
  margin: 6px 0 0;
  font-size: clamp(34px, 7vw, 56px);
  line-height: 1;
  font-weight: 800;
  color: #e0f2fe;
}

.overall-meta {
  margin-top: 8px;
  font-size: 13px;
  color: #cbd5e1;
}
