/* easiForms components and the app shell. Load after ef-tokens.css.
   Measurements follow Kolmena (kol-shell.css, admin.css, kol-aire.css; room
   kolmena-easiforms-css-design): 40px controls with a 10px radius, flat 16px
   cards, menus and dialogs as the only things with a shadow, a plain page
   header instead of a banner. Colours only from ef-tokens.css. */

.muted { color: var(--ink-2); }
.small { font-size: var(--text-sm); }

/* ---- controls ------------------------------------------------------------ */
label { display: block; font-weight: 600; font-size: var(--text-sm); color: var(--ink); margin: 0 0 6px; }
input, select, textarea {
  width: 100%;
  min-height: var(--ctl-h);
  font: inherit;
  font-size: var(--text-md);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-ctl);
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
textarea { line-height: var(--lh-base); padding: 10px 12px; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: var(--ring); }
input[type="checkbox"], input[type="radio"] {
  width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--brand); box-shadow: none;
}
select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.field { margin-bottom: var(--space-4); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--ctl-h);
  padding: 0 16px;
  font: inherit; font-size: 13.5px; font-weight: 600; line-height: 1.2;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-ctl);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease);
}
.btn:hover { border-color: var(--border-strong); background: var(--surface-subtle); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-on); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-ghost { background: var(--surface); }
.btn-danger { background: var(--surface); border-color: var(--danger-border); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger-border); }
.btn-link {
  min-height: 0; padding: 0; border: 0; background: none;
  color: var(--brand-ink); font-weight: 600;
}
.btn-link:hover { background: none; text-decoration: underline; text-underline-offset: 2px; }
.btn-block { width: 100%; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: var(--text-sm); border-radius: 9px; }
a.btn:hover { text-decoration: none; }

.alert {
  margin: 0 0 var(--space-4);
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-ctl);
  font-size: var(--text-md);
}
.alert-error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.alert-ok { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.alert-warn { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.alert-warn p { margin: 0 0 4px; font-weight: 600; }
.alert-warn ul { margin: 0; padding-left: 1.2rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
}

/* ---- sign-in page ------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box > .card { padding: 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: var(--track-head); color: var(--ink); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--brand);
  display: grid; place-items: center; color: var(--brand-on);
  font-family: var(--font-display); font-size: 13px; font-weight: 700; letter-spacing: -.02em;
}
.auth-head { text-align: center; margin-bottom: 24px; }
.auth-head .brand { justify-content: center; margin-bottom: 10px; }
.auth-head p { color: var(--ink-2); margin: 0; }
.code-input { font-size: 26px; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; min-height: 56px; }
.auth-foot { display: flex; justify-content: space-between; margin-top: var(--space-4); }
.lang-switch { text-align: center; margin-top: var(--space-5); color: var(--ink-3); }

/* Segmented control (sign-in tabs, list filters). */
.tabs {
  display: flex; gap: 4px; padding: 4px; margin-bottom: var(--space-5);
  background: var(--surface-muted); border-radius: var(--radius-md);
}
.tab {
  flex: 1; min-height: 34px; padding: 6px 12px; border: 0; border-radius: 9px;
  background: none; color: var(--ink-2); cursor: pointer; text-align: center;
  font: inherit; font-size: var(--text-sm); font-weight: 600;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"], .tab[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--elev-1); }

/* ---- app shell ------------------------------------------------------------ */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--space-4);
  padding: 18px 14px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.sidebar > .brand { padding: 2px 8px 4px; }
.tenant-btn {
  width: 100%; min-height: 48px; text-align: left;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: var(--ink); cursor: pointer;
  font: inherit; font-size: var(--text-md);
  transition: border-color var(--dur-fast) var(--ease);
}
.tenant-btn:hover { border-color: var(--border-strong); }
.tenant-btn .name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 40px; padding: 8px 12px; border-radius: var(--radius-ctl);
  color: var(--ink-2); font-size: 14.5px; font-weight: 500;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav a:hover { background: var(--surface-muted); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--brand-96); color: var(--brand-43); font-weight: 600; }
.nav a.nav-sub { padding-left: 26px; font-size: var(--text-md); min-height: 36px; }
.nav .soon {
  font-size: var(--text-2xs); font-weight: 600; color: var(--ink-3);
  padding: 2px 7px; border-radius: var(--radius-pill); background: var(--surface-muted);
}
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border-subtle); padding: 12px 8px 0; }
.user-line { font-size: var(--text-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { width: 100%; max-width: calc(var(--content-max) + 80px); margin: 0 auto; padding: 32px 40px 48px; }

/* Page header (Kolmena "aire"): the title, one line of context, the actions
   on the right. No banner. */
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 12px 24px; margin-bottom: var(--space-6);
}
.page-head h1 { margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--ink-2); max-width: 64ch; }

