/* Artransfer Web Admin — minimal black & white theme */

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #111111;
  --muted: #666666;
  --border: #e0e0e0;
  --accent: #000000;
  --accent-hover: #333333;
  --success: #1a1a1a;
  --error: #cc0000;
  --radius: 2px;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", Monaco, "Courier New", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--muted);
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.sidebar {
  background: var(--accent);
  color: #fff;
  padding: 2rem 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 2.5rem;
  font-weight: 500;
}

.sidebar-brand strong {
  display: block;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
  font-weight: 400;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar nav a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  color: #fff;
  border-left-color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 2rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
}

.main {
  padding: 2.5rem 3rem;
  max-width: 1100px;
}

.main.main-wide {
  max-width: none;
}

.main.main-artworks {
  max-width: 1440px;
}

.main.main-artworks table.data th,
.main.main-artworks table.data td {
  padding: 0.5rem 0.6rem;
}

.main.main-artworks table.data th:first-child,
.main.main-artworks table.data td:first-child {
  padding-left: 1rem;
}

.main.main-artworks table.data th:last-child,
.main.main-artworks table.data td:last-child {
  padding-right: 1rem;
}

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.page-header--actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 300;
  letter-spacing: -0.02em;
}

.page-header p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.flash-group {
  margin-bottom: 1.5rem;
}

