/* ─── Design Tokens (theme.css) ─── */
@import url("css/theme.css");

/* ─── Print Styles (print.css) ─── */
@import url("css/print.css");

/* ─── Rich-Text Editor (rich-text.css) ─── */
@import url("css/rich-text.css");

/* ─── User/HR (user-hr.css) ─── */
@import url("css/user-hr.css");

/* ═══════════════════════════════════════════════════════════════════
   styles.css — base layout, components, and page-specific styles
   ═══════════════════════════════════════════════════════════════════ */


* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Source Sans 3", ui-sans-serif, system-ui, sans-serif;
  line-height: 1.45;
}

.login-page {
  min-height: 100vh;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  display: grid;
  gap: 20px;
  width: min(100%, 400px);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.login-panel > div {
  display: grid;
  gap: 4px;
}

.login-panel h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.login-panel p {
  margin: 6px 0 0;
  color: var(--muted);
}

.login-panel p.error {
  color: var(--danger);
}

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

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #0d100e;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 0 16px;
  transition: background 150ms ease, box-shadow 150ms ease, transform 80ms ease;
}

button:hover {
  background: var(--accent-dark);
  box-shadow: 0 2px 12px var(--accent-glow);
}

.button-link {
  align-items: center;
  border-radius: 8px;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  text-decoration: none;
  background: var(--accent);
  color: #0d100e;
  transition: background 150ms ease, box-shadow 150ms ease;
}

.secondary-button {
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--line);
}

.secondary-button:hover {
  background: var(--surface-hover);
}

.invoice-start-button {
  background: var(--accent);
  box-shadow: 0 4px 16px rgba(45, 184, 134, 0.2);
  color: #0d100e;
  white-space: nowrap;
}

.invoice-start-button:hover,
.invoice-start-button:focus-visible {
  background: var(--accent-dark);
}

.back-link {
  background: transparent;
  color: var(--muted);
  padding-inline: 6px;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 4px;
}

input {
  width: 100%;
  min-height: 51px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  padding: 12px;
  border-color: var(--line-strong);
}

textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  padding: 12px 14px;
}

textarea:focus {
  outline: 3px solid var(--accent-glow);
  outline-offset: 2px;
}

select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  padding: 0 12px;
  border-color: var(--line-strong);
  font: inherit;
}

/* Select-picker: native <select> hidden, trigger button shown */
.select-picker-wrapper {
  display: flex;
  align-items: center;
}

.select-picker-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

/* In form-grids (51px height context), the trigger should match input height */
.entry-row .select-picker-trigger,
.modal-form-grid .select-picker-trigger {
  min-height: 51px;
  height: 51px;
  width: 100%;
  max-width: none;
  font-size: 14px;
}

/* In compact-bar / filter-bar context: 36px, ellipsis truncation */
.compact-bar .select-picker-trigger,
.compact-filter-bar .select-picker-trigger {
  min-height: 36px;
  height: 36px;
  max-width: max-content;
  text-overflow: ellipsis;
  text-wrap: nowrap;
  overflow: clip;
}

/* Active state: soft accent like checked checkbox-fields */
.compact-filter-bar .select-picker-trigger.active,
.compact-bar .select-picker-trigger.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
  border-color: var(--accent);
}

/* Input sizing in compact contexts */
.compact-bar input[type="number"],
.compact-filter-bar input[type="number"] {
  max-width: 8em;
}

.compact-bar input[type="date"],
.compact-filter-bar input[type="date"] {
  min-width: 8.5em;
}

