:root {
  --ink: #0f172a;
  --muted: #475569;
  --bg: #f8fafc;
  --panel: #ffffff;
  --line: #dce4f2;
  --accent: #0f766e;
  --accent-2: #0ea5a3;
  --warn: #b45309;
  --danger: #b91c1c;
  --radius: 14px;
  --shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 0% 0%, rgba(14, 165, 163, 0.14), transparent 35%),
    radial-gradient(circle at 100% 0%, rgba(15, 118, 110, 0.12), transparent 38%),
    var(--bg);
}

.container {
  width: min(1280px, 92vw);
  margin: 0 auto;
  padding: 18px 0 40px;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: rgba(248, 250, 252, 0.92);
  border-bottom: 1px solid var(--line);
}

.top-nav-inner {
  width: min(1280px, 92vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge {
  background: rgba(14, 165, 163, 0.15);
  color: #0f766e;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 10px;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--ink);
  background: #e2e8f0;
}

.nav-user {
  font-size: 12px;
  color: #334155;
  background: #e2e8f0;
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
}

.logout-form {
  margin: 0;
}

.nav-logout-btn {
  padding: 8px 10px;
  font-size: 12px;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: 1.4fr 1fr;
}

.grid.main {
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.9fr);
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel h2,
.panel h3 {
  margin: 0 0 12px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

form.inline-create {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
}

label {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  display: block;
  margin-bottom: 6px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(14, 165, 163, 0.15);
}

textarea {
  min-height: 120px;
  max-height: 220px;
  resize: none;
  overflow-y: auto;
}

.quill-editor {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.quill-editor .ql-editor {
  min-height: 220px !important;
  max-height: 220px !important;
  height: 220px !important;
  overflow-y: auto !important;
  font-size: 14px;
}

.quill-editor .ql-toolbar.ql-snow {
  border: 0;
  border-bottom: 1px solid #cbd5e1;
  background: #f8fafc;
}

.quill-editor .ql-container.ql-snow {
  height: 220px !important;
  min-height: 220px !important;
  max-height: 220px !important;
  overflow-y: auto !important;
  border: 0;
  border-top: 0;
  border-radius: 0;
}

#summary-editor {
  max-height: 210px !important;
}

#conclusion-editor .ql-container.ql-snow {
  height: 210px !important;
  min-height: 210px !important;
  max-height: 210px !important;
}

.form-grid > .quill-field {
  min-height: 284px;
}

button,
.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: white;
}

.btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-warn {
  background: #fef3c7;
  color: #92400e;
}

.btn-danger {
  background: #fee2e2;
  color: #991b1b;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  white-space: nowrap;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.actions .status-pill {
  min-height: 42px;
  padding: 0 16px;
}

.status-pill.draft {
  background: #fef3c7;
  color: #92400e;
}

.status-pill.final {
  background: #dcfce7;
  color: #166534;
}

.message {
  border-radius: 10px;
  padding: 10px 12px;
  background: #ecfeff;
  border: 1px solid #99f6e4;
  color: #0f766e;
  margin-bottom: 12px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}

.card h4 {
  margin: 0 0 8px;
}

.all-dossiers-block {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid #dbe4f0;
}

.all-dossiers-title {
  margin-bottom: 12px;
}

.all-dossiers-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.search-input-wrap {
  flex: 1 1 420px;
}

.all-dossiers-page-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.all-dossiers-page-size select {
  width: auto;
  min-width: 88px;
}

.all-dossiers-table-wrap {
  border: 1px solid #d7e1ef;
  border-radius: 12px;
  overflow: auto;
}

.all-dossiers-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.all-dossiers-table th {
  background: #f0fdfa;
  white-space: nowrap;
}

.all-dossiers-table td {
  vertical-align: middle;
}

.dossier-row-clickable {
  cursor: pointer;
  transition: background-color 120ms ease;
}

.dossier-row-clickable:hover {
  background: #ecfeff;
}

.dossier-row-clickable:focus-visible {
  outline: 2px solid #0ea5a3;
  outline-offset: -2px;
}

.all-dossiers-pagination {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

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

.section {
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fcfdff;
}

.section h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid .span-2 {
  grid-column: span 2;
}

.form-grid .span-3 {
  grid-column: span 3;
}

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

table th,
table td {
  border: 1px solid #d7e1ef;
  padding: 8px;
  font-size: 13px;
  text-align: left;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  border: 1px solid #d8e4f4;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.metric .label {
  font-size: 12px;
  color: #475569;
}

.metric .value {
  font-size: 20px;
  font-weight: 700;
}

.list {
  margin: 0;
  padding-left: 18px;
}

.list li + li {
  margin-top: 6px;
}

.callout {
  border-left: 4px solid var(--warn);
  background: #fff7ed;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: #9a3412;
}

.callout.error {
  border-left-color: var(--danger);
  background: #fef2f2;
  color: #991b1b;
}

.audit-entry {
  border-bottom: 1px dashed #dbe7f5;
  padding: 8px 0;
  font-size: 13px;
}

.audit-entry:last-child {
  border-bottom: 0;
}

.thumb-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.thumb-item {
  width: 150px;
  margin: 0;
  border: 1px solid #d8e4f4;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.thumb-item img {
  width: 150px;
  height: 105px;
  display: block;
  object-fit: cover;
}

.thumb-item figcaption {
  font-size: 11px;
  color: #475569;
  padding: 6px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

@media (max-width: 1080px) {
  .grid.main,
  .grid.two,
  .hero {
    grid-template-columns: 1fr;
  }

  form.inline-create {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .form-grid.three {
    grid-template-columns: 1fr;
  }

  .form-grid .span-2,
  .form-grid .span-3 {
    grid-column: span 1;
  }

  .all-dossiers-toolbar {
    align-items: stretch;
  }
}