/* "Back to ..." above a page title: a drawn chevron, not a typed arrow. */
.back-line { margin: 0 0 10px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); }
.back-link:hover { color: var(--brand-ink); text-decoration: none; }
.back-link::before {
  content: ""; width: 16px; height: 16px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 5l-7 7 7 7'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 5l-7 7 7 7'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Menus. */
.menu { position: relative; }
.menu-list {
  position: absolute; z-index: var(--z-dropdown); top: calc(100% + 6px); left: 0; right: 0;
  display: flex; flex-direction: column; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--sh-menu);
}
.menu-list button {
  min-height: 36px; padding: 8px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--ink); cursor: pointer; text-align: left;
  font: inherit; font-size: var(--text-md);
}
.menu-list button:hover { background: var(--surface-muted); }
.menu-list button.danger { color: var(--danger); }
.menu-list button.danger:hover { background: var(--danger-bg); }
.menu-list .sep { height: 1px; background: var(--border-subtle); margin: 4px 2px; }
details.more { position: relative; }
details.more > summary { list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more .menu-list { left: auto; right: 0; min-width: 180px; }

/* Tables. Sentence-case heads, no capitals. */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
th { font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--surface-subtle); }
thead th:first-child { border-top-left-radius: var(--radius-md); }
thead th:last-child { border-top-right-radius: var(--radius-md); }
tbody tr:last-child > * { border-bottom: 0; }
td select { width: auto; min-height: 32px; padding: 4px 30px 4px 10px; }
.tag {
  display: inline-block; font-size: var(--text-xs); font-weight: 600;
  padding: 2px 8px; border-radius: var(--radius-sm);
  background: var(--surface-muted); color: var(--ink-2);
}

.row { display: flex; gap: var(--space-3); align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 180px; margin-bottom: 0; }

/* Dialogs: the one place with a big shadow. Fixed head and foot, the body scrolls. */
dialog {
  width: calc(100% - 32px); max-width: 440px; padding: 22px;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  box-shadow: var(--sh-dialog);
}
dialog::backdrop { background: rgba(16, 24, 28, .42); backdrop-filter: blur(3px); }
dialog h2 { font-size: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: var(--space-5); }
dialog.form-dialog { max-width: 500px; }

.mobile-bar { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    display: none; position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: auto;
    z-index: var(--z-nav); box-shadow: var(--sh-dialog);
  }
  .sidebar.open { display: flex; }
  .mobile-bar {
    position: sticky; top: 0; z-index: var(--z-bar);
    display: flex; align-items: center; justify-content: space-between;
    min-height: 56px; padding: 8px 16px;
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
  }
  .main { padding: 20px 16px 40px; }
  .hide-sm { display: none; }
}
@media (max-width: 860px) and (prefers-color-scheme: dark) {
  .mobile-bar { background: rgba(24, 33, 36, .96); }
}

