:root {
  --app-bg: #f3f6fb;
  --app-surface: #ffffff;
  --app-surface-soft: #f8fafc;
  --app-ink: #132136;
  --app-muted: #5f6f87;
  --app-border: #d9e1ee;
  --app-primary: #3a6ea5;
  --app-primary-strong: #2f5f92;
  --app-accent: #1fbf91;
  --app-shadow-sm: 0 8px 22px rgba(17, 35, 65, 0.08);
  --app-shadow-md: 0 16px 34px rgba(17, 35, 65, 0.12);

  --sidebar-bg-start: #0f1c2c;
  --sidebar-bg-end: #b48c32;
  --sidebar-brand-text: #f8fbff;
  --sidebar-link-text: #e9f1ff;
  --sidebar-icon-color: #dbe8fc;
  --sidebar-title-text: #d7e2f6;
  --sidebar-section-text: #bdcee8;
  --sidebar-divider-color: #2c3e5c;
  --sidebar-link-hover-bg: #2b3d59;
  --sidebar-link-hover-border: #4b5f7f;
  --sidebar-link-active-bg: #2d4e7a;
  --sidebar-link-active-border: #6d8fbe;
  --sidebar-badge-info-bg: #3b82f6;
  --sidebar-badge-danger-bg: #e11d48;

  --priority-case-low: #6c757d;
  --priority-case-normal: #0d6efd;
  --priority-case-high: #dc3545;
  --priority-task-low: #6c757d;
  --priority-task-normal: #0d6efd;
  --priority-task-high: #dc3545;
  --priority-service-low: #6c757d;
  --priority-service-normal: #0d6efd;
  --priority-service-high: #dc3545;
}

body.app-body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--app-ink);
  background:
    radial-gradient(1200px 520px at 5% -15%, #d8ecff 0%, transparent 58%),
    radial-gradient(900px 460px at 100% -20%, #d9f8eb 0%, transparent 52%),
    var(--app-bg);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.app-sidebar {
  background: linear-gradient(185deg, var(--sidebar-bg-start) 30%, var(--sidebar-bg-end) 100%);
  border-right: 1px solid var(--sidebar-divider-color);
  padding: 1rem 0.9rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.app-sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0.25rem 1.05rem;
  padding: 0;
  min-height: 0;
  line-height: 0;
  text-decoration: none;
  font-size: 1.06rem;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.app-sidebar-brand:hover,
.app-sidebar-brand:focus {
  transform: translateY(-1px);
  background: transparent;
}

.app-sidebar-brand-logo {
  display: block;
  width: 100%;
  max-width: 218px;
  height: auto;
  object-fit: contain;
  object-position: center;
}

.app-sidebar-brand-text {
  display: none;
  color: #f8fbff;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.app-sidebar .app-brand {
  color: var(--sidebar-brand-text) !important;
}

.app-sidebar-section {
  margin-top: 0.4rem;
}

.app-sidebar-title {
  color: var(--sidebar-link-text);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0.45rem 0.55rem;
}

.app-sidebar-subtitle {
  color: var(--sidebar-link-text);
  font-size: 0.69rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0.58rem 0.45rem 0.42rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--sidebar-divider-color);
}

.app-sidebar-nav {
  display: grid;
  gap: 0.3rem;
}

.app-side-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: var(--sidebar-link-text);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.58rem 0.7rem;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.app-side-link-main {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  min-width: 0;
}

.app-side-link-icon {
  width: 1.2rem;
  height: 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-icon-color);
}

.app-side-link-icon svg {
  width: 100%;
  height: 100%;
}

.app-side-link:hover {
  transform: translateX(2px);
  color: #fff;
  background: var(--sidebar-link-hover-bg);
  border-color: var(--sidebar-link-hover-border);
}

.app-side-link.is-active {
  color: #fff;
  background: var(--sidebar-link-active-bg);
  border-color: var(--sidebar-link-active-border);
}

.app-side-link.is-active .app-side-link-icon {
  color: #ffffff;
}

.app-sidebar .badge.text-bg-danger {
  background-color: var(--sidebar-badge-danger-bg) !important;
  color: #fff !important;
}

.app-sidebar .badge.text-bg-primary {
  background-color: var(--sidebar-badge-info-bg) !important;
  color: #fff !important;
}

.app-shell-main {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.9rem 1.2rem;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--app-border);
}

.app-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.app-mobile-menu-btn {
  display: none;
}

.app-mobile-sidebar-backdrop {
  display: none;
}

