/* Shared controls and compact public workspace. */
:root {
  font: 14px/1.5 Arial, "Malgun Gothic", -apple-system, BlinkMacSystemFont, sans-serif;
  color: #222;
  background: #fff;
  color-scheme: light;
  --accent: #244b83;
  --ink: #222;
  --muted: #555;
  --line: #c7c7c7;
  --paper: #fff;
  --soft: #f3f3f3;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
p, h1, h2, h3 { margin: 0; }
h1 { font-size: 18px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
a { color: #174b91; text-decoration: none; overflow-wrap: anywhere; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; border-radius: 0; }
button, a, input, select, textarea, summary { touch-action: manipulation; }
button {
  min-height: 34px; padding: 5px 10px; border: 1px solid #aaa;
  color: #222; background: #f4f4f4; line-height: 1.4; cursor: pointer;
}
button:hover { background: #e7e7e7; border-color: #777; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, textarea, select {
  width: 100%; min-width: 0; min-height: 34px; padding: 5px 7px;
  border: 1px solid #aaa; background: #fff; color: #222; line-height: 1.4;
}
input::placeholder, textarea::placeholder { color: #666; opacity: 1; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[aria-invalid=true], textarea[aria-invalid=true], select[aria-invalid=true] { border: 2px solid #a12626; }
textarea { resize: vertical; min-height: 90px; }
input[type=checkbox] { flex: 0 0 17px; width: 17px; height: 17px; min-height: 17px; margin: 0; accent-color: var(--accent); }
label { display: grid; gap: 4px; min-width: 0; font-weight: 600; }
small, .muted { color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.stack { display: grid; gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { min-width: 0; }
.row.fill > *, .row label { flex: 1; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check { display: flex; align-items: center; gap: 7px; min-height: 28px; font-size: 13px; font-weight: 400; }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.primary:hover { color: #fff; background: #18375f; }
.quiet { background: #fff; }
.danger { color: #922020; border-color: #ae7474; }
.sr { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }

/* No hero, cards, or separate access screen. */
#dc-mobile-scope-host { max-width: 1080px; margin: auto; padding: 0 16px 20px; }
.panel, .content, [data-view] { min-width: 0; }
.app-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 12px; min-height: 48px; border-bottom: 2px solid #333; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: #222; font-size: 22px; font-weight: 700; }
.brand:hover { text-decoration: none; }
.local-badge { color: var(--muted); font-size: 12px; }
.service-notice { padding: 8px 0; border-bottom: 1px solid var(--line); color: #555; font-size: 12px; line-height: 1.6; }
.service-notice strong { color: #333; }
.workspace-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 0 8px; }
.workspace-heading p { color: var(--muted); font-size: 12px; }
.nav { display: flex; gap: 0; margin-bottom: 12px; border-bottom: 1px solid #777; }
.nav button { min-width: 100px; margin-bottom: -1px; border: 1px solid transparent; border-bottom-color: #777; background: #fff; }
.nav button[aria-current=page] { border-color: #777; border-bottom-color: #fff; color: #173e73; font-weight: 700; }
.nav [data-count] { margin-left: 3px; font-size: 12px; }
[data-view=results], [data-view=history] { gap: 10px; }
.search-fields { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
.search-fields:disabled { opacity: .65; }
.search-fields .stack:empty { display: none; }
.flow-group, .condition-group { min-width: 0; padding: 12px; border: 1px solid var(--line); background: #fff; }
.group-heading { display: flex; align-items: baseline; gap: 7px; padding-bottom: 6px; border-bottom: 1px solid #ddd; }
.group-heading > div { min-width: 0; }
.group-heading h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.group-heading p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.group-symbol { font-size: 16px; }
.logic-tag { padding: 1px 5px; border: 1px solid #bbb; color: #555; font-size: 11px; font-weight: 400; }
.include-group, .exclude-group { border-left: 3px solid #777; }
.mode-description { color: var(--muted); font-size: 12px; }
[data-gallery-fields], [data-gallery-kind] { gap: 5px; }
[data-gallery-preview] { color: #555; }
[data-gallery-kind] > label { max-width: 280px; }
.primary-condition, [data-keyword-group], [data-date-condition], .filter-row { display: grid; gap: 8px; min-width: 0; padding: 10px; border: 1px solid #d2d2d2; background: #fafafa; }
.condition-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.condition-heading button { font-size: 12px; }
.filter-row > .row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.filter-row [data-remove-filter] { font-size: 12px; }
.condition-adder { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; padding-top: 8px; border-top: 1px solid #ccc; }
.comment-settings { padding: 10px; border: 1px solid #ccc; background: #f6f6f6; }
[data-comment-options] > small { grid-column: 1 / -1; }
.scope-overview { padding: 7px 9px; border: 1px solid #ccc; background: #f4f4f4; font-size: 13px; }
[data-search-order] { color: var(--muted); }
.scope-card { gap: 12px; }
.scope-field-section { gap: 8px; }
.scope-field-section + .scope-field-section { padding-top: 12px; border-top: 1px solid #ccc; }
.scope-gallery-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px; align-items: end; gap: 8px; }
.scope-identity-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.scope-range-group { gap: 8px; background: #fafafa; }
.scope-range-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; }
.scope-range-heading > span { color: var(--muted); font-size: 12px; }
.scope-presets button { min-width: 80px; }
.scope-conditions-link { justify-self: start; color: #174b91; }

/* Search options. */
details { padding-top: 6px; border-top: 1px solid var(--line); }
summary { min-height: 34px; padding: 6px 0; font-size: 13px; cursor: pointer; }
details[open] > summary { margin-bottom: 6px; }
.advanced-settings { padding: 0; border: 1px solid #bbb; }
.advanced-settings > summary { padding: 7px 10px; background: #f3f3f3; }
.advanced-settings [data-advanced-summary] { margin-left: 10px; color: var(--muted); font-size: 12px; }
.advanced-settings[open] > summary { margin-bottom: 0; border-bottom: 1px solid #ccc; }
.advanced-settings > .stack { padding: 10px; }
.advanced-section { display: grid; gap: 8px; }
.advanced-section + .advanced-section { padding-top: 10px; border-top: 1px solid #ccc; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { font-size: 13px; }
.chips .on { color: #173e73; border-color: #244b83; background: #edf2f8; font-weight: 700; }
.hint { padding: 8px; border: 1px solid #bbb; background: #f4f4f4; font-size: 13px; }
.hint.error { color: #922020; border-color: #ae7474; }

/* Results and history are list rows rather than cards. */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); }
.stat { padding: 7px 10px; background: #f4f4f4; font-size: 12px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat b { margin-left: 8px; color: #222; font-size: 18px; }
.toolbar .row { flex-wrap: wrap; }
.export-tools { padding: 0; border-top: 0; border-bottom: 1px solid var(--line); }
.export-tools > .stack { padding-bottom: 8px; }
.export-tools [data-export-summary] { margin-left: 6px; color: var(--muted); font-size: 12px; }
.results { display: grid; gap: 0; }
.card { min-width: 0; padding: 9px 4px; border-bottom: 1px solid #ccc; overflow-wrap: anywhere; }
.card:nth-child(even) { background: #fafafa; }
.card .row { justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; }
.card .title { display: block; margin: 4px 0; color: #174b91; font-size: 14px; line-height: 1.5; }
.card .meta, .card .check { color: #555; font-size: 12px; }
.badge { color: #555; font-size: 12px; }
#dc-mobile-scope-host:not([data-selecting=true]) [data-result-select] { display: none; }
[data-post-comments] { margin-top: 6px; }
.comment-entry { padding: 7px 4px; border-top: 1px solid #ddd; color: #333; font-size: 13px; overflow-wrap: anywhere; white-space: pre-wrap; }
.empty { padding: 18px 8px; border: 1px solid #ccc; color: #555; background: #fafafa; font-size: 13px; }
.history-item { display: grid; gap: 6px; padding: 10px 4px; border-bottom: 1px solid #ccc; }
.history-item b { font-size: 14px; overflow-wrap: anywhere; }
.history-item small { overflow-wrap: anywhere; }
.history-item .row { flex-wrap: wrap; }
.history-item button { font-size: 12px; }

/* Running state remains visible while scrolling. */
.bottom { position: sticky; z-index: 10; bottom: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 5px 12px; margin-top: 12px; padding: 10px; border: 1px solid #888; background: #f3f3f3; }
.bottom > .row { grid-column: 2; grid-row: 1 / 3; }
.bottom > .row button { min-width: 85px; }
.status { font-size: 13px; overflow-wrap: anywhere; }
.status.is-error { color: #922020; }
.progress { height: 6px; overflow: hidden; background: #d0d0d0; }
.progress i { display: block; width: 0; height: 100%; background: var(--accent); transition: width .2s; }

@media (min-width: 760px) {
  .scope-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
  .scope-field-section + .scope-field-section { padding-top: 0; padding-left: 16px; border-top: 0; border-left: 1px solid #ccc; }
}
@media (max-width: 640px) {
  #dc-mobile-scope-host { padding: 0 8px calc(140px + env(safe-area-inset-bottom)); }
  .app-header { min-height: 44px; }
  .brand { font-size: 20px; }
  .local-badge { font-size: 11px; }
  .workspace-heading { display: block; padding-top: 10px; }
  .workspace-heading p { margin-top: 3px; }
  .nav button { flex: 1; min-width: 0; min-height: 40px; padding: 6px 3px; font-size: 13px; white-space: nowrap; }
  button, summary { min-height: 40px; }
  input, textarea, select { min-height: 40px; font-size: 16px; }
  .flow-group, .condition-group { padding: 10px; }
  .scope-gallery-row { grid-template-columns: minmax(0, 1fr); }
  [data-gallery-kind] > label { max-width: none; }
  .primary-condition, [data-keyword-group], [data-date-condition], .filter-row { padding: 8px; }
  .filter-row > .row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-row [data-remove-filter] { grid-column: 1 / -1; justify-self: start; }
  .condition-adder { grid-template-columns: minmax(0, 1fr); }
  .condition-adder button { justify-self: start; }
  .stat { padding: 6px; }
  .stat b { display: block; margin-left: 0; }
  .bottom { position: fixed; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin: 0; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); border-width: 1px 0 0; }
  .bottom > .row { gap: 6px; }
  .bottom > .row button { min-width: 0; min-height: 40px; }
  .status { max-height: 58px; overflow: auto; font-size: 12px; }
}
@media (max-width: 420px) {
  .two, .filter-row > .row { grid-template-columns: minmax(0, 1fr); }
  .filter-row [data-remove-filter] { grid-column: auto; }
  .condition-heading { align-items: flex-start; }
  .toolbar .row button { padding: 5px 7px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .progress i { transition: none; }
}