/* ---- admin lists: forms and submissions --------------------------------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; margin-bottom: var(--space-5); }
.filter-bar .field { margin: 0; min-width: 140px; flex: 0 1 190px; }
.filter-bar .field.grow { flex: 1 1 240px; }
.filter-bar .tabs { margin-bottom: 0; }

.badge {
  flex: none; display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--text-xs); font-weight: 600; line-height: 1.4;
  padding: 2px 9px; border-radius: var(--radius-pill);
  white-space: nowrap; vertical-align: middle;
}
.badge-accent { background: var(--brand-soft); color: var(--brand-ink); box-shadow: inset 0 0 0 1px var(--brand-93); }
.badge-ok { background: var(--success-bg); color: var(--success); }
.badge-muted { background: var(--surface-muted); color: var(--ink-2); }
.badge .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.form-group { margin-bottom: var(--space-8); }
.form-group > h2 { font-size: var(--text-md); font-family: var(--font); font-weight: 600; color: var(--ink-2); margin-bottom: var(--space-3); }
.card-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-3); }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1080px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.form-card { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; min-width: 0; transition: border-color var(--dur-fast) var(--ease); }
.form-card:hover { border-color: var(--border-strong); }
.form-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.form-card-name { font-size: var(--text-base); margin: 0; }
.form-card-name a { color: var(--ink); }
.form-card-name a:hover { color: var(--brand-ink); }
.form-card-desc {
  margin: 0; color: var(--ink-2); font-size: var(--text-md);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.form-card-counts { margin: 0; color: var(--ink-3); font-size: var(--text-sm); }
.form-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 10px; }
.unpublished { margin: 0; color: var(--warning); display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); }
.unpublished .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); }

/* Empty states: an invitation to act, not a mood. */
.empty { text-align: center; padding: 44px 24px; border: 1px dashed var(--border-strong); background: var(--surface); }
.empty h2 { font-size: var(--text-base); }
.empty p { color: var(--ink-2); max-width: 46ch; margin-left: auto; margin-right: auto; }

.pager { display: flex; align-items: center; justify-content: center; gap: var(--space-3); margin: var(--space-5) 0; color: var(--ink-2); }
.skeleton-grid { display: grid; gap: var(--space-3); }
.skeleton-card { height: 96px; border-radius: var(--radius-lg); background: var(--surface-muted); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.table-card { padding: 0; overflow: hidden; }
.click-row { cursor: pointer; }
.click-row:hover td, .click-row:hover th { background: var(--surface-subtle); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .btn + .btn { margin-left: 6px; }
@media (max-width: 640px) {
  .subs-table thead { display: none; }
  .subs-table, .subs-table tbody, .subs-table tr, .subs-table td { display: block; width: 100%; }
  .subs-table tr { border-bottom: 1px solid var(--border-subtle); padding: 10px 14px; }
  .subs-table td { border: 0; padding: 2px 0; }
  .subs-table td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-3); font-size: var(--text-sm); }
  .row-actions { text-align: left; padding-top: 6px; }
}

/* ---- one submission ------------------------------------------------------ */
.sub-summary { margin: 0 0 4px; font-weight: 600; }
.sub-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; color: var(--ink-2); font-size: var(--text-sm); }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.meta-box { margin-bottom: var(--space-4); padding: 14px 20px; }
.meta-box summary { cursor: pointer; font-weight: 600; }
.meta-box dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 10px 0 0; font-size: var(--text-sm); }
.meta-box dt { color: var(--ink-2); }
.meta-box dd { margin: 0; }
.sub-view .fa-view { display: flex; flex-direction: column; gap: var(--space-4); }
.sub-view .fa-view-page { display: flex; flex-direction: column; gap: var(--space-3); }
.sub-view .fa-page-title { font-size: var(--text-xl); margin: 4px 0 0; }
.sub-view .fa-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 24px; }
.sub-view .fa-section-title { font-size: var(--text-base); margin: 0 0 14px; }
.sub-view .fa-section > .ef-field:last-child { margin-bottom: 0; }