/* Div wrappers around inputs/buttons expand to content */
.compact-bar > div,
.compact-filter-bar > div {
  max-width: max-content;
  min-width: unset;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid var(--accent-glow);
  outline-offset: 2px;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

/* Custom scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Topbar + panel transitions */
.topbar,
.quick-entry,
.panel,
.metric {
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

header#app-topbar,
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  padding: 0 48px;
  background: rgba(22, 27, 24, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.topbar h1,
.section-header h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(24px, 2.4vw, 34px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

#system-status {
  display: none;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.menu-shell {
  position: relative;
}

.icon-menu-button {
  display: grid;
  place-items: center;
  width: 42px;
  padding: 0;
}

.hamburger-lines {
  display: grid;
  gap: 4px;
  width: 18px;
}

.hamburger-lines span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.app-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 110;
  display: grid;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  animation: modal-in 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.app-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 6px;
  color: var(--text);
  font-weight: 700;
  padding: 10px 12px;
  text-decoration: none;
  transition: background 120ms ease;
}

.app-menu a .menu-icon {
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 120ms ease;
}

.app-menu a:hover .menu-icon,
.app-menu a[aria-current="page"] .menu-icon {
  opacity: 1;
}

.app-menu a:hover,
.app-menu a[aria-current="page"] {
  background: var(--surface-muted);
}

/* Account menu items (buttons styled like links) */
.account-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  font-size: inherit;
  padding: 10px 12px;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease;
}

.account-menu-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.account-menu-item:hover svg {
  opacity: 1;
}

.account-menu-item:hover {
  background: var(--surface-muted);
}

/* Menu Builder hidden entries (uses dashboard-preview-items styling) */
.dashboard-preview-items li.menu-hidden {
  opacity: 0.45;
}

.dashboard-preview-items li.menu-hidden > span:first-child {
  text-decoration: line-through;
}

.icon-text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.payroll-expand-btn {
  min-width: 13em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.payroll-summary-inline {
  display: inline-flex;
  align-items: center;
  margin: 0 32px 0 auto;
  gap: 32px;
  flex-wrap: wrap;
  font-size: 0.9em;
}

.icon-text-button svg {
  flex-shrink: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* Override compact-bar's display:flex !important which has higher specificity */
.compact-bar > div.hidden,
.compact-filter-bar > div.hidden {
  display: none !important;
}

/* ─── Server-side role/addon visibility system ──────────────────────
   Visibility CSS is injected by topbar.ts before </head>.
   Only DISABLED addon elements and NON-OWNER restricted elements
   get display:none rules. Enabled addons are visible by default.

   [data-owner-only]  → display:none for non-owners (CSS rule injected server-side)
   [data-addon="xyz"] → display:none if addon "xyz" is disabled (per-addon rules)
   ────────────────────────────────────────────────────────────────── */

.layout {
  display: grid;
  gap: 24px;
  padding: 24px clamp(16px, 4vw, 48px) 56px;
}

.quick-entry,
.panel,
.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.quick-entry,
.panel {
  padding: 22px;
}

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

.section-header h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.section-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.inline-filter {
  display: grid;
  gap: 4px;
  min-width: 240px;
}

.inline-filter input,
.inline-filter select {
  min-height: 51px;
}

#entry-result {
  color: var(--muted);
  min-height: 22px;
  text-align: right;
}

#entry-result.error {
  color: var(--danger);
}

label:not(.checkbox-field) {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.entry-row {
  display: grid;
  grid-template-columns: 120px minmax(220px, 1.2fr) minmax(260px, 1.4fr) 170px 132px auto;
  gap: 14px;
  align-items: end;
}

.entry-row > div,
.date-filter > div:not(.preset-buttons):not(.date-filter-actions) {
  display: grid;
  gap: 4px;
}

.date-filter .inline-filter {
  min-width: 120px;
}

.date-filter-checkbox-field {
  min-width: auto;
}

.review-filters > div,
.user-form > div {
  display: grid;
  gap: 4px;
}

.settings-form {
  display: grid;
  gap: 16px;
}

.settings-page-form {
  columns: 2;
  column-gap: 18px;
}

.settings-page-form > .panel {
  break-inside: avoid;
  margin: 0 0 18px;
}


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

.settings-grid > div {
  display: grid;
  gap: 6px;
}

.settings-form > div {
  display: grid;
  gap: 6px;
}

.settings-prompt-field textarea,
.service-summary-field textarea {
  min-height: 150px;
  resize: vertical;
}

.service-summary-field {
  max-width: 680px;
}

.position-title-input {
  margin-bottom: 12px;
}

.position-title-input input {
  width: 100%;
}

.service-summary-input {
  position: relative;
}

.service-summary-input textarea {
  padding-bottom: 54px;
  width: 100%;
}

.service-summary-input button {
  bottom: 10px;
  min-height: 34px;
  padding: 0 12px;
  position: absolute;
  right: 10px;
}

.settings-actions {
  align-items: center;
  gap: 18px;
  display: flex;
  width: 100vw;
  position: fixed;
  bottom: 0;
  left: 0;
  margin: 0 !important;
  backdrop-filter: blur(5px) saturate(140%);
  padding: 18px;
  background: rgba(22, 27, 24, 0.82);
  border-top: 1px solid var(--line);
}

.settings-field-actions {
  display: flex;
  margin-top: 4px;
}

.settings-subsection {
  border-top: none;
  display: grid;
  gap: 12px;
  margin-top: 0px;
  padding-top: 18px;
}

.settings-subsection h3,
.settings-subsection p {
  margin: 0;
}

label.switch-field {
  align-items: center;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  gap: 12px;
  position: relative;
  user-select: none;
  width: fit-content;
}

.switch-field input {
  cursor: pointer;
  height: 100%;
  inset: 0;
  margin: 0;
  min-height: 0;
  opacity: 0;
  position: absolute;
  width: 100%;
  z-index: 1;
}

.switch-control {
  background: #3a423d;
  border-radius: 18px;
  flex: 0 0 auto;
  height: 26px;
  position: relative;
  transition: background 160ms ease;
  width: 46px;
}

.switch-control::after {
  background: #f0f5f1;
  border-radius: 50%;
  content: "";
  height: 20px;
  left: 3px;
  position: absolute;
  top: 3px;
  transition: transform 160ms ease;
  width: 20px;
}

.switch-field input:checked + .switch-control {
  background: var(--accent);
}

.switch-field input:checked + .switch-control::after {
  transform: translateX(20px);
}

.switch-field input:focus-visible + .switch-control {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.invoice-number-settings {
  margin-top: 18px;
  max-width: 760px;
}

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

.invoice-number-form > div {
  display: grid;
  gap: 6px;
}

.invoice-number-form [role="status"] {
  grid-column: 1 / -1;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin: 0;
  color: var(--text);
  font-weight: 700;
}

.checkbox-field input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
}

.compact-checkbox {
  height: 16px;
  margin: 0;
  min-height: 0;
  width: 16px;
}

label.compact-checkbox {
  font-size: 14px;
  width: auto;
}

/* ─── Paid cell: inline date input + checkbox in table row ─── */
.paid-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.inline-date-input {
  height: 30px;
  min-height: 30px;
  width: 130px;
  font-size: 12px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--text);
  cursor: pointer;
}

.inline-date-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.paid-date-locked {
  font-size: 12px;
  color: var(--accent-dark);
  font-weight: 600;
  padding: 4px 8px;
  background: var(--accent-soft);
  border-radius: 6px;
  border: 1px solid var(--accent);
}

/* Checkbox inside paid-cell: compact, no label text */
.paid-cell .checkbox-field {
  min-height: 30px;
  gap: 0;
}

.date-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
  padding: 14px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.date-filter-actions {
  display: flex;
  justify-content: flex-end;
  align-items: end;
  flex-shrink: 0;
}

.date-filter-checkbox {
  min-height: 51px;
}

.date-filter-actions .icon-text-button {
  min-height: 42px;
  white-space: nowrap;
}

.user-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.review-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 260px));
  gap: 10px;
  margin-bottom: 14px;
}

.preset-buttons {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0;
  flex: 0 0 auto;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
}

.preset-buttons button {
  min-height: 36px;
  height: 36px;
  border: none;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface-muted);
  color: var(--muted);
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.preset-buttons button:last-child {
  border-right: 0;
}

.preset-buttons button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.preset-buttons .active-filter {
  background: var(--accent);
  color: #0d100e;
  font-weight: 700;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.metric {
  min-height: 104px;
  padding: 20px;
  border-top: 3px solid var(--accent);
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, var(--accent-soft), transparent 60%);
  pointer-events: none;
  opacity: 0.6;
}

.metric-link {
  color: inherit;
  text-decoration: none;
}

