/* Eigen opmaak van PictureToEmbroidery. Kleuren, kop, knoppen, panelen en toast komen uit eknir-ui.css. */

[hidden] { display: none !important; }
.spacer { margin-left: auto; }
.logo { letter-spacing: -.12em; }

main { flex: 1; min-height: 0; padding: 4px 28px 28px; display: flex; }
.page { flex: 1; min-width: 0; min-height: 0; display: flex; gap: 16px; }
.page.make { display: grid; grid-template-columns: 310px minmax(0, 1fr) 300px; grid-template-rows: minmax(0, 1fr); }
.page.calibrate { display: grid; grid-template-columns: 260px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.page.make.dragging .preview { outline: 3px dashed var(--accent); outline-offset: -3px; }

.panel .body { flex: 1; min-height: 0; overflow: auto; padding: 14px; }
.panel .actions { padding: 12px 14px; border-top: 1px solid var(--border); background: var(--surface-2); display: flex; flex-wrap: wrap; gap: 8px; }
.panel .actions .btn { flex: 1; padding: 10px 14px; font-size: 14px; }
.panel.full { flex: 1; }
.panel.narrow { flex: 1; max-width: 860px; margin: 0 auto; }
.panel > header .segmented { margin: 0; }
.panel > header input[type="search"] { max-width: 240px; }

h3 { margin: 18px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.body > h3:first-child, fieldset#settings > h3:first-child { margin-top: 6px; }
small, .hint { color: var(--muted); font-size: 12.5px; }
.hint { margin: 6px 0 10px; }
.error { color: var(--danger); margin: 6px 0; min-height: 0; font-size: 13.5px; }
.error:empty { display: none; }

/* ---- formulieren ---- */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
input, select, textarea { font: inherit; color: var(--text); }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]), select, textarea, .panel select {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; font-size: 14px; min-width: 0;
}
textarea { resize: vertical; width: 100%; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
input:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; font-size: 13.5px; }
.field > span { font-weight: 600; }
.field output { font-weight: 400; color: var(--muted); }
.field.short { max-width: 340px; }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.field.inline > span { font-weight: 400; }
.field.inline input { width: 90px; }
.check { display: flex; align-items: center; gap: 7px; font-size: 13.5px; margin: 0 0 8px; cursor: pointer; }
.row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 8px; }
.row > .field { margin: 0; }
.row .grow { flex: 1; }
.range-number { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13.5px; }
.range-number input[type="number"] { width: 74px; flex: none; }
.range-number span { white-space: nowrap; }

.segmented { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 6px; }
.segmented button { flex: 1; border: 0; background: transparent; color: var(--muted); border-radius: 9px; padding: 5px 9px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-text); }

