:root {
  --ink: #161616;
  --muted: #6f6b64;
  --line: #e9e3d8;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --brand: #1312c6;
  --brand-dark: #090879;
  --brand-soft: #ececff;
  --accent: #1312c6;
  --accent-dark: #1312c6;
  --good: #daf0df;
  --good-ink: #24623a;
  --warn: #fff1c9;
  --warn-ink: #7b5b11;
  --hot: #ffe0d2;
  --hot-ink: #9c3412;
  --blue: #e4f1f7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #f9f9f9;
  font-family: Inter, Avenir, "Helvetica Neue", Arial, sans-serif;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #f4f4fb;
}

.login-shell {
  width: min(100%, 440px);
  padding: 22px;
}

.login-card {
  display: grid;
  gap: 16px;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(22, 22, 22, 0.08);
}

.login-card .brand-logo {
  width: 250px;
  padding: 0;
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #ffd4c5;
  border-radius: 6px;
  color: #9c3412;
  background: #fff4f1;
  font-weight: 700;
}

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

button,
.file-button,
.link-button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

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

.primary {
  background: var(--brand);
  color: white;
  box-shadow: 0 8px 18px rgba(19, 18, 198, 0.18);
  font-weight: 600;
  font-size: 14px;
}

.secondary,
.ghost,
.link-button {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.secondary.active-toggle {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-dark);
  font-weight: 700;
}

.danger {
  background: #fff4f1;
  color: #9c3412;
  border: 1px solid #ffd4c5;
  font-weight: 700;
}

.danger:hover {
  background: #ffe0d2;
}

.ghost {
  background: rgba(255, 255, 255, 0.72);
}

.file-button input {
  display: none;
}

.topbar {
  min-height: 86px;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  /* background: linear-gradient(180deg, #ffffff 0%, #f5f5ff 100%); */
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-logo {
  width: 235px;
  height: auto;
  display: block;
  padding: 10px 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  font-size: 28px;
  line-height: 1.05;
}

h2 {
  font-size: 20px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

main {
  padding: 22px;
}

.sync-panel {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #dedcff;
  border-radius: 8px;
  background: var(--brand-soft);
}

.sync-panel strong,
.sync-panel p {
  margin: 0;
}

.sync-panel p {
  margin-top: 5px;
  color: var(--muted);
}

.sync-panel.sync-success {
  border-color: #bfe4ca;
  background: var(--good);
}

.sync-panel.sync-error {
  border-color: #ffd4c5;
  background: #fff4f1;
}

.settings-layout {
  display: grid;
  gap: 18px;
}

.settings-head {
  padding: 4px 0 2px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.settings-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.settings-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.settings-card-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

.settings-form {
  display: grid;
  gap: 14px;
}

.user-list {
  display: grid;
  gap: 10px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 150px 110px minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.inline-check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.inline-check input {
  width: auto;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-strip article {
  background: var(--panel);
  border: 1px solid #dedcff;
  border-radius: 8px;
  padding: 16px;
}

.summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.summary-strip strong {
  display: block;
  margin-top: 6px;
  font-size: 25px;
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.workspace > .detail {
  display: none;
}

.muted {
  color: var(--muted);
}

.dossier-page {
  max-width: 1440px;
  margin: 0 auto;
}

.dossier-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.dossier-heading .muted {
  margin: 8px 0 0;
}

.dossier-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.dossier-main,
.dossier-side {
  display: grid;
  gap: 18px;
}

.dossier-side {
  position: sticky;
  top: 18px;
}

.message-timeline,
.task-list,
.customer-history {
  display: grid;
  gap: 12px;
}

.message-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: #fff;
}

.message-card.outbound {
  border-left-color: var(--good-ink);
  background: #f5fbf6;
}

.message-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.message-head div,
.message-head span {
  display: grid;
  gap: 3px;
}

.message-head span,
.message-head time,
.message-card a {
  color: var(--muted);
  font-size: 12px;
}

.message-card h3 {
  margin: 14px 0 8px;
  font-size: 15px;
}

.message-card p {
  margin: 0 0 12px;
  line-height: 1.55;
  font-size: 14px;
}

.task-form {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.task-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.task-row input {
  width: auto;
}

.task-row div,
.task-row span {
  display: grid;
  gap: 3px;
}

.task-row span {
  color: var(--muted);
  font-size: 12px;
}

.task-row.done strong {
  color: var(--muted);
  text-decoration: line-through;
}

.task-delete {
  min-width: 34px;
  min-height: 34px;
  padding: 0;
}

.history-row {
  display: grid;
  gap: 4px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  text-decoration: none;
}

.history-row:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.history-row small {
  color: var(--muted);
}

.filters,
.case-list,
.detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.filters {
  position: sticky;
  top: 14px;
  padding: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: #3e3b36;
  font-size: 13px;
  font-weight: 700;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-label-row .link-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
}

.filters label + label,
.filters button {
  margin-top: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d9d0c2;
  border-radius: 6px;
  color: var(--ink);
  background: white;
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(19, 18, 198, 0.18);
}

input[readonly],
textarea[readonly] {
  background: #f6f6f6;
  color: #5f5f5f;
  cursor: default;
}

.case-list {
  min-height: 620px;
  overflow: hidden;
}

.list-head {
  height: 74px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.list-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.rows {
  max-height: calc(100vh - 242px);
  min-height: 520px;
  overflow: auto;
}

.case-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: white;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
}

.case-row:hover,
.case-row.active {
  background: var(--brand-soft);
}

.case-row.active {
  box-shadow: inset 4px 0 0 var(--accent);
}

.case-main {
  min-width: 0;
}

.case-title {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.case-title strong {
  font-size: 15px;
}

.case-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-open {
  color: var(--hot-ink);
  background: var(--hot);
}

.status-done {
  color: var(--good-ink);
  background: var(--good);
}

.priority-hoog {
  color: var(--hot-ink);
  background: var(--hot);
}

.priority-normaal {
  color: var(--warn-ink);
  background: var(--warn);
}

.priority-laag {
  color: var(--good-ink);
  background: var(--good);
}

.date-chip {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.detail {
  min-height: 620px;
}

.empty-state {
  min-height: 620px;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 38px;
  text-align: center;
}

.logo-mark {
  width: 118px;
  height: 118px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  border: 10px solid #222;
  background: linear-gradient(135deg, white 0%, #f1e7d6 100%);
  box-shadow: 16px 16px 0 rgba(19, 18, 198, 0.18);
  font-weight: 900;
}

.empty-state p {
  max-width: 420px;
  color: var(--muted);
}

.case-form {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.hidden {
  display: none;
}

.form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

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

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

.danger-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 230px minmax(320px, 1fr);
  }

  .detail {
    grid-column: 1 / -1;
  }

  .settings-grid,
  .user-row,
  .dossier-grid {
    grid-template-columns: 1fr;
  }

  .dossier-side {
    position: static;
  }
}

@media (max-width: 760px) {
  .topbar,
  .brand,
  .top-actions,
  .form-head,
  .dossier-heading {
    align-items: stretch;
    flex-direction: column;
  }

  main {
    padding: 14px;
  }

  .summary-strip,
  .workspace,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
  }

  .rows {
    max-height: none;
  }

  .brand-logo {
    width: 100%;
    max-width: 230px;
  }
}
