:root {
  --paper: #f5f6f8;
  --surface: #ffffff;
  --surface-strong: #fdfbf6;
  --ink: #18202a;
  --muted: #6b7280;
  --line: #dfe3e8;
  --line-strong: #c7ccd4;
  --navy: #092d52;
  --navy-soft: #e7edf4;
  --gold: #c59a2c;
  --gold-soft: #f4ead0;
  --danger: #9f2b2b;
  --success: #2f6f4e;
  --shadow: 0 18px 45px rgba(20, 29, 43, 0.12);
  --radius: 8px;
  color-scheme: light;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

.is-hidden {
  display: none !important;
}

.auth-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(244, 248, 252, 0.86) 0%, rgba(249, 251, 253, 0.96) 44%, #ffffff 100%),
    #f7f9fc;
}

.auth-screen::before {
  content: "";
  position: absolute;
  left: max(-260px, -12vw);
  top: 50%;
  width: min(980px, 68vw);
  aspect-ratio: 1;
  background: url("/assets/doj-logo-mark.png") center / contain no-repeat;
  opacity: 0.08;
  transform: translateY(-50%);
  pointer-events: none;
}

.auth-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 46% 50%, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 28%);
  pointer-events: none;
}

.auth-panel {
  display: grid;
  gap: 16px;
  width: min(430px, 100%);
  position: relative;
  z-index: 1;
  transform: translateX(16vw);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.93);
  padding: 36px 34px 30px;
  box-shadow: 0 24px 70px rgba(35, 50, 70, 0.14);
  backdrop-filter: blur(6px);
}

.auth-panel .eyebrow {
  display: none;
}

.auth-panel h1 {
  margin: 12px 0 2px;
  color: #09182a;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: 0;
}

.auth-logo {
  width: 72px;
  height: 72px;
  display: block;
  object-fit: cover;
  border-radius: 50%;
  background: transparent;
  padding: 0;
  box-shadow: 0 12px 24px rgba(9, 45, 82, 0.14);
}

.auth-panel .field {
  gap: 8px;
}

.auth-panel .field input {
  min-height: 44px;
  border-color: #ccd5e0;
  background: #ffffff;
  font-weight: 700;
}

.auth-panel .button.primary {
  min-height: 44px;
  margin-top: 8px;
  box-shadow: 0 14px 28px rgba(9, 45, 82, 0.16);
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--navy);
  color: #ffffff;
}

.brand {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 14px;
  align-items: center;
  min-height: 74px;
}

.brand-logo {
  width: 58px;
  height: 58px;
  display: block;
  object-fit: cover;
  border-radius: 50%;
  background: transparent;
  padding: 0;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}

.brand-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.brand-copy span,
.eyebrow {
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.brand-copy strong {
  overflow-wrap: anywhere;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.12;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: rgba(255, 255, 255, 0.76);
  padding: 0 12px;
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-mark {
  width: 8px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.nav-item.is-active .nav-mark {
  border-color: var(--gold);
  background: var(--gold);
}

.sidebar-footer {
  display: grid;
  gap: 12px;
  margin-top: auto;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.seal-line {
  width: 64px;
  height: 2px;
  background: var(--gold);
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.workspace .eyebrow,
.modal .eyebrow {
  color: var(--gold);
}

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

h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.05;
}

h1 {
  margin-top: 5px;
  font-size: 34px;
}

h2 {
  margin-top: 5px;
  font-size: 26px;
}

h3 {
  font-size: 15px;
}

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

.user-chip {
  display: grid;
  align-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.button,
.icon-button {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  padding: 0 14px;
  white-space: nowrap;
}

.button span {
  font-size: 18px;
  line-height: 1;
}

.button:hover,
.icon-button:hover {
  border-color: var(--gold);
}

.button.primary {
  border-color: var(--navy);
  background: var(--navy);
  color: #ffffff;
}

.button.ghost {
  background: transparent;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 14px;
  color: var(--navy);
  font-size: 32px;
  line-height: 1;
}

.dashboard-panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
  box-shadow: 0 10px 30px rgba(20, 29, 43, 0.06);
}

.notification-list,
.note-list {
  display: grid;
  gap: 10px;
}

.notification-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px 12px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 12px;
  color: var(--ink);
  text-align: left;
}

.notification-item strong {
  color: var(--navy);
}

.notification-item span:not(.badge),
.notification-item small,
.notification-empty {
  color: var(--muted);
  font-size: 12px;
}

.notification-item span:not(.badge) {
  grid-column: 2 / 4;
}

.notification-empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}

.tool-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(20, 29, 43, 0.06);
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px 220px;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

#casesView .filters {
  grid-template-columns: minmax(220px, 1fr) 180px 200px 210px;
}

#defenseView .filters {
  grid-template-columns: minmax(260px, 1fr) auto;
}