.chip { display: inline-block; width: 18px; height: 18px; flex: none; border-radius: 6px; border: 1px solid var(--border); }
.color-pick { display: flex; align-items: center; gap: 8px; }
.color-pick select { flex: 1; }
.badge { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 11.5px; font-weight: 600; }
.notice { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px; font-size: 13.5px; margin: 0 0 10px; }
.notice p { margin: 0 0 8px; }
.warning, .warnings li { border-left: 3px solid #e0a100; background: color-mix(in srgb, #e0a100 13%, transparent); border-radius: 0 10px 10px 0; padding: 7px 10px; font-size: 13px; }
.warnings { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }

.pick { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.pick .btn { cursor: pointer; }
.pick img { display: block; max-width: 100%; max-height: 130px; margin: 0 auto; border-radius: 10px; border: 1px solid var(--border);
  background: repeating-conic-gradient(#ccc 0 25%, #fff 0 50%) 0 0 / 14px 14px; }

/* ---- voorbeeld ---- */
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.view-tools .check { margin: 0 0 0 6px; }
.view-tools input[type="color"] { width: 34px; height: 24px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none; cursor: pointer; }
.view-stage { flex: 1; min-height: 0; position: relative; overflow: hidden; background: var(--surface-3); }
.view-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.view-stage canvas:active { cursor: grabbing; }
.view-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); pointer-events: none; }
.view-busy { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 9px; padding: 7px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 13px; font-weight: 600; white-space: nowrap; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.view-player { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--border); background: var(--surface-2); }
.view-status { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.swatch-view { flex: none; height: 460px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 6px; }

/* ---- gegevens ---- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 8px; }
.stats div { background: var(--surface-2); border-radius: 12px; padding: 7px 10px; }
.stats dt { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.stats dd { margin: 0; font-weight: 600; font-size: 13.5px; }
.colors { list-style: none; margin: 0 0 14px; padding: 0; }
.colors label { display: grid; grid-template-columns: auto auto 1fr; column-gap: 8px; align-items: center; padding: 4px 0; cursor: pointer; border-bottom: 1px solid var(--border); }
.colors input, .colors .chip { grid-row: span 2; }
.color-name { font-size: 13.5px; }
.colors small { grid-column: 3; font-size: 11.5px; }

/* ---- bibliotheek ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; align-content: start; }
.card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--surface-2); }
.thumb { border: 0; padding: 10px; height: 190px; background: #f3f0ea; cursor: pointer; display: grid; place-items: center; }
.thumb img { max-width: 100%; max-height: 170px; object-fit: contain; }
.card-body { display: flex; flex-direction: column; padding: 10px 12px; flex: 1; }
.card h4 { margin: 0 0 3px; font-size: 15px; overflow-wrap: anywhere; }
.card .note { margin: 6px 0 0; font-size: 13px; white-space: pre-line; overflow-wrap: anywhere; }
.card-actions { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 12px 12px; }
.card-actions .btn { padding: 3px 10px; font-size: 12.5px; }

/* ---- tabellen en lijsten ---- */
.table { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 14px; }
.table th, .table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.table thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.table .right { text-align: right; white-space: nowrap; }
.locked { opacity: .6; padding-right: 10px; }
.levels th { font-weight: 400; }
.levels input, .levels select { width: 100%; max-width: 150px; }
.scroll-x { overflow-x: auto; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.list-item { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 9px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; }
.list-item:hover { border-color: var(--accent); }
.list-item[aria-current="true"] { border-color: var(--accent); background: var(--surface-3); }
.tests { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.tests li { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.tests .check { margin: 0; }
.tests summary { cursor: pointer; font-size: 12.5px; color: var(--accent); }
.range-fields { display: flex; gap: 8px; margin: 6px 0; font-size: 12.5px; }
.range-fields label { display: flex; flex-direction: column; }
.range-fields input { width: 74px; }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 12px; align-items: start; }
.groups fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px 10px; }
.groups legend { font-weight: 700; font-size: 13px; padding: 0 5px; }
.legend { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.legend label { display: grid; grid-template-columns: auto 30px 1fr; gap: 8px; align-items: center; cursor: pointer; font-size: 13.5px; }
.versions { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.versions li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.versions .btn { margin-left: auto; }
.save-row { margin-top: 10px; }
.save-row input { flex: 1; max-width: 420px; }
.swatch-photo { max-width: min(100%, 520px); max-height: 380px; border-radius: 12px; border: 1px solid var(--border); }

/* ---- inloggen en vensters ---- */
.login { flex: 1; display: grid; place-items: start center; padding: 8vh 16px; }
.login .panel { width: 100%; max-width: 360px; }
.login .body { display: flex; flex-direction: column; padding: 18px; }
dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow); padding: 20px; width: min(430px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 12, 30, .45); }
dialog h2 { margin: 0 0 8px; font-size: 18px; }
dialog .message { margin: 0 0 12px; font-size: 14px; }
dialog .buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
dialog .buttons .btn.primary { padding: 9px 20px; font-size: 14px; }
.btn.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
.ruler { margin: 6px 0 4px; }
.ruler-bar { height: 12px; background: var(--accent); border-radius: 2px; margin-bottom: 8px; max-width: 100%; }
.toast { max-width: min(560px, calc(100vw - 32px)); width: max-content; z-index: 10; }

/* ---- smallere schermen ---- */
@media (max-width: 1180px) {
  .page.make { grid-template-columns: 290px minmax(0, 1fr); grid-template-rows: minmax(0, 3fr) minmax(0, 2fr); }
  .page.make > :first-child { grid-row: span 2; }
}
@media (max-width: 860px) {
  main { padding: 4px 14px 20px; display: block; }
  .page, .page.make, .page.calibrate { display: flex; flex-direction: column; }
  .panel { overflow: visible; }
  .panel .body { overflow: visible; }
  .page.make .preview { order: -1; height: 72vh; overflow: hidden; }
  .page.make .actions { position: sticky; bottom: 0; }
  .swatch-view { height: 360px; }
  .panel > header { flex-wrap: wrap; }
}
