:root{
  color-scheme: light dark;

  --bg: #0b0c10;
  --panel: #111318;
  --panel2: #0f1015;
  --text: #e9eef5;
  --muted: #a8b2c1;
  --border: #232734;
  --accent: #7aa2ff;
  --accentA: #ff3b30;
  --danger: #ff6b6b;
  --dangerC: #0a84ff;
  --ok: #3ddc97;
  --okB: #ffd60a;
  --ingest-status-width: 380px;

  --radius: 16px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  --gap: 14px;
  --pad: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
}

[data-theme="light"]{
  --bg: #f7f8fb;
  --panel: #ffffff;
  --panel2: #fbfcff;
  --text: #111827;
  --muted: #586377;
  --border: #e6e9f2;
  --accent: #245bff;
  --danger: #d92d20;
  --ok: #027a48;

  --shadow: 0 10px 26px rgba(16,24,40,.08);
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

[hidden]{ display: none !important; }

  .app-header{
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: var(--gap);
    row-gap: 8px;
    padding: 10px calc(16px + 18px + 2px);
    border-bottom: 1px solid var(--border);
    background: color-mix(in oklab, var(--bg) 92%, transparent);
    backdrop-filter: blur(10px);
  }

  .app-header img{ display: block; justify-self: start; }
  .imgLogo {
    height: 66px;
    background-color: steelblue;
    mask-image: url(../img/logo.png);
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
  }
.imgLogo {
  color: #000;
}

@media (prefers-color-scheme: dark) {
  .imgLogo {
    color: #fff;
  }
}

  .app-logo-area {
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
    align-items: center;
    width: max-content;
  }
  .app-logo-area > a,
  .app-logo-area > a:visited,
  .app-logo-area > a:hover,
  .app-logo-area > a:active{
    color: inherit;
    text-decoration: none;
  }

  .brand{
    display:flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    justify-self: center;
    align-items: center;
    text-align: center;
  }
  .brand__title{ font-size: 32px; font-weight: 650; line-height: 1.1; }
  .brand__subtitle{ font-size: 18px; color: var(--muted); margin-top: 0; line-height: 1.2; }

  .toolbar{
    display:flex;
    gap: 8px;
    align-items:center;
    justify-self: end;
    justify-content: flex-end;
    flex-wrap: nowrap;
    min-width: 0;
  }
.toolbar__status{
    display: inline-flex;
    align-items: center;
    min-width: 0;
    flex: 0 0 var(--ingest-status-width);
    width: var(--ingest-status-width);
    max-width: var(--ingest-status-width);
  }

  .toolbar .field--toolbar{
    min-width: unset;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin: 0;
  }
  .toolbar .field--toolbar span{
    font-size: 12px;
    color: var(--muted);
  }
  .toolbar .field--toolbar select{
    min-width: 140px;
    padding: 8px 10px;
  }

.btn{
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--panel) 88%, transparent);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.btn:hover{ border-color: color-mix(in oklab, var(--border) 70%, var(--accent)); }
.btn:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }
.btn--ghost{ box-shadow:none; background: transparent; }
a.btn{ text-decoration: none; display: inline-flex; align-items: center; }
.btn--icon{
  padding: 8px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn--theme .icon{
  width: 18px;
  height: 18px;
  display: none;
  fill: currentColor;
  stroke: currentColor;
}
html[data-theme="dark"] .btn--theme .icon--sun{ display: block; }
html[data-theme="light"] .btn--theme .icon--moon{ display: block; }

/* ── Dark-mode button contrast ───────────────────────────────────────
   In dark mode the default --border (#232734) is nearly invisible
   against --bg (#0b0c10). Brighten borders so buttons read as
   distinct clickable elements. Ghost buttons get a faint fill so
   they separate from the page background.
   :not([data-theme="light"]) covers both the explicit dark attr
   and the no-attribute first-paint state.                          */
html:not([data-theme="light"]) .btn{
  border-color: rgba(255,255,255,0.14);
}
html:not([data-theme="light"]) .btn:hover{
  border-color: rgba(255,255,255,0.28);
}
html:not([data-theme="light"]) .btn--ghost{
  background: rgba(255,255,255,0.04);
}
html:not([data-theme="light"]) .btn--ghost:hover{
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.22);
}

.panel{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel--wide{
  grid-column: 1 / -1;
}

.panel__header{
  display:flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel2);
}
.panel__header { display: flex; align-items: center; gap: 12px; }
.panel__actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.panel__actions .btn{ display: inline-flex; align-items: center; line-height: 1; }
.panel__actions.stacked-meta{ gap: 8px; }

.panel__title{ margin:0; font-size: 14px; font-weight: 650; }

.panel__body{ padding: var(--pad); }

.btn--hint-toggle{
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  min-width: 20px;
}