#peopleView .filters {
  grid-template-columns: minmax(220px, 1fr) 190px 190px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  text-transform: none;
}

.field select option,
select option {
  background: #ffffff;
  color: var(--ink);
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(197, 154, 44, 0.16);
}

.check-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.table-scroll {
  overflow: auto;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.compact-table {
  min-width: 760px;
}

.compact-table th,
.compact-table td {
  padding: 11px 12px;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table tbody tr.is-selected {
  background: var(--navy-soft);
}

.case-link {
  border: 0;
  background: transparent;
  color: var(--navy);
  padding: 0;
  font-weight: 800;
  text-align: left;
}

.case-title {
  display: grid;
  gap: 4px;
}

.case-title small,
.party-list,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.case-sections {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.case-accordion {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.case-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  border: 0;
  background: var(--surface-strong);
  padding: 14px 16px;
  color: var(--ink);
  text-align: left;
}

.case-section-title {
  display: grid;
  gap: 3px;
}

.case-section-title strong {
  color: var(--navy);
  font-size: 15px;
}

.case-section-title small,
.section-empty {
  color: var(--muted);
  font-size: 12px;
}

.case-section-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.case-section-chevron {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--navy);
  font-weight: 900;
}

.case-section-body {
  border-top: 1px solid var(--line);
}

.case-table {
  min-width: 860px;
}

.section-empty {
  padding: 26px 16px;
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.status-nowa,
.badge.status-w_toku,
.badge.status-oczekuje_na_rozprawe {
  border-color: #c8d7e6;
  background: var(--navy-soft);
  color: var(--navy);
}

.badge.status-zakonczona {
  border-color: #b9d5c7;
  background: #edf7f1;
  color: var(--success);
}

.badge.status-umorzona {
  border-color: #efcdcd;
  background: #fff3f2;
  color: var(--danger);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.user-lock-status {
  display: grid;
  gap: 4px;
  min-width: 0;
  max-width: 260px;
}

.user-lock-status small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.related-list {
  display: grid;
  gap: 8px;
}

.related-case {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 10px;
  color: var(--ink);
  text-align: left;
}

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

.small-button {
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.small-button.danger {
  color: var(--danger);
}

.empty-row td {
  height: 180px;
  color: var(--muted);
  text-align: center;
}

.details-empty {
  display: grid;
  gap: 14px;
  padding-top: 26px;
  color: var(--muted);
}

.details-logo {
  width: 92px;
  height: 92px;
  object-fit: contain;
  opacity: 0.28;
}

.details-card {
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
  box-shadow: 0 10px 28px rgba(20, 29, 43, 0.06);
}

.details-head {
  display: grid;
  gap: 8px;
}

.details-head strong {
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.case-preview-grid {
  display: grid;
  gap: 14px;
}

.preview-section {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 14px;
}

.details-grid {
  display: grid;
  gap: 12px;
}

.two-column-details {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-line {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.detail-line span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-line strong,
.detail-line p {
  overflow-wrap: anywhere;
}

.modal {
  width: min(760px, calc(100vw - 32px));
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  padding: 0;
  overflow: hidden;
}

.modal.large-modal {
  width: min(1080px, calc(100vw - 24px));
}

.modal.case-modal {
  width: min(1280px, calc(100vw - 24px));
}

.modal::backdrop {
  background: rgba(8, 18, 32, 0.48);
}

.modal-body {
  display: grid;
  gap: 18px;
  width: 100%;
  max-width: 100%;
  max-height: calc(100vh - 24px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 22px;
  box-shadow: var(--shadow);
  overflow-x: hidden;
  overflow-y: auto;
}

.modal-body.compact {
  width: min(620px, 100%);
}

.modal-body.wide {
  width: min(1080px, 100%);
}

.case-modal-body {
  width: min(1240px, 100%);
}

.case-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.case-tab {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--muted);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.case-tab.is-active {
  border-color: var(--navy);
  background: var(--navy);
  color: #ffffff;
}

.case-tab:focus-visible {
  outline: 3px solid rgba(20, 91, 157, 0.18);
  outline-offset: 2px;
}

.case-details-tabs {
  margin-top: 2px;
}

.case-form-layout {
  display: block;
}

.form-section {
  display: grid;
  gap: 16px;
  align-content: start;
}

.form-section.case-tab-panel {
  display: none;
}

.form-section.case-tab-panel.is-active {
  display: grid;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.modal-header > div {
  min-width: 0;
}

.modal-header h2 {
  overflow-wrap: anywhere;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  min-width: 40px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  flex: 0 0 40px;
}

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

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

.party-section {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.party-row {
  display: grid;
  grid-column: span 2;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 12px;
  align-items: end;
}

.document-modal-body {
  width: min(1120px, 100%);
  min-height: min(820px, calc(100vh - 24px));
  grid-template-rows: auto auto minmax(360px, 1fr) auto auto;
}

.document-title-field {
  flex: 1;
}

.document-source-grid {
  align-items: end;
}

.document-editor-wrap {
  display: grid;
  gap: 10px;
  min-height: 0;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(#fffdf8, #f6f8fb);
  padding: 8px;
}

.editor-toolbar select {
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 0 8px;
}

.toolbar-divider {
  width: 1px;
  align-self: stretch;
  min-height: 30px;
  background: var(--line);
}

.toolbar-button {
  min-width: 34px;
}

.document-editor {
  min-width: 0;
  min-height: 420px;
  max-height: calc(100vh - 320px);
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 22px;
  line-height: 1.5;
  outline: none;
  overflow-wrap: anywhere;
}

.document-editor:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(197, 154, 44, 0.16);
}

.document-preview {
  cursor: default;
}

.document-preview * {
  max-width: 100%;
}

.document-preview table {
  table-layout: fixed;
  width: 100%;
}

.document-preview.embedded-document-preview {
  overflow: hidden;
  padding: 0;
}

.document-preview:focus {
  border-color: var(--line-strong);
  box-shadow: none;
}

.preview-modal-body {
  grid-template-rows: auto minmax(420px, 1fr) auto;
}

.share-user-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}

.share-user-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 10px;
}

.share-user-option.is-shared {
  border-color: #c8d7e6;
  background: #fbfdff;
}

.share-user-option > label:first-child {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: center;
}

.share-user-option span {
  display: grid;
  gap: 2px;
}

.share-user-option small {
  color: var(--muted);
  font-size: 12px;
}

.share-edit-field {
  min-height: 32px;
  white-space: nowrap;
}

.share-option-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.button.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.confirm-message {
  color: var(--ink);
  line-height: 1.5;
}

.case-inline-empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.note-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 12px;
}

.note-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.note-meta strong {
  color: var(--navy);
}

.note-item p {
  white-space: pre-wrap;
  line-height: 1.5;
}

.align-left {
  justify-content: flex-start;
}

.material-image-preview {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 260px);
  margin: 0 auto;
  object-fit: contain;
}

.google-doc-preview-frame {
  display: block;
  width: 100%;
  min-height: 560px;
  height: min(72vh, 760px);
  border: 0;
  background: #ffffff;
}

.google-doc-preview-shell {
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr) auto;
  min-height: min(76vh, 820px);
  background: #ffffff;
}

.google-doc-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  padding: 10px 12px;
}

.google-doc-preview-toolbar > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.google-doc-preview-toolbar strong {
  color: var(--navy);
  font-size: 13px;
}

.google-doc-preview-toolbar span {
  color: var(--muted);
  font-size: 12px;
}

.google-doc-preview-help {
  display: none;
  border-top: 1px solid var(--line);
  background: #fff8e8;
  color: #62460d;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.google-doc-preview-help.is-visible {
  display: block;
}

.external-link-preview {
  display: grid;
  gap: 12px;
  min-height: 360px;
  align-content: center;
  justify-items: center;
  padding: 28px;
  text-align: center;
  background: #ffffff;
}

.external-link-preview p {
  max-width: 680px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.form-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 48px));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--ink);
  color: #ffffff;
  padding: 12px 14px;
  font-weight: 700;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .auth-screen {
    place-items: center;
  }

  .auth-screen::before {
    left: 50%;
    width: min(720px, 125vw);
    opacity: 0.06;
    transform: translate(-50%, -50%);
  }

  .auth-panel {
    transform: none;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px;
  }

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

  .sidebar-footer {
    display: none;
  }

  .workspace {
    padding: 18px;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions .button {
    flex: 1 1 150px;
  }

  .metrics,
  .filters,
  .form-grid,
  .case-form-layout {
    grid-template-columns: 1fr;
  }

  #casesView .filters {
    grid-template-columns: 1fr;
  }

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

  .party-row {
    grid-column: span 1;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 28px;
  }

  .auth-screen {
    padding: 18px;
  }

  .auth-panel {
    padding: 28px 22px 24px;
  }

  .auth-panel h1 {
    font-size: 30px;
  }

  .brand {
    grid-template-columns: 48px 1fr;
  }

  .brand-logo {
    width: 48px;
    height: 48px;
  }

  .modal-body {
    padding: 18px;
  }

  .modal-actions {
    display: grid;
  }
}
/* Professional registry dashboard additions */
.top-search {
  min-width: min(420px, 42vw);
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--border, #d8e1ec);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 22px rgba(18, 39, 63, 0.04);
}

.top-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink, #172033);
  font: inherit;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-user strong,
.sidebar-user small {
  display: block;
}

.sidebar-user strong {
  color: #fff;
  font-size: 13px;
}

.sidebar-user small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, #f4c858, #fff4bf);
  color: #0a2c50;
  font-weight: 800;
  font-size: 11px;
  box-shadow: 0 0 0 3px rgba(244, 200, 88, 0.16);
}

.case-status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 14px 0 20px;
}