.flash {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.flash.flash-hide {
  opacity: 0;
  transform: translateY(-6px);
}

.flash.success {
  border-left: 3px solid #2e7d32;
  background: #eef7ee;
  color: #1b5e20;
}

.flash.error {
  border-left: 3px solid var(--error);
  color: var(--error);
}

.dashboard-section {
  margin-bottom: 1.5rem;
}

.dashboard-section-title {
  margin: 0 0 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.stat-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

a.stat-card:hover {
  border-color: #bbb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  color: inherit;
}

.stat-card-accent {
  border-left: 3px solid var(--accent);
}

.stat-card .value {
  font-size: 1.4rem;
  font-weight: 500;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat-card .label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-top: 0.3rem;
  font-weight: 500;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.card h2 {
  margin: 0 0 1.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 1.5rem;
}

.form-grid .full {
  grid-column: 1 / -1;
}

label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field-display {
  margin: 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.95rem;
  color: var(--text);
  border-radius: var(--radius);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="file"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-row input {
  width: auto;
}

.checkbox-row label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  color: var(--text);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 1.5rem;
  margin: 0;
}

.detail-grid dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.detail-grid dd {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.5;
}

.payment-finished {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.payment-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.payment-status .badge {
  white-space: nowrap;
}

.payment-actions {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
}

.payment-actions .inline-form {
  display: flex;
}

.payment-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-height: 38px;
}

.payment-status-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.badge.badge-success {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.badge.badge-warning {
  background: #fef9c3;
  color: #854d0e;
  border-color: #fde047;
}

.badge.badge-danger {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

/* Quotation detail page */
.quotation-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.quotation-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quotation-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.quotation-total {
  font-weight: 600;
  color: var(--text);
}

.quotation-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 1.6fr;
  gap: 1.5rem;
  align-items: start;
}

.quotation-customer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.quotation-customer .customer-block {
  line-height: 1.6;
  font-size: 0.95rem;
}

.quotation-customer .customer-name {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.quotation-customer .btn-sm {
  align-self: flex-start;
}

.quotation-info {
  margin-bottom: 0;
}

.card-table-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 2rem 0;
}

.card-table-header .muted-count {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Quotation lines table */
.quotation-lines {
  margin-top: 1.5rem;
}

.quotation-lines table.data {
  table-layout: auto;
}

.quotation-lines table.data th,
.quotation-lines table.data td {
  padding: 0.85rem 1rem;
}

.quotation-lines table.data th:first-child,
.quotation-lines table.data td:first-child {
  padding-left: 2rem;
}

.quotation-lines table.data th:last-child,
.quotation-lines table.data td:last-child {
  padding-right: 2rem;
}

.data th.num,
.data td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

.data td.cell-strong {
  font-weight: 600;
  color: var(--text);
}

.data td.cell-empty {
  color: var(--muted);
  padding: 1.5rem 2rem;
}

.data .col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.quotation-lines tfoot td {
  border-bottom: none;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.quotation-lines tfoot tr:first-child td {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.quotation-lines tfoot tr:hover td {
  background: transparent;
}

.quotation-lines tfoot .totals-label {
  color: var(--muted);
  font-weight: 500;
}

.quotation-lines tfoot .totals-total td {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 1.25rem;
}

.quotation-lines tfoot .totals-total .totals-label {
  color: var(--text);
}

@media (max-width: 900px) {
  .quotation-layout {
    grid-template-columns: 1fr;
  }
}

/* Lifecycle section */
.lifecycle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2rem;
}

.lifecycle-subtitle {
  margin: 0 0 0.85rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.lifecycle-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0;
}

.lifecycle-key {
  min-width: 110px;
  font-size: 0.9rem;
  color: var(--muted);
}

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

.lifecycle-link {
  font-size: 0.9rem;
}

.lifecycle-select {
  width: auto;
  min-width: 190px;
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
}

.lifecycle-hint {
  margin: 0.35rem 0 1rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted);
}

.lifecycle-datetime {
  width: auto;
  min-width: 190px;
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
}

.lifecycle-value {
  font-size: 0.9rem;
}

.lifecycle-tz {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* Digital Product Passeport */
.dpp-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
}

.dpp-fields {
  flex: 1 1 320px;
  min-width: 0;
}

.dpp-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border, #eee);
}

.dpp-row:last-child {
  border-bottom: none;
}

.dpp-key {
  flex: none;
  width: 150px;
  font-size: 0.9rem;
  color: var(--muted);
}

.dpp-value {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.9rem;
  word-break: break-word;
}

.dpp-value--mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.dpp-link {
  word-break: break-all;
}

.dpp-qr {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

.dpp-qr__img {
  width: 180px;
  height: 180px;
  border: 1px solid var(--border, #eee);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.dpp-qr__hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Toggle switch */
.switch-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.2s ease;
}

.switch-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

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

.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

.switch input:focus-visible + .switch-slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch-stack {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.col-toggle {
  width: 70px;
  text-align: center;
  white-space: nowrap;
}

.th-help {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.th-help .field-help {
  margin-left: 0;
}

.switch--sm {
  width: 32px;
  height: 18px;
  vertical-align: middle;
}

.switch--sm .switch-slider::before {
  height: 12px;
  width: 12px;
  left: 3px;
  top: 3px;
}

.switch--sm input:checked + .switch-slider::before {
  transform: translateX(14px);
}

.switch-label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  color: var(--text);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: none;
  accent-color: var(--accent);
}

.checkbox-label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}

.field-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  margin-left: -0.5rem;
  border: none;
  border-radius: 999px;
  background: var(--border);
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1;
  cursor: help;
}

.field-help::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: max-content;
  max-width: 300px;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  background: #1f2937;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.5;
  text-align: left;
  white-space: pre-line;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.field-help::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  border: 6px solid transparent;
  border-top-color: #1f2937;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease;
}

.field-help:hover::after,
.field-help:focus::after,
.field-help:hover::before,
.field-help:focus::before {
  opacity: 1;
  visibility: visible;
}

/* Inline help icon that sits cleanly after a label, no overlap. */
.label-help {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.field-help--inline {
  margin-left: 0;
  flex: 0 0 auto;
}

/* Resale right status pill with colored dot. */
.resale-status-cell {
  display: flex;
  align-items: center;
}

.resale-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.resale-status__dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex: 0 0 auto;
}

.resale-status--on {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.resale-status--on .resale-status__dot {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.resale-status--off {
  background: #f1f5f9;
  color: #64748b;
  border-color: #e2e8f0;
}

.resale-status--off .resale-status__dot {
  background: #94a3b8;
}

.document-field {
  margin-bottom: 1.25rem;
}

.document-current {
  display: inline-block;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  color: var(--accent);
  word-break: break-all;
}

.multiselect {
  position: relative;
}

.multiselect-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.multiselect-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.multiselect-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multiselect-label.is-placeholder {
  color: var(--muted);
}

.multiselect-caret {
  color: var(--muted);
  font-size: 0.75rem;
}

.multiselect-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  padding: 0.35rem;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.multiselect-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}

.multiselect-option:hover {
  background: var(--bg, #f5f5f5);
}

.multiselect-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: none;
  accent-color: var(--accent);
}

.multiselect-empty {
  margin: 0;
  padding: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.btn {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  font-family: var(--font);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-decoration: none;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.btn:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover {
  background: var(--bg);
  color: var(--text);
}

.btn-danger {
  background: transparent;
  color: var(--error);
  border-color: var(--error);
}

.btn-danger:hover {
  background: var(--error);
  color: #fff;
}

.btn.is-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0.85;
  cursor: progress;
}

.spinner[hidden] {
  display: none;
}

.spinner {
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spinner-rotate 0.6s linear infinite;
}

@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}

.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.7rem;
}

.actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.actions--spaced {
  margin-bottom: 2.5rem;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 1000;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 0.25rem;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem;
  overflow: auto;
}

.template-instructions {
  flex: 0 0 320px;
  font-size: 0.9rem;
}

.template-instructions ol {
  padding-left: 1.2rem;
  margin: 0.75rem 0;
}

.template-instructions li {
  margin-bottom: 0.5rem;
}

.template-instructions .actions {
  margin-top: 1rem;
  flex-direction: column;
  align-items: stretch;
}

.template-preview {
  flex: 1 1 auto;
  min-width: 0;
}

.template-preview iframe {
  width: 100%;
  height: 60vh;
  min-height: 360px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

@media (max-width: 768px) {
  .modal-body {
    flex-direction: column;
  }

  .template-instructions {
    flex-basis: auto;
  }
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data th,
table.data td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

table.data th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 500;
}

table.data tr:hover td {
  background: var(--bg);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--border);
  background: var(--bg);
}

.badge.dark {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.badge.badge-role {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.col-portfolio-type {
  width: 1%;
  white-space: nowrap;
}

.portfolio-type {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem 0.2rem 0.45rem;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  border-radius: 3px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  background: var(--surface);
  color: var(--text);
}

.portfolio-type--sales {
  border-left-color: var(--accent);
}

.portfolio-type--artists {
  border-left-color: #666;
}

.portfolio-type--category {
  border-left-color: #bbb;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.tag-list .badge {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.7rem;
}

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

.pagination {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.search-bar input[type="text"],
.search-bar input[type="search"] {
  flex: 1 1 240px;
  min-width: 200px;
}

.search-field {
  position: relative;
  display: flex;
  flex: 1 1 240px;
  min-width: 200px;
}

.search-field input[type="text"],
.search-field input[type="search"] {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  padding-right: 2.25rem;
}

.search-clear {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  z-index: 2;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--muted);
}

.search-clear:hover {
  color: var(--text);
}

.search-field.has-value .search-clear {
  display: flex;
}

.search-bar select {
  width: auto;
  flex: 0 0 auto;
  min-width: 180px;
}

.search-bar .btn {
  flex: 0 0 auto;
}

/* Advanced filters panel */
.adv-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.adv-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
}

.adv-panel {
  flex: 1 1 100%;
  width: 100%;
  margin-top: 0.25rem;
  padding: 1rem 1.25rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.adv-panel[hidden] {
  display: none;
}

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

.adv-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.adv-item > span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.adv-item select,
.adv-item input[type="number"],
.adv-item input[type="date"] {
  width: 100%;
  min-width: 0;
}

.adv-range {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.adv-range input {
  flex: 1 1 0;
}

.adv-dash {
  color: var(--muted);
}

.adv-item--check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  align-self: end;
  padding-bottom: 0.4rem;
}

.adv-item--check input {
  flex: 0 0 auto;
}

.adv-item--check span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

.adv-activity {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}

.adv-activity-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.adv-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.adv-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.1rem;
}

.data th.sortable {
  white-space: nowrap;
}

.data th.sortable a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.data th.sortable a:hover {
  color: var(--text);
}

.data th.sortable.sorted a {
  font-weight: 600;
}

.data th.sortable .sort-indicator {
  font-size: 0.7rem;
  opacity: 0.55;
  line-height: 1;
}

.data td.cell-truncate {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.form-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
}

.login-box {
  background: var(--surface);
  padding: 3rem;
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--border);
}

.login-box h1 {
  font-size: 1.25rem;
  font-weight: 300;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

.login-box .subtitle {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

.login-box select {
  width: 100%;
  margin-bottom: 0;
}

.many2one-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.page-note {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 1.25rem;
}

.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.6rem 1rem;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 8px;
}

.bulk-toolbar[hidden] {
  display: none;
}

.bulk-count {
  font-weight: 600;
}

.bulk-hint {
  font-size: 0.85rem;
  color: var(--muted);
}

.btn-text {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-decoration: underline;
  cursor: pointer;
}

.btn-text:hover {
  color: var(--text, #111);
}

.col-select {
  width: 2.5rem;
  text-align: center;
  white-space: nowrap;
}

.col-select input {
  cursor: pointer;
}

.combo {
  position: relative;
}

.combo-results {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% - 1px);
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.combo-results li {
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.combo-results li:hover {
  background: var(--bg);
}

.combo-results li.combo-more {
  color: var(--muted);
  font-size: 0.8rem;
  cursor: default;
}

.combo-results li.combo-more:hover {
  background: var(--surface);
}

/* Artist picker — searchable combobox with inline create + contact-card link */
.artist-combo {
  position: relative;
}

.artist-combo__field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0 0.65rem;
  transition: border-color 0.15s;
}

.artist-combo__field:focus-within {
  border-color: var(--accent);
}

.artist-combo__search-icon {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
}

.artist-combo__input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  padding: 0.6rem 0 !important;
  border-radius: 0 !important;
}

.artist-combo__input:focus {
  outline: none;
}

.artist-combo__clear {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.15rem;
}

.artist-combo__clear:hover {
  color: var(--accent);
}

.artist-combo__results {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.artist-combo__option {
  padding: 0.55rem 0.65rem;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: calc(var(--radius) - 2px);
}

.artist-combo__option:hover,
.artist-combo__option.is-active {
  background: var(--bg);
}

.artist-combo__create {
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
  color: var(--accent);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.artist-combo__plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1;
}

.artist-combo__empty {
  padding: 0.55rem 0.65rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.artist-combo__selected {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.artist-combo__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.artist-combo__check {
  color: #1a8a3a;
  font-weight: 700;
}

.artist-combo__card {
  font-size: 0.82rem;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.artist-combo__card:hover {
  color: var(--accent-hover);
}

.multicombo {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.4rem;
}

.multicombo:focus-within {
  border-color: var(--accent);
}

.multicombo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.multicombo-chips:empty {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.3rem 0.2rem 0.65rem;
  font-size: 0.85rem;
}

.chip-x {
  border: none;
  background: var(--accent);
  color: #fff;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  line-height: 1;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chip-x:hover {
  background: var(--accent-hover);
}

.multicombo-input {
  border: none !important;
  padding: 0.35rem 0.4rem !important;
  margin-top: 0.25rem;
}

.multicombo-input:focus {
  outline: none;
}

.multicombo .combo-results {
  left: -1px;
  right: -1px;
}

.inline-form {
  display: inline;
}

.inline-form select {
  width: auto;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
}

/* --- Offers page ------------------------------------------------------- */
.offers-section {
  margin-bottom: 2.5rem;
}

.offers-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--muted);
}

.offers-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  padding: 0 0.4rem;
  height: 1.4rem;
  font-size: 0.75rem;
  letter-spacing: 0;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.offers-search {
  margin-bottom: 1rem;
}

.offers-actions-col {
  width: auto;
  white-space: nowrap;
}

.offers-actions-cell {
  white-space: nowrap;
}

.offer-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
}

.offer-action-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
  flex-shrink: 0;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-accept {
  background: #edf6ef;
  border-color: #c5ddcb;
  color: #3d7a52;
}

.btn-accept:hover {
  background: #dceee1;
  border-color: #a8cdb2;
  color: #2f6340;
}

.btn-reject {
  background: #fdf0f0;
  border-color: #e8cccc;
  color: #a85555;
}

.btn-reject:hover {
  background: #f8e4e4;
  border-color: #ddb8b8;
  color: #8f4444;
}

.btn-counter {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-counter:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.offer-counter {
  gap: 0.3rem;
}

.offer-counter input[type="number"] {
  width: 6.5rem;
  min-width: 6.5rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.offer-status {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.offer-status--accepted {
  color: #1f7a34;
  background: #eef7ef;
  border-color: #c5e2cb;
}

.offer-status--refused {
  color: var(--error);
  background: #fbeeee;
  border-color: #ecc8c8;
}

.offer-status--expired {
  color: var(--muted);
  background: var(--bg);
  border-color: var(--border);
}

.offer-status--ongoing {
  color: var(--text);
  background: var(--bg);
  border-color: var(--border);
}

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

.artworks-db-filters {
  margin-bottom: 1.75rem;
}

.artworks-db-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.artworks-db-search {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.artworks-db-filters select {
  width: auto;
  min-width: 140px;
  font-size: 0.85rem;
}

.artworks-kanban {
  display: flex;
  gap: 0;
  align-items: flex-start;
  overflow-x: auto;
  border: 1px solid var(--border);
  background: var(--bg);
  min-height: 420px;
}

.artworks-kanban-column {
  flex: 1 1 200px;
  min-width: 200px;
  max-width: 280px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.artworks-kanban-column:last-child {
  border-right: none;
}

.artworks-kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.artworks-kanban-column-header h2 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.3;
}

.artworks-kanban-count {
  font-weight: 400;
  color: var(--muted);
}

.artworks-kanban-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface);
}

.artworks-kanban-add:hover {
  color: var(--text);
  border-color: var(--text);
}

.artworks-kanban-cards {
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 280px);
}

.artworks-kanban-card {
  display: flex;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.artworks-kanban-card-thumb {
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.artworks-kanban-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.artworks-kanban-card-placeholder {
  color: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.artworks-kanban-badge-sold {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.25rem;
  background: #2e7d32;
  color: #fff;
  line-height: 1.2;
}

.artworks-kanban-card-body {
  flex: 1;
  min-width: 0;
}

.artworks-kanban-card-artist {
  margin: 0;
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artworks-kanban-card-title {
  margin: 0.1rem 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.artworks-kanban-card-price {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.artworks-kanban-empty,
.artworks-kanban-more {
  margin: 0;
  padding: 1rem 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

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

@media (max-width: 900px) {
  .chart-grid-2 {
    grid-template-columns: 1fr;
  }
}

.chart-card--full {
  grid-column: 1 / -1;
}

.kpi-card .label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.chart-card {
  margin-bottom: 0;
  padding: 1.5rem 1.75rem;
}

.chart-canvas-wrap {
  position: relative;
  height: 280px;
}

.chart-canvas-wrap-combo {
  height: 300px;
}

.chart-table-wrap {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  max-height: 220px;
  overflow-y: auto;
}

.chart-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.chart-table th,
.chart-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.chart-table th.num,
.chart-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.chart-table th {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  position: sticky;
  top: 0;
  background: var(--surface);
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.chart-head h2 {
  margin: 0;
}

.chart-head select {
  width: auto;
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
}

.chart-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  font-style: italic;
  line-height: 1;
  cursor: help;
  user-select: none;
}

.info-icon:hover,
.info-icon:focus {
  border-color: var(--text, #111111);
  color: var(--text, #111111);
  outline: none;
}

.info-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: 240px;
  padding: 0.6rem 0.7rem;
  border-radius: 6px;
  background: #111111;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.info-icon:hover::after,
.info-icon:focus::after {
  opacity: 1;
  visibility: visible;
}

.row-thumb {
  display: inline-flex;
  width: 40px;
  height: 40px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
  align-items: center;
  justify-content: center;
}

.row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.artwork-main-preview {
  display: block;
  margin-bottom: 1.5rem;
}

.artwork-main-preview p {
  margin: 0.75rem 0 0;
  color: var(--muted);
}

.picture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.picture {
  margin: 0;
  border: 1px solid var(--border);
  background: var(--surface);
}

.picture img {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: cover;
  background: var(--bg);
}

.js-picture {
  cursor: zoom-in;
  transition: opacity 0.15s ease;
}

.js-picture:hover,
.js-picture:focus-visible {
  opacity: 0.85;
  outline: 2px solid var(--accent, #6c5ce7);
  outline-offset: 2px;
}

.picture-hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

body.no-scroll {
  overflow: hidden;
}

.picture-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.picture-lightbox[hidden] {
  display: none;
}

.picture-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
}

.picture-lightbox__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  max-width: min(960px, 100%);
  max-height: 100%;
}

.picture-lightbox__close {
  position: absolute;
  top: -2.6rem;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.picture-lightbox__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.picture-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.8rem;
  height: 2.8rem;
  padding: 0 0 0.2rem;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.picture-lightbox__nav:hover {
  background: rgba(0, 0, 0, 0.75);
}

.picture-lightbox__nav--prev {
  left: calc(50% - 230px);
}

.picture-lightbox__nav--next {
  right: calc(50% - 230px);
}

.picture-lightbox__nav[hidden] {
  display: none;
}

.picture-lightbox__img {
  max-width: 100%;
  max-height: calc(100vh - 12rem);
  object-fit: contain;
  background: #fff;
}

.picture-lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  color: #fff;
}

.picture-lightbox__caption {
  font-size: 0.95rem;
  opacity: 0.9;
}

.picture-lightbox__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.picture-lightbox__actions form {
  margin: 0;
}

.picture-lightbox__actions .btn {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.picture-add {
  border: none;
  background: none;
}

.picture-add__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 150px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.picture-add__btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg);
}

.picture figcaption {
  padding: 0.5rem 0.6rem;
  font-size: 0.75rem;
  color: var(--muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-danger {
  background: none;
  border: none;
  color: var(--error);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0;
  text-decoration: underline;
}

.link-muted {
  font-size: 0.75rem;
  color: var(--muted);
}

.responsibility-list {
  margin: 0;
  padding-left: 1.1rem;
  line-height: 1.8;
}

.responsibility-list li {
  font-size: 0.95rem;
}

.role-block {
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
}

.role-block:first-of-type {
  border-top: none;
  padding-top: 0;
}

.role-block h3 {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
  font-weight: 300;
}

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

  .sidebar {
    height: auto;
    position: relative;
  }

  .main {
    padding: 1.5rem;
  }

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

  .price-cols {
    grid-template-columns: 1fr;
  }

  .dimension-grid {
    flex-wrap: wrap;
  }

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

  .chart-canvas-wrap {
    height: 220px;
  }
}

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

/* --- Todo Actions page ------------------------------------------------- */
.todo-tabs {
  display: flex;
  gap: 0.2rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.todo-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: -1px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font);
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.todo-tab:hover {
  color: var(--text);
}

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

.todo-tab[data-unavailable] {
  opacity: 0.5;
}

.todo-tab__icon {
  display: inline-flex;
  color: var(--muted);
  transition: color 0.15s;
}

.todo-tab.is-active .todo-tab__icon {
  color: var(--accent);
}

.todo-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.todo-tab.is-active .todo-tab__count {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.todo-tab__mine {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border-radius: 999px;
  background: #facc15;
  color: #1a1a1a;
  border: 1px solid #eab308;
}

/* When JS is active, only the selected panel is shown; without JS every
   panel stays visible (progressive enhancement). */
.todo-panel {
  margin-bottom: 1.75rem;
}

.todo-panel[hidden] {
  display: none;
}

.todo-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.todo-section-head__title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.todo-section-head__title h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text);
}

.todo-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
}

.todo-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  height: 1.55rem;
  padding: 0 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.todo-pill--mine {
  background: #facc15;
  border-color: #eab308;
  color: #1a1a1a;
}

.todo-search {
  margin-bottom: 0;
  flex: 0 1 360px;
}

.todo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding: 3rem 2rem;
  text-align: center;
}

.todo-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
}

.todo-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.todo-empty-cell {
  padding: 2.25rem 1rem;
  text-align: center;
  color: var(--muted);
}

.todo-manage {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.todo-manage select,
.todo-manage input[type="text"] {
  width: auto;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
}

.todo-manage input[type="text"] {
  min-width: 140px;
}

tr.row-mine > td {
  background: var(--bg);
}

.badge.badge-mine {
  background: #facc15;
  color: #1a1a1a;
  border-color: #eab308;
}

.todo-locked {
  margin-left: 0.4rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* --- Artwork form: header, dimensions & pricing ------------------------ */
.page-header__sub {
  color: var(--muted);
  font-weight: 300;
}

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

/* Dimensions */
.dimension-grid {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
}

.dimension-field {
  flex: 1 1 0;
  min-width: 0;
}

.dimension-input {
  position: relative;
  display: flex;
  align-items: center;
}

.dimension-input input {
  padding-right: 2.75rem;
}

.dimension-unit {
  position: absolute;
  right: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  pointer-events: none;
}

.dimension-sep {
  padding-bottom: 0.6rem;
  color: var(--muted);
  font-size: 1.1rem;
}

/* Pricing two-column layout */
.price-cols {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2rem 3rem;
  align-items: start;
}

.price-col__title {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
  color: var(--muted);
}

.price-col__title--spaced {
  margin-top: 1.75rem;
}

.price-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 0.9rem;
}

.price-row > label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.85rem;
  color: var(--text);
}

.price-row--commission > label {
  align-self: center;
}

/* Money + percentage inputs with adornment */
.money-input,
.pct-input {
  position: relative;
  display: flex;
  align-items: center;
}

.money-input input {
  padding-right: 2rem;
  text-align: right;
}

.money-unit {
  position: absolute;
  right: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  pointer-events: none;
}

.pct-input {
  max-width: 90px;
}

.pct-input input {
  padding-right: 1.6rem;
  text-align: right;
}

.pct-unit {
  position: absolute;
  right: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
  pointer-events: none;
}

.pct-input--readonly {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  justify-content: flex-end;
  gap: 0.2rem;
  color: var(--muted);
}

.pct-input--readonly .pct-unit {
  position: static;
}

.commission-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.computed-amount {
  font-size: 0.85rem;
  color: var(--muted);
}

.computed-amount strong {
  color: var(--text);
  font-weight: 500;
}

/* Derived (recomputed) price inputs look muted, anchor stands out */
input.is-derived {
  background: var(--bg);
  color: var(--muted);
}

input.is-anchor {
  border-color: var(--accent);
}

.price-hint {
  grid-column: 1 / -1;
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.price-ref-line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.price-ref-line select {
  width: auto;
  min-width: 150px;
}

.btn-compute {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font);
  font-size: 0.82rem;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.btn-compute:hover {
  color: var(--muted);
}

/* Activity log (Odoo-style field-change tracking) */
.tracking-card {
  background: transparent;
  border: none;
  padding: 0;
}

.tracking {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tracking__entry {
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

.tracking__entry:first-child {
  padding-top: 0;
  border-top: none;
}

.tracking__meta {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}

.tracking__author {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
}

.tracking__date {
  font-size: 0.75rem;
  color: var(--muted);
}

.tracking__changes {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tracking__changes li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text);
}

.tracking__arrow {
  color: var(--muted);
}

.tracking__new {
  font-weight: 600;
}

.tracking__empty {
  color: var(--muted);
  font-weight: 400;
}

.tracking__field {
  color: var(--muted);
  font-style: italic;
}

/* --- Contacts page: new-contacts insight chart ------------------------- */
.ci-card {
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.ci-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.ci-title {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.ci-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.ci-clear {
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--border);
  transition: color 0.12s, border-color 0.12s;
}

.ci-clear:hover {
  color: var(--text);
  border-color: var(--text);
}

.ci-bars {
  display: flex;
}

.ci-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 1.5rem 1.5rem 1.1rem;
  text-decoration: none;
  color: inherit;
  border-right: 1px solid var(--border);
  transition: background 0.12s;
  cursor: pointer;
  user-select: none;
}

.ci-col:last-child {
  border-right: none;
}

.ci-col:hover {
  background: var(--bg);
}

.ci-col.is-active {
  background: var(--bg);
}

.ci-count {
  font-size: 2.5rem;
  font-weight: 200;
  line-height: 1;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  margin-bottom: 1.1rem;
  transition: color 0.12s;
}

.ci-col:hover .ci-count,
.ci-col.is-active .ci-count {
  color: var(--text);
}

.ci-track {
  width: 56px;
  height: 72px;
  display: flex;
  align-items: flex-end;
  margin-bottom: 0.9rem;
}

.ci-bar {
  width: 100%;
  background: var(--border);
  transition: background 0.15s;
  min-height: 3px;
}

.ci-col:hover .ci-bar {
  background: #aaa;
}

.ci-col.is-active .ci-bar {
  background: var(--accent);
}

.ci-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 500;
  transition: color 0.12s;
  white-space: nowrap;
}

.ci-col:hover .ci-label,
.ci-col.is-active .ci-label {
  color: var(--text);
}

/* Table modifier: prevent row content from wrapping */
table.data.data--nowrap td {
  white-space: nowrap;
}

table.data.data--nowrap td.cell-date {
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

/* ── Sticky action bar ─────────────────────────────────────────────── */
.sticky-actions {
  position: fixed;
  bottom: 0;
  left: 240px; /* align with sidebar width */
  right: 0;
  z-index: 200;
  transform: translateY(110%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease;
  opacity: 0;
  pointer-events: none;
}

.sticky-actions.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.sticky-actions__inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding: 0.75rem 2rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.07);
}

.sticky-actions__status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sticky-actions__dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: dot-pulse 1.8s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}

.sticky-actions__btns {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

@media (max-width: 640px) {
  .sticky-actions {
    left: 0;
  }
  .sticky-actions__inner {
    padding: 0.65rem 1rem;
  }
}