.app-top-chip {
  display: inline-flex;
  align-items: stretch;
  gap: 0.48rem;
  border: 1px solid #cdd9ea;
  background: #fff;
  color: #244060;
  border-radius: 999px;
  min-height: 40px;
  padding: 0.18rem 0.62rem 0.18rem 0.18rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.app-top-chip-link {
  text-decoration: none;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.app-top-chip-link:hover {
  border-color: #a7bddc;
  background: #f2f7ff;
  color: #1f395b;
}

.app-top-chip-label {
  display: inline-flex;
  align-items: center;
}

.app-top-chip-logo-wrap {
  width: 34px;
  min-width: 34px;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #c7d4e8;
  background: #ffffff;
  overflow: hidden;
}

.app-top-chip-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-main {
  min-height: 0;
}

.app-content-wrap {
  padding: 1rem 1.2rem 1.3rem;
  animation: app-fade-in 0.28s ease-out;
}

.app-navbar {
  background: linear-gradient(120deg, #1f2d45 0%, #2a3b59 56%, #314868 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.app-brand {
  font-family: "Sora", "Segoe UI", sans-serif;
  letter-spacing: 0.01em;
  color: #f8fbff !important;
  text-shadow: 0 1px 1px rgba(7, 13, 24, 0.35);
}

.app-brand:hover,
.app-brand:focus {
  color: #ffffff !important;
}

.app-muted {
  color: rgba(232, 239, 253, 0.78);
}

.app-nav-btn {
  border-color: rgba(230, 239, 255, 0.35);
  color: #e9f1ff;
  background: rgba(255, 255, 255, 0.03);
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.app-nav-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(230, 239, 255, 0.6);
  background: rgba(255, 255, 255, 0.08);
}

.app-logout-btn {
  color: #12233e;
  border-color: transparent;
  font-weight: 600;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: "Sora", "Manrope", sans-serif;
  letter-spacing: -0.01em;
  color: #12203a;
}

.text-muted {
  color: var(--app-muted) !important;
}

.card {
  background: var(--app-surface);
  border: 1px solid var(--app-border) !important;
  border-radius: 14px;
  box-shadow: var(--app-shadow-sm);
}

.card-header {
  background: linear-gradient(180deg, #fcfdff 0%, #f7faff 100%) !important;
  border-bottom: 1px solid var(--app-border) !important;
  border-top-left-radius: 14px !important;
  border-top-right-radius: 14px !important;
}

.table {
  --bs-table-bg: transparent;
}

.table> :not(caption)>*>* {
  border-bottom-color: #e7edf7;
}

.table thead th {
  color: #35507d;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.table tbody tr:hover {
  background: #f7faff;
}

.app-case-list-table th,
.app-case-list-table td {
  font-size: 0.7rem;
}

.app-case-list-table td .small {
  font-size: 0.66rem;
}

.app-case-list-actions-col {
  width: 126px;
}

.app-case-list-actions-head {
  width: 126px;
  white-space: nowrap;
}

.app-case-action-link {
  width: 30px;
  height: 30px;
  border: 1px solid #bfd0e8;
  border-radius: 999px;
  background: #f4f8ff;
  color: #274d7a;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.app-case-action-button {
  padding: 0;
}

.app-case-action-link:hover,
.app-case-action-link:focus-visible {
  background: #e8f1ff;
  border-color: #97b4da;
  color: #1f3f66;
  transform: translateY(-1px);
}

.app-case-action-link.is-danger {
  color: #9a2e3f;
  background: #fff4f6;
  border-color: #efc8cf;
}

.app-case-action-link.is-danger:hover,
.app-case-action-link.is-danger:focus-visible {
  color: #7f2332;
  background: #ffe9ee;
  border-color: #e29eab;
}

.app-case-action-link.is-duplicate {
  color: #275086;
  background: #eef4ff;
  border-color: #c4d5f0;
}

.app-case-action-link.is-duplicate:hover,
.app-case-action-link.is-duplicate:focus-visible {
  color: #1f3f66;
  background: #e3edff;
  border-color: #a9c3e8;
}

.app-resizable-table {
  table-layout: fixed;
}

.app-resizable-table th,
.app-resizable-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-resizable-col {
  position: relative;
}

.app-draggable-col {
  cursor: grab;
  transition: background-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.app-draggable-col:active {
  cursor: grabbing;
}

.app-draggable-col .app-col-sort-link {
  cursor: inherit;
  transition: color 0.14s ease;
}

.app-draggable-col:hover {
  background: #eef5ff;
  transform: translateY(-1px);
}

.app-draggable-col:hover .app-col-sort-link {
  color: #1f4f8f;
}

.app-column-dragging {
  opacity: 0.72;
  background: #e8f3ff;
  transform: translateY(-2px) rotate(-0.3deg);
  box-shadow: 0 10px 22px rgba(17, 35, 65, 0.16);
}

.app-column-drop-before,
.app-column-drop-after {
  background: #f0f8ff;
}

.app-column-drop-before::before,
.app-column-drop-after::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 4px;
  border-radius: 999px;
  background: var(--app-accent);
  box-shadow: 0 0 0 4px rgba(31, 191, 145, 0.18);
  z-index: 4;
}

.app-column-drop-before::before {
  left: 0;
}

.app-column-drop-after::before {
  right: 0;
}

.app-resizable-table.app-is-dragging-columns {
  user-select: none;
}

.app-resizable-table.app-is-dragging-columns .app-col-sort-link {
  pointer-events: none;
}

.app-col-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  touch-action: none;
  z-index: 5;
}

.app-col-resize-handle::after {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  right: 3px;
  width: 2px;
  background: transparent;
  border-radius: 999px;
  transition: background-color 0.15s ease;
}

.app-resizable-col:hover .app-col-resize-handle::after,
.app-col-resize-handle:hover::after {
  background: #95afd6;
}

body.app-is-resizing-columns {
  cursor: col-resize !important;
  user-select: none;
}

.task-row-done>td {
  background: #e5e9ef !important;
}

.task-row-done:hover>td {
  background: #dde3eb !important;
}

.form-control,
.form-select {
  border-radius: 10px;
  border-color: #cfd8e7;
  background: #fff;
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  padding-right: 2.2rem;
  border-color: #b9c9e2;
  background-color: #f8fbff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath fill='%233f5f8b' d='M2 2l5 5 5-5 1 1-6 6-6-6z'/%3E%3C/svg%3E");
  background-position: right 0.72rem center;
  background-size: 14px 10px;
  background-repeat: no-repeat;
}

.form-control:focus,
.form-select:focus {
  border-color: #95b9ff;
  box-shadow: 0 0 0 0.22rem rgba(31, 94, 255, 0.18);
}

.form-control.form-control-readonly-preview,
.form-control.form-control-readonly-preview:disabled {
  background: #eef2f8;
  border-color: #c6d3e7;
  color: #4c617e;
  cursor: not-allowed;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.choices__list--dropdown .choices__item--choice {
  position: relative;
  padding-right: 2.2rem;
}

.app-choice-favorite-toggle {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  width: 1.35rem;
  height: 1.35rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #8ca3c6;
  font-size: 0.94rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.app-choice-favorite-toggle:hover,
.app-choice-favorite-toggle:focus {
  background: #e8f1ff;
  color: #3a6ea5;
  outline: none;
}

.app-choice-favorite-toggle.is-favorite {
  color: #f0b429;
}

.btn {
  border-radius: 10px;
  font-weight: 600;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-dark {
  background: linear-gradient(120deg, var(--app-primary) 0%, var(--app-primary-strong) 100%);
  border-color: transparent;
  box-shadow: 0 8px 16px rgba(47, 95, 146, 0.22);
}

.btn-dark:hover,
.btn-dark:focus {
  background: linear-gradient(120deg, #35689e 0%, #2a567f 100%);
}

.btn-outline-secondary {
  border-color: #bfccdf;
  color: #28405f;
  background: #fff;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  background: #f4f8ff;
  color: #1f395f;
  border-color: #9fb4d4;
}

.alert {
  border-radius: 12px;
  border: 1px solid #d3e2ff;
  box-shadow: var(--app-shadow-sm);
}

.app-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.app-page-title {
  margin: 0;
  font-size: clamp(1.35rem, 2.1vw, 1.8rem);
}

.case-page-identity {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  min-width: 0;
}

.case-page-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid #c7d5eb;
  background: #eff5ff;
  overflow: hidden;
  flex: 0 0 auto;
}

.case-page-avatar-link {
  display: block;
  width: 100%;
  height: 100%;
}

.case-page-avatar-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.case-page-avatar-fallback {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #2f517c;
  font-weight: 700;
  font-size: 0.95rem;
}

.app-page-subtitle {
  margin: 0.25rem 0 0;
  color: var(--app-muted);
}

.app-page-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.app-view-toggle {
  border-radius: 8px;
  overflow: hidden;
}

.app-view-toggle-btn {
  min-width: 42px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.55rem;
}

.app-view-toggle-btn.is-active {
  background: #e9f2ff;
  border-color: #9fb4d4;
  color: #1f395f;
}

.app-view-toggle-icon {
  width: 18px;
  height: 18px;
}

.app-kpi-card {
  position: relative;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.app-kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--app-shadow-md);
  border-color: rgba(58, 110, 165, 0.34);
}

.app-kpi-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #537096;
  font-weight: 700;
}

.app-kpi-value {
  font-size: clamp(1.55rem, 2.5vw, 2rem);
  line-height: 1.1;
  margin-top: 0.25rem;
  color: #142845;
}

.app-tile-hover {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.app-tile-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(17, 35, 65, 0.11);
  border-color: rgba(58, 110, 165, 0.35) !important;
  background: #f7fbff;
}

.app-filter-toolbar .card-body {
  padding: 0.95rem 1rem;
}

.app-advanced-filter {
  border: 1px solid #d5e0ef;
  border-radius: 10px;
  background: #f8fbff;
  padding: 0.45rem 0.65rem 0.65rem;
}

.app-advanced-filter>summary {
  cursor: pointer;
  list-style: none;
  color: #234a79;
  font-size: 0.84rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.app-advanced-filter>summary::-webkit-details-marker {
  display: none;
}

.app-advanced-filter>summary::before {
  content: "+";
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  border: 1px solid #b8cbe4;
  color: #2f5f92;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  line-height: 1;
  background: #ffffff;
}

.app-advanced-filter[open]>summary::before {
  content: "−";
}

.app-active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.app-active-filters-label {
  font-size: 0.78rem;
  color: #4f6484;
  font-weight: 700;
}

.app-active-filter-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #c8d8ee;
  background: #eef5ff;
  color: #24476f;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
}

.app-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.app-column-chooser {
  position: relative;
}

.app-column-chooser>summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid #bfccdf;
  border-radius: 10px;
  background: #fff;
  color: #28405f;
  padding: 0.36rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.app-column-chooser>summary::-webkit-details-marker {
  display: none;
}

.app-column-chooser-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 260px;
  max-height: 320px;
  overflow: auto;
  border: 1px solid #c7d4e8;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(17, 35, 65, 0.14);
  padding: 0.75rem;
  z-index: 25;
}

.app-column-chooser-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: #274465;
  margin-bottom: 0.3rem;
}

.app-col-sort-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: inherit;
  text-decoration: none;
  padding-right: 0.5rem;
}

.app-col-sort-link:hover {
  color: #1f4f8f;
}

.app-tab-shell .nav-tabs {
  border-bottom-color: #d5e0ef;
}

.app-tab-shell .nav-link {
  color: #37567f;
  border: 1px solid transparent;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.app-tab-shell .nav-link.active {
  background: #fff;
  color: #173256;
  border-color: #d5e0ef #d5e0ef #fff;
  font-weight: 700;
}

.app-empty-state {
  text-align: center;
  padding: 1.2rem 1rem;
  color: var(--app-muted);
}

.app-empty-title {
  font-weight: 700;
  color: #28405f;
}

.app-empty-text {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
}

.app-scroll-to-save {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1040;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid #bfd0e8;
  background: #ffffff;
  color: #224c7d;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(17, 35, 65, 0.16);
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.app-scroll-to-save:hover,
.app-scroll-to-save:focus-visible {
  background: #eef5ff;
  border-color: #9fb9dc;
  color: #193d66;
  transform: translateY(-1px);
}

.case-basic-layout.has-photo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 248px;
  gap: 1rem 1.25rem;
  align-items: start;
}

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

.case-basic-side {
  display: flex;
  justify-content: flex-end;
}

.case-photo-panel {
  width: min(240px, 100%);
  border: 1px solid #d5e0ef;
  border-radius: 12px;
  background: #fbfdff;
  padding: 0.6rem;
  box-shadow: 0 6px 18px rgba(17, 35, 65, 0.08);
}

.case-photo-panel-title {
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #33527a;
  font-weight: 700;
}

.case-photo-panel-subtitle {
  font-size: 0.76rem;
  color: #5f6f87;
  margin-top: 0.1rem;
  margin-bottom: 0.45rem;
}

.case-photo-link {
  display: block;
  text-decoration: none;
}

.case-photo-image {
  display: block;
  width: 100%;
  max-height: 290px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #cdd9ea;
  background: #f3f6fb;
}

.case-photo-name {
  margin-top: 0.48rem;
  text-align: center;
  font-weight: 700;
  color: #1e3a61;
  font-size: 0.84rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

@media (max-width: 991px) {
  .case-basic-layout.has-photo {
    grid-template-columns: 1fr;
  }

  .case-basic-side {
    order: -1;
    justify-content: flex-end;
    margin-bottom: 0.35rem;
  }
}

.app-status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.36rem 0.56rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.app-status-badge.is-open {
  color: #1a6a53;
  background: #e8fbf3;
  border-color: #b9ebd7;
}

.app-status-badge.is-complete {
  color: #5a3f13;
  background: #fff7df;
  border-color: #f0dc9d;
}

.app-status-badge.is-new {
  color: #1f4d91;
  background: #eaf2ff;
  border-color: #c7dbff;
}

.app-priority-badge {
  color: #fff !important;
}

.app-priority-badge.is-task.is-low {
  background-color: var(--priority-task-low) !important;
}

.app-priority-badge.is-task.is-normal {
  background-color: var(--priority-task-normal) !important;
}

.app-priority-badge.is-task.is-high {
  background-color: var(--priority-task-high) !important;
}

.app-priority-badge.is-case.is-low {
  background-color: var(--priority-case-low) !important;
}

.app-priority-badge.is-case.is-normal {
  background-color: var(--priority-case-normal) !important;
}

.app-priority-badge.is-case.is-high {
  background-color: var(--priority-case-high) !important;
}

.pagination .page-link {
  border-radius: 8px;
  border-color: #c7d4e8;
  color: #2a466c;
}

.pagination .page-item+.page-item {
  margin-left: 0.3rem;
}

.pagination .page-item.active .page-link,
.pagination .page-link:hover {
  background: #e9f1ff;
  border-color: #adc4e8;
  color: #1d3f6b;
}

.pagination .page-item.disabled .page-link {
  background: #f7f9fc;
  color: #8fa0b8;
}

.app-pagination-jump-form {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.app-pagination-jump-form input[type="number"] {
  width: 84px;
}

.dashboard-latest-table td:nth-child(3),
.dashboard-latest-table td:nth-child(4) {
  white-space: nowrap;
}

.dashboard-latest-table tbody tr {
  height: 51px;
}

.dashboard-latest-table tbody td {
  vertical-align: middle;
}

.dashboard-card-footer-compact {
  min-height: 48px;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

.dashboard-select-all-inline {
  line-height: 1;
}

.app-overlay-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.app-overlay-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.app-overlay-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #d6dfef;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.2);
}

.app-overlay-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #e5ebf6;
}

.app-overlay-modal-close {
  border: 0;
  background: transparent;
  color: #334a6d;
  font-size: 1.2rem;
  line-height: 1;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.app-overlay-modal-close:hover {
  background: #eef3fb;
  color: #132f55;
}

.app-overlay-modal-body {
  padding: 1rem;
}

.app-overlay-modal-open {
  overflow: hidden;
}

.dashboard-unassigned-table {
  width: 100%;
}

.dashboard-unassigned-table th,
.dashboard-unassigned-table td,
.dashboard-latest-table th,
.dashboard-latest-table td {
  font-size: 0.7rem;
}

.dashboard-unassigned-table th,
.dashboard-unassigned-table td {
  vertical-align: middle;
}

.dashboard-unassigned-table tbody tr:not([data-assign-row-case]) {
  height: 51px;
}

.dashboard-unassigned-table th:nth-child(1),
.dashboard-unassigned-table td:nth-child(1) {
  white-space: nowrap;
}

.dashboard-unassigned-table th:nth-child(2),
.dashboard-unassigned-table td:nth-child(2) {
  overflow-wrap: anywhere;
}

.dashboard-unassigned-table th:nth-child(3),
.dashboard-unassigned-table td:nth-child(3) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.dashboard-unassigned-table th:nth-child(4),
.dashboard-unassigned-table td:nth-child(4) {
  width: 92px;
  min-width: 92px;
  white-space: nowrap;
}

.dashboard-unassigned-table thead th {
  white-space: nowrap;
}

.client-interactions-table thead th,
.client-interactions-table td {
  font-size: 0.74rem;
}

.client-interactions-table th:nth-child(1),
.client-interactions-table td:nth-child(1) {
  white-space: nowrap;
  width: 122px;
  min-width: 122px;
}

@media (max-width: 1500px) and (max-height: 760px) {
  .dashboard-unassigned-table thead th {
    font-size: 0.7rem;
    letter-spacing: 0.03em;
  }
}

.company-setup-layout {
  display: grid;
  grid-template-columns: minmax(220px, 250px) minmax(0, 1fr) minmax(260px, 320px);
  gap: 1rem;
  align-items: start;
}

.company-setup-nav-card {
  position: sticky;
  top: 88px;
}

.company-setup-nav-title {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #58729a;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.company-setup-nav-list {
  display: grid;
  gap: 0.4rem;
}

.company-setup-nav-link {
  border: 1px solid #cfdbec;
  background: #f7faff;
  color: #1d3f67;
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.company-setup-nav-link:hover {
  background: #edf4ff;
  border-color: #b9cdec;
}

.company-setup-nav-link.is-active {
  background: #1d4f8d;
  border-color: #1d4f8d;
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(20, 60, 108, 0.2);
}

.company-setup-main .card-header strong {
  color: #1f3654;
}

.company-logo-preview-tile {
  border: 1px dashed #bfd0e8;
  background: #f8fbff;
  border-radius: 12px;
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.company-logo-preview-img {
  max-width: 100%;
  max-height: 92px;
  object-fit: contain;
}

.company-logo-preview-empty {
  font-size: 0.86rem;
  color: #6983a8;
}

.company-presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.company-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.company-color-field {
  border: 1px solid #d7e2f0;
  border-radius: 12px;
  background: #fbfdff;
  padding: 0.6rem 0.7rem;
}

.company-color-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.company-color-input.form-control-color {
  width: 54px;
  min-width: 54px;
  height: 38px;
  border-radius: 10px;
  padding: 0.2rem;
  cursor: pointer;
}

.company-color-value {
  display: inline-block;
  padding: 0.23rem 0.5rem;
  border-radius: 999px;
  background: #edf3fd;
  border: 1px solid #cbdaf0;
  color: #365a85;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.company-advanced-toggle {
  border: 1px solid #d7e2f0;
  border-radius: 12px;
  background: #f9fcff;
  padding: 0.55rem 0.7rem;
}

.company-advanced-toggle>summary {
  cursor: pointer;
  color: #22476f;
  font-weight: 600;
  font-size: 0.9rem;
}

.company-priority-group-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #45648b;
  margin-bottom: 0.45rem;
}

.company-integrations-note {
  border: 1px dashed #bfd0e8;
  background: #f8fbff;
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
}

.company-setup-preview {
  position: sticky;
  top: 88px;
}

.company-preview-card .card-body {
  display: grid;
  gap: 0.9rem;
}

.company-preview-sidebar-box {
  border-radius: 14px;
  padding: 0.8rem;
  background: linear-gradient(170deg, var(--sidebar-bg-start), var(--sidebar-bg-end));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.company-preview-brand {
  color: var(--sidebar-link-text);
  font-weight: 700;
  margin-bottom: 0.65rem;
}

.company-preview-link {
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--sidebar-link-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.86rem;
  padding: 0.35rem 0.55rem;
  margin-bottom: 0.35rem;
}

.company-preview-link.is-active {
  background: var(--sidebar-link-active-bg);
  border-color: var(--sidebar-link-active-border);
}

.company-preview-badge {
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.2rem 0.45rem;
}

.company-preview-badge.info {
  background: var(--sidebar-badge-info-bg);
}

.company-preview-badge.danger {
  background: var(--sidebar-badge-danger-bg);
}

@media (max-width: 1400px) {
  .company-setup-layout {
    grid-template-columns: minmax(220px, 240px) minmax(0, 1fr);
  }

  .company-setup-preview {
    grid-column: 1 / -1;
    position: static;
  }
}

@media (max-width: 992px) {
  .company-setup-layout {
    grid-template-columns: 1fr;
  }

  .company-setup-nav-card,
  .company-setup-preview {
    position: static;
  }
}

.app-calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.app-calendar-switcher {
  position: relative;
}

.app-calendar-switcher-trigger {
  min-width: 250px;
  text-align: left;
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
}

.app-calendar-switcher-panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  min-width: 300px;
  z-index: 20;
  border: 1px solid #c8d5ea;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 12px 22px rgba(16, 34, 57, 0.14);
  padding: 0.6rem;
}

.app-calendar-switcher-head {
  font-size: 0.78rem;
  text-transform: uppercase;
  color: #33527a;
  font-weight: 700;
  border-bottom: 1px solid #dde6f3;
  padding-bottom: 0.35rem;
  margin-bottom: 0.5rem;
}

.app-calendar-switcher-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.app-calendar-switcher-nav {
  display: inline-flex;
  gap: 0.25rem;
}

.app-calendar-switcher-form .form-select {
  min-width: 108px;
  width: auto;
}

.app-calendar-picker {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.app-calendar-picker .form-select {
  min-width: 140px;
}

.app-calendar-table thead th {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.84rem;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.app-calendar-cell-wrap {
  width: 14.2%;
}

.app-calendar-cell {
  min-height: clamp(72px, calc((100vh - 370px) / 6), 118px);
  background: #fff;
  padding: 0.4rem !important;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background-color 0.16s ease;
}

.app-calendar-cell.is-other-month {
  background: #f4f7fc;
}

.app-calendar-cell:hover {
  border-color: #8eb0df !important;
  box-shadow: 0 6px 16px rgba(47, 95, 146, 0.16);
  background: #f7fbff;
  transform: translateY(-1px);
}

.app-calendar-cell:hover:not(.is-over-event) {
  border-color: #7ab596 !important;
  box-shadow: 0 7px 18px rgba(31, 140, 87, 0.18);
}

.app-calendar-cell:focus-visible {
  outline: 0;
  border-color: #5f93da !important;
  box-shadow: 0 0 0 0.2rem rgba(31, 94, 255, 0.2);
}

.app-calendar-day-number {
  font-size: 0.98rem;
  font-weight: 700;
  color: #27466b;
}

.app-calendar-day-number.is-today {
  color: #0d6efd;
}

.app-calendar-events {
  align-content: start;
}

.app-calendar-event-link {
  display: block;
  padding: 0.12rem 0;
  line-height: 1.25;
  border-radius: 6px;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.app-calendar-event-link:hover,
.app-calendar-event-link:focus-visible {
  background: #e9f2ff;
  color: #11427a !important;
  box-shadow: inset 0 0 0 1px #9dbcea;
  text-decoration: none;
  outline: none;
}

.app-calendar-mini-badge {
  font-size: 0.62rem;
  line-height: 1;
  padding: 0.2rem 0.32rem;
}

.app-calendar-cell-actions {
  margin-top: 0.35rem;
  display: grid;
  gap: 0.18rem;
}

.app-calendar-add-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  font-size: 0.73rem;
  line-height: 1;
  border-radius: 6px;
  border: 1px dashed #9eb5d6;
  color: #315b8e;
  background: #f5f9ff;
  padding: 0.22rem 0.38rem;
  text-decoration: none;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.14s ease, transform 0.14s ease, border-color 0.14s ease, background-color 0.14s ease;
}

.app-calendar-cell-hint {
  font-size: 0.68rem;
  color: #5e7392;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.app-calendar-cell:hover:not(.is-over-event) .app-calendar-add-link,
.app-calendar-cell:focus-visible .app-calendar-add-link,
.app-calendar-cell:hover:not(.is-over-event) .app-calendar-cell-hint,
.app-calendar-cell:focus-visible .app-calendar-cell-hint {
  opacity: 1;
  transform: translateY(0);
}

.app-calendar-add-link:hover,
.app-calendar-add-link:focus-visible {
  border-color: #6fa084;
  background: #edf9f2;
  color: #195b3d;
  text-decoration: none;
  outline: none;
}

.app-calendar-month-page .app-page-head {
  margin-bottom: 0.6rem;
}

.app-calendar-month-page .app-page-title {
  font-size: clamp(1.2rem, 1.5vw, 1.6rem);
}

.app-calendar-month-page .app-page-subtitle {
  margin-top: 0.12rem;
}

@media (max-width: 992px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(86vw, 320px);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: 0;
    z-index: 1045;
    transform: translateX(-104%);
    transition: transform 0.22s ease;
  }

  .app-sidebar-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell.is-mobile-sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .app-mobile-menu-btn {
    display: inline-flex;
    margin-right: 0.45rem;
  }

  .app-mobile-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 17, 31, 0.36);
    opacity: 0;
    pointer-events: none;
    z-index: 1040;
    transition: opacity 0.18s ease;
  }

  .app-shell.is-mobile-sidebar-open .app-mobile-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .app-topbar {
    padding: 0.75rem 0.9rem;
  }

  .app-content-wrap {
    padding: 0.85rem 0.65rem 1rem;
  }

  .app-page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .app-calendar-cell {
    min-height: 160px;
  }

  .app-calendar-switcher-panel {
    min-width: 265px;
  }

  .app-calendar-switcher-nav {
    justify-content: flex-start;
  }

  .app-calendar-picker .form-select {
    min-width: 120px;
  }
}

@media (max-width: 768px) {
  .app-sidebar {
    padding: 0.8rem 0.7rem;
  }

  .app-sidebar-nav {
    grid-template-columns: 1fr;
  }

  .app-side-link {
    padding: 0.55rem 0.62rem;
  }

  .app-topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.55rem;
  }

  .app-topbar-left,
  .app-topbar-right {
    width: 100%;
  }

  .app-topbar-right {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .app-topbar-right .small {
    display: block;
    max-width: 100%;
    word-break: break-word;
  }

  .app-content-wrap {
    padding: 0.8rem 0.55rem 0.95rem;
  }
}

@media (max-width: 576px) {
  .app-sidebar-brand {
    margin-bottom: 0.85rem;
    min-height: 68px;
    padding: 0.42rem 0.5rem;
  }

  .app-sidebar-brand-logo {
    max-width: 196px;
  }

  .app-top-chip {
    max-width: 100%;
    white-space: normal;
  }

  .app-calendar-switcher-trigger,
  .app-calendar-switcher-panel {
    min-width: 100%;
  }

  .app-calendar-picker .form-select,
  .app-calendar-switcher-form .form-select {
    min-width: 100%;
    width: 100%;
  }
}

@keyframes app-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-shell--reset {
  position: relative;
  min-height: calc(100vh - 96px);
  display: grid;
  align-items: center;
  padding: 1.2rem 0;
}

.auth-shell--reset::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(520px 220px at 12% 8%, rgba(58, 110, 165, 0.2) 0%, rgba(58, 110, 165, 0) 68%),
    radial-gradient(430px 200px at 88% 18%, rgba(31, 191, 145, 0.18) 0%, rgba(31, 191, 145, 0) 68%);
  pointer-events: none;
}

.auth-row {
  position: relative;
  z-index: 1;
}

.auth-card {
  overflow: hidden;
  border-radius: 16px;
  animation: auth-card-enter 0.32s ease-out;
}

.auth-card::before {
  content: "";
  display: block;
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, #2f5f92 0%, #3a6ea5 50%, #1fbf91 100%);
}

.auth-kicker {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #2f5f92;
}

.auth-subtitle {
  max-width: 44ch;
}

.auth-input {
  min-height: 46px;
  background: #fbfdff;
  border-color: #c7d7ec;
}

.auth-input::placeholder {
  color: #8ca0bf;
}

.auth-input:focus {
  border-color: #78a4e8;
  box-shadow: 0 0 0 0.22rem rgba(47, 95, 146, 0.2);
}

.auth-submit-btn {
  min-height: 46px;
}

.auth-link {
  color: #2f5f92;
  text-decoration: none;
  font-weight: 600;
}

.auth-link:hover,
.auth-link:focus {
  color: #244c75;
  text-decoration: underline;
}

.auth-feedback {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font-size: 0.9rem;
}

.auth-feedback p+p {
  margin-top: 0.28rem;
}

.auth-feedback--error {
  background: #fff5f5;
  border-color: #f1b7be;
  color: #a3303c;
}

.auth-help ul {
  margin: 0;
  padding-left: 1.15rem;
  color: #4c617f;
  font-size: 0.82rem;
}

.auth-help li+li {
  margin-top: 0.16rem;
}

.auth-help .auth-rule-list {
  list-style: none;
  padding-left: 0;
  display: grid;
  gap: 0.28rem;
}

.auth-help .auth-rule-list li {
  position: relative;
  padding-left: 1.32rem;
  line-height: 1.36;
  transition: color 0.16s ease;
}

.auth-help .auth-rule-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #d64545;
  box-shadow: 0 0 0 2px rgba(214, 69, 69, 0.16);
  transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.auth-help .auth-rule-list li.is-invalid {
  color: #bc2f3a;
}

.auth-help .auth-rule-list li.is-valid {
  color: #198754;
}

.auth-help .auth-rule-list li.is-valid::before {
  background: #198754;
  box-shadow: 0 0 0 2px rgba(25, 135, 84, 0.18);
}

@keyframes auth-card-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.995);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 768px) {
  .auth-shell--reset {
    min-height: auto;
    align-items: stretch;
    padding: 0.4rem 0 0.9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card {
    animation: none;
  }
}