:root {
  --bg: #f5f1e6;
  --panel: #fbf8f1;
  --line: #ded3bd;
  --line-strong: #cfbea0;
  --text: #10233a;
  --muted: #6f756e;
  --accent: #bb9257;
  --chip: #ebe4d5;
  --white: #ffffff;
  --danger: #a34b3c;

  --green: #D9FFEF;
  --green-line: #7DFFC9;
  --green-text: #179B63;
  --green-row-bg: rgba(59, 255, 176, 0.18);

  --success: var(--green-line);
  --shadow: 0 12px 34px rgba(67, 45, 16, 0.08);

  --status-gray-bg: #e9e5de;
  --status-gray-line: #cbc4b8;
  --status-gray-text: #5b615f;

  --status-yellow-bg: #f7edc6;
  --status-yellow-line: #d8c47c;
  --status-yellow-text: #7c6841;

  --status-green-bg: var(--green);
  --status-green-line: var(--green-line);
  --status-green-text: var(--green-text);

  --status-red-bg: #f3d8d2;
  --status-red-line: #d4a198;
  --status-red-text: #844f47;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(245, 241, 230, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar__brand {
  display: grid;
  gap: 3px;
  min-width: 150px;
}

.topbar__eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.topbar__nav {
  flex: 1;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.table-nav__link,
.topbar__settings,
.primary-button,
.secondary-button,
.row-actions__button,
.side-panel__close {
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s ease;
}

.table-nav__link {
  padding: 11px 22px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.table-nav__link:hover,
.topbar__settings:hover,
.primary-button:hover,
.secondary-button:hover,
.row-actions__button:hover,
.side-panel__close:hover {
  border-color: var(--accent);
}

.table-nav__link.is-active,
.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}

.topbar__settings,
.secondary-button,
.side-panel__close {
  padding: 11px 20px;
}

.secondary-button--danger,
.row-actions__button--danger {
  color: var(--danger);
  border-color: rgba(163, 75, 60, 0.35);
}

.page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 26px 24px 40px;
}

.statistics-view {
  display: block;
  width: 100%;
}

.statistics-view .hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.statistics-view .hint {
  color: var(--muted);
}

.statistics-view .hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.statistics-view canvas {
  max-width: 100%;
}

.view-layout {
  display: block;
}

.view-card,
.side-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.overlay-modal {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 24px;
  background: rgba(16, 35, 58, 0.18);
  backdrop-filter: blur(3px);
}

.overlay-modal__dialog {
  width: min(980px, calc(100vw - 48px));
  max-height: calc(100vh - 64px);
}

.overlay-modal .side-panel {
  max-height: calc(100vh - 64px);
  overflow: auto;
}

.view-card__header,
.side-panel__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 18px;
}

.view-card__title-block,
.topbar__brand {
  display: grid;
  gap: 4px;
}

.view-card__title,
.side-panel__title {
  margin: 0;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0.02em;
}

.view-card__subtitle,
.side-panel__text,
.detail-card__text {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.view-actions,
.side-panel__footer,
.detail-meta,
.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.view-card__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 24px 18px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.stat-chip__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.stat-chip__value {
  font-size: 14px;
}

.filters {
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
  padding: 0 24px 18px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(240, 232, 217, 0.48), rgba(251, 248, 241, 0));
}

.filters--empty {
  display: none;
}

.filter-item,
.detail-field {
  display: grid;
  gap: 6px;
  min-width: 150px;
}

.detail-field--pdf {
  gap: 10px;
}

.filter-item__label,
.detail-field__label,
.side-panel__eyebrow,
.detail-card__title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.side-panel__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 8px;
}

.filter-item__control,
.detail-field__control {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--white);
  color: var(--text);
  font-size: 13px;
  padding: 0 14px;
  outline: none;
}

.detail-field__hint {
  font-size: 12px;
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  padding: 6px 20px 20px;
}

.data-table {
  width: 100%;
  min-width: 1400px;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
}

.data-table th {
  padding: 12px 12px 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table th.is-center,
.data-table td.is-center {
  text-align: center;
}

.data-table th.status-column,
.data-table td.status-cell {
  text-align: center;
}

.data-table td {
  padding: 12px;
  vertical-align: middle;
  background: transparent;
  border-bottom: 1px solid rgba(222, 211, 189, 0.7);
}

.data-table td.status-cell {
  padding: 10px 8px;
}

.data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.42);
}

.data-table tbody tr.is-done td {
  background: var(--green-row-bg);
}

.data-table td.is-editable {
  cursor: pointer;
}

.data-table td.is-editable:hover {
  background: rgba(255, 255, 255, 0.62);
}

.data-table td.is-editing {
  background: rgba(255, 255, 255, 0.92) !important;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.data-table td.is-saving {
  background: rgba(240, 232, 217, 0.9) !important;
}

.cell-text {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.cell-file-name {
  max-width: 100%;
}

.cell-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--chip);
  color: var(--text);
}

.status-button {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  box-shadow: inset 0 -1px 0 rgba(16, 35, 58, 0.03);
}

.status-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 14px rgba(67, 45, 16, 0.08);
}

.status-button:active {
  transform: translateY(0);
}

.status-button:disabled {
  cursor: default;
  opacity: 0.8;
}

.status-button__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 10px;
  background: currentColor;
  opacity: 0.88;
}

.status-button__label {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-button--detail {
  min-height: 42px;
}

.status-button--gray {
  background: var(--status-gray-bg);
  border-color: var(--status-gray-line);
  color: var(--status-gray-text);
}

.status-button--yellow {
  background: var(--status-yellow-bg);
  border-color: var(--status-yellow-line);
  color: var(--status-yellow-text);
}

.status-button--green {
  background: var(--status-green-bg);
  border-color: var(--status-green-line);
  color: var(--status-green-text);
}

.status-button--red {
  background: var(--status-red-bg);
  border-color: var(--status-red-line);
  color: var(--status-red-text);
}

.cell-editor {
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--white);
  color: var(--text);
  font: inherit;
  outline: none;
}

.cell-editor--select {
  cursor: pointer;
}

.row-actions__button {
  padding: 7px 11px;
  font-size: 12px;
}

.empty-row {
  padding: 24px 12px !important;
  text-align: center;
  color: var(--muted);
  background: transparent !important;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
}

.side-panel__body {
  display: grid;
  gap: 14px;
  padding: 0 24px 20px;
}

.detail-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
}

.detail-card__title {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.pdf-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.pdf-field__info {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.pdf-field__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-field__name--empty {
  color: var(--muted);
}

.pdf-field__helper {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.pdf-field__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.side-panel__footer {
  padding: 0 24px 24px;
}

.toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 40;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--text);
  color: var(--white);
  box-shadow: var(--shadow);
}

.toast--success {
  background: #4f6036;
}

.toast--error {
  background: #8b3a32;
}

@media (max-width: 1200px) {
  .overlay-modal__dialog {
    width: min(920px, calc(100vw - 32px));
  }
}

@media (max-width: 920px) {
  .topbar__inner {
    flex-wrap: wrap;
    padding: 14px 16px;
  }

  .topbar__nav,
  .topbar__brand,
  .topbar__settings {
    width: 100%;
  }

  .page {
    padding: 18px 14px 28px;
  }

  .view-card__header,
  .side-panel__header,
  .pdf-field {
    flex-direction: column;
    align-items: flex-start;
  }

  .primary-button,
  .topbar__settings,
  .secondary-button,
  .side-panel__close {
    width: 100%;
  }

  .view-actions,
  .side-panel__footer,
  .pdf-field__actions {
    width: 100%;
  }

  .pdf-field__actions .secondary-button {
    width: 100%;
  }

  .overlay-modal {
    padding: 14px;
  }

  .overlay-modal__dialog {
    width: 100%;
    max-height: calc(100vh - 28px);
  }

  .overlay-modal .side-panel {
    max-height: calc(100vh - 28px);
  }

  .toast {
    right: 14px;
    left: 14px;
    bottom: 14px;
  }

  .status-button__label {
    white-space: normal;
  }
}


.cell-file-name--document {
  font-weight: 700;
}

.cell-file-name--link {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.cell-file-name--link:hover {
  color: var(--accent);
}

.cell-file-name--link:focus-visible {
  outline: 2px solid rgba(187, 146, 87, 0.35);
  outline-offset: 2px;
  border-radius: 6px;
}


/* =========================================================
   STATUS RESET
   One shared status component for ALL tables and ALL status columns.
   This block must stay at the END of the file so it wins over older rules.
   ========================================================= */

.status-column,
.status-cell {
  text-align: center !important;
}

.status-cell {
  padding: 10px 8px !important;
}

.status-button {
  width: 100% !important;
  min-height: 38px !important;
  padding: 8px 10px !important;
  border-radius: 14px !important;
  border: 1px solid var(--line-strong) !important;
  background: var(--white) !important;
  color: var(--text) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1.1 !important;
  text-align: center !important;
  cursor: pointer !important;
  transition: transform 0.14s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease !important;
  box-shadow: inset 0 -1px 0 rgba(16, 35, 58, 0.03) !important;
}

.status-button:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 8px 14px rgba(67, 45, 16, 0.08) !important;
}

.status-button:active {
  transform: translateY(0) !important;
}

.status-button:disabled {
  cursor: default !important;
  opacity: 0.8 !important;
}

.status-button__dot {
  width: 10px !important;
  height: 10px !important;
  border-radius: 999px !important;
  flex: 0 0 10px !important;
  background: currentColor !important;
  opacity: 0.88 !important;
}

.status-button__label {
  display: block !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.status-button--detail {
  min-height: 42px !important;
}

.status-button--gray {
  background: var(--status-gray-bg) !important;
  border-color: var(--status-gray-line) !important;
  color: var(--status-gray-text) !important;
}

.status-button--yellow {
  background: var(--status-yellow-bg) !important;
  border-color: var(--status-yellow-line) !important;
  color: var(--status-yellow-text) !important;
}

.status-button--green {
  background: var(--status-green-bg) !important;
  border-color: var(--status-green-line) !important;
  color: var(--status-green-text) !important;
}

.status-button--red {
  background: var(--status-red-bg) !important;
  border-color: var(--status-red-line) !important;
  color: var(--status-red-text) !important;
}

/* =========================================================
   RUTINER / PDF remains isolated and separate from status.
   ========================================================= */

.rutiner-pdf-link {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  font: inherit !important;
  font-size: 14px !important;
  line-height: 1.35 !important;
  font-weight: 700 !important;
  color: #1a5cff !important;
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 2px !important;
  cursor: pointer !important;
  display: inline !important;
  border-radius: 0 !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}

.rutiner-pdf-link:hover {
  color: #003ecc !important;
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  opacity: 1 !important;
}

.rutiner-pdf-link:active {
  color: #003ecc !important;
  transform: translateY(1px);
}

.rutiner-pdf-link:focus,
.rutiner-pdf-link:focus-visible {
  outline: 2px solid #1a5cff !important;
  outline-offset: 2px !important;
}

.rutiner-pdf-link::after {
  content: " ↗";
  font-size: 0.85em;
}

.rutiner-pdf-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.rutiner-pdf-field__info {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.rutiner-pdf-field__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rutiner-pdf-field__name--empty {
  color: var(--muted);
}

.rutiner-pdf-field__helper {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.rutiner-pdf-field__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 920px) {
  .status-button__label {
    white-space: normal !important;
  }

  .rutiner-pdf-field {
    flex-direction: column;
    align-items: flex-start;
  }

  .rutiner-pdf-field__actions {
    width: 100%;
  }

  .rutiner-pdf-field__actions .secondary-button {
    width: 100%;
  }
}


/* =========================================================
   NOTES UI
   ========================================================= */

.notes-button {
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: 0.18s ease;
}

.notes-button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.notes-panel .side-panel__body {
  gap: 16px;
}

.notes-form__body {
  min-height: 120px;
  resize: vertical;
  padding: 12px 14px;
  font: inherit;
}

.notes-history__list {
  display: grid;
  gap: 12px;
}

.notes-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
}

.notes-card__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.notes-card__meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.notes-card__body {
  font-size: 14px;
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
}

@media (max-width: 920px) {
  .notes-button {
    width: 100%;
    border-radius: 14px;
  }
}


/* =========================================================
   DOCUMENT LINKS IN COLUMN HEADERS
   ========================================================= */

.column-header {
  position: relative;
  display: block;
  min-width: 0;
  padding-right: 18px;
}

.column-header__label {
  display: block;
  min-width: 0;
}

.doc-link-dot {
  position: absolute;
  top: 4px;
  right: 2px;
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #1a5cff;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(26, 92, 255, 0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.doc-link-dot:hover {
  transform: scale(1.22);
  box-shadow: 0 0 0 4px rgba(26, 92, 255, 0.14);
  background: #003ecc;
}

.doc-link-dot:focus,
.doc-link-dot:focus-visible {
  outline: 2px solid rgba(26, 92, 255, 0.35);
  outline-offset: 2px;
}

.doc-link-dot:active {
  transform: scale(1.08);
}


/* =========================================================
   SETTINGS UI
   ========================================================= */

.settings-panel .side-panel__body {
  gap: 16px;
}

.settings-list__rows {
  display: grid;
  gap: 10px;
}

.settings-list__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
}

.settings-list__info {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.settings-list__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-list__meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.settings-list__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 920px) {
  .settings-list__row {
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-list__actions {
    width: 100%;
  }

  .settings-list__actions .secondary-button {
    width: 100%;
  }
}


/* =========================================================
   SETTINGS MENU
   ========================================================= */

.settings-menu {
  display: grid;
  gap: 12px;
}

.settings-menu__card {
  position: relative;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  cursor: pointer;
  transition: 0.18s ease;
}

.settings-menu__card:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.settings-menu__card.is-disabled {
  cursor: default;
  opacity: 0.7;
}

.settings-menu__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.settings-menu__meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.settings-menu__tag {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(26, 92, 255, 0.10);
  color: #1a5cff;
  font-size: 11px;
  font-weight: 700;
}

.settings-back-row {
  display: flex;
  justify-content: flex-start;
}



/* =========================================================
   DOCUMENT LINK DOT (final tuned v2)
   ========================================================= */

.column-header {
  display: inline-block;
  min-width: 0;
}

.column-header__label {
  position: relative;
  display: inline-block;
}

.doc-link-dot {
  position: absolute;
  top: -5px;
  right: -1px;
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #1a5cff;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.doc-link-dot:hover {
  transform: scale(1.22);
  box-shadow: 0 0 0 4px rgba(26, 92, 255, 0.16);
  background: #003ecc;
}

.doc-link-dot:focus,
.doc-link-dot:focus-visible {
  outline: 2px solid rgba(26, 92, 255, 0.35);
  outline-offset: 2px;
}

.doc-link-dot:active {
  transform: scale(1.1);
}

/* =========================================================
   AUTH UI
   ========================================================= */

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.auth-card {
  width: min(440px, 100%);
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.auth-card__brand {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
}

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

.auth-submit {
  width: 100%;
}

.auth-error {
  min-height: 18px;
  margin: 0;
  font-size: 13px;
  color: var(--danger);
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar__user-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.55);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 920px) {
  .topbar__user {
    width: 100%;
  }

  .topbar__user-badge,
  #logoutButton {
    width: 100%;
  }
}

/* =========================================================
   NOTES UNREAD BADGE
   ========================================================= */

.notes-button {
  position: relative;
}

.notes-button__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #1a5cff;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--panel);
}

/* =========================================================
   TODO MODAL – REFINED UI
   Additive block only — keeps the original app styling intact
   ========================================================= */

.side-panel {
  position: relative;
}

.todo-modal__heading .side-panel__eyebrow {
  margin-bottom: 6px;
}

.todo-modal__heading .side-panel__title {
  margin-bottom: 4px;
}

.todo-modal__heading .side-panel__text {
  max-width: 42ch;
}

.side-panel__header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding-right: 28px;
}

.side-panel__header-actions .secondary-button {
  min-width: 92px;
}

.side-panel__close--small {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--muted, #6b7280);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.side-panel__close--small:hover {
  background: rgba(0, 0, 0, 0.07);
  color: var(--text, #1f2937);
}

.todo-modal__textarea {
  min-height: 148px;
  resize: vertical;
}

.todo-item {
  padding: 12px 14px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

.todo-item.is-done {
  opacity: 0.66;
}

.todo-item__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.todo-item__category {
  font-size: 13px;
  font-weight: 700;
  color: var(--text, #1f2937);
  letter-spacing: 0.01em;
}

.todo-item__right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.todo-item__meta {
  font-size: 12px;
  color: var(--muted, #6b7280);
  white-space: nowrap;
}

.todo-item__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.todo-item__body {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--text, #1f2937);
}

@media (max-width: 920px) {
  .side-panel__header-actions {
    gap: 6px;
    padding-right: 24px;
  }

  .side-panel__header-actions .secondary-button {
    min-width: 84px;
  }

  .todo-item__top {
    flex-direction: column;
    align-items: flex-start;
  }

  .todo-item__right {
    width: 100%;
    justify-content: flex-start;
  }
}

/* =========================================================
   NOTES MODAL – REFINED UI
   Additive block only — keeps the original app styling intact
   ========================================================= */

.note-item {
  padding: 12px 14px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

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

.note-item__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.note-item__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text, #1f2937);
  letter-spacing: 0.01em;
}

.note-item__meta {
  font-size: 12px;
  color: var(--muted, #6b7280);
  white-space: nowrap;
}

.note-item__body {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--text, #1f2937);
}

@media (max-width: 920px) {
  .note-item__top {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* =========================================================
   TODO + NOTES – SAFE UI EXTENSION (NON-DESTRUCTIVE)
   ========================================================= */

/* ===== SPACING SYSTEM ===== */
:root {
  --space-xs: 6px;
  --space-sm: 10px;
  --space-md: 14px;
  --space-lg: 20px;
}

/* ===== PANEL BASE ===== */
.side-panel {
  position: relative;
}

/* ===== HEADER ===== */
.side-panel__header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
  padding-right: 28px;
}

/* Close button (top right corner) */
.side-panel__close--small {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.side-panel__close--small:hover {
  background: rgba(0,0,0,0.08);
}

/* ===== FORM ===== */
.notes-form {
  margin-bottom: var(--space-lg);
}

/* Consistent spacing between fields */
.notes-form .detail-field {
  margin-top: var(--space-md);
}

.notes-form .detail-field:first-of-type {
  margin-top: 0;
}

/* Larger textarea */
.todo-modal__textarea {
  min-height: 150px;
  resize: vertical;
}

/* ===== TODO LIST ===== */
.todo-item {
  padding: var(--space-md);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.6);
}

.todo-item + .todo-item {
  margin-top: var(--space-sm);
}

.todo-item__top {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
}

.todo-item__body {
  margin-top: var(--space-xs);
}

/* ===== NOTES LIST ===== */
.note-item {
  padding: var(--space-md);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.6);
}

.note-item + .note-item {
  margin-top: var(--space-sm);
}

.note-item__top {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
}

.note-item__body {
  margin-top: var(--space-xs);
}

/* ===== LIST CONTAINER ===== */
.notes-history__list {
  margin-top: var(--space-md);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 920px) {
  .todo-item__top,
  .note-item__top {
    flex-direction: column;
  }
}

/* =========================================================
   TOPBAR – ADAPTIVE NAV
   Keeps table nav on one row with horizontal scroll.
   LÄNKAR stays before Settings.
   ========================================================= */

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: nowrap;
  min-width: 0;
}

.topbar__brand {
  flex: 0 0 auto;
}

.topbar__nav,
#tableNav {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.topbar__nav::-webkit-scrollbar,
#tableNav::-webkit-scrollbar {
  height: 6px;
}

.topbar__nav::-webkit-scrollbar-thumb,
#tableNav::-webkit-scrollbar-thumb {
  background: rgba(16, 35, 58, 0.18);
  border-radius: 999px;
}

.topbar__nav .table-nav__link,
#tableNav .table-nav__link {
  flex: 0 0 auto;
  white-space: nowrap;
}

.topbar__user {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin-left: 0;
  padding-right: 0;
}

#linksButton,
.topbar__settings,
.topbar__user-badge {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 920px) {
  .topbar__inner {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .topbar__brand {
    width: 100%;
  }

  .topbar__nav,
  #tableNav {
    width: 100%;
    order: 2;
  }

  .topbar__user {
    width: 100%;
    order: 3;
    justify-content: flex-start;
  }

  #linksButton,
  .topbar__settings,
  .topbar__user-badge {
    width: auto;
  }
}


/* =========================================================
   RUTINER – DOCUMENT COLUMN WIDTH
   Exact selector for current codebase:
   the table that contains .rutiner-pdf-link is the RUTINER table,
   and the document column is the 2nd data column.
   ========================================================= */

.data-table:has(.rutiner-pdf-link) thead th:nth-child(2),
.data-table:has(.rutiner-pdf-link) tbody td:nth-child(2) {
  width: 34ch !important;
  min-width: 34ch !important;
  white-space: nowrap !important;
}

.data-table:has(.rutiner-pdf-link) tbody td:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table:has(.rutiner-pdf-link) .rutiner-pdf-link {
  display: inline-block !important;
  max-width: 100%;
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* =========================================================
   PRINT SUPPORT
   Browser Print can be used to save as PDF.
   ========================================================= */

@media print {
  .topbar,
  .filters,
  .view-actions,
  .row-actions,
  .overlay-modal,
  .toast {
    display: none !important;
  }

  body {
    background: #ffffff !important;
  }

  .page {
    padding: 0 !important;
  }

  .view-card {
    border: 0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
  }

  .view-card__header {
    padding: 0 0 14px !important;
  }

  .table-wrap {
    overflow: visible !important;
    padding: 0 !important;
  }

  .data-table {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: auto !important;
  }

  .data-table th,
  .data-table td {
    white-space: normal !important;
    color: #000000 !important;
  }

  .status-button,
  .cell-chip {
    border: 1px solid #999999 !important;
    background: #ffffff !important;
    color: #000000 !important;
  }
}


/* =========================================================
   OWNER BADGES
   Initial badge before first/key column text.
   Admin can change owner via dropdown.
   ========================================================= */

.owner-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.owner-cell__content {
  min-width: 0;
  flex: 1 1 auto;
}

.owner-cell__content .cell-text,
.owner-cell__content .cell-chip {
  min-width: 0;
}

.owner-badge {
  --owner-badge-bg: var(--text);
  --owner-badge-fg: var(--white);
  flex: 0 0 auto;
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(16, 35, 58, 0.14);
  background: var(--owner-badge-bg);
  color: var(--owner-badge-fg);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  text-align: center;
  box-shadow: 0 1px 2px rgba(16, 35, 58, 0.10);
}

.owner-badge--select {
  cursor: pointer;
  padding: 0 4px;
  appearance: none;
  -webkit-appearance: none;
  text-align: center;
  text-align-last: center;
  outline: none;
}

.owner-badge--select:hover,
.owner-badge--select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(187, 146, 87, 0.14);
}

@media print {
  .owner-badge {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #999999 !important;
    box-shadow: none !important;
  }
}


/* Modal close button – enhanced */
.modal-close,
.modal__close,
.modal-close-button,
button[aria-label="Close"],
button[aria-label="Stäng"] {
  font-size: 28px !important;
  width: 42px !important;
  height: 42px !important;
  line-height: 42px !important;
  border-radius: 50% !important;
  background: rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease;
  cursor: pointer;
}

/* Hover */
.modal-close:hover,
.modal__close:hover,
.modal-close-button:hover,
button[aria-label="Close"]:hover,
button[aria-label="Stäng"]:hover {
  background: rgba(0,0,0,0.12);
  transform: scale(1.05);
}

/* Active click */
.modal-close:active,
.modal__close:active,
.modal-close-button:active,
button[aria-label="Close"]:active,
button[aria-label="Stäng"]:active {
  transform: scale(0.95);
}

/* =========================================================
   OVERDUE DATE HIGHLIGHT
   ========================================================= */

.cell-text--overdue {
  color: #ff4d4f !important;
  font-weight: 700;
}

/* =========================================================
   GREEN COLOR SYSTEM - FINAL OVERRIDE
   Central source for all green/status-success usage.
   ========================================================= */

.data-table tbody tr.is-done td {
  background: var(--green-row-bg) !important;
}

.toast--success {
  background: var(--green-text) !important;
}

/* =========================================================
   COLUMN CHECKLISTS
   ========================================================= */

.column-checklist-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--green-text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  opacity: 0.78;
  vertical-align: baseline;
}

.column-checklist-badge:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.checklist-card {
  background: rgba(255, 255, 255, 0.62);
}

.checklist-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist-list__item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid rgba(222, 211, 189, 0.7);
}

.checklist-list__item:last-child {
  border-bottom: 0;
}

.checklist-list__mark {
  color: var(--green-text);
  font-weight: 800;
  line-height: 1.35;
}

.checklist-list__text {
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
}

/* =========================================================
   SETTINGS FORM ACTIONS
   Keep Spara/Rensa consistent and placed top-right in settings forms.
   ========================================================= */

.settings-form {
  position: relative;
  padding-top: 64px;
}

.settings-form > .detail-card__title {
  position: absolute;
  top: 22px;
  left: 22px;
  right: 190px;
  margin: 0;
}

.settings-form > .side-panel__footer {
  position: absolute;
  top: 16px;
  right: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

@media (max-width: 720px) {
  .settings-form {
    padding-top: 104px;
  }

  .settings-form > .detail-card__title {
    right: 22px;
  }

  .settings-form > .side-panel__footer {
    top: 54px;
    left: 22px;
    right: 22px;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* =========================================================
   MOCK MESSAGES MODULE
   ========================================================= */

.messages-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(198, 184, 154, 0.85);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.messages-button:hover {
  background: rgba(255, 255, 255, 0.92);
}

.messages-button__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--status-red-bg);
  color: var(--status-red-text);
  border: 1px solid var(--status-red-line);
  font-size: 12px;
  font-weight: 800;
}

.messages-list {
  display: grid;
  gap: 12px;
}

.message-card {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid rgba(222, 211, 189, 0.82);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
}

.message-card.is-unread {
  border-color: var(--green-line);
  box-shadow: 0 0 0 2px rgba(164, 184, 125, 0.16);
}

.message-card__top {
  display: grid;
  gap: 3px;
}

.message-card__title {
  color: var(--text);
  font-weight: 800;
}

.message-card__meta,
.message-card__context {
  color: var(--muted);
  font-size: 12px;
}

.message-card__context {
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(236, 230, 216, 0.72);
}

.message-card__body {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.message-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message-compose__context {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(236, 230, 216, 0.72);
  color: var(--muted);
  font-size: 13px;
}

.messages-button[data-messages-button="true"] {
  flex-shrink: 0;
}

/* v83 message UI refinements */

.message-card__row-link {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--green-text);
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

.message-card__row-link:hover {
  opacity: 0.82;
}

.message-recipient-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message-recipient-option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid rgba(198, 184, 154, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.message-recipient-option input {
  margin: 0;
}

/* v84 message reply UI */

.message-card__top {
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 10px;
  align-items: start;
}

.message-card__meta {
  grid-column: 1 / 2;
}

.message-card__reply {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  align-self: start;
  justify-self: end;
  padding: 5px 9px;
  border: 1px solid rgba(198, 184, 154, 0.85);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.message-card__reply:hover {
  background: rgba(255, 255, 255, 0.94);
}

/* v86 message header layout */

.message-card__top {
  grid-template-columns: minmax(0, 1fr) auto auto;
  column-gap: 12px;
  row-gap: 2px;
  align-items: center;
}

.message-card__title {
  min-width: 0;
}

.message-card__meta--header {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
  justify-self: end;
  white-space: nowrap;
}

.message-card__reply {
  grid-column: 3 / 4;
  grid-row: 1 / 2;
  align-self: center;
}

@media (max-width: 720px) {
  .message-card__top {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .message-card__meta--header {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    justify-self: start;
    white-space: normal;
  }

  .message-card__reply {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
  }
}

/* v87 messages: header-only inbox with read/open behavior */

.messages-section {
  display: grid;
  gap: 8px;
}

.messages-section + .messages-section {
  margin-top: 18px;
}

.messages-section__title {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.messages-section__empty {
  margin: 0;
  padding: 10px 2px;
  color: var(--muted);
  font-size: 13px;
}

.message-card--compact {
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.message-card__top-button {
  width: 100%;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto 24px;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.message-card__top-button:hover {
  background: rgba(255, 255, 255, 0.42);
}

.message-card__unread-mark {
  color: var(--green-text);
  font-size: 11px;
  line-height: 1;
}

.message-card__chevron {
  justify-self: end;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.message-card__expanded {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px 40px;
}

.message-card__actions--expanded {
  justify-content: flex-end;
}

.message-card.is-expanded {
  border-color: var(--green-line);
}

.message-card:not(.is-unread) .message-card__title {
  font-weight: 650;
}

@media (max-width: 720px) {
  .message-card__top-button {
    grid-template-columns: 16px minmax(0, 1fr) 24px;
  }

  .message-card__meta--header {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    justify-self: start;
    white-space: normal;
  }

  .message-card__chevron {
    grid-column: 3 / 4;
    grid-row: 1 / 3;
  }

  .message-card__expanded {
    padding-left: 38px;
  }
}


/* v88 message header alignment */

.message-card__top-button {
  grid-template-columns: 18px minmax(260px, 1fr) auto 24px;
}

.message-card__title {
  justify-self: start;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-card__meta--header {
  margin-left: auto;
  text-align: right;
}

/* v91 MSG header safe alignment */

.message-card__top-button {
  grid-template-columns: 18px minmax(0, 1fr) max-content 24px;
}

.message-card__top-button .message-card__title {
  grid-column: 2;
  justify-self: start;
  text-align: left;
  min-width: 0;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-card__top-button .message-card__meta--header {
  grid-column: 3;
  justify-self: end;
  margin-left: 12px;
  text-align: right;
  white-space: nowrap;
}

.message-card__top-button .message-card__chevron {
  grid-column: 4;
  justify-self: end;
}

@media (max-width: 720px) {
  .message-card__top-button {
    grid-template-columns: 16px minmax(0, 1fr) 24px;
  }

  .message-card__top-button .message-card__title {
    grid-column: 2;
    grid-row: 1;
  }

  .message-card__top-button .message-card__meta--header {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    margin-left: 0;
    text-align: left;
    white-space: normal;
  }

  .message-card__top-button .message-card__chevron {
    grid-column: 3;
    grid-row: 1 / 3;
  }
}

/* v93: remove stale topbar Links button, keep Settings > Länkar card */
.topbar .links-button,
.topbar [data-links-button="true"] {
  display: none !important;
}

/* v93: make MSG visible in topbar */
.topbar .messages-button,
.topbar [data-messages-button="true"] {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* v97 TODO quick filter */

.view-actions .secondary-button.is-active {
  background: var(--green);
  border-color: var(--green-line);
  color: var(--green-text);
}

/* v98 checklist edit state */

.detail-card__title.is-editing::after {
  content: "Ändrar befintlig";
  display: inline-flex;
  margin-left: 10px;
  padding: 3px 8px;
  border: 1px solid var(--green-line);
  border-radius: 999px;
  background: var(--green);
  color: var(--green-text);
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}

/* v99 checklist settings reload */

.settings-list__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.settings-list__header .detail-card__title {
  margin: 0;
}

/* v100 checklist admin visibility */

.settings-list__row--clickable .settings-list__info {
  cursor: pointer;
}

.settings-list__row--clickable .settings-list__info:hover .settings-list__title {
  text-decoration: underline;
}

/* =========================================================
   PROJECT VIEW v116
   Custom inline project/activity planning view.
   ========================================================= */

.project-view .view-card__header {
  align-items: flex-start;
}

.project-table-wrap {
  padding-top: 6px;
}

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

.project-table thead th {
  top: 0;
}

.project-row td {
  background: rgba(255, 255, 255, 0.32);
}

.project-row:hover td,
.project-activity-row:hover td {
  background: rgba(255, 255, 255, 0.54);
}

.project-activity-row td {
  background: rgba(251, 248, 241, 0.42);
  border-bottom-color: rgba(222, 211, 189, 0.48);
}

.project-activity-row td:first-child {
  padding-left: 48px;
}

.project-activity-add-row td {
  padding: 8px 12px 16px 48px;
  background: rgba(251, 248, 241, 0.36);
}

.project-title-wrap,
.project-inline-field,
.project-docs-field,
.project-date-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.project-title-wrap {
  gap: 10px;
}

.project-expand-button {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.project-expand-button:hover,
.project-date-button:hover,
.project-docs-open:hover {
  border-color: var(--accent);
}

.project-owner-prefix {
  min-width: 34px;
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--chip);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}

.project-inline-input,
.project-inline-select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 6px 8px;
  outline: none;
}

.project-inline-input:hover,
.project-inline-input:focus,
.project-inline-select:hover,
.project-inline-select:focus {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.72);
}

.project-inline-input--textarea {
  resize: vertical;
  min-height: 34px;
  line-height: 1.35;
}

.project-inline-input--url {
  font-size: 13px;
}

.project-inline-select {
  border-color: var(--line-strong);
  background: var(--white);
}

.project-date-button,
.project-docs-open {
  min-height: 32px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 10px;
}

.project-date-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.project-docs-field .project-inline-input {
  flex: 1 1 auto;
}

.project-docs-open {
  flex: 0 0 auto;
}

.project-inline-field.is-saving,
.project-date-field.is-saving {
  opacity: 0.72;
}

.project-activity-empty-cell {
  color: var(--muted);
}

.project-add-activity-button {
  width: auto;
}

@media (max-width: 920px) {
  .project-table {
    min-width: 1120px;
  }
}

/* =========================================================
   PROJECTS v117 adjustments
   ========================================================= */

.project-owner-prefix--select {
  appearance: none;
  border: 1px solid var(--line-strong);
  cursor: pointer;
  text-align: center;
  text-align-last: center;
  outline: none;
}

.project-owner-prefix--select:hover,
.project-owner-prefix--select:focus {
  border-color: var(--accent);
  background: var(--white);
}

.project-owner-prefix--select.is-saving {
  opacity: 0.72;
}


/* =========================================================
   PROJECT VIEW v118 refinements
   Align project-name header over inline field and give the
   project-name column more space.
   ========================================================= */

.project-table th:first-child,
.project-table td:first-child {
  width: 56ch;
}

.project-title-header {
  padding-left: 88px;
}

.project-title-cell .project-inline-field {
  flex: 1 1 auto;
  min-width: 0;
}

.project-title-cell .project-inline-input {
  min-width: 34ch;
}


/* =========================================================
   PROJECT VIEW v119 activity hierarchy
   Activity header row, stronger project/activity contrast,
   and clearer activity indentation.
   ========================================================= */

.project-row td {
  background: rgba(255, 255, 255, 0.72);
  border-top: 1px solid var(--line-strong);
  border-bottom-color: var(--line-strong);
  font-weight: 600;
}

.project-row .project-inline-input,
.project-row .project-inline-select,
.project-row .project-date-button,
.project-row .project-docs-open {
  font-weight: 600;
}

.project-activity-header-row td {
  padding: 10px 12px 8px;
  background: rgba(235, 228, 213, 0.72);
  border-bottom: 1px solid var(--line);
}

.project-activity-header-row td:first-child {
  padding-left: 78px;
}

.project-activity-header-label {
  display: inline-block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.project-activity-row td {
  background: rgba(251, 248, 241, 0.78);
  border-bottom-color: rgba(222, 211, 189, 0.58);
}

.project-activity-row td:first-child {
  padding-left: 78px;
  box-shadow: inset 3px 0 0 rgba(207, 190, 160, 0.72);
}

.project-activity-add-row td {
  padding-left: 78px;
  background: rgba(251, 248, 241, 0.62);
  box-shadow: inset 3px 0 0 rgba(207, 190, 160, 0.72);
}

.project-row:hover td {
  background: rgba(255, 255, 255, 0.86);
}

.project-activity-header-row:hover td,
.project-activity-row:hover td,
.project-activity-add-row:hover td {
  background: rgba(255, 255, 255, 0.58);
}


/* =========================================================
   PROJECT VIEW v121 activity add action
   Move the activity create action into the activity header.
   ========================================================= */

.project-activity-header-start {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.project-add-activity-button--header {
  min-height: 28px;
  padding: 6px 12px;
  font-size: 11px;
  line-height: 1;
}

.project-activity-header-row td:first-child {
  padding-left: 78px;
  box-shadow: inset 3px 0 0 rgba(207, 190, 160, 0.72);
}

/* =========================================================
   PROJECT VIEW v122 typography refinements
   Keep project/activity row text normal weight and make category compact.
   ========================================================= */

.project-row td,
.project-activity-row td {
  font-weight: 400;
}

.project-row .project-inline-input,
.project-row .project-inline-select,
.project-row .project-date-button,
.project-row .project-docs-open,
.project-activity-row .project-inline-input,
.project-activity-row .project-date-button {
  font-weight: 400;
}

.project-owner-prefix,
.project-owner-prefix--select,
.project-expand-button,
.project-activity-header-label,
.project-add-activity-button--header {
  font-weight: 700;
}

.project-category-select {
  font-size: 12px;
  padding-left: 8px;
  padding-right: 8px;
}

/* =========================================================
   PROJECT VIEW v123 refinements
   Cleaner expand affordance, document upload field and trash icon.
   ========================================================= */

.project-view .doc-link-dot {
  display: none !important;
}

.project-expand-button {
  width: 24px !important;
  height: 30px !important;
  flex: 0 0 24px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.project-expand-button:hover {
  background: transparent !important;
  color: var(--accent);
}

.project-docs-field {
  gap: 6px;
}

.project-docs-name {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-docs-name--empty {
  color: var(--muted);
}

.project-docs-native {
  display: none;
}

.project-delete-button {
  color: var(--danger);
  border-color: rgba(163, 75, 60, 0.35);
}

.project-delete-button:hover {
  border-color: var(--danger);
  background: rgba(163, 75, 60, 0.08);
}

.project-title-header {
  padding-left: 72px;
}

/* =========================================================
   v127 - SÄLJINTRO centered status/week inline editing
   ========================================================= */
.status-button--week {
  width: 100% !important;
  min-height: 34px !important;
  padding: 6px 8px !important;
  position: relative;
}

.status-week-cell {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  pointer-events: none;
}

.status-week-cell__date-trigger {
  pointer-events: auto;
  position: relative;
  border: 1px solid rgba(16, 35, 58, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.4em;
  min-height: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  color: currentColor;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  overflow: hidden;
}

.status-week-cell__date-label {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.status-week-cell__date-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  opacity: 0.001;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color-scheme: light;
}

.status-week-cell__date-input::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.status-week-cell__date-trigger:hover,
.status-week-cell__date-trigger:focus-visible {
  background: rgba(255, 255, 255, 0.72);
  outline: 1px solid rgba(16, 35, 58, 0.18);
  outline-offset: 1px;
}

.status-week-cell__date-trigger--empty {
  min-width: 2.4em;
}

.visually-hidden-date-input {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* =========================================================
   v134 - SÄLJINTRO status week range cells
   Two date zones inside the same status cell: left = from, right = to.
   ========================================================= */
.status-button--week-range {
  padding-left: 5px !important;
  padding-right: 5px !important;
}

.status-week-cell--range {
  display: grid;
  grid-template-columns: minmax(2.6em, 1fr) auto minmax(2.6em, 1fr);
  align-items: center;
  justify-items: center;
  width: 100%;
  gap: 3px;
}

.status-week-cell__range-separator {
  color: currentColor;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.52;
  pointer-events: none;
}

.status-week-cell--range .status-week-cell__date-trigger {
  min-width: 2.8em;
  max-width: 4em;
  padding-left: 5px;
  padding-right: 5px;
}

.status-week-cell__date-trigger--from {
  justify-self: start;
}

.status-week-cell__date-trigger--to {
  justify-self: end;
}

/* =========================================================
   v136 DESIGN inline editing refinements
   Multi-line table cells for the Design/UTVECKLING description.
   ========================================================= */

.cell-editor--textarea {
  min-height: 42px;
  resize: vertical;
  line-height: 1.35;
  padding-top: 8px;
  padding-bottom: 8px;
}

.cell-text--multiline {
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}


/* =========================================================
   v138 inline row actions for PRE Design and Design
   Keeps process actions available without reopening detail panels.
   ========================================================= */

.row-actions--inline {
  justify-content: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.row-actions--inline .row-actions__button {
  min-height: 30px;
  padding: 6px 9px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.row-actions--inline .row-actions__button--danger {
  min-width: 32px;
  padding-left: 8px;
  padding-right: 8px;
}
