/* Kids Telling Admin: the look of Kids Telling Artwork (warm paper, deep green, soft green lines), like Kids Voices. */
:root {
  --ink: #243b38; --muted: #65786d; --paper: #fff; --ground: #f5f6f0; --line: #d6dfd6; --accent: #285d4c;
  --danger: #9e382e; --ok: #23783d; --sun: #e3aa56; --radius: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); line-height: 1.5; }
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--paper); border-bottom: 1px solid var(--line); padding: 18px 4% 14px; }
.top .brand { font-size: 11px; font-weight: 600; letter-spacing: 2px; color: #517367; text-transform: uppercase; }
.top h1 { margin: 2px 0 0; font-size: 22px; }
.top-right { display: flex; gap: 10px; align-items: center; }
.hdr-lang, .hdr-btn { height: 42px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--accent);
  font: 700 13px/1 inherit; }
.hdr-lang { width: 64px; padding: 8px 4px 8px 8px; cursor: pointer; }
.hdr-btn { width: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; text-decoration: none; font-weight: 800; }
.hdr-lang:hover, .hdr-btn:hover { background: #edf4eb; }
.test-mode { margin: 0; padding: 8px 4%; background: #fbf1df; color: #8a5a12; font-weight: 700; text-align: center; }
main { max-width: 1000px; margin: 0 auto; padding: 18px 16px 48px; display: grid; gap: 16px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h2 { margin: 0 0 8px; font-size: 18px; }
.login { max-width: 420px; width: calc(100% - 32px); margin: 10vh auto 40px; }
.login form { display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-weight: 600; }
label.inline { display: inline-flex; align-items: center; gap: 8px; }
input, select { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); min-height: 42px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }
.row input { flex: 1; min-width: 200px; }
button, .btn-link { font: inherit; font-weight: 550; padding: 10px 16px; min-height: 42px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); cursor: pointer; transition: background .15s; text-decoration: none; display: inline-flex; align-items: center; }
button:hover, .btn-link:hover { background: #eaf0e7; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #1c483a; }
button.danger { color: var(--danger); border-color: #d49a91; background: #fff; }
button.danger:hover { background: #fceeea; }
button:disabled, button.primary:disabled, button.danger:disabled { background: #dfe3e8; border-color: #dfe3e8; color: #8a94a0; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .ok { color: var(--ok); font-weight: 700; } .bad { color: var(--danger); font-weight: 700; }
table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 14px; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; }
pre { background: var(--ground); border: 1px solid var(--line); border-radius: 10px; padding: 10px; max-height: 320px; overflow: auto; font-size: 12px; white-space: pre-wrap; }
details summary { cursor: pointer; }
.settings summary { list-style: none; }
.settings summary h2 { display: inline; font-size: 15px; color: var(--muted); }
.settings summary h2::before { content: "▸ "; }
.settings[open] summary h2::before { content: "▾ "; }

/* The flow 1-2-3: numbered steps joined by a line */
.flow { list-style: none; margin: 0; padding: 0 0 0 28px; display: grid; gap: 16px; position: relative; }
.flow::before { content: ""; position: absolute; left: 13px; top: 24px; bottom: 24px; width: 2px; background: var(--line); }
.step { position: relative; }
.step-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.step-head h2 { margin: 0; flex: 1; }
.num { position: absolute; left: -42px; top: 16px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 14px; box-shadow: 0 0 0 4px var(--ground); }
.step.locked { opacity: .6; }
.step.locked .num { background: #aab5ae; }
.state { font-size: 13px; font-weight: 700; color: var(--muted); background: var(--ground); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.paused { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px;
  border-radius: var(--radius); background: #f8eceb; border: 1px solid #e4b9b3; color: var(--danger); font-weight: 700; }

/* Confirmation inside the page and the progress of the running job */
.confirm { margin-top: 12px; padding: 12px; border: 2px solid var(--danger); border-radius: 12px; background: #fff6f6; }
.confirm p { margin: 0 0 8px; white-space: pre-line; }
.progress { margin-top: 12px; }
.progress .track { height: 14px; background: var(--ground); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress .fill { height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.progress .fill.indeterminate { width: 30%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { margin-left: -30%; } to { margin-left: 100%; } }
@media (prefers-reduced-motion: reduce) { .progress .fill.indeterminate { animation: none; } }
.progress p { margin: 6px 0 0; white-space: pre-line; overflow-wrap: anywhere; }

@media (max-width: 600px) {
  .top { padding: 12px 16px 10px; } .top h1 { font-size: 17px; }
  .flow { padding-left: 0; } .flow::before { display: none; } .num { position: static; box-shadow: none; }
  table { font-size: 12px; }
}

/* hidden always wins over display rules above */
[hidden] { display: none !important; }

/* Square icon buttons with a hint (preview «Оновити» / «Замінити все») */
.icon-btn { width: 42px; min-width: 42px; height: 42px; padding: 0; justify-content: center; border-radius: 12px; color: var(--accent); }
/* What is new after a preview: green */
td.new { }
td.gone { color: var(--danger); font-weight: 700; }
tr.row-new td:first-child { box-shadow: inset 4px 0 0 var(--ok); }
.news { background: #e0f2e4; border: 1px solid #8aba94; border-radius: 12px; padding: 10px 14px; margin: 8px 0; }
.news .new-title { margin: 0 0 4px; color: var(--ok); font-weight: 800; }
.news ul { margin: 0; padding-left: 18px; max-height: 240px; overflow: auto; }
.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: #e0f2e4; } to { background: transparent; } }

/* What only «Замінити все» removes: red */
.gone-box { background: #f8eceb; border: 1px solid #e4b9b3; border-radius: 12px; padding: 10px 14px; margin: 8px 0; }
.gone-box .gone-title { margin: 0 0 4px; color: var(--danger); font-weight: 800; }
.gone-box pre { background: transparent; border: 0; padding: 0; margin: 0; max-height: 200px; }

/* Icons in buttons (preview / «Оновити» / «Замінити все») */
.with-ico { gap: 8px; }
.ico { flex: none; display: block; }

.s1-actions { display: inline-flex; gap: 10px; }
.icon-btn.primary { color: #fff; }
[data-role="s1-row-below"]:empty { display: none; }

.icon-btn.btn-link { padding: 0; justify-content: center; color: var(--accent); }

/* New from Artwork (green) and not in Artwork (red): one block, one font, one list, the same scrolling */
.delta { border-radius: 12px; padding: 10px 14px; margin: 8px 0; border: 1px solid; font: inherit; }
.delta.new { background: #e0f2e4; border-color: #8aba94; }
.delta.gone { background: #f8eceb; border-color: #e4b9b3; }
.delta .delta-title { margin: 0 0 6px; font-weight: 800; }
.delta.new .delta-title { color: var(--ok); }
.delta.gone .delta-title { color: var(--danger); }
.delta ul { margin: 0; padding-left: 18px; max-height: 220px; overflow-y: auto; font-size: 14px; line-height: 1.6; }

td.after .plus { color: var(--ok); font-weight: 800; }
td.after .minus { color: var(--danger); font-weight: 800; }

/* A changed cell: highlighted, with "+13" in green and "−12" in red, and a hint that explains the sum */
td.after.changed { background: #fbf6e6; box-shadow: inset 0 0 0 2px #e3c27a; border-radius: 6px; font-weight: 700; cursor: help; }

[data-tab-page] { display: grid; gap: 16px; }
/* The journal table: newest first; a row opens its whole text */
.table-wrap { overflow-x: auto; }
table.journal td { vertical-align: top; }
.j-row { cursor: pointer; }
.j-row:hover td { background: #f0f4ed; }
.j-row.bad-row td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
.j-detail pre { max-height: 420px; margin: 4px 0 8px; }

.plain-list { margin: 4px 0 8px; padding-left: 18px; max-height: 220px; overflow-y: auto; font-size: 14px; line-height: 1.6;
  background: var(--ground); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 8px 30px; }

/* Tabs «Імпорт» / «Журнал»: Artwork's menu (ui/app.css .app-nav), in the header under the title */
.top { flex-wrap: wrap; padding-bottom: 0; }
.app-nav { flex-basis: 100%; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.app-nav button { display: block; border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent;
  min-height: 0; padding: 13px 16px; font: 550 14px/1.2 inherit; color: var(--ink); cursor: pointer; }
.app-nav button:hover { background: #f4f7f0; }
.app-nav button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--accent); background: #edf4eb; }
@media (max-width: 600px) { .app-nav { gap: 0; } .app-nav button { padding: 12px 10px; font-size: 13px; } }

.s3-target { margin: 4px 0 0; padding: 8px 12px; border-radius: 10px; background: #edf4eb; border: 1px solid var(--line); }

/* A failed job: the bar and its text in red, with the reason */
.progress .fill.failed { background: var(--danger); }
.progress p.bad { white-space: pre-line; }

.btn-link.primary-link { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-link.primary-link:hover { background: #1c483a; }

/* Where you are in the flow: done = green, current = green with a ring, later = grey */
.step.todo .num { background: #aab5ae; }
.step.done .num { background: var(--accent); }
.step.current .num { background: var(--accent); box-shadow: 0 0 0 4px var(--ground), 0 0 0 7px #8aba94; }
.step.current { border-color: #8aba94; }
