/* Lakender: the shared parts of the pages (buttons, sections, fields, switches, tables, lists). Taken over from
   Bouwplan's bouwplan.css, so both projects look the same. base.css stays as the base has it; everything Lakender adds
   is here. Page specific css is in pages/<name>/<name>.css. */

.tnum { font-variant-numeric: tabular-nums; }

/* A page may keep its x-modal inside the page element (so its page css applies); it must not become a grid cell. */
.page > x-modal { position: absolute; }

/* ---------- Buttons (additions to .button of base.css) ---------- */
.button .ic { width: 18px; height: 18px; }
.button.danger { background: var(--danger); border-color: var(--danger); color: #ffffff; }
.button.danger:hover { background: var(--danger); filter: brightness(0.92); }
.button.small { height: 30px; padding: 0 10px; font-size: 12.5px; }
.button.small .ic { width: 16px; height: 16px; }
.modal-note { font-size: 13.5px; color: var(--fg-2); }

/* ---------- Sections and fields (inside x-detail) ---------- */
.section { max-width: 1120px; }
.section + .section { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section-title { font-size: 14px; font-weight: 600; color: var(--fg); }
.section-note { color: var(--fg-3); font-size: 13px; margin-bottom: 14px; max-width: 760px; }

.fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 20px; }
@container (max-width: 600px) { .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 400px) { .fields { grid-template-columns: minmax(0, 1fr); } .fields .field.span2 { grid-column: auto; } }
.field { min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field.span2 { grid-column: span 2; }
.field .field-label { display: block; font-size: 14px; font-weight: 500; color: var(--fg); margin-bottom: 6px; }

.input::placeholder { color: var(--fg-3); }
.input:hover { border-color: var(--fg-3); }
.input[readonly] { background: var(--zebra); border-color: var(--line); color: var(--fg-2); }
textarea.input { height: auto; min-height: 120px; padding: 12px 14px; line-height: 1.6; resize: none; overflow: hidden; max-width: 860px; display: block; }
select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2356626e' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
}
:root[data-theme="dark"] select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa6b2' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
input[type="color"].input { padding: 4px; width: 72px; cursor: pointer; }

.range { display: flex; align-items: center; gap: 8px; }
.range .input { min-width: 0; }
.range span { color: var(--fg-3); font-size: 13px; }

.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; margin: 0; font-weight: 400; cursor: pointer; position: relative; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 40px; height: 24px; border-radius: 12px; background: var(--line-strong); position: relative; transition: background 0.3s var(--ease); flex: none; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.3s var(--ease); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-text { color: var(--fg-2); font-size: 13.5px; }
/* base.css makes every label in a .field a block with a bold text; switches and checks are labels too */
.field label.switch { display: inline-flex; margin-bottom: 0; }
.field label.check { display: flex; margin-bottom: 0; font-weight: 400; font-size: 13.5px; }

.checks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 16px; }
@container (max-width: 760px) { .checks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 400px) { .checks { grid-template-columns: minmax(0, 1fr); } }
.check { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--input-bg); cursor: pointer; transition: border-color 0.25s var(--ease), background 0.25s var(--ease); }
.check:hover { border-color: var(--line-strong); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; flex: none; }
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Tables and lists ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--input-bg); }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: 13px; color: var(--fg-2); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tbody tr:nth-child(even) td { background: var(--zebra); }
.table tr:last-child td { border-bottom: 0; }
.table td.number, .table th.number { text-align: right; }
.table td.wrap { white-space: normal; }
.table .switch { min-height: 0; }

.list-rows { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--input-bg); }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: var(--input-bg); width: 100%; text-align: left; }
.list-row:last-child { border-bottom: 0; }
.list-row:nth-child(even) { background: var(--zebra); }
.list-row .main { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .sub { color: var(--fg-3); font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty-box { border: 1px dashed var(--line-strong); border-radius: 6px; padding: 36px 24px; text-align: center; color: var(--fg-3); max-width: 1120px; background: var(--input-bg); }
.empty-box .empty-title { color: var(--fg); font-weight: 600; margin-bottom: 4px; }

/* ---------- Small shared marks ---------- */
.color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; vertical-align: middle; }
.memo-icon { display: inline-flex; color: var(--warn); cursor: help; }
.memo-icon .ic { width: 18px; height: 18px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12.5px; font-weight: 500; background: var(--muted-soft); color: var(--fg-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