.case-status-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 18px;
  border: 1px solid var(--border, #d8e1ec);
  border-radius: 999px;
  background: #fff;
  color: var(--muted, #64748b);
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.case-status-tabs button strong {
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #f1f5f9;
  color: #0b3158;
  font-size: 12px;
}

.case-status-tabs button.active {
  border-color: #b9d7f5;
  color: #0b4f8a;
  box-shadow: 0 10px 24px rgba(26, 99, 174, 0.12);
}

.case-status-tabs button.active strong {
  background: #e8f3ff;
}

.case-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.case-metric {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 112px;
  padding: 20px;
  border: 1px solid var(--border, #d8e1ec);
  border-radius: 8px;
  background: #fff;
}

.case-metric .metric-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 900;
  font-size: 21px;
}

.case-metric span,
.case-metric small {
  display: block;
}

.case-metric span {
  color: #49627f;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.case-metric strong {
  display: block;
  margin: 4px 0;
  color: #071b33;
  font-size: 28px;
  line-height: 1;
}

.case-metric small {
  color: #527067;
  font-size: 12px;
}

.case-metric.blue {
  background: linear-gradient(135deg, #f6fbff, #ffffff);
}

.case-metric.blue .metric-icon {
  background: #e5f2ff;
  color: #1976d2;
}

.case-metric.amber {
  background: linear-gradient(135deg, #fffaf1, #ffffff);
}

.case-metric.amber .metric-icon {
  background: #fff1cf;
  color: #b86d00;
}

.case-metric.green {
  background: linear-gradient(135deg, #f4fff8, #ffffff);
}

.case-metric.green .metric-icon {
  background: #ddf7e7;
  color: #168143;
}

.case-metric.violet {
  background: linear-gradient(135deg, #fbf8ff, #ffffff);
}

.case-metric.violet .metric-icon {
  background: #efe5ff;
  color: #6f42c1;
}

.case-insights-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.1fr) minmax(300px, 0.85fr);
  gap: 16px;
  margin: 16px 0;
}

.insight-panel,
.all-cases-panel,
.placeholder-panel {
  border: 1px solid var(--border, #d8e1ec);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 40px rgba(15, 34, 55, 0.06);
}

.insight-panel {
  padding: 18px;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-title-row h3 {
  margin: 0;
  color: #09213e;
  font-size: 16px;
}

.panel-title-row p {
  margin: 4px 0 0;
  color: #6b7f96;
  font-size: 12px;
}

.section-count {
  min-width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border, #d8e1ec);
  border-radius: 8px;
  background: #fff;
  color: #0b3158;
  font-weight: 900;
}

.term-list,
.activity-list,
.user-stats-list {
  display: grid;
  gap: 10px;
}

.term-item,
.activity-item,
.stat-row {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 11px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #edf1f6;
}

.term-item {
  grid-template-columns: 46px minmax(0, 1fr) auto;
}

.date-badge {
  width: 42px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e8f3ff;
  color: #0b4f8a;
}

.date-badge strong {
  font-size: 16px;
  line-height: 1;
}

.date-badge span {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.term-item > div:nth-child(2) strong,
.activity-item strong,
.stat-row strong {
  display: block;
  color: #10233d;
  font-size: 13px;
}

.term-item > div:nth-child(2) span,
.activity-item span,
.term-meta span,
.stat-row small {
  display: block;
  margin-top: 2px;
  color: #6b7f96;
  font-size: 12px;
}

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

.term-meta strong {
  color: #0b3158;
  font-size: 13px;
}

.activity-item {
  grid-template-columns: 34px minmax(0, 1fr) auto;
}

.activity-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e8f3ff;
  color: #0b4f8a;
  font-weight: 900;
}

.activity-icon.green {
  background: #ddf7e7;
  color: #168143;
}

.activity-icon.amber {
  background: #fff1cf;
  color: #b86d00;
}

.activity-item time {
  color: #72839a;
  font-size: 11px;
  white-space: nowrap;
}

.stat-row {
  grid-template-columns: 10px minmax(0, 1fr) auto;
}

.stat-row span:first-child {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1976d2;
}

.stat-row.green span:first-child {
  background: #168143;
}

.stat-row.amber span:first-child {
  background: #b86d00;
}

.stat-row.violet span:first-child {
  background: #6f42c1;
}

.stat-row b {
  color: #071b33;
}

.all-cases-panel {
  padding: 18px;
  margin-top: 16px;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.icon-button.small {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
}

.status-pill.info {
  background: #e8f3ff;
  color: #0b4f8a;
}

.status-pill.success {
  background: #ddf7e7;
  color: #166534;
}

.status-pill.warning {
  background: #fff1cf;
  color: #92400e;
}

.status-pill.muted {
  background: #e9eef5;
  color: #475569;
}

.quick-add-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.quick-add-card {
  display: grid;
  gap: 8px;
  min-height: 120px;
  padding: 18px;
  border: 1px solid var(--border, #d8e1ec);
  border-radius: 8px;
  background: #fff;
  color: #10233d;
  text-align: left;
  cursor: pointer;
}

.quick-add-card strong {
  font-size: 15px;
}

.quick-add-card span {
  color: #6b7f96;
  font-size: 12px;
}

.quick-add-card:hover {
  border-color: #b9d7f5;
  box-shadow: 0 12px 28px rgba(26, 99, 174, 0.12);
}

.placeholder-panel {
  padding: 28px;
}

.placeholder-panel h3 {
  margin: 0 0 8px;
  color: #09213e;
}

.placeholder-panel p {
  margin: 0;
  color: #6b7f96;
}

.case-preview-modal .modal-card.wide {
  width: min(920px, calc(100vw - 36px));
}

.case-preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 18px;
}

.case-preview-grid section {
  padding: 18px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #fbfdff;
}

.case-preview-grid h3 {
  margin: 0 0 12px;
  color: #09213e;
  font-size: 15px;
}

.details-list {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 10px 14px;
  margin: 0;
}

.details-list dt {
  color: #6b7f96;
  font-size: 12px;
  font-weight: 800;
}

.details-list dd {
  margin: 0;
  color: #10233d;
}

.case-preview-section {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #fff;
}

.case-preview-section h3 {
  margin: 0 0 12px;
  color: #09213e;
  font-size: 15px;
}

.preview-note {
  padding: 12px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #fbfdff;
}

.preview-note + .preview-note {
  margin-top: 10px;
}

.preview-note strong {
  color: #10233d;
  font-size: 13px;
}

.preview-note time {
  margin-left: 8px;
  color: #6b7f96;
  font-size: 12px;
}

.preview-note p {
  margin: 8px 0 0;
  color: #34445b;
}

.defense-table {
  min-width: 1320px;
}

.defense-metrics {
  padding: 16px 16px 0;
}

.defense-modal .modal-body.wide {
  width: min(1080px, calc(100vw - 40px));
}

.defense-modal-body {
  max-height: min(860px, calc(100vh - 42px));
  overflow: auto;
}

.defense-section {
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
}

.defense-section + .defense-section {
  padding-top: 16px;
}

.defense-section:last-of-type {
  border-bottom: 0;
}

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

.textarea-counter {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.sentence-reduction {
  display: grid;
  gap: 2px;
}

.sentence-reduction strong {
  color: var(--navy);
  font-size: 14px;
}

.sentence-reduction span {
  color: var(--muted);
  font-size: 11px;
}

.codebook-panel {
  overflow: hidden;
}

.codebook-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  min-height: 620px;
}

.codebook-sources-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  border-right: 1px solid var(--line);
  background: var(--surface-strong);
  padding: 18px;
}

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

.codebook-source-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 12px;
  cursor: pointer;
}

.codebook-source-option:hover {
  border-color: #c7d6e7;
  box-shadow: 0 10px 22px rgba(9, 45, 82, 0.06);
}

.codebook-source-option.is-journal-act {
  background: #f8fafc;
}

.codebook-source-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--navy);
}

.codebook-source-option small {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.codebook-search-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
}

.codebook-search-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(210px, auto);
  gap: 12px;
  align-items: end;
}

.codebook-search-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.codebook-search-actions .muted {
  max-width: 360px;
  text-align: right;
}

.codebook-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
  padding: 12px 14px;
}

.codebook-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.codebook-summary strong {
  min-width: 34px;
  min-height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #d8c58a;
  border-radius: var(--radius);
  background: var(--gold-soft);
  color: #765414;
  font-size: 15px;
}

.codebook-results {
  display: grid;
  gap: 12px;
}

.codebook-result-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 16px;
  box-shadow: 0 14px 34px rgba(20, 29, 43, 0.06);
}

