:root {
  --bg: #f8f4f9;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: #ffffff;

  --text: #1d1d1f;
  --muted: #6e6e73;

  --primary: #822082;
  --primary-dark: #641564;
  --primary-soft: rgba(130, 32, 130, 0.08);
  --primary-extra-soft: rgba(130, 32, 130, 0.045);

  --border: rgba(64, 20, 64, 0.10);
  --border-strong: rgba(64, 20, 64, 0.16);

  --green-bg: #e8f7ee;
  --green-text: #166534;

  --yellow-bg: #fff7df;
  --yellow-text: #8a5a00;

  --red-bg: #fff0f0;
  --red-text: #b42318;

  --shadow: 0 16px 44px rgba(64, 20, 64, 0.075);
  --shadow-soft: 0 8px 24px rgba(64, 20, 64, 0.05);

  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(130, 32, 130, 0.11), transparent 34%),
    radial-gradient(circle at top right, rgba(130, 32, 130, 0.06), transparent 30%),
    var(--bg);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Display",
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-mini {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px 7px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-soft);
  font-size: 14px;
  font-weight: 700;
}

.brand-mini img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 10px;
  background: #ffffff;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  font-weight: 650;
  transition:
    transform 0.18s ease,
    background 0.18s ease;
}

.back-link:hover {
  transform: translateY(-1px);
  background: #ffffff;
}

.button,
.search-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: var(--primary);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.button:hover,
.search-form button:hover {
  transform: translateY(-1px);
  background: var(--primary-dark);
  box-shadow: 0 10px 24px rgba(130, 32, 130, 0.18);
}

.button-primary {
  width: 100%;
  min-height: 48px;
}

.button-secondary {
  min-height: 36px;
  padding: 0 14px;
  color: var(--text);
  background: #f5f5f7;
  border: 1px solid var(--border);
}

.button-secondary:hover {
  color: var(--text);
  background: #ffffff;
  box-shadow: none;
}

.button-success {
  color: #ffffff;
  background: #168a45;
}

.button-success:hover {
  background: #0f7036;
  box-shadow: 0 10px 24px rgba(22, 138, 69, 0.22);
}

.button-danger {
  color: #ffffff;
  background: #b42318;
}

.button-danger:hover {
  background: #941b13;
  box-shadow: 0 10px 24px rgba(180, 35, 24, 0.22);
}

.search-form {
  position: relative;
  display: flex;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
}

.search-icon {
  display: grid;
  place-items: center;
  width: 34px;
  color: var(--muted);
  font-size: 20px;
}

.search-form input {
  flex: 1;
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 15px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.status-valide {
  color: var(--green-text);
  background: var(--green-bg);
}

.status-refuse {
  color: var(--red-text);
  background: var(--red-bg);
}

.status-a_relire {
  color: var(--yellow-text);
  background: var(--yellow-bg);
}

.panel,
.stat-card {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  overflow: hidden;
  border-radius: 24px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 12px;
}

.panel-header h2 {
  margin-bottom: 4px;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.panel-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.modern-table {
  width: 100%;
  border-collapse: collapse;
}

.modern-table th {
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  background: #f6f1f7;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

.modern-table td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.modern-table tbody tr:hover {
  background: var(--primary-extra-soft);
}

.title-cell,
.document-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-cell strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  line-height: 1.25;
}

.title-cell small {
  display: block;
  max-width: 460px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-icon,
.pdf-icon {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  font-weight: 850;
}

.document-icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  color: #ffffff;
  background: linear-gradient(145deg, var(--primary), #b85ab8);
  font-size: 11px;
}

.pdf-icon {
  width: 34px;
  height: 26px;
  border-radius: 9px;
  color: var(--red-text);
  background: var(--red-bg);
  font-size: 11px;
}

.empty-state {
  margin: 18px;
  padding: 32px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  text-align: center;
  background: var(--primary-extra-soft);
}

.empty-state.compact-empty {
  margin: 10px 18px 18px;
  padding: 28px;
}

.empty-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 14px;
  border-radius: 16px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 24px;
}

.empty-state h3 {
  margin-bottom: 6px;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.align-right {
  text-align: right;
}

progress {
  width: 100%;
  height: 9px;
  border: none;
  border-radius: 999px;
  overflow: hidden;
  background: #eee7f1;
}

progress::-webkit-progress-bar {
  border-radius: 999px;
  background: #eee7f1;
}

progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--primary);
}

progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--primary);
}

.progress-text {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

textarea {
  resize: vertical;
}

@media (max-width: 720px) {
  .search-form {
    border-radius: 18px;
    flex-wrap: wrap;
  }

  .search-form button {
    width: 100%;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