/* ---- entities and records (04_ENTITIES.md 8) ----------------------------- */
label.inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; margin: 0 16px 6px 0; }
label.inline input { width: auto; margin: 0; flex: none; }
.plain-list { list-style: none; margin: 0 0 12px; padding: 0; }
.plain-list li { padding: 4px 0; }
.type-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--brand-soft); color: var(--brand-ink); box-shadow: inset 0 0 0 1px var(--brand-93);
}
.type-card .form-card-head { justify-content: flex-start; align-items: center; gap: 12px; }
.type-badges { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.archived-group > summary { cursor: pointer; list-style: none; }
.archived-group > summary h2 { display: inline; }
.title-with-icon { display: flex; align-items: center; gap: 12px; min-width: 0; }
.title-with-icon h1 { margin: 0; }
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; max-height: 12rem; overflow-y: auto; padding: 4px; }
.icon-choice { position: relative; display: flex; justify-content: center; margin: 0; cursor: pointer; }
.icon-choice input { position: absolute; opacity: 0; }
.icon-choice > span:first-of-type { display: flex; padding: 7px; border: 1px solid var(--border); border-radius: 9px; color: var(--ink-2); }
.icon-choice input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.icon-choice input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
dialog.type-dialog { max-width: 580px; }
fieldset.field { border: 0; padding: 0; margin: 0 0 var(--space-4); }
fieldset.field legend { font-weight: 600; font-size: var(--text-sm); margin-bottom: 6px; padding: 0; }
.filter-panel { margin-bottom: var(--space-4); padding: 14px 20px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.filter-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; width: 100%; }
.filter-row > select { width: auto; min-width: 9rem; }
.filter-value { flex: 1 1 12rem; min-width: 0; }
.filter-row > .btn { flex: none; align-self: center; }
.filter-value .ef-field { margin: 0; }
.filter-value .ef-label, .filter-value .ef-help { display: none; }
.records-table tbody th[scope="row"] { font-size: inherit; color: var(--ink); font-weight: 600; background: none; }
.records-table tr.is-inactive th, .records-table tr.is-inactive td { color: var(--ink-3); }
.sort-btn { font: inherit; color: inherit; text-decoration: none; padding: 0; }
.col-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--border-subtle); }
.rec-badges { margin: 4px 0; display: flex; gap: 6px; flex-wrap: wrap; }
.rec-fields { margin-bottom: var(--space-4); }
.rec-empty { margin-bottom: var(--space-4); }
.rec-empty > summary { cursor: pointer; color: var(--ink-2); margin-bottom: 8px; }
.rec-tabs .tabs { max-width: 26rem; margin-bottom: var(--space-3); }
.rec-tabs [role="tabpanel"] { padding: 20px 24px; }
.history-list { list-style: none; margin: 0; padding: 0; }
.history-list > li { border-bottom: 1px solid var(--border-subtle); padding: 10px 0; }
.history-list > li p { margin: 0 0 4px; }
.history-list ul { margin: 0; padding-left: 1.1rem; }
.rec-form { max-width: 880px; }
.rec-form .fa-progress, .rec-form .fa-fill-page > .fa-page-title { display: none; }
.rec-form .fa-fill-page { display: flex; flex-direction: column; gap: var(--space-4); }
.rec-form .fa-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 24px; }
.rec-form .fa-section-title { font-size: var(--text-base); margin: 0 0 14px; }
/* On a desktop, short answers sit two by two; long text, groups, photos, maps and
   choice lists keep the whole width. */
@media (min-width: 900px) {
  .rec-form .fa-section { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
  .rec-form .fa-section > :not(.fa-slot) { grid-column: 1 / -1; }
  .rec-form .fa-slot:has(textarea, .ef-group, .ef-photo-grid, .ef-photo-take, .ef-geo-get, .ef-options, .ef-chips, .ef-buttons, .ef-section) { grid-column: 1 / -1; }
  .rec-form .fa-slot > .ef-field { margin-bottom: 18px; }
}
.rec-form .fa-bar { position: sticky; bottom: 0; background: var(--canvas); padding: 12px 0; display: flex; justify-content: flex-end; gap: 8px; }
.rec-form .fa-fill-bar .btn { flex: 0 0 auto; min-width: 8rem; }
dialog.record-dialog .fa-bar { background: var(--surface); }
dialog.record-dialog { width: min(720px, 96vw); max-width: none; max-height: 92vh; overflow-y: auto; }
.record-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); margin-bottom: var(--space-3); }
.record-dialog-head h2 { margin: 0; }
@media (max-width: 860px) {
  .records-table th[scope="row"] { display: block; width: 100%; padding: 2px 0; border: 0; }
  .records-table td:nth-of-type(n+3) { display: none; }
  .filter-row > select { flex: 1 1 45%; }
}

.nt-lib-how { margin: 4px 0 0 24px; }
.nt-lib-how p { margin: 0 0 6px 24px; }
#nt-library, #nt-parent { width: auto; min-width: 12rem; margin: 0 0 8px 24px; display: block; }