.codebook-result-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.codebook-result-head .case-title {
  gap: 7px;
}

.codebook-result-head .case-title strong {
  color: var(--navy);
  font-size: 15px;
}

.codebook-fragment,
.codebook-full-article {
  display: grid;
  gap: 8px;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  background: #fbfdff;
  padding: 13px 14px;
}

.codebook-full-article {
  border-color: #d7c384;
  background: #fffcf3;
}

.codebook-fragment span,
.codebook-full-article span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.codebook-fragment p,
.codebook-full-article p {
  color: #2f3a49;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.65;
  white-space: pre-line;
}

.codebook-warning {
  display: grid;
  gap: 8px;
  border: 1px solid #e1ca84;
  border-radius: var(--radius);
  background: #fff8e6;
  padding: 13px 14px;
  color: #6f4b10;
  font-size: 12px;
  font-weight: 800;
}

.codebook-warning p {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.codebook-source-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 10px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.codebook-source-badge.source-kodeks-1 {
  border-color: #d4b15f;
  background: #fff5d9;
  color: #73510f;
}

.codebook-source-badge.source-kodeks-2 {
  border-color: #a9c9e8;
  background: #edf6ff;
  color: #0c4b7c;
}

.codebook-source-badge.source-kodeks-3 {
  border-color: #a9d5bd;
  background: #effaf3;
  color: #216543;
}

.codebook-source-badge.source-kodeks-4 {
  border-color: #e2afb8;
  background: #fff0f3;
  color: #842c3b;
}

.codebook-source-badge.source-journal-act {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #475569;
}

@media (max-width: 980px) {
  .codebook-layout,
  .codebook-search-form,
  #defenseView .filters,
  .defense-form-grid {
    grid-template-columns: 1fr;
  }

  .codebook-sources-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .codebook-search-actions {
    justify-items: stretch;
  }

  .codebook-search-actions .muted {
    max-width: none;
    text-align: left;
  }

  .codebook-result-head {
    display: grid;
  }

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

.dashboard-summary-panel {
  margin-bottom: 16px;
}

.dashboard-summary-panel .case-metrics {
  margin-bottom: 0;
}

.dashboard-home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 16px;
}

.dashboard-home-grid .dashboard-panel {
  min-height: 220px;
}

.dashboard-home-grid .dashboard-panel:nth-child(1) {
  grid-row: span 2;
}

.dashboard-home-grid .notification-list {
  align-content: start;
}

@media (max-width: 1100px) {
  .dashboard-home-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-home-grid .dashboard-panel:nth-child(1) {
    grid-row: auto;
  }
}

.empty-state.compact,
.empty-row {
  color: #7b8ca3;
  font-size: 13px;
  text-align: center;
}

.empty-state.compact {
  padding: 18px;
  border: 1px dashed #d5dfeb;
  border-radius: 8px;
  background: #fbfdff;
}

.empty-row {
  padding: 18px;
}

@media (max-width: 1280px) {
  .case-metrics,
  .case-insights-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .top-search {
    min-width: 100%;
    order: 3;
  }

  .case-metrics,
  .case-insights-grid,
  .quick-add-grid {
    grid-template-columns: 1fr;
  }

  .term-item,
  .activity-item {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .term-meta,
  .activity-item time {
    grid-column: 2;
    text-align: left;
  }
}
