:root { color-scheme: light; font: 16px/1.5 system-ui, sans-serif; color: #243c38; background: #f7f9f7; }
* { box-sizing: border-box; }
body { margin: 0; }
main { --content-gutter: clamp(20px, 3vw, 48px); min-width: 0; min-height: 100vh; margin-left: 264px; padding: 32px var(--content-gutter) 24px; }

h1 { font-size: clamp(1.6rem, 3vw, 2rem); letter-spacing: -.04em; line-height: 1.2; margin: 3px 0 0; overflow-wrap: anywhere; }

.editor-panel, .output-panel { border: 1px solid #cbd6cb; border-radius: 12px; background: #fff; min-width: 0; overflow: hidden; }
.editor-panel { padding: 20px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
label, h2 { font-size: .9rem; font-weight: 650; }
h2 { margin: 0; }
.panel-heading span, .hint, footer { font-size: .75rem; color: #617269; }
textarea, input, select { width: 100%; color: #213c35; background: #fafcf8; border: 1px solid #cbd6cb; border-radius: 6px; padding: 12px; }
textarea { display: block; min-height: 420px; resize: vertical; tab-size: 2; font: .9rem/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre; }
.metadata-editor { min-height: 180px; }
input, select { display: block; margin-top: 8px; font: inherit; }
.hint { margin: 10px 0 22px; }
button { border: 0; border-radius: 6px; background: #236247; color: white; padding: 10px 30px; font: 600 .9rem system-ui, sans-serif; cursor: pointer; }
button:hover:enabled { background: #174b35; }
button:disabled { opacity: .5; cursor: wait; }
:focus-visible { outline: 3px solid #6b9e88; outline-offset: 3px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0; font-size: .8rem; }
.pagination button { padding: 7px 12px; }
.inline-action { padding: 2px 5px; min-width: 28px; background: transparent; color: inherit; font-size: 1.15rem; vertical-align: middle; }
.inline-action:hover:enabled { background: #edf2ed; }
.item-symbol[data-color="red"] { color: #c43f3f; }
.item-symbol[data-color="blue"] { color: #3978b5; }
.item-symbol[data-color="orange"] { color: #d97706; }
.item-symbol[data-color="green"] { color: #236247; }
.item-symbol[data-color="purple"] { color: #8557b2; }
.task-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 34px; padding: 3px 7px; color: #40594e; background: transparent; border-radius: 7px; vertical-align: middle; }
.task-toggle.icon-only { width: 34px; padding: 0; }
.task-toggle:hover:enabled { background: #edf3ef; }
.task-toggle:disabled { opacity: .45; cursor: not-allowed; }
.toggle-mark { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex-shrink: 0; }
.task-toggle svg, .date-chip svg, .date-tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.toggle-checkbox .toggle-mark { width: 20px; height: 20px; border: 1.5px solid #8fa398; border-radius: 6px; background: #fff; }
.toggle-checkbox svg { width: 17px; height: 17px; stroke-width: 2.3; opacity: 0; }
.toggle-checkbox:hover:enabled .toggle-mark { border-color: #347755; }
.toggle-checkbox[data-checked="true"] .toggle-mark { background: #347755; border-color: #347755; color: #fff; }
.toggle-checkbox[data-checked="true"] svg { opacity: 1; }
.toggle-star .toggle-mark { color: #87968b; }
.toggle-star[data-checked="true"] .toggle-mark { color: #a97819; }
.toggle-star[data-checked="true"] svg { fill: #f1ca61; }
.toggle-star:hover:enabled { background: #faf4df; }
.badge.date-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; background: #edf3ef; border: 1px solid #dae5de; color: #486356; border-radius: 6px; }
.date-chip svg { width: 14px; height: 14px; flex-shrink: 0; }
.date-chip time { white-space: pre-wrap; }
.date-field { display: flex; align-items: center; min-width: 0; width: 100%; margin-top: 5px; border: 1px solid #c9d8ce; border-radius: 8px; background: #f6f9f5; overflow: hidden; }
.date-field:focus-within { border-color: #347755; box-shadow: 0 0 0 2px #34775520; }
.action-form > .field .date-field input { width: 0; flex: 1; min-width: 105px; margin: 0; padding: 9px 10px; border: 0; background: transparent; color: #314f40; }
.date-field.custom-picker input::-webkit-calendar-picker-indicator { display: none; }
.date-field .date-tool { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 34px; height: 36px; padding: 0; background: transparent; color: #647d6e; border-radius: 5px; }
.date-field .date-tool:hover:enabled { color: #235e3c; background: #e6efe8; }
.date-field .date-clear svg { width: 15px; height: 15px; }
.date-field .date-tool:disabled { opacity: .45; cursor: not-allowed; }
/* Temporary execution/save locks keep the current view visually steady. */
#output-tasks [data-transient-disabled="true"]:disabled,
#task-details [data-transient-disabled="true"]:disabled { opacity: 1; -webkit-text-fill-color: currentColor; cursor: wait; }
.item-actions .task-toggle { padding: 3px 7px; }
@media (pointer: coarse) { .task-toggle, .task-toggle.icon-only { min-width: 44px; min-height: 44px; } .date-field .date-tool { width: 44px; height: 44px; } }
.output-panel { align-self: start; display: flex; flex-direction: column; background: #f9fbf7; }
.output-panel .panel-heading { padding: 20px; margin: 0; border-bottom: 1px solid #dce3d8; }
#output { margin: 0; padding: 20px; height: 130px; max-height: 300px; overflow: auto; white-space: pre; font: .9rem/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; }
.error { color: #a02525; background: #fff0ed; }
footer { margin-top: 20px; }

.input-heading { margin-top: 0; flex-wrap: wrap; }
.secondary { color: #236247; background: #eaf1e8; padding: 8px 12px; }
.secondary:hover:enabled { background: #d9e8d7; }
.task-editor { border: 1px solid #dce3d8; border-radius: 8px; padding: 14px; margin-bottom: 12px; background: #fafcf8; }
.field { font-size: .75rem; }
.check-field { display: flex; align-items: center; gap: 7px; font-size: .8rem; font-weight: 400; }
.check-field input { width: 16px; height: 16px; margin: 0; accent-color: #236247; }
#input-tasks { padding: 3px; margin: -3px; }
#output-tasks { margin-inline: 0; padding: 0; max-height: none; overflow: visible; }
.empty { text-align: center; font-size: .85rem; color: #617269; padding: 8px 0; }
.task-result { border: 1px solid #dce3d8; border-radius: 8px; padding: 4px 2px; margin: 0; min-width: 0; background: white; overflow-wrap: anywhere; }
.badge { font-size: .7rem; background: #edf2e9; color: #51675b; border-radius: 4px; padding: 3px 7px; }

#view-controls { border: 0; background: none; padding: 0; margin-bottom: 10px; }
#view-options { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
#view-options .field { min-width: 0; max-width: 100%; }
#view-options select { width: auto; max-width: 100%; field-sizing: content; margin: 0; min-height: 30px; padding: 4px 8px; font-size: .75rem; line-height: 1.4; }
summary { cursor: pointer; font-size: .8rem; color: #236247; }
details { border: 1px solid #dce3d8; border-radius: 6px; padding: 10px; }
#schema { font-size: .75rem; white-space: pre-wrap; }
.view-section + .view-section { margin-top: 14px; }
.task-result[data-accent="orange"] { border-left: 4px solid #d97706; }
.task-result[data-accent="red"] { border-left: 4px solid #c43f3f; }
.task-result[data-accent="green"] { border-left: 4px solid #236247; }
.task-result[data-accent="blue"] { border-left: 4px solid #3978b5; }
.task-result[data-accent="purple"] { border-left: 4px solid #8557b2; }
.task-result h4 { margin: 0; font-size: .95rem; }
.control-line { display: flex; align-items: center; gap: 4px; min-width: 0; }
.inline-control { display: inline-flex; align-items: center; flex: 0 0 auto; min-width: 0; }
.inline-text-control { flex: 0 1 auto; min-width: 0; max-width: 100%; }
.inline-text { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.controls-right { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: auto; flex: 0 0 auto; min-width: 0; max-width: 100%; }


.item-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.item-actions:empty { display: none; }
.item-actions button { padding: 7px 10px; font-size: .75rem; }
.action-form { display: flex; gap: 8px; width: 100%; min-width: 0; }
.action-form input { margin: 0; padding: 7px; min-width: 0; flex: 1; font-size: .8rem; }
.action-form > .field { display: block; width: 100%; }
.action-form > .field > label { font-size: inherit; }
.action-form > .field input, .action-form > .field textarea { margin-top: 5px; }
.action-form button { flex-shrink: 0; }
.multiline-form { flex-direction: column; align-items: flex-start; }
.action-form textarea { min-height: 110px; min-width: 0; max-width: 100%; margin: 0; padding: 8px; font: inherit; font-size: .85rem; line-height: 1.5; white-space: pre-wrap; }
.action-scripts { margin-top: 12px; }
#action-script { min-height: 190px; margin: 10px 0; }

.item-symbol { display: inline-block; text-decoration: none; white-space: pre-wrap; }

[hidden] { display: none !important; }
.selector-panel { border: 1px solid #cbd6cb; background: white; border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.workspace-management { margin-bottom: 20px; }
.management-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.management-card { min-width: 0; border: 1px solid #dce3d8; border-radius: 8px; padding: 16px; }
.management-card h3 { margin-top: 0; }
.management-card form button { margin-top: 12px; }
.management-card code { overflow-wrap: anywhere; }
#source-list-choices { max-height: 180px; overflow: auto; }
#source-list-choices label { overflow-wrap: anywhere; padding: 4px 0; }
#list-source-lists { border: 1px solid #dce3d8; border-radius: 6px; margin: 12px 0; min-width: 0; }
#delete-dialog { max-width: min(520px, calc(100% - 32px)); border: 1px solid #cbd6cb; border-radius: 12px; padding: 24px; color: #243c38; }
#delete-dialog::backdrop { background: rgb(20 35 30 / 45%); }
#delete-dialog p { overflow-wrap: anywhere; }
button.danger { background: #963c33; color: white; }
.view-section { min-width: 0; }
details.view-section { border: 0; border-radius: 0; padding: 0; }
.section-items { display: grid; grid-template-columns: 1fr; gap: 6px; min-width: 0; }
.section-title { margin: 0; padding: 7px 0; font-size: .82rem; font-weight: 650; list-style: none; cursor: pointer; overflow-wrap: anywhere; white-space: pre-wrap; }
.section-title::-webkit-details-marker { display: none; }
.section-title::before { content: '▸'; display: inline-block; width: 18px; }
.view-section[open] > .section-title::before { content: '▾'; }
.view-section[open] > .section-title { margin-bottom: 5px; }
.raw-task-heading { display: flex; align-items: center; gap: 8px; }
.raw-task-heading input[type="checkbox"] { flex: 0 0 16px; width: 16px; height: 16px; margin: 0; accent-color: #236247; }
.raw-task-heading .raw-task-name { flex: 1; min-width: 0; margin: 0; padding: 4px; border: 0; background: transparent; font-size: .85rem; text-overflow: ellipsis; }
.raw-record { min-width: 0; margin-top: 6px; padding: 0; border: 0; }
.raw-record > summary { width: fit-content; }
.raw-record .item-json { min-height: 200px; max-height: 600px; margin: 8px 0 0; padding: 12px; background: #eef2e9; font: .75rem/1.6 ui-monospace, monospace; white-space: pre; overflow: auto; }
.logs-panel { margin-top: 22px; }

.config-buttons { display:flex; flex-wrap:wrap; gap:10px; margin:12px 0; }
.item-actions > .item-symbol { align-self:center; }

.view-text { width:100%; margin:4px 0; font-size:.85rem; white-space:pre-wrap; }
.inline-text.text-ellipsis, .view-text.text-ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.muted { color:#617269; font-size:.7rem; }
.strikethrough { text-decoration:line-through; color:#617269; }
#ui-catalog { font:.75rem/1.7 ui-monospace,monospace; white-space:pre-wrap; overflow-wrap:anywhere; }
#action-name { margin-bottom:10px; }

/* App shell and drawer navigation. Row controls still come entirely from Lua. */
.page-header { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; }
.page-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex: 1; min-width: 0; }
#page-title { min-width: 0; margin: 0; font-size: 1.2rem; line-height: 1.3; letter-spacing: -.02em; }
#result-count { flex-shrink: 0; color: #617269; font-size: .8rem; white-space: nowrap; background: transparent; padding: 4px; min-height: 0; font-weight: normal; }
.drawer { position: fixed; inset: 0 auto 0 0; z-index: 30; width: 264px; background: #edf2ed; border-right: 1px solid #dce4dc; padding: 26px 16px 16px; overflow-y: auto; display: flex; flex-direction: column; }
.drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; font-weight: 700; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #236247; color: white; font-size: 1.2rem; }
.nav-heading { margin: 20px 12px 9px; font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: #617269; }
.list-navigation > .nav-heading:first-child { margin-top: 0; }
.drawer-button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px; text-align: left; border-radius: 7px; background: transparent; color: #3e554b; font-size: .82rem; font-weight: 500; min-height: 42px; }
.drawer-button > span:first-child { flex-shrink: 0; width: 18px; text-align: center; font-size: 1.1rem; line-height: 1; color: #718277; }
.drawer-button:hover:enabled { background: #e0e9df; }
.drawer-button[aria-current="page"] { background: #d9e8dc; color: #174b35; font-weight: 650; }
.drawer-button[aria-current="page"] > span:first-child { color: #236247; }
.list-link[data-selected="true"] { box-shadow: inset 3px 0 #438360; }
.list-name { min-width: 0; overflow-wrap: anywhere; }
.folder-toggle { font-weight: 500; }
.folder-lists { margin-left: 16px; padding-left: 4px; border-left: 1px solid #d6e0d5; }
.navigation-settings { margin-bottom: 22px; }
.navigation-settings > summary { font-size: .9rem; font-weight: 650; }
#navigation-config { min-height: 240px; }
#navigation-list-reference { max-height: 220px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .75rem; }
.create-list-buttons { margin-bottom: 18px; }
.workspace-navigation { margin: auto 0 12px; border: 0; border-radius: 0; padding: 24px 0 0; }
.workspace-navigation > summary { cursor: pointer; }
.drawer-footer { margin: 0 12px; padding-top: 8px; font-size: .68rem; color: #738077; }
.icon-button { width: 40px; height: 40px; flex-shrink: 0; padding: 0; background: transparent; color: #345747; font-size: 1.4rem; }
.icon-button:hover:enabled { background: #dce8dd; }
#drawer-toggle, #drawer-close { display: none; }
.item-actions .action-form { flex: 1 1 280px; max-width: 450px; }
#page-title:focus { outline: none; }
#page-title:focus-visible { outline: 3px solid #6b9e88; outline-offset: 4px; }
@media (max-width: 1050px) {
  .page-header { flex-wrap: wrap; }
  .management-grid { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  main { --content-gutter: 16px; margin-left: 0; padding: 20px var(--content-gutter); }
  #output-tasks { margin-inline: calc(6px - var(--content-gutter)); }
  .page-header { gap: 12px; margin-bottom: 20px; }
  .page-heading { flex-basis: calc(100% - 52px); }
  #drawer-toggle, #drawer-close { display: block; }
  .drawer { width: min(300px, 88vw); visibility: hidden; transform: translateX(-100%); }
  .drawer.is-open { visibility: visible; transform: translateX(0); box-shadow: 8px 0 32px #18281e26; }
  #drawer-backdrop { position: fixed; inset: 0; z-index: 20; background: #16271f66; }
  body.drawer-open { overflow: hidden; }
  .selector-panel, .editor-panel { padding: 16px; }
  .output-panel .panel-heading { padding: 16px; }
  textarea { min-height: 340px; }
}

.list-picker { display: block; margin-bottom: 22px; }

/* Selected task details: secondary Lua controls live in a right drawer. */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.task-result { cursor: pointer; }
.task-result[data-selected="true"] { outline: 2px solid #438360; outline-offset: 2px; }
.task-drawer { position: fixed; inset: 0 0 0 auto; z-index: 50; width: 380px; min-width: 0; display: flex; flex-direction: column; background: #fff; border-left: 1px solid #cbd6cb; box-shadow: -8px 0 24px #18281e12; }
.task-drawer-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; padding: 16px 20px; border-bottom: 1px solid #dce3d8; }
.task-drawer-header h2 { grid-column: 1; grid-row: 1; font-size: 1rem; white-space: nowrap; }
.task-drawer-header #close-task { grid-column: 3; grid-row: 1; }
#task-details { flex: 1; min-height: 0; overflow: auto; padding: 20px; overflow-wrap: anywhere; }
#task-details h4 { margin: 0 0 16px; font-size: 1.1rem; white-space: pre-wrap; }
#task-details .action-form { flex: 1 1 100%; max-width: none; }
#task-drawer-status { grid-column: 2; grid-row: 1; min-width: 0; margin: 0; font-size: .72rem; white-space: pre-wrap; max-height: 160px; overflow: auto; overflow-wrap: anywhere; }
#task-drawer-status:not(.error) { color: #617269; }
#task-drawer-status.error { grid-column: 1 / -1; grid-row: 2; padding: 8px; font-size: .8rem; }
#task-drawer-status:empty { display: none; }
#task-backdrop { position: fixed; inset: 0; z-index: 45; background: #16271f66; }
@media (min-width: 1101px) {
  body.task-open main { margin-right: 380px; }
  body.task-open #add-task { right: calc(380px + 24px + env(safe-area-inset-right, 0px)); }
}
@media (max-width: 1100px) {
  .task-drawer { width: min(420px, 100vw); }
  body.task-modal-open { overflow: hidden; }
}

#panel-view { padding-bottom: 80px; }
#add-task { position: fixed; right: max(20px, env(safe-area-inset-right, 0px)); bottom: max(20px, env(safe-area-inset-bottom, 0px)); z-index: 10; min-width: 88px; min-height: 48px; padding: 12px 24px; border-radius: 999px; box-shadow: 0 4px 16px #163a292b; }
#add-task-hint:empty, #task-notice:empty, #new-task-error:empty { display: none; }
.creation-settings { grid-column: 1 / -1; }
#add-task-dialog { width: min(440px, calc(100% - 32px)); border: 1px solid #cbd6cb; border-radius: 12px; padding: 24px; color: #243c38; margin-top: max(20px, 12dvh); margin-bottom: auto; max-height: calc(100dvh - 48px); overflow: auto; overflow-wrap: anywhere; }
#add-task-dialog::backdrop { background: rgb(20 35 30 / 45%); }
#add-task-dialog .hint { margin-bottom: 18px; }
#new-task-error { padding: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
#new-task-logs { padding: 10px; max-height: 130px; overflow: auto; background: #f7f9f7; white-space: pre; font: .75rem/1.6 ui-monospace,monospace; }
#task-notice { overflow-wrap: anywhere; }
#new-task-error { max-height: 180px; overflow: auto; }

.task-native-actions { display: flex; flex-wrap: wrap; gap: 10px; flex-shrink: 0; margin: 0; padding: 16px 20px; border-top: 1px solid #dce3d8; }
.task-operation-dialog { width: min(440px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; border: 1px solid #cbd6cb; border-radius: 12px; padding: 24px; color: #243c38; overflow-wrap: anywhere; }
.task-operation-dialog::backdrop { background: rgb(20 35 30 / 45%); }
.operation-task-name { margin: 16px 0 8px; font-weight: 650; white-space: pre-wrap; max-height: 100px; overflow: auto; }
.move-list-picker { margin-top: 20px; }
#move-destinations { max-height: 240px; overflow: auto; }
.move-destination { display: flex; align-items: center; gap: 10px; padding: 12px 8px; border-radius: 6px; overflow-wrap: anywhere; }
.move-destination:has(input:disabled) { color: #737c76; }
.move-destination input { flex-shrink: 0; width: auto; margin: 0; padding: 0; }
.task-operation-dialog .error:empty { display: none; }
.task-operation-dialog .error { white-space: pre-wrap; max-height: 150px; overflow: auto; }
#delete-task-description { margin: 18px 0; }
.view-list { flex: 1 1 100%; list-style: none; padding: 0; margin: 4px 0 12px; max-height: 280px; overflow: auto; }
.view-list li { display: flex; align-items: center; gap: 12px; justify-content: space-between; border-bottom: 1px solid #e6ebe2; padding: 10px 0; }
.view-list li span { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.view-list button { flex-shrink: 0; }
.task-picker-choices { min-width: 0; padding: 8px; }
#task-picker-results { max-height: min(320px, 40vh); overflow: auto; }
.task-picker-option { display: flex; align-items: center; gap: 12px; padding: 12px 6px; cursor: pointer; border-bottom: 1px solid #e6ebe2; }
.task-picker-option input { flex-shrink: 0; width: auto; margin: 0; padding: 0; }
.task-picker-option span { min-width: 0; overflow-wrap: anywhere; }
.task-picker-option strong, .task-picker-option small { display: block; }
.task-picker-option small { color: #617269; font-weight: 400; }
#task-picker-dialog .config-buttons { margin-top: 18px; }


.list-navigation { margin-top: 22px; }

.control-own-line { flex: 0 0 100%; min-width: 0; }

/* Input presentation is selected by Lua, independent of where it is rendered. */
.inline-input-control { flex: 1 1 0; min-width: 0; }
.control-line .action-form { margin: 0; font: inherit; max-width: none; }
.control-line .action-form > .field { font: inherit; }
.action-form [data-text-size="small"] { font-size: .8rem; }
.action-form [data-text-size="medium"] { font-size: .95rem; }
.action-form [data-text-size="large"] { font-size: 1.1rem; }
.action-form .input-frameless { border: 0; border-radius: 0; background: transparent; padding: 0; margin: 0; color: inherit; font-family: inherit; font-weight: inherit; }
.action-form textarea[data-auto-resize] { min-height: 0; max-height: none; resize: none; overflow: hidden; width: 100%; }

.action-form .input-frameless.strikethrough { color: #617269; }
