html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(121, 88, 189, 0.35);
}

a,
.nav-link {
  color: #7958bd;
}

a:hover,
.nav-link:hover {
  color: #60429e;
}

.btn-primary {
  border-color: #7958bd;
  background-color: #7958bd;
}

.btn-primary:hover,
.btn-primary:focus {
  border-color: #60429e;
  background-color: #60429e;
}

.btn-outline-primary {
  color: #7958bd;
  border-color: #9878d1;
}

.btn-outline-primary:hover {
  color: #ffffff;
  border-color: #7958bd;
  background-color: #7958bd;
}

.text-primary,
.link-primary {
  color: #7958bd !important;
}

.border-primary {
  border-color: #9878d1 !important;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  color: #263238;
  background: linear-gradient(135deg, #f1edff 0%, #fbfaff 48%, #eee8ff 100%);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

.navbar {
  background: rgba(255, 255, 255, 0.9) !important;
  backdrop-filter: blur(12px);
}

.case-editor-shell {
  max-width: 1080px;
  margin: 1.5rem auto 3rem;
  padding: 1.5rem;
  border: 1px solid rgba(38, 50, 56, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 45px rgba(38, 50, 56, 0.1);
}

.case-editor-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: -0.25rem -0.25rem 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e3e9e8;
}

.case-editor-eyebrow {
  margin-bottom: 0.25rem;
  color: #7958bd;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.case-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1.25rem;
}

.case-editor-field {
  min-width: 0;
}

.case-editor-field .form-label {
  margin-bottom: 0.25rem;
  color: #526268;
  font-size: 0.875rem;
  font-weight: 600;
}

.case-editor-field .form-control,
.case-editor-field .form-select {
  min-height: 2.65rem;
  border-color: #d7e1df;
  border-radius: 8px;
  background-color: #fcfaff;
}

textarea.form-control {
  background-color: #fcfaff;
}

.case-editor-field .form-control:focus,
.case-editor-field .form-select:focus {
  border-color: #9878d1;
  box-shadow: 0 0 0 0.2rem rgba(121, 88, 189, 0.15);
}

.case-editor-field-wide {
  grid-column: 1 / -1;
}

.case-editor-field textarea {
  min-height: 5.5rem;
  resize: vertical;
}

.case-editor-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 0;
  margin-top: 0.5rem;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid #e3e9e8;
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.case-editor-actions .btn-primary {
  border-color: #7958bd;
  background-color: #7958bd;
}

.case-editor-actions .btn-primary:hover {
  border-color: #60429e;
  background-color: #60429e;
}

.case-notes {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid #e5dcfa;
  border-radius: 12px;
  background: #faf8ff;
}

.case-notes-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.case-notes-heading h3 {
  margin: 0;
  font-size: 1.15rem;
}

.case-notes-list {
  display: grid;
  gap: 0.65rem;
  max-height: 240px;
  margin-bottom: 1rem;
  overflow-y: auto;
}

.case-note {
  padding: 0.75rem 0.9rem;
  border-left: 3px solid #9878d1;
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 3px 12px rgba(72, 48, 122, 0.06);
}

.case-note-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: #6d5b8e;
  font-size: 0.8rem;
}

.case-note-meta time {
  white-space: nowrap;
}

.case-note p {
  margin: 0.4rem 0 0;
  white-space: pre-wrap;
}

.case-notes-empty {
  margin: 0 0 1rem;
  color: #76698c;
}

@media (max-width: 767.98px) {
  .case-editor-shell {
    margin-top: 0.75rem;
    padding: 1rem;
    border-radius: 10px;
  }

  .case-note-meta {
    display: block;
  }

  .case-note-meta time {
    display: block;
    margin-top: 0.15rem;
  }

  .case-editor-header {
    align-items: start;
  }

  .case-editor-grid {
    grid-template-columns: 1fr;
  }

  .case-editor-field-wide {
    grid-column: auto;
  }
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.case-note-edit-form,
.case-note-add-form {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.case-note-edit-form .btn {
  justify-self: start;
}

.case-note-attachments {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.case-note-attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  background: #f4efff;
  font-size: 0.875rem;
}

.case-note-attachment form {
  margin: 0;
}

.case-note-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.case-note-upload input[type="file"] {
  max-width: 100%;
  font-size: 0.8rem;
}

.case-note-delete-form {
  margin-top: 0.4rem;
}

.paste-preview {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid #e5dcfa;
  border-radius: 7px;
  background: #f4efff;
  color: #6d5b8e;
  font-size: 0.8rem;
}

.paste-preview img {
  width: 54px;
  height: 38px;
  border-radius: 4px;
  object-fit: cover;
}

:root {
  --ink: #18243b;
  --muted: #7f899e;
  --line: #e5e8f2;
  --lavender: #f3f5fb;
  --purple: #6950d6;
  --purple-dark: #27264e;
}

html { background: var(--lavender); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 0 0, #e9e4ff 0, transparent 34%), var(--lavender);
  font-family: "DM Sans", "Aptos", "Segoe UI", sans-serif;
}

.app-shell {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  min-height: 100vh;
}

.workspace-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 1.75rem 1rem 1.1rem;
  color: #c1c5df;
  background: #171936;
}

.workspace-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0 0.7rem;
  color: #ffffff;
  font-family: "Manrope", "Aptos", sans-serif;
  font-size: 1rem;
  font-weight: 800;
  text-decoration: none;
}

.workspace-mark {
  display: grid;
  width: 2.1rem;
  height: 2.1rem;
  place-items: center;
  border-radius: 0.7rem;
  color: #ffffff;
  background: linear-gradient(135deg, #9f7aff, #6445d3);
  box-shadow: 0 8px 20px rgba(145, 108, 255, 0.33);
}

.sidebar-group-label {
  margin: 0 0 0.55rem 0.8rem;
  color: #7f85ac;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.workspace-nav { display: grid; gap: 0.3rem; }

.workspace-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.8rem;
  border-radius: 0.7rem;
  color: #abb0cf;
  font-size: 0.82rem;
  text-decoration: none;
}

.workspace-nav a:hover,
.workspace-nav a.active { color: #ffffff; background: #33325f; }
.workspace-nav a.active { font-weight: 700; }
.nav-icon { width: 1.1rem; color: currentColor; font-size: 1.05rem; text-align: center; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: auto;
  padding: 0.8rem;
  border: 1px solid #3a3e63;
  border-radius: 0.8rem;
  color: #ffffff;
  background: #232647;
  font-size: 0.75rem;
}

.sidebar-user strong,
.sidebar-user small { display: block; }
.sidebar-user small { margin-top: 0.15rem; color: #8f97bb; font-size: 0.65rem; }

.user-avatar {
  display: grid;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.6rem;
  color: #ffffff;
  background: #8f74df;
  font-size: 0.7rem;
  font-weight: 800;
}

.site-main {
  width: 100%;
  max-width: 1500px;
  min-width: 0;
  margin: 0 auto;
  padding: 1.9rem clamp(1.4rem, 4vw, 3.9rem) 3.75rem;
}

.site-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.7rem;
  color: #8992a8;
  font-size: 0.78rem;
}

.site-breadcrumb span { padding: 0 0.45rem; color: #b1b7c7; }
.site-breadcrumb strong { color: #3b4260; }
.topbar-logout { color: #6950d6; font-weight: 700; text-decoration: none; }
.topbar-logout:hover { color: #4d35ac; }
.auth-main { min-height: 100vh; padding: 3rem 1rem; }

.site-footer {
  padding: 1.25rem 1rem;
  color: #8992a8;
  font-size: 0.72rem;
  text-align: center;
}

.login-branding {
  margin-bottom: 1.5rem;
  text-align: center;
}

.login-branding h1 {
  margin: 0;
  color: #18243b;
  font-family: "Manrope", "Aptos", sans-serif;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.login-subtitle {
  margin: 0.45rem 0 0;
  color: #788298;
  font-size: 0.85rem;
}

.case-editor-shell,
.card {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #ffffff;
  box-shadow: 0 7px 25px rgba(37, 43, 102, 0.06);
}

.case-editor-shell { max-width: 1080px; margin: 0 auto 3rem; padding: 1.5rem; }
.card { padding: 1.5rem; }
table thead th { color: #5d6880; font-size: 0.73rem; letter-spacing: 0.02em; text-transform: uppercase; }
table thead th a { color: #6950d6; text-decoration: none; }
table thead th a:hover { color: #4d35ac; }
.case-editor-eyebrow { color: #7860d6; }

.case-editor-field .form-control,
.case-editor-field .form-select,
textarea.form-control { border-color: #dde2ed; background: #fbfcff; }

.case-editor-field .form-control:focus,
.case-editor-field .form-select:focus,
textarea.form-control:focus { border-color: #8d72e1; box-shadow: 0 0 0 3px rgba(141, 114, 225, 0.15); }

.btn-primary {
  border-color: #6950d6;
  background: linear-gradient(135deg, #8163ea, #6045c6);
  box-shadow: 0 7px 15px rgba(121, 97, 211, 0.2);
}

.btn-primary:hover,
.btn-primary:focus { border-color: #6045c6; background: linear-gradient(135deg, #8e72ed, #6950d6); }
.btn-outline-secondary:hover { color: #6950d6; border-color: #cfc5f2; background: #f7f5ff; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .workspace-brand span:last-child, .sidebar-group-label, .sidebar-user > span:last-child { display: none; }
  .workspace-nav a { justify-content: center; padding: 0.75rem; font-size: 0; }
  .workspace-nav .nav-icon { font-size: 1.05rem; }
  .sidebar-user { justify-content: center; padding: 0.5rem; }
}

@media (max-width: 650px) {
  .app-shell { display: block; }
  .workspace-sidebar { display: none; }
  .site-main { padding: 1.35rem 0.95rem 3rem; }
  .site-topbar { margin-bottom: 1.1rem; }
  .case-editor-shell { margin-top: 0; padding: 1rem; }
}

.case-page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}

.case-page-heading h1 {
  max-width: 760px;
  margin: 0;
  color: #18243b;
  font-family: "Manrope", "Aptos", sans-serif;
  font-size: clamp(1.45rem, 2.3vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.case-page-heading p { margin: 0.55rem 0 0; color: #788298; font-size: 0.82rem; }
.case-page-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }
.case-badge { padding: 0.45rem 0.65rem; border-radius: 999px; font-size: 0.7rem; font-weight: 800; white-space: nowrap; }
.case-badge-purple { color: #6848c7; background: #eee8ff; }
.case-badge-red { color: #c24e55; background: #fff0ef; }

.case-page-content {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(285px, 0.8fr);
  gap: 1.25rem;
}

.case-card { margin-bottom: 1.25rem; }
.case-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.7rem; margin-bottom: 1.3rem; }
.case-card-heading h2 { margin: 0; font-family: "Manrope", "Aptos", sans-serif; font-size: 1rem; font-weight: 800; }
.case-card-heading p { margin: 0.3rem 0 0; color: #8892a5; font-size: 0.72rem; }
.case-pill { padding: 0.3rem 0.5rem; border-radius: 0.4rem; color: #7659ce; background: #f4f1ff; font-size: 0.62rem; font-weight: 800; white-space: nowrap; }
.case-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.case-field { display: flex; min-width: 0; flex-direction: column; gap: 0.4rem; }
.case-field-wide { grid-column: 1 / -1; }
.case-field label { color: #5d6880; font-size: 0.7rem; font-weight: 800; }
.percent-slider { display: flex; align-items: center; gap: 0.7rem; }
.percent-slider input { flex: 1; accent-color: #765ad5; }
.percent-slider output { width: 2.5rem; color: #6f55d3; font-size: 0.75rem; font-weight: 800; text-align: right; }
.case-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; margin-top: 1.3rem; padding-top: 1rem; border-top: 1px solid #eef0f5; }
.case-hint { color: #99a2b3; font-size: 0.68rem; }
.case-actions { display: flex; gap: 0.45rem; }
.case-notes-card h3 { margin: 0; font-family: "Manrope", "Aptos", sans-serif; font-size: 0.82rem; }
.case-note { border-color: #e8eaf1; background: #ffffff; }
.case-quick-stats { display: grid; gap: 0.65rem; }
.case-quick-stats > div { display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem; border: 1px solid #edf0f5; border-radius: 0.7rem; }
.case-quick-stats strong { min-width: 2.2rem; color: #7659d1; font-size: 1.1rem; }
.case-quick-stats small { color: #97a0b2; font-size: 0.68rem; }
.case-file-drop { display: grid; justify-items: center; gap: 0.3rem; padding: 1rem; border: 1.5px dashed #ccc7ed; border-radius: 0.75rem; color: #8990a3; background: #f9f7ff; text-align: center; font-size: 0.7rem; }
.case-file-drop strong { color: #26314a; font-size: 0.75rem; }
.case-file-drop input[type="file"] { max-width: 100%; font-size: 0.68rem; }
.case-file-symbol { color: #7d5bdd; font-size: 1.35rem; }
.case-page-rail .case-note-attachment { margin-top: 0.6rem; }

.case-list-page table {
  font-size: 0.78rem;
}

.case-list-page table th,
.case-list-page table td {
  padding: 0.48rem 0.62rem;
}

.case-list-page table thead th {
  font-size: 0.66rem;
}

.case-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.case-list-heading .case-editor-eyebrow {
  margin-bottom: 0;
}

.case-list-heading-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.case-list-page .form-label {
  margin-bottom: 0.28rem;
  color: #5d6880;
  font-size: 0.72rem;
  font-weight: 700;
}

.case-list-page .form-control,
.case-list-page .form-select {
  min-height: 2.25rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
}

.case-page-size-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: #7f899e;
  font-size: 0.72rem;
  white-space: nowrap;
}

.case-page-size-label select {
  width: auto;
  min-width: 4.1rem;
  border-color: #dde2ed;
  color: #5d6880;
  background: #fbfcff;
}

@media (max-width: 1050px) {
  .case-page-content { grid-template-columns: 1fr; }
  .case-page-rail { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
}

@media (max-width: 650px) {
  .case-page-heading { display: block; }
  .case-page-badges { justify-content: flex-start; margin-top: 0.9rem; }
  .case-form-grid { grid-template-columns: 1fr; }
  .case-field-wide { grid-column: auto; }
  .case-card-footer { align-items: flex-start; flex-direction: column; }
  .case-page-rail { display: block; }
}

.screenshot-thumbnail {
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: zoom-in;
}

.screenshot-thumbnail img {
  display: block;
  width: 86px;
  height: 58px;
  border: 1px solid #d9c9f3;
  border-radius: 6px;
  object-fit: cover;
}

.screenshot-lightbox[hidden] {
  display: none;
}

.screenshot-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: rgba(38, 25, 64, 0.82);
  cursor: zoom-out;
}

.screenshot-lightbox img {
  max-width: min(92vw, 1400px);
  max-height: 88vh;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.screenshot-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  border: 0;
  color: #ffffff;
  background: transparent;
  font-size: 2rem;
  line-height: 1;
}

.delete-dialog[hidden] {
  display: none;
}

.delete-dialog {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(27, 24, 54, 0.48);
  backdrop-filter: blur(4px);
}

.delete-dialog-card {
  width: min(100%, 390px);
  padding: 1.5rem;
  border: 1px solid #e5e0f5;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 22px 70px rgba(38, 31, 74, 0.22);
  text-align: center;
}

.delete-dialog-icon {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  margin: 0 auto 0.8rem;
  place-items: center;
  border-radius: 50%;
  color: #bd555e;
  background: #fff0ef;
  font-size: 1.25rem;
  font-weight: 800;
}

.delete-dialog-card h2 {
  margin: 0;
  color: #18243b;
  font-family: "Manrope", "Aptos", sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
}

.delete-dialog-card p {
  margin: 0.55rem 0 1.2rem;
  color: #7f899e;
  font-size: 0.8rem;
  line-height: 1.5;
}

.delete-dialog-actions {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
}

.delete-dialog-actions .btn-danger {
  border-color: #c95d67;
  background: #c95d67;
}

.delete-dialog-actions .btn-danger:hover {
  border-color: #a84652;
  background: #a84652;
}