@import url("../../assets/acg-webtools-base.css?v=4");

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

.topbar .import-button {
  border: 1px solid #c9d7ff;
  background: #edf3ff;
  color: var(--action-blue);
  box-shadow: none;
}

.topbar .import-button:hover {
  background: #e6efff;
  color: var(--action-blue);
  opacity: 1;
}

.topbar h1 {
  font-weight: 650;
}

.sidebar-filters {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.sidebar-filters label {
  font-size: 11px;
}

.sidebar-filters select {
  height: 34px;
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 10px;
  font-size: 12px;
}

.year-button-filter {
  display: grid;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
}

.year-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.year-buttons button {
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.year-buttons button.selected {
  border-color: #93b3f6;
  background: var(--blue-soft);
  color: var(--action-blue);
}

.stats-separated {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.layout.sidebar-collapsed .sidebar-filters {
  display: none;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1190px;
  font-size: 11px;
  table-layout: fixed;
}

.report-table th,
.report-table td {
  padding: 6px 8px;
  line-height: 1.18;
  vertical-align: middle;
  overflow-wrap: break-word;
}

.report-table th {
  padding: 8px 9px;
  font-size: 12px;
  font-weight: 760;
  line-height: 1.12;
  white-space: nowrap;
  background: var(--soft);
  color: var(--text);
  position: sticky;
  top: 0;
  z-index: 5;
}

.report-table td {
  font-weight: 430;
}

.report-table th:first-child,
.report-table td:first-child {
  width: 118px;
  min-width: 118px;
  white-space: nowrap;
}

.report-table th:nth-child(2) { width: 92px; }
.report-table th:nth-child(3) { width: 160px; }
.report-table th:nth-child(4) { width: auto; }
.report-table th:nth-child(5) { width: 150px; }
.report-table th:nth-child(6) { width: 74px; }
.report-table th:nth-child(7) { width: 150px; }
.report-table th:nth-child(8) { width: 104px; }
.report-table th:nth-child(9) { width: 64px; }
.report-table th:nth-child(10) { width: 72px; }

.report-table tbody tr { cursor: pointer; }
.report-table tbody tr:nth-child(even) { background: #fbfcfe; }
.report-table tbody tr:hover { background: var(--blue-soft); }
.report-table tbody tr.overdue-row {
  background: var(--danger-soft);
}
.report-table tbody tr.overdue-row:hover {
  background: #fee2e2;
}
.report-table tbody tr.due-soon-row {
  background: var(--warn-soft);
}
.report-table tbody tr.due-soon-row:hover {
  background: #ffedd5;
}

.report-table td strong {
  font-weight: 620;
}

.quick-open-button {
  height: 34px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: none;
}

.quick-open-button:hover {
  transform: none;
  background: var(--blue-soft);
  color: var(--action-blue);
  opacity: 1;
}

.quick-open-button.active {
  border-color: #93b3f6;
  background: var(--blue-soft);
  color: var(--action-blue);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 620;
  border: 1px solid transparent;
}

.status-chip.neu { color: #1e408f; background: #eef3ff; border-color: #c9d7ff; }
.status-chip.in-bearbeitung { color: #975a16; background: #fff7ed; border-color: #fed7aa; }
.status-chip.abgeschlossen { color: #475467; background: #f2f4f7; border-color: #d0d5dd; }
.status-chip.abgeschlossen---vorgemerkt { color: #1e408f; background: #eef3ff; border-color: #c9d7ff; }

.status-light {
  display: inline-flex;
  width: 16px;
  height: 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  vertical-align: middle;
}

.status-light.neu {
  background: #3b82f6;
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px #eff6ff;
}

.status-light.in-bearbeitung {
  background: #f97316;
  border-color: #fdba74;
  box-shadow: 0 0 0 4px #fff7ed;
}

.status-light.abgeschlossen {
  background: #22c55e;
  border-color: #86efac;
  box-shadow: 0 0 0 4px #ecfdf3;
}

.status-light.abgeschlossen---vorgemerkt {
  background: #60a5fa;
  border-color: #bfdbfe;
  box-shadow: 0 0 0 4px #eff6ff;
}

.status-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.validation-warning {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 12px;
  font-weight: 760;
  line-height: 1;
  box-shadow: 0 0 0 3px #fee2e2;
}

.relation-count {
  display: inline-flex;
  min-width: 26px;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.deadline {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 650;
}

.deadline.overdue { color: #a83d3d; background: var(--danger-soft); }
.deadline.dueSoon,
.deadline.due-soon {
  color: #9a3412;
  background: #ffedd5;
}
.deadline.open { color: #176b55; background: var(--ok-soft); }
.deadline.done { color: #667085; background: #f2f4f7; }

.warn-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 999px;
  background: #f97316;
  box-shadow: 0 0 0 3px #ffedd5;
}

.copy-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  margin: 0;
  padding: 0;
  border: 1px solid #c7d2e4;
  border-radius: 9px;
  background: #f4f7fb;
  color: #475467;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .65);
}

.detail-header-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.detail-header-actions button:not(.save-header-button) {
  height: 42px;
  min-height: 42px;
}

.detail-header-actions .save-header-button {
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #b7e4cf;
  border-radius: 12px;
  background: #eaf8f1;
  color: #176b55;
  font-weight: 760;
}

.detail-header-actions .save-header-button:hover {
  background: #ddf3e8;
  color: #125844;
  transform: none;
  opacity: 1;
}

.detail-header-actions .icon-close {
  padding-top: 0;
  padding-bottom: 0;
}

.detail-header-actions .icon-close {
  width: 42px;
  min-width: 42px;
}

.copy-button:hover {
  background: #eaf0f8;
  border-color: #b8c5d8;
  color: var(--action-blue);
  transform: none;
}

.detail-modal.is-dirty .detail-sticky-head {
  box-shadow: 0 1px 0 rgba(234, 179, 8, .22), 0 12px 24px rgba(15, 23, 42, .08);
}

.detail-modal.is-dirty .save-header-button {
  box-shadow: 0 0 0 3px rgba(251, 191, 36, .18);
}

.detail-sticky-head {
  position: sticky;
  top: -18px;
  z-index: 20;
  margin: -18px -18px 14px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
}

.detail-sticky-head .card-header {
  margin-bottom: 0;
}

.detail-card-header {
  align-items: center;
}

.detail-card-header h2 {
  max-width: min(850px, 62vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-nav {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 0;
}

.detail-nav select {
  min-width: 0;
  height: 40px;
  min-height: 40px;
  margin-top: 0;
  border-radius: 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
}

.detail-nav-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 9px;
  font-size: 19px;
}

.detail-position {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.person-other {
  margin-top: 6px;
}

.person-other[hidden] {
  display: none;
}

.person-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, .55fr);
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.person-inline:has(.person-other[hidden]) {
  grid-template-columns: 1fr;
}

.person-inline .person-other {
  margin-top: 0;
}

.dialog-date-field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
}

.dialog-date-field[hidden] {
  display: none;
}

.dialog-date-field input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 430;
}

.date-field {
  position: relative;
}

.date-picker-button {
  width: 100%;
  height: 40px;
  min-height: 40px;
  margin-top: 6px;
  padding: 8px 11px;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
  font-family: var(--font-main);
  line-height: 1.2;
  box-shadow: none;
  transform: none;
  box-sizing: border-box;
}

.detail-fields input,
.detail-fields select,
.detail-fields textarea,
#entryForm input,
#entryForm select,
#entryForm textarea {
  font-weight: 400;
  border-radius: 11px;
}

.detail-fields input,
.detail-fields select,
.detail-fields .date-picker-button {
  height: 40px;
  min-height: 40px;
}

.date-picker-button:hover {
  transform: none;
  opacity: 1;
}

.date-picker-button strong {
  color: var(--muted);
  font-size: 12px;
}

.date-picker-popover {
  position: fixed;
  z-index: 1800;
  width: 286px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-modal);
}

.date-picker-popover.hidden {
  display: none;
}

.date-picker-head,
.date-picker-weekdays,
.date-picker-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  align-items: center;
}

.date-picker-head {
  grid-template-columns: 34px 1fr 34px;
  margin-bottom: 10px;
}

.date-picker-head strong {
  text-align: center;
  font-size: 14px;
  font-weight: 720;
}

.date-picker-head button,
.date-picker-days button {
  min-height: 30px;
  padding: 0;
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.date-picker-head button {
  border: 1px solid var(--border);
  color: var(--muted);
}

.date-picker-weekdays {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.date-picker-days button {
  border: 0;
  font-weight: 650;
}

.date-picker-days button:hover {
  background: var(--blue-soft);
}

.date-picker-days .muted-day {
  color: #cbd5e1;
}

.date-picker-days .selected-day {
  background: var(--primary);
  color: #fff;
}

.date-picker-today {
  width: 100%;
  min-height: 32px;
  margin-top: 10px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--blue-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.date-picker-today:hover {
  background: #e0e8ff;
}

.warning-strip {
  margin-bottom: 14px;
  padding: 11px 13px;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  background: var(--warn-soft);
  color: #975a16;
  font-weight: 650;
}

.form-error {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: #fff1f2;
  color: #991b1b;
  font-size: 12px;
  font-weight: 700;
}

.form-error.hidden {
  display: none;
}

.warn-modal {
  z-index: 140;
}

.warn-box {
  max-width: 440px;
}

.warn-box p {
  margin: 4px 0 18px;
  color: var(--muted);
  font-size: 14px;
}

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

.warn-actions .warning {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fed7aa;
}

input[aria-disabled="true"] {
  background: #f7f9fc;
  color: #98a2b3;
  cursor: not-allowed;
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.detail-footer-actions {
  display: flex;
  justify-content: flex-end;
  padding: 4px 0 0;
}

.detail-footer-actions .danger-button {
  min-width: 170px;
}

.entry-preview-layout {
  margin-top: 8px;
}

.entry-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.entry-footer-actions .secondary,
.entry-footer-actions .save-header-button {
  min-width: 120px;
}

.detail-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
}

.detail-field-group {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(184, 200, 230, .72);
  border-radius: 14px;
  background: rgba(255, 255, 255, .62);
}

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

.detail-field-group.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-field-group.status-deadline {
  grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr);
}

.detail-field-group.stacked {
  grid-template-columns: 1fr;
}

.field-toggle-block {
  display: grid;
  gap: 6px;
}

.field-toggle-block > label {
  margin: 0;
}

.choice-toggle,
.status-toggle {
  display: grid;
  gap: 6px;
  min-height: 40px;
  align-items: center;
}

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

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

.choice-chip,
.status-toggle .status-chip {
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  color: var(--muted);
  box-shadow: none;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.05;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.choice-chip:hover,
.status-toggle .status-chip:hover {
  transform: none;
  background: #f8fafc;
}

.choice-chip.selected,
.status-toggle .status-chip.selected {
  border-width: 2px;
  font-weight: 700;
  opacity: 1;
}

.choice-chip:not(.selected),
.status-toggle .status-chip:not(.selected) {
  opacity: .52;
}

.status-toggle .status-chip span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.choice-chip.selected {
  color: #1e408f;
  background: #eef3ff;
  border-color: #93b3f6;
}

.status-toggle .status-chip.selected.neu {
  color: #1e408f;
  background: #eef3ff;
  border-color: #93b3f6;
}

.status-toggle .status-chip.selected.in-bearbeitung {
  color: #975a16;
  background: #fff7ed;
  border-color: #f97316;
}

.status-toggle .status-chip.selected.abgeschlossen {
  color: #166534;
  background: #ecfdf3;
  border-color: #22c55e;
}

.status-toggle .status-chip.selected.abgeschlossen---vorgemerkt {
  color: #1e408f;
  background: #eff6ff;
  border-color: #60a5fa;
}

.deadline-field-with-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.inline-copy-button {
  width: auto;
  min-width: 138px;
  height: 40px;
  min-height: 40px;
  margin-top: 0;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}

.inline-copy-button:hover {
  color: var(--action-blue);
  background: #f4f7fb;
  transform: none;
}

.inline-copy-button.forwarding-mail-active {
  border-color: #f2c7c7;
  background: #fff3f3;
  color: #a43b3b;
}

.inline-copy-button.forwarding-mail-active:hover {
  border-color: #e6aaaa;
  background: #ffebeb;
  color: #8d2929;
}

.full-panel {
  width: 100%;
}

.side-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--soft);
}

.evidence-relations-box.drag-over {
  border-color: var(--action-blue);
  background: var(--blue-soft);
}

.side-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.report-box {
  background: linear-gradient(180deg, #edf4ff 0%, #f8fbff 48%, #ffffff 100%);
  border-color: #b8c8e6;
  box-shadow: inset 4px 0 0 #1e408f, 0 10px 26px rgba(30, 64, 143, .075);
}

.report-box.report-status-neu {
  background: linear-gradient(180deg, #edf4ff 0%, #f8fbff 48%, #ffffff 100%);
  border-color: #b8c8e6;
  box-shadow: inset 5px 0 0 #1e408f, 0 10px 26px rgba(30, 64, 143, .075);
}

.report-box.report-status-in-bearbeitung {
  background: linear-gradient(180deg, #fff7ed 0%, #fffbf5 48%, #ffffff 100%);
  border-color: #fed7aa;
  box-shadow: inset 5px 0 0 #f97316, 0 10px 26px rgba(249, 115, 22, .08);
}

.report-box.report-status-abgeschlossen {
  background: linear-gradient(180deg, #ecfdf3 0%, #f7fef9 48%, #ffffff 100%);
  border-color: #bbf7d0;
  box-shadow: inset 5px 0 0 #22c55e, 0 10px 26px rgba(34, 197, 94, .075);
}

.report-box.report-status-abgeschlossen---vorgemerkt {
  background: linear-gradient(180deg, #eff6ff 0%, #f8fbff 48%, #ffffff 100%);
  border-color: #bfdbfe;
  box-shadow: inset 5px 0 0 #60a5fa, 0 10px 26px rgba(96, 165, 250, .075);
}

.report-box.report-status-overdue {
  background: linear-gradient(180deg, #fff1f2 0%, #fff8f8 48%, #ffffff 100%);
  border-color: #fecdd3;
  box-shadow: inset 5px 0 0 #dc2626, 0 10px 26px rgba(220, 38, 38, .08);
}

.closure-note-field {
  border-style: solid;
}

.closure-note-label {
  display: grid;
  gap: 6px;
}

.closure-note-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.closure-mail-button {
  min-width: 208px;
  height: auto;
  align-self: stretch;
}

.closure-mail-button.has-closure-note {
  border-color: #b9e5c9;
  background: #effbf4;
  color: #187447;
}

.closure-mail-button.has-closure-note:hover {
  border-color: #91d2aa;
  background: #e4f8ec;
  color: #12653b;
}

.closure-note-field.closure-missing {
  border-color: #fecaca;
  background: #fff1f2;
  box-shadow: inset 4px 0 0 #dc2626;
}

.attachments-none-field textarea {
  border-color: #e5e7eb;
  background: #f3f4f6;
  color: #8a94a6;
}

.attachments-none-field textarea:focus {
  background: #fff;
  color: var(--text);
}

.evidence-relations-box,
.journal-box {
  background: #f8fafc;
}

.linked-section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: 12px;
  align-items: start;
}

.linked-section {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: #fff;
}

.section-subtitle {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.document-list,
.journal-list {
  display: grid;
  gap: 0;
  margin-bottom: 10px;
}

.empty-docs {
  padding: 9px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-weight: 500;
}

.document-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.document-row:last-child {
  border-bottom: 0;
}

.document-name {
  min-width: 0;
  display: block;
  color: var(--text);
  text-decoration: none;
}

.document-name strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 400;
}

.document-extension {
  justify-self: end;
  color: var(--action-blue);
  font-size: 11px;
  font-weight: 650;
}

.document-actions {
  display: inline-flex;
  gap: 6px;
}

.doc-action {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 650;
}

.doc-action:hover {
  background: var(--blue-soft);
  color: var(--action-blue);
  transform: none;
}

.doc-action.danger {
  color: #a83d3d;
}

.doc-action.danger:hover {
  background: var(--danger-soft);
  color: #a83d3d;
}

.journal-row {
  padding: 9px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-weight: 400;
}

.journal-box textarea {
  background: #fff;
}

.journal-entry-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.journal-entry-add textarea {
  margin-top: 0;
}

.journal-entry-add button {
  min-width: 150px;
  margin-top: 0;
  align-self: stretch;
}

.journal-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}

.relation-list {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
}

.relation-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  min-width: 0;
  overflow: visible;
  padding: 8px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: #fff;
}

.relation-link {
  min-height: 0;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  text-align: left;
  box-shadow: none;
  width: 100%;
  white-space: normal;
}

.relation-link:hover {
  color: var(--action-blue);
  transform: none;
}

.relation-link strong {
  font-size: 12px;
  font-weight: 720;
  white-space: normal;
  overflow-wrap: anywhere;
}

.relation-link span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  overflow-wrap: anywhere;
  white-space: normal;
}

.relation-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.relation-add select {
  min-width: 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.upload-progress {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
}

.upload-progress.hidden {
  display: none;
}

.upload-progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eaf2;
}

.upload-progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--action-blue);
  transition: width .16s ease;
}

.upload-progress strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.dialog-box {
  width: min(520px, 92vw);
}

.dialog-box textarea {
  width: 100%;
  margin-top: 8px;
  background: #fff;
}

.dialog-box textarea[hidden] {
  display: none;
}

.dialog-box .quick-actions {
  margin-top: 14px;
}

@media (max-width: 1100px) {
  .layout,
  .layout.sidebar-collapsed {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .sidebar {
    overflow-x: hidden;
  }

  .main {
    width: 100%;
    min-width: 0;
    padding: 14px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .topbar-title {
    min-width: 0;
  }

  .topbar h1 {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 30px;
    line-height: 1.05;
  }

  .topbar-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
  }

  .topbar-tools input,
  .topbar-tools button {
    width: 100%;
    flex: none;
  }

  .card {
    min-width: 0;
  }

  .table-shell {
    max-width: 100%;
  }

  .linked-section-grid {
    grid-template-columns: 1fr;
  }

  .detail-fields {
    grid-template-columns: 1fr;
  }

  .detail-field-group.three,
  .detail-field-group.two,
  .detail-field-group.status-deadline {
    grid-template-columns: 1fr;
  }

  .person-inline,
  .person-inline:has(.person-other[hidden]) {
    grid-template-columns: 1fr;
  }

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

  .detail-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-card-header h2 {
    max-width: 100%;
    white-space: normal;
  }

  .detail-header-actions {
    width: 100%;
    justify-content: flex-end;
    grid-column: 1 / -1;
  }

  .detail-nav {
    grid-template-columns: 42px minmax(0, 1fr) auto 42px;
  }

  .relation-add {
    grid-template-columns: 1fr;
  }
}

.journal-text {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-weight: 400;
}

.journal-actions {
  display: inline-flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mini-action {
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-weight: 800;
}

.danger-mini {
  color: #a83d3d;
}

.full-button { width: 100%; }

.upload-control {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #fff;
  color: var(--primary);
  cursor: pointer;
}

.upload-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 760px) {
  .main {
    padding: 12px;
  }

  .topbar h1 {
    font-size: 28px;
    letter-spacing: -.035em;
  }

  .card {
    padding: 10px;
  }

  .modal {
    align-items: stretch;
    padding: 8px;
  }

  .modal-box,
  .detail-modal-box.wide {
    width: 100%;
    max-height: calc(100vh - 16px);
    border-radius: 14px;
    padding: 14px;
  }

  .detail-sticky-head {
    top: -14px;
    margin: -14px -14px 12px;
    padding: 12px 14px 10px;
    border-radius: 14px 14px 0 0;
  }

  .detail-nav {
    grid-template-columns: 42px 1fr 42px;
  }

  .detail-nav > .detail-nav-button:first-child {
    grid-column: 1;
    grid-row: 1;
  }

  .detail-nav > select {
    grid-column: 2;
    grid-row: 1;
  }

  .detail-nav > .detail-nav-button:nth-of-type(2) {
    grid-column: 3;
    grid-row: 1;
  }

  .detail-position {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .detail-header-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

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

  .document-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

@media (hover: none) and (pointer: coarse) and (min-width: 761px) and (max-width: 1400px), (-webkit-touch-callout: none) and (min-width: 761px) and (max-width: 1400px) {
  html,
  body {
    height: var(--ops-viewport-height, 100svh) !important;
    min-height: var(--ops-viewport-height, 100svh) !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
  }

  .layout,
  .layout.sidebar-collapsed {
    height: var(--ops-viewport-height, 100svh) !important;
    min-height: 0 !important;
    max-height: var(--ops-viewport-height, 100svh) !important;
    overflow: hidden !important;
  }

  .main {
    min-height: 0 !important;
    overflow: hidden !important;
    padding-bottom: max(18px, env(safe-area-inset-bottom)) !important;
  }

  .card {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin-bottom: 0 !important;
  }

  .table-shell {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0 !important;
  }

  .report-table {
    width: 100% !important;
    min-width: 0 !important;
    margin-bottom: 0 !important;
    font-size: 10px !important;
    table-layout: fixed !important;
  }

  .report-table th,
  .report-table td {
    padding: 5px 6px !important;
    line-height: 1.12 !important;
  }

  .report-table th {
    font-size: 10px !important;
  }

  .report-table th:first-child,
  .report-table td:first-child {
    width: 105px !important;
    min-width: 0 !important;
  }

  .report-table th:nth-child(2) { width: 78px !important; }
  .report-table th:nth-child(3) { width: 150px !important; }
  .report-table th:nth-child(4) { width: auto !important; }
  .report-table th:nth-child(5) { width: 136px !important; }
  .report-table th:nth-child(6) { width: 54px !important; }
  .report-table th:nth-child(7) { width: 142px !important; }
  .report-table th:nth-child(8) { width: 95px !important; }
  .report-table th:nth-child(9) { width: 48px !important; }
  .report-table th:nth-child(10) { width: 52px !important; }

  .status-light {
    width: 14px !important;
    height: 14px !important;
  }

  .deadline,
  .relation-count {
    font-size: 10px !important;
    padding-left: 6px !important;
    padding-right: 6px !important;
  }

  .table-shell::after {
    content: "";
    display: block;
    height: max(120px, calc(104px + env(safe-area-inset-bottom)));
  }

  .modal {
    align-items: stretch;
    padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  }

  .modal-box,
  .detail-modal-box.wide {
    max-height: calc(100svh - max(36px, env(safe-area-inset-top) + env(safe-area-inset-bottom) + 36px));
  }
}

@media (max-width: 760px) {
  .journal-entry-add {
    grid-template-columns: 1fr;
  }

  .journal-entry-add button {
    width: 100%;
  }

  .closure-note-entry {
    grid-template-columns: 1fr;
  }

  .closure-mail-button {
    width: 100%;
    min-height: 40px;
  }
}