.metric-link:hover,
.metric-link:focus-visible {
  border-color: rgba(31, 122, 91, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.metric-warning {
  border-top-color: #f44336;
}

.metric-warning::before {
  background: radial-gradient(circle at top right, rgba(244, 67, 54, 0.12), transparent 60%);
}

.metric-warning:hover,
.metric-warning:focus-visible {
  border-color: rgba(244, 67, 54, 0.45);
}

.metric span {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.compact-summary {
  margin: 18px 0;
}

/* Quick Entry Upload Button — removed, now uses standard icon-text-button */

/* Compact inputs for quick-entry bars */
.compact-bar .compact-input {
  min-height: 36px;
  height: 36px;
  width: 100%;
  font-size: 13px;
  padding: 0 8px;
}

/* Quick-entry section: no own panel styling, lives inside a parent panel */
section.quick-entry {
  padding: 0;
  border: none;
  box-shadow: none;
}

/* Quick-entry as standalone panel (like projects-time page) */
.quick-entry-panel {
  margin-bottom: 20px;
}
.quick-entry-panel .section-header {
  margin-bottom: 14px;
}
.quick-entry-panel .entry-row.compact-bar {
  gap: 10px;
}

.vat-hint {
  font-size: 11px;
  line-height: 1;
  margin-top: 2px;
  display: block;
}

.notice {
  border-radius: 8px;
  margin-top: 14px;
  padding: 12px 14px;
}

.notice.warning {
  background: rgba(255, 196, 64, 0.1);
  border: 1px solid rgba(255, 196, 64, 0.3);
  color: #ffc840;
}

.invoice-actions {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 18px;
}

.invoice-actions label {
  align-self: center;
  margin-right: -4px;
}

.invoice-editor-row {
  align-items: end;
  display: grid;
  grid-template-columns: 170px 1fr auto;
  gap: 12px;
  margin-top: 18px;
}

.invoice-editor-row > div {
  display: grid;
  gap: 4px;
}

.invoice-editor-row > .invoice-actions {
  justify-self: end;
}

.compact-action {
  min-height: 36px;
  padding-inline: 12px;
}

.invoice-detail-page {
  background: var(--bg);
}

.invoice-detail-layout {
  display: grid;
  gap: 18px;
  justify-items: center;
  padding: 24px;
}

.invoice-status-banner {
  width: min(100%, 210mm);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 800;
  padding: 12px 16px;
}

.invoice-status-banner.status-paid {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.invoice-status-banner.status-canceled {
  border-color: var(--danger);
  color: var(--danger);
}

.invoice-document {
  width: min(100%, 210mm);
  min-height: 297mm;
  padding: 45mm 20mm 14mm 25mm;
  background: #fff;
  color: #111;
  box-shadow: 0 10px 35px rgba(24, 32, 27, 0.14);
  font-family: "Source Sans 3", sans-serif;
  font-size: 11.5pt;
  line-height: 1.35;
  position: relative;
}

.invoice-birds {
  height: auto;
  position: absolute;
  right: 27mm;
  top: 19mm;
  width: 42mm;
}

.invoice-letterhead {
  display: grid;
  grid-template-columns: minmax(0, 80mm) minmax(0, 65mm);
  gap: 20mm;
}

.sender-return-address {
  margin: 0;
  font-size: 8.5pt;
  display: block;
  height: 17.7mm;
  padding-bottom: 3mm;
  align-content: end;
}

.invoice-recipient {
  height: 45mm;
}

.invoice-recipient address {
  display: grid;
  font-size: 12pt;
  font-style: normal;
}

.invoice-sender {
  padding-top: 5mm;
}

.invoice-sender > strong {
  display: block;
  margin-bottom: 5mm;
  font-size: 12pt;
  font-weight: 600;
}

.invoice-sender dl,
.invoice-sender dd {
  margin: 0;
}

.invoice-sender dl {
  display: grid;
  gap: 0;
  font-size: 10pt;
}

.invoice-sender dl > div {
  display: grid;
  grid-template-columns: 18mm minmax(0, 1fr);
}

.invoice-sender dd {
  white-space: nowrap;
}

.invoice-sender dt {
  font-weight: 400;
}

.invoice-date-row {
  margin-top: 5mm;
}

.invoice-content h2 {
  margin: 8.25mm 0;
  font-size: 13pt;
}

.invoice-content > p {
  margin: 0 0 10mm;
}

.invoice-content td {
  letter-spacing: 0;
}

.invoice-content th {
  letter-spacing: 0;
}

.invoice-position-table {
  min-width: 0;
  font-size: 11.5pt;
}

.invoice-position-table th,
.invoice-position-table td {
  border-color: #333;
  padding: 2.5mm 2mm;
  vertical-align: top;
}

.invoice-position-table th {
  color: #111;
  font-size: 9pt;
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  padding-bottom: 1mm;
}

.invoice-position-table tr th:first-of-type,
.invoice-position-table tr td:first-of-type {
  padding-left: 0;
  max-width: 6ch;
}

.invoice-position-table tr th:last-of-type,
.invoice-position-table tr td:last-of-type {
  padding-right: 0;
}

.invoice-position-table th:first-child {
  width: 11mm;
}

.invoice-position-table th:nth-child(2) {
  width: 22mm;
}

.invoice-position-table th:nth-child(4),
.invoice-position-table th:nth-child(5) {
  width: 27mm;
}

.invoice-service-summary {
  margin-top: 1.5mm;
  font-size: 9pt;
  font-style: italic;
  white-space: pre-line;
}

.invoice-position-title {
  display: block;
  font-size: 11.5pt;
  font-style: normal;
  font-weight: 400;
}

.invoice-position-table small {
  display: block;
  margin-top: 1.5mm;
  font-size: 9pt;
  font-style: italic;
}

.invoice-position-table tfoot th,
.invoice-position-table tfoot td {
  border-bottom: 0;
}

.invoice-position-table tfoot th {
  text-align: right;
}

.invoice-position-table .invoice-grand-total th,
.invoice-position-table .invoice-grand-total td {
  border-top: 1px solid #333;
  font-size: 11.5pt;
  font-style: normal;
  font-weight: 400;
}

.invoice-position-table .invoice-grand-total td {
  font-weight: 600;
}

.invoice-footer-copy {
  margin-top: 12mm;
}

.invoice-footer-copy p {
  margin: 0 0 6mm;
  white-space: pre-line;
}

.invoice-closing-block {
  position: relative;
  break-inside: avoid;
  page-break-inside: avoid;
  min-height: 32mm;
  padding-right: 34mm;
}

.invoice-epc-qr {
  position: absolute;
  bottom: -1.5mm;
  right: -2.5mm;
  width: 30mm;
  height: 30mm;
}

/* ═══ Incoming Invoice QR Modal ═══ */

.ii-qr-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 0;
}

.ii-qr-content #ii-qr-image {
  display: block;
  width: 220px;
  height: 220px;
  margin: 0 auto;
  background: #fff;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.ii-qr-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  margin: 0;
}

.ii-qr-details > div {
  display: contents;
}

.ii-qr-details dt {
  font-size: 13px;
  color: var(--text-muted, #777);
  align-self: center;
}

.ii-qr-details dd {
  margin: 0;
  font-size: 14px;
  word-break: break-all;
}

.invoice-signature {
  display: block;
  height: auto;
  margin: 7mm 0 6mm;
  width: 27mm;
}

#invoice-signature-name,
.invoice-signature-name {
  margin-top: 0;
}

.invoice-source-panel {
  width: min(100%, 210mm);
}

/* ═══ Multi-Position Invoice Editor ═══ */

.invoice-position-section {
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.invoice-position-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.invoice-position-header h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}

.invoice-position-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.invoice-position-section .table-wrap {
  margin: 0 0 12px;
}

.invoice-position-section .service-summary-field {
  margin-top: 8px;
}

.invoice-add-position-row {
  display: flex;
  justify-content: flex-start;
  padding: 16px 0;
}

/* Drag & Drop states */
.invoice-position-table-edit tr[draggable="true"] {
  cursor: grab;
}

.invoice-position-table-edit tr.dragging {
  opacity: 0.4;
}

.invoice-position-table-edit.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

.position-move-select {
  min-height: 28px;
  font-size: 12px;
  padding: 2px 6px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-controls button {
  min-height: 36px;
  padding: 0 10px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

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

.customers-table {
  min-width: 780px;
}

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

/* Zebra striping for data tables */
tbody tr:nth-child(even):not(.section-row):not(.section-total-row):not(.empty-row):not(.editing-row) td {
  background: rgba(255, 255, 255, 0.018);
}

/* Smooth hover on data rows */
tbody tr:not(.section-row):not(.empty-row) td {
  transition: background 120ms ease;
}

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

.number {
  text-align: right;
  white-space: nowrap;
}

.section-row td {
  background: var(--surface-hover);
  border-bottom: 1px solid var(--line);
  border-top: 14px solid transparent;
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.06em;
  padding-top: 16px;
  padding-bottom: 16px;
  text-transform: uppercase;
}

.section-row span {
  color: var(--muted);
  font-size: 12px;
  margin-left: 8px;
}

.section-total-row td {
  background: var(--surface-muted);
  border-bottom: 0;
  color: var(--text);
  font-weight: 800;
}

.project-row {
  cursor: pointer;
  transition: background 120ms ease;
}

.customer-row {
  cursor: pointer;
  transition: background 120ms ease;
}

.project-row:hover td,
.project-row:focus td {
  background: var(--surface-hover) !important;
}

.customer-row:hover td,
.customer-row:focus td {
  background: var(--surface-hover) !important;
}

/* Unified expandable row styles — customers-table & projects-table */
.customer-row[aria-expanded="true"] td,
.customer-row[aria-expanded="true"]:hover td,
.customer-row[aria-expanded="true"]:focus td,
.project-row[aria-expanded="true"] td,
.project-row[aria-expanded="true"]:hover td,
.project-row[aria-expanded="true"]:focus td {
  background: var(--detail-bg) !important;
  border-top: 3px solid var(--accent);
}

.customer-row[aria-expanded="true"] td:first-of-type,
.project-row[aria-expanded="true"] td:first-of-type {
  border-left: 3px solid var(--accent);
}

.customer-row[aria-expanded="true"] td:last-of-type,
.project-row[aria-expanded="true"] td:last-of-type {
  border-right: 3px solid var(--accent);
}

.project-row:focus,
.customer-row:focus {
  outline: 3px solid var(--accent-glow);
  outline-offset: -3px;
}

/* Row expander icon — Material Design keyboard_arrow icons via CSS mask */
.row-expander {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 6px;
  vertical-align: middle;
  background: var(--accent-dark);
  -webkit-mask-image: url("/resources/keyboard_arrow_right_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/keyboard_arrow_right_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  mask-repeat: no-repeat;
  flex-shrink: 0;
}

.customer-row[aria-expanded="true"] .row-expander,
.project-row[aria-expanded="true"] .row-expander {
  -webkit-mask-image: url("/resources/keyboard_arrow_up_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/keyboard_arrow_up_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

/* Unified details row styles — customers-table & projects-table */
.project-details-row td,
.customer-details-row td {
  background: var(--detail-bg) !important;
  padding: 24px 10px 24px 34px;
  border-bottom: 2px solid var(--accent);
  border-left: 3px solid var(--accent);
  border-right: 3px solid var(--accent);
}

.customer-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.customer-details-main {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  width: 100%;
}

.customer-detail {
  min-width: 150px;
  max-width: 360px;
}

.customer-detail-wide {
  flex-basis: 280px;
}

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

.customer-detail strong {
  display: block;
  margin-top: 4px;
  font-weight: 600;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.customer-detail-actions {
  align-self: flex-end;
  margin-left: auto;
}

.customer-detail-information,
.customer-detail-tasks,
.project-detail-information,
.project-detail-tasks {
  display: grid;
  gap: 8px;
  width: 100%;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--detail-border);
  justify-content: start;
  justify-items: start;
}

.customer-detail-information > span,
.customer-detail-tasks > span,
.project-detail-information > span,
.project-detail-tasks > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.project-details {
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  gap: 6px;
  background: transparent;
}

.project-detail-actions {
  display: flex;
  gap: 8px;
  align-items: end;
  margin-left: auto;
}

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

.project-details strong {
  display: block;
  margin-top: 4px;
}

.empty-row td {
  color: var(--muted);
  padding: 32px 10px;
  text-align: center;
  font-size: 14px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.actions-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.number-cell {
  text-align: right;
  white-space: nowrap;
}

.user-edit-name {
  display: grid;
  gap: 6px;
  min-width: 220px;
  grid-template-columns: 1fr 1fr;
}

.icon-button {
  min-height: 34px;
  padding: 0 10px;
}

.icon-only-button {
  display: inline-grid;
  width: 38px;
  min-height: 38px;
  padding: 0;
  place-items: center;
  border-radius: 8px;
}

.pagination-controls .icon-only-button {
  padding: 0;
}

.button-icon {
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
}

.table-value-icon {
  display: inline-block;
  vertical-align: middle;
}

.edit-icon {
  -webkit-mask-image: url("/resources/edit_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/edit_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.delete-icon {
  -webkit-mask-image: url("/resources/delete_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/delete_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.visibility-icon {
  -webkit-mask-image: url("/resources/visibility_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/visibility_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.qr-icon {
  -webkit-mask-image: url("/resources/qr_code_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/qr_code_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.close-icon {
  -webkit-mask-image: url("/resources/close_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/close_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.download-icon {
  -webkit-mask-image: url("/resources/file_save_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/file_save_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.undo-icon {
  -webkit-mask-image: url("/resources/undo_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/undo_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.euro-symbol-icon {
  -webkit-mask-image: url("/resources/euro_symbol_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/euro_symbol_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.close-icon {
  -webkit-mask-image: url("/resources/close_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/close_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.backward-icon {
  -webkit-mask-image: url("/resources/arrow_back_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/arrow_back_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.forward-icon {
  -webkit-mask-image: url("/resources/arrow_forward_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/arrow_forward_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.add-notes-icon {
  -webkit-mask-image: url("/resources/add_notes_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/add_notes_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.event-note-icon {
  -webkit-mask-image: url("/resources/event_note_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/event_note_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.block-icon {
  -webkit-mask-image: url("/resources/block_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/block_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.lock-reset-icon {
  -webkit-mask-image: url("/resources/lock_reset_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/lock_reset_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.bullet-list-icon {
  -webkit-mask-image: url("/resources/format_list_bulleted_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/format_list_bulleted_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.numbered-list-icon {
  -webkit-mask-image: url("/resources/format_list_numbered_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/format_list_numbered_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.check-icon {
  -webkit-mask-image: url("/resources/check_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
  mask-image: url("/resources/check_24dp_E3E3E3_FILL0_wght400_GRAD0_opsz24.svg");
}

.task-status-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.task-status-button .button-icon {
  width: 18px;
  height: 18px;
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239, 107, 107, 0.25);
}

.danger-button:hover {
  background: rgba(239, 107, 107, 0.2);
}

.compact-input {
  min-height: 36px;
  padding: 0 8px;
}

.number-input {
  text-align: right;
}

.editing-row td {
  background: var(--surface-hover);
  vertical-align: middle;
}

.badge {
  align-self: start;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
  text-transform: uppercase;
}

.modal {
  min-width: min(92vw, 1024px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.invoice-confirm-modal {
  width: min(96vw, 1060px);
  max-width: none;
  height: 94vh;
  max-height: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.invoice-confirm-modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.invoice-confirm-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  background: var(--surface);
}

.invoice-confirm-header,
.invoice-confirm-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
}

.invoice-confirm-header {
  border-bottom: 1px solid var(--line);
}

.invoice-confirm-header h2,
.invoice-confirm-header p {
  margin: 0;
}

.invoice-confirm-actions {
  border-top: 1px solid var(--line);
}

.invoice-confirm-scroll {
  overflow: auto;
  padding: 18px;
  background: var(--bg);
}

.invoice-document-preview {
  margin: 0 auto;
}

.customer-modal {
  width: min(94vw, 780px);
}

.work-schedule-modal {
  width: min(96vw, 860px);
}

.work-contract-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(210px, 1fr) minmax(180px, 1fr);
  gap: 14px;
  align-items: end;
}

.work-contract-grid > div {
  display: grid;
  gap: 4px;
}

.input-with-suffix {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.input-with-suffix > span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.work-contract-period {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 51px;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.work-contract-period legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.work-contract-period label:not(.checkbox-field) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 14px;
}

.work-schedule-table {
  min-width: 720px;
}

.work-schedule-table input {
  min-width: 112px;
}

.work-schedule-table .schedule-duration {
  color: var(--text);
  background: var(--surface-muted);
  cursor: default;
}

.work-schedule-hint {
  margin: -4px 0 0;
}

.meat-items-table {
  min-width: 580px;
}

.meat-items-table input,
.meat-items-table select {
  min-width: 100px;
}

.meat-items-table td:last-child {
  width: 40px;
  text-align: center;
}

.work-time-sheet-modal {
  width: min(98vw, 1320px);
}

.work-time-sheet-toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.work-time-sheet-toolbar > div {
  display: grid;
  gap: 4px;
}

.work-time-sheet-toolbar .badge {
  align-self: center;
  margin-left: auto;
}

.confirmed-badge {
  background: rgba(45, 184, 134, 0.2);
}

.work-time-sheet-scroll {
  display: grid;
  gap: 14px;
}

.work-time-sheet-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
}

.work-time-sheet-summary > div {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.work-time-sheet-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.work-time-sheet-summary strong {
  font-size: 20px;
}

.work-time-sheet-table {
  min-width: 1240px;
}

.work-time-sheet-table th:first-child {
  min-width: 150px;
}

.work-time-sheet-table th small {
  display: block;
  max-width: 170px;
  color: var(--accent-dark);
  font-weight: 600;
  white-space: normal;
}

.work-time-sheet-table select {
  min-width: 145px;
}

.work-time-sheet-table input[type="time"] {
  min-width: 112px;
}

.work-time-sheet-table input[type="number"] {
  width: 88px;
}

.sheet-note-input {
  min-width: 190px;
}

.positive-balance {
  color: var(--accent-dark) !important;
}

.negative-balance {
  color: var(--danger) !important;
}

.customer-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-height: 65vh;
  overflow-y: auto;
  padding: 2px;
}

.customer-form-grid > div {
  display: grid;
  gap: 4px;
}

.customer-form-wide {
  grid-column: 1 / -1;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
}

.modal-panel {
  display: grid;
  gap: 16px;
  padding: 22px;
  background: var(--surface);
}

.member-list {
  display: grid;
  gap: 8px;
  max-height: 45vh;
  overflow: auto;
}

.member-option {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 120ms ease;
}

.member-option:hover {
  border-color: var(--line-strong);
}

.member-option small {
  display: block;
  color: var(--muted);
  font-weight: 600;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Always push save button to the trailing edge,
   even when space-between can't (3+ buttons, single button, etc.) */
.modal-actions .btn-save {
  margin-left: auto;
}

.modal-button-row {
  display: flex;
  gap: 8px;
}

.project-details-main {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.information-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.information-chip {
  min-height: 34px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
  font: inherit;
  text-align: left;
}

.information-chip:hover {
  background: var(--surface-hover);
}

.task-list {
  display: grid;
  gap: 8px;
  width: 100%;
}

.task-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--detail-border);
  border-radius: 10px;
  background: var(--surface-muted);
  transition: border-color 120ms ease, background 120ms ease;
}

.task-row:hover {
  border-color: var(--accent-glow);
}

.task-row.task-done {
  opacity: 0.78;
}

.task-row.task-done .task-title-button {
  text-decoration: line-through;
}

.task-row-main {
  display: grid;
  grid-template-columns: 1fr max-content;
  gap: 6px;
  min-width: 400px;
  align-items: center;
}

.task-title-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.task-title-button:hover {
  color: var(--text);
  background: transparent;
}

.page-tab-tasks .task-title-button:hover {
  box-shadow: none;
}

.task-table-sections {
  display: grid;
  gap: 20px;
}

/* ─── Compact filter bar ───────────────────────────────────────────
   Pill-style inline filters: no external labels, 36px height.
   Two variants:
   - .filter-trigger-button → opens a modal picker (project/customer)
   - .preset-buttons        → inline preset buttons (link type/date ranges)
   ────────────────────────────────────────────────────────────────── */
.compact-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.compact-filter {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* Selects + inputs inside compact-filter-bar: 36px height */
.compact-filter-bar select,
.compact-filter-bar input[type="text"],
.compact-filter-bar input[type="number"],
.compact-filter-bar input[type="date"],
.compact-filter-bar input:not([type]) {
  min-height: 36px;
  height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

/* Selects in compact-filter-bar nicht übermäßig breit werden lassen */
.compact-filter-bar select {
  max-width: 200px;
}

/* Date range group: Von – Bis in one visual unit */
.date-range-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.date-range-separator {
  color: var(--muted);
  font-size: 13px;
  user-select: none;
}

/* Checkbox fields in compact-filter-bar + compact-bar: toggle button style */
.compact-filter-bar .checkbox-field,
.compact-filter-bar .date-filter-checkbox,
.compact-bar .checkbox-field {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  height: 36px;
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

/* Hide the native checkbox — the label itself is the toggle */
.compact-filter-bar .checkbox-field input[type="checkbox"],
.compact-bar .checkbox-field input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 0;
  height: 0;
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

.compact-filter-bar .checkbox-field:hover,
.compact-bar .checkbox-field:hover {
  background: var(--surface-hover);
}

/* Toggled-on state: subtle accent tint (soft bg, bright text, accent border) */
.compact-filter-bar .checkbox-field:has(input:checked),
.compact-bar .checkbox-field:has(input:checked) {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
  border-color: var(--accent);
}

/* Prevent hover from washing out the checked state */
.compact-filter-bar .checkbox-field:has(input:checked):hover,
.compact-bar .checkbox-field:has(input:checked):hover {
  background: var(--accent-glow);
}

/* Action buttons: 36px */
.compact-filter-bar .icon-text-button,
.compact-filter-bar .date-filter-actions .icon-text-button {
  min-height: 36px;
  height: 36px;
  white-space: nowrap;
}

/* Trigger button: opens a filter-picker modal */
.filter-trigger-button {
  height: 36px;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--muted);
  padding: 0 28px 0 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
  transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a958f' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.filter-trigger-button:hover {
  border-color: var(--text);
  color: var(--text);
}

.filter-trigger-button:focus,
.filter-trigger-button.active:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-trigger-button.active {
  border-color: var(--accent);
  color: var(--text);
  background-color: var(--accent-soft);
}

/* ─── Compact bar: 36px unified height for date-filter + entry-row ──
   Applied via .compact-bar modifier on existing containers.
   Eliminates external labels; uses placeholder/aria-label instead.
   ────────────────────────────────────────────────────────────────── */
.compact-bar {
  align-items: center;
}

/* Selects + inputs inside .compact-bar: 36px height, no grid label row */
.compact-bar select,
.compact-bar input[type="text"],
.compact-bar input[type="number"],
.compact-bar input[type="date"],
.compact-bar input:not([type]) {
  min-height: 36px;
  height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

.compact-bar input[type="date"] {
  width: auto;
  min-width: 130px;
}

/* Grid cells inside compact-bar lose their label gap */
.compact-bar > div {
  display: flex !important;
  align-items: center;
  gap: 6px;
}

/* Labels inside compact-bar: inline, not above */
.compact-bar label:not(.checkbox-field):not(.compact-checkbox) {
  display: inline;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  width: auto;
}

/* Checkbox fields: toggle styling covered by .compact-filter-bar + .compact-bar rules above */

/* Action buttons inside compact-bar: 36px */
.compact-bar .icon-text-button,
.compact-bar .date-filter-actions .icon-text-button {
  min-height: 36px;
  height: 36px;
  white-space: nowrap;
}

/* ─── Quick entry compact ──────────────────────────────────────────
   .entry-row.compact-bar: single-row flex, 36px height, inline labels
   ────────────────────────────────────────────────────────────────── */
.entry-row.compact-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Description field (3rd child) grows to fill available space */
.entry-row.compact-bar > div:nth-child(3) {
  flex: 1 1 200px;
  min-width: 200px;
}

.entry-row.compact-bar button[type="submit"] {
  min-height: 36px;
  height: 36px;
  padding: 0 18px;
  font-size: 13px;
  white-space: nowrap;
}

/* ─── Filter picker modal ────────────────────────────────────────── */
.filter-picker-modal {
  width: min(92vw, 520px);
  min-width: 0;
  max-width: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.filter-picker-shell {
  display: grid;
  gap: 0;
  background: var(--surface);
}

.filter-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
}

.filter-picker-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.filter-picker-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}

.filter-picker-close:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.filter-picker-search {
  padding: 0 18px 12px;
}

.filter-picker-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  padding: 0 14px;
  font: inherit;
  font-size: 14px;
}

.filter-picker-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-picker-list {
  max-height: min(50vh, 380px);
  overflow-y: auto;
  padding: 0 12px 12px;
}

.filter-picker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  gap: 8px;
}

.filter-picker-option:hover {
  background: var(--surface-hover);
}

.filter-picker-option.highlighted {
  background: var(--surface-muted);
}

.filter-picker-option.selected {
  color: var(--accent-dark);
  font-weight: 600;
}

.filter-picker-check {
  color: var(--accent);
  font-size: 14px;
  flex-shrink: 0;
}

.filter-picker-option span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-picker-empty {
  padding: 20px 18px;
  text-align: center;
  font-size: 14px;
}

.task-overview-table {
  min-width: 920px;
}

.task-overview-table .task-title-button {
  max-width: 100%;
}

.task-table-context {
  margin-top: 2px;
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-status-cell {
  /* td must remain display:table-cell for proper row-height alignment;
     the flex layout lives in the inner wrapper. */
}

.task-status-cell-inner {
  align-items: center;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  min-height: 100%;
}

.task-done-table .task-table-row {
  opacity: 0.78;
}

.task-done-table .task-title-button {
  text-decoration: line-through;
}

.task-meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-view-heading {
  flex-grow: 1;
  min-width: 0;
}

.task-view-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.task-view-title-row #task-view-title {
  min-width: 0;
}

.task-view-badges {
  justify-content: flex-end;
  margin-left: auto;
}

.task-meta-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.task-meta-badge.task-meta-done {
  background: var(--accent-soft);
}

.task-status-toggle {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  min-height: 0;
}

.information-view-body {
  display: grid;
  gap: 14px;
}

.information-content {
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.information-attachment,
.information-inline-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
}

.information-attachment a,
.information-inline-attachment a {
  color: var(--accent-dark);
  font-weight: 600;
}

@media (max-width: 860px) {
  .topbar,
  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-actions,
  .modal-actions,
  .modal-button-row,
  .invoice-confirm-header,
  .invoice-confirm-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 42px 1fr 1fr;
  }

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

  .entry-row,
  .date-filter,
  .invoice-editor-row,
  .invoice-number-form,
  .project-details,
  .review-filters,
  .settings-page-form,
  .settings-grid,
  .user-form,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .work-contract-grid {
    grid-template-columns: 1fr;
  }

  .invoice-detail-layout {
    padding: 12px;
  }

  .invoice-document {
    min-height: 0;
    padding: 24px;
  }

  .invoice-letterhead {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .sender-return-address {
    margin-top: 20px;
  }

  .invoice-sender {
    padding-top: 0;
  }

  .invoice-birds {
    display: block;
    margin-left: auto;
    position: static;
    width: 130px;
  }

  .customer-form-grid {
    grid-template-columns: 1fr;
  }

  .customer-form-wide {
    grid-column: auto;
  }

  #entry-result {
    text-align: left;
  }
}


@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Dialog backdrop animation */
dialog.modal[open],
dialog.invoice-confirm-modal[open] {
  animation: modal-in 200ms cubic-bezier(0.16, 1, 0.3, 1);
}


.task-modal {
  width: min(96vw, 1120px);
}

.task-modal-panel {
  width: min(96vw, 1120px);
}

.task-view-layout,
.task-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 18px;
  align-items: start;
}

.task-main-form-grid {
  max-height: 68vh;
}

.task-notes-sidebar {
  display: grid;
  gap: 10px;
  align-content: start;
  height: 100%;
  max-height: 68vh;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-muted);
}

.task-notes-header {
  position: sticky;
  top: -12px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0 8px;
  background: var(--surface-muted);
  color: var(--text);
  font-weight: 700;
}

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

.task-note-item,
.task-note-editor-item {
  display: grid;
  grid-template-rows: max-content 1fr;
  gap: 8px;
  height: fit-content;
  max-height: 230px;
  overflow-y: auto;
  align-self: start;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.task-note-title-stack {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.task-note-title-input {
  min-width: 0;
  overflow: hidden;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-note-title-input:focus {
  outline: none;
}


.task-note-content-input {
  display: -webkit-box;
  width: 100%;
  height: 3.1rem;
  min-height: 0;
  overflow: hidden;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  resize: none;
  text-align: start;
  vertical-align: top;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.task-note-content-input:focus {
  outline: none;
}

.task-note-editor-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.task-note-editor-item textarea {
  min-height: 86px;
  resize: vertical;
}

.task-notes-empty {
  margin: 0;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  text-align: center;
}

@media (max-width: 860px) {
  .task-view-layout,
  .task-form-layout {
    grid-template-columns: 1fr;
  }

  .task-notes-sidebar {
    max-height: 34vh;
  }
}

.task-note-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.task-note-item {
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.task-note-item:hover,
.task-note-item:focus-visible {
  border-color: var(--accent-glow);
  outline: none;
}

.task-note-collapse {
  display: none;
  width: 30px;
  height: 30px;
  align-self: start;
  justify-self: end;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.task-note-list.has-expanded-note .task-note-item:not(.task-note-expanded) {
  display: none;
}

.task-note-item.task-note-expanded {
  max-height: none;
  overflow: auto;
  cursor: default;
}


.task-note-expanded input.task-note-title-input {
  min-height: 0;
  border: 0 !important;
  border-radius: 0;
  padding: 0 !important;
  background: none !important;
  font-size: 1.1rem;
  text-overflow: clip;
  white-space: normal;
}

.task-note-expanded textarea.task-note-content-input {
  display: block;
  flex: 1;
  height: auto;
  min-height: 260px;
  overflow: auto;
  border: 0 !important;
  border-radius: 0;
  padding: 0 !important;
  background: none !important;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
  hyphens: auto;
  resize: vertical;
  text-align: start;
  white-space: pre-wrap;
  -webkit-line-clamp: unset;
}

.task-note-item:not(.task-note-expanded) input {
  min-height: 0;
}

.task-add-note-button,
.task-note-header-close {
  position: relative;
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 1;
  color: var(--accent);
}

.task-add-note-button .button-icon,
.task-note-header-close .button-icon {
  width: 18px;
  height: 18px;
}

.task-note-header-close {
  display: inline-flex;
  justify-content: center;
}


.task-view-content-editor {
  display: grid;
  gap: 10px;
}

.task-view-content-editor textarea,
.task-note-inline-editor textarea,
.task-note-inline-editor input {
  width: 100%;
}

.task-inline-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.rt-save-indicator {
  margin-left: auto;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.task-note-inline-editor {
  border-color: var(--accent-soft);
  background: color-mix(in srgb, var(--accent-soft) 20%, var(--surface));
}


.task-notes-header {
  padding: 0;
  column-gap: 8px;
}


/* Trash button in expanded note — absolute bottom-right */
.task-note-item.task-note-expanded {
  position: relative;
}

.task-note-delete {
  display: none;
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  padding: 0;
}

.task-note-delete .button-icon {
  width: 18px;
  height: 18px;
}

.task-note-item.task-note-expanded .task-note-delete {
  display: inline-flex;
  justify-content: center;
}

/* ─── Generic UI Components (reusable across addons) ──────────────── */

/* Tab bar — horizontal tab navigation */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
}

.tab-button {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
}

.tab-button:hover {
  color: var(--text);
  background: transparent;
  box-shadow: none;
}

.tab-button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* Tab panel — content area for each tab.
   Inherits the parent .layout grid gap so panels inside tabs
   have the same spacing as direct children of .layout. */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 24px;
}

/* Card list — grid of cards (used by meat-processing, reusable) */
.card-list {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

/* Form grid — responsive 2-column form layout inside modals */
.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}



/* ─── Dashboard Composer ───────────────────────────────────────────── */
.dashboard-layout {
  gap: 18px;
}

.dashboard-composition {
  display: grid;
  gap: 18px;
}

.dashboard-container-heading {
  margin-bottom: 10px;
}

.dashboard-container-heading h2 {
  margin: 0;
}

.dashboard-panel-grid {
  display: grid;
  gap: 14px;
}

.dashboard-panel-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.dashboard-widget-panel {
  min-width: 0;
}

.dashboard-widget-header {
  align-items: center;
}

.dashboard-panel-link {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 auto;
  height: 30px;
  justify-content: center;
  opacity: 0.46;
  transition: opacity 0.16s ease, background 0.16s ease, border-color 0.16s ease;
  width: 30px;
}

.dashboard-panel-link:hover,
.dashboard-panel-link:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
  opacity: 0.9;
}

.dashboard-panel-link img {
  display: block;
  height: 18px;
  width: 18px;
}

.dashboard-fullwidth-widget + .dashboard-fullwidth-widget {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* ─── Dashboard: scrollable list widgets ────────────────────────────── */
.dashboard-list-scroll {
  max-height: 400px;
  overflow-y: auto;
  overflow-x: auto;
}

/* ─── Settings: Dashboard Builder ──────────────────────────────────── */
.dashboard-builder-panel {
  overflow: hidden;
}

.dashboard-builder {
  display: grid;
  grid-template-columns: minmax(200px, 300px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.dashboard-builder-sidebar,
.dashboard-builder-preview {
  min-width: 0;
}

.compact-subsection {
  padding: 14px;
}

.dashboard-builder-button-list {
  display: grid;
  gap: 8px;
}

.dashboard-builder-add-button {
  width: 100%;
  justify-content: flex-start;
}

.dashboard-widget-catalog {
  display: grid;
  gap: 14px;
  max-height: 60vh;
  overflow: auto;
  padding-right: 4px;
}

.dashboard-widget-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  overflow: visible;
}

.dashboard-widget-accordion summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  list-style: none;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard-widget-accordion summary::-webkit-details-marker {
  display: none;
}

.dashboard-widget-accordion summary::before {
  content: "›";
  color: var(--accent);
  font-size: 1.1rem;
  transition: transform 0.18s ease;
}

.dashboard-widget-accordion[open] summary::before {
  transform: rotate(90deg);
}

.dashboard-widget-accordion summary span {
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  color: var(--text);
  font-size: 0.72rem;
}

.dashboard-widget-group-body {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding: 10px;
}

.dashboard-widget-option {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}

.dashboard-widget-option:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: none;
}

.dashboard-widget-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dashboard-widget-option span {
  font-weight: 700;
}

.dashboard-widget-option small,
.dashboard-preview-container small,
.dashboard-preview-items small {
  color: var(--muted);
}

/* ── Widget type badges ──────────────────────────────────────────── */
.widget-type-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  white-space: nowrap;
}

.widget-type-module-view {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.widget-type-metric {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.widget-type-quick-entry {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.widget-type-list {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
}

.dashboard-widget-option .widget-type-badge,
.dashboard-preview-items .widget-type-badge {
  justify-self: start;
}

.widget-badge-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.widget-addon-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.dashboard-builder-preview {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
  padding: 14px;
}

.dashboard-builder-preview-header {
  margin-bottom: 12px;
}

.dashboard-builder-preview-header h3 {
  margin: 0;
}

.dashboard-layout-preview {
  display: grid;
  gap: 12px;
}

.dashboard-preview-container {
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 12px;
  cursor: pointer;
}

.dashboard-preview-container.selected {
  border-style: solid;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.dashboard-preview-container-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.dashboard-preview-container-header > div:first-child {
  display: grid;
  gap: 2px;
}

.dashboard-preview-container-title {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.dashboard-preview-container-title label {
  display: grid;
  gap: 5px;
}

.dashboard-preview-container-title label > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dashboard-preview-container-title input {
  width: min(100%, 420px);
  min-height: 36px;
  padding: 7px 10px;
  font-weight: 700;
}

.dashboard-preview-container-title input::placeholder {
  color: var(--muted);
}

.dashboard-preview-container-actions,
.dashboard-preview-item-actions {
  display: inline-flex;
  gap: 4px;
}

.dashboard-preview-container-actions button,
.dashboard-preview-item-actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 2px 7px;
  min-height: 0;
}

.dashboard-preview-container-actions button:hover,
.dashboard-preview-item-actions button:hover {
  color: var(--text);
  border-color: var(--accent);
  box-shadow: none;
}

.dashboard-preview-items {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.dashboard-preview-items li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: color-mix(in srgb, var(--panel) 78%, var(--bg));
}

.dashboard-preview-items li > span:first-child {
  font-weight: 700;
}

.dashboard-preview-items li small {
  grid-column: 1 / 2;
}

.dashboard-preview-item-actions {
  grid-row: 1 / span 2;
  grid-column: 2;
}

@media (max-width: 860px) {
  .settings-page-form {
    columns: 1;
  }

  .dashboard-builder {
    grid-template-columns: 1fr;
  }
}


/* ─── Dashboard Quick Workflows ─────────────────────────────────────── */
.dashboard-quick-entry {
  width: 100%;
}

.dashboard-quick-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  align-items: end;
}

.dashboard-quick-form label:not(.checkbox-field) {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.dashboard-quick-form.entry-row {
  grid-template-columns: 120px minmax(220px, 1.2fr) minmax(260px, 1.4fr) 170px 132px auto;
  gap: 14px;
}

.dashboard-time-entry-widget .dashboard-quick-form select {
  min-height: 51px;
}

.dashboard-time-entry-widget .dashboard-quick-checkbox {
  display: flex;
  margin-bottom: 0;
}

.dashboard-time-entry-widget .dashboard-quick-checkbox input {
  width: 18px;
}

.dashboard-quick-form input,
.dashboard-quick-form select {
  width: 100%;
}

.dashboard-quick-form-wide {
  grid-column: span 2;
}

.dashboard-quick-status {
  align-self: center;
}

.dashboard-quick-link {
  align-self: center;
  text-align: center;
  text-decoration: none;
}

@media (max-width: 760px) {
  .dashboard-quick-form-wide {
    grid-column: span 1;
  }
}

/* ─── Global button icons ────────────────────────────────────────── */
.btn-add::before,
.btn-save::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -2px;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.btn-add::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M7 1h2v6h6v2H9v6H7V9H1V7h6z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M7 1h2v6h6v2H9v6H7V9H1V7h6z'/%3E%3C/svg%3E");
}

.btn-save::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10H5V5h10v4z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10H5V5h10v4z'/%3E%3C/svg%3E");
}

/* ─── Global button loading state ────────────────────────────────── */
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

.is-loading {
  pointer-events: none;
  opacity: 0.7;
}

.is-loading::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 6px;
  border: 2px solid currentColor;
  border-bottom-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  vertical-align: middle;
}