@media print {
  .sidebar, .mobile-bar, .no-print { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  body { background: #fff; }
  .card, .sub-view .fa-section { border-color: #ccc; }
}

/* ---- home ------------------------------------------------------------------ */
/* What to do now: forms to fill, drafts to finish, the team's latest answers.
   Rows in one list, not a grid of identical boxes. */
.home { display: flex; flex-direction: column; gap: var(--space-8); }
.home-block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: var(--space-3); }
.home-block-head h2 { margin: 0; }
.home-block-head a { font-size: var(--text-sm); font-weight: 600; }
.home-list { list-style: none; margin: 0; padding: 0; }
.home-row {
  display: flex; align-items: center; gap: 12px 16px;
  padding: 14px 20px; border-bottom: 1px solid var(--border-subtle);
}
.home-row:last-child { border-bottom: 0; }
.home-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: var(--ink); }
.home-row-main:hover { text-decoration: none; }
.home-row-main:hover .home-row-title { color: var(--brand-ink); }
.home-row-title { font-weight: 600; font-size: var(--text-base); transition: color var(--dur-fast) var(--ease); }
.home-row-text {
  color: var(--ink-2); font-size: var(--text-sm);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.home-row-meta { flex: none; font-size: var(--text-sm); color: var(--warning); font-weight: 600; }
.home-quiet { color: var(--ink-2); margin: 0; }
@media (max-width: 560px) {
  .home-row { padding: 12px 16px; flex-wrap: wrap; }
  .home-row-meta { order: 3; }
}

/* ---- one record: saved values read like a spec sheet on a desktop -------- */
.rec-fields .fa-section-title, .rec-empty .fa-section-title { font-size: var(--text-base); }
@media (min-width: 900px) {
  .rec-fields .ef-field, .rec-empty .ef-field {
    display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); column-gap: 24px; align-items: baseline;
    margin: 0; padding: 10px 0; border-bottom: 1px solid var(--border-subtle);
  }
  .rec-fields .ef-field:last-child, .rec-empty .ef-field:last-child { border-bottom: 0; }
  .rec-fields .ef-field > .ef-label, .rec-empty .ef-field > .ef-label { margin: 0; color: var(--ink-2); font-weight: 500; }
  .rec-fields .ef-field > :not(.ef-label), .rec-empty .ef-field > :not(.ef-label) { grid-column: 2; }
}
details > summary.disclose, .rec-empty > summary, .meta-box summary, .archived-group > summary {
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
}
.rec-empty > summary::-webkit-details-marker, .meta-box summary::-webkit-details-marker, .archived-group > summary::-webkit-details-marker { display: none; }
.rec-empty > summary::before, .meta-box summary::before, .archived-group > summary::before {
  content: ""; width: 14px; height: 14px; background: currentColor; transition: transform var(--dur-fast) var(--ease);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5l7 7-7 7'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5l7 7-7 7'/%3E%3C/svg%3E") center / contain no-repeat;
}
.rec-empty[open] > summary::before, .meta-box[open] summary::before, .archived-group[open] > summary::before { transform: rotate(90deg); }
.records-table tbody th[scope="row"] a, .subs-table td:first-child a { color: var(--ink); }
.records-table tbody th[scope="row"] a:hover, .subs-table td:first-child a:hover { color: var(--brand-ink); }

/* ---- settings ---------------------------------------------------------------- */
.settings-card { max-width: 620px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--border-subtle); }
fieldset.brand-field { margin-top: var(--space-6); padding-top: var(--space-5); border-top: 1px solid var(--border-subtle); }
.brand-field > p { margin: 0 0 12px; }
.brand-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.brand-row input[type="color"] {
  width: 48px; height: 40px; min-height: 0; padding: 4px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-ctl); background: var(--surface);
}
.brand-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.brand-row input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }
.brand-hex { width: 140px; }
.brand-hex input { font-variant-numeric: tabular-nums; text-transform: lowercase; }
/* The preview takes the tokens of the chosen colour (set inline by settings.js). */
.brand-preview {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: var(--space-4);
  padding: 16px; border-radius: var(--radius-md); background: var(--canvas); border: 1px solid var(--border-subtle);
}
.brand-preview-title { flex: 1 0 100%; font-size: var(--text-xs); font-weight: 600; color: var(--ink-3); }
.brand-preview-option {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 12px;
  background: var(--brand-soft); color: var(--ink); box-shadow: inset 0 0 0 2px var(--brand); font-weight: 500;
}
.brand-preview .btn { pointer-events: none; min-height: 44px; }
/* A floated legend sits inside the fieldset like a normal heading, so the top
   divider runs whole instead of breaking around it. */
fieldset.brand-field > legend { float: left; width: 100%; margin-bottom: 6px; }
fieldset.brand-field > legend + * { clear: both; }
