/* Dominator AI Optimizer — brand: charcoal #303030 + blue #0868E0 (from the logo). Type: Barlow / Barlow Semi Condensed.
   Surfaces are frosted glass over a soft blue wash. Status colours are reserved: RED = not optimized, GREEN = optimized, AMBER = needs a look. */
:root {
  --blue: #0868e0;
  --blue-600: #0658bf;
  --blue-700: #04479d;
  --blue-900: #0a2a5e;
  --charcoal: #303030;

  --bg: #f4f8fe;
  --surface: #ffffff;
  --surface-2: rgba(238, 244, 253, .72);
  --surface-3: rgba(8, 104, 224, .07);
  --line: rgba(16, 42, 80, .11);
  --line-strong: rgba(16, 42, 80, .20);
  --ink: #1f2328;
  --ink-2: #454c55;
  --muted: #66717d;

  /* kept under the old names so every existing rule keeps working: "accent" is now the brand blue */
  --accent: var(--blue);
  --accent-600: var(--blue-600);
  --accent-700: var(--blue-700);
  --accent-50: rgba(8, 104, 224, .07);
  --accent-100: rgba(8, 104, 224, .14);
  --accent-ring: rgba(8, 104, 224, .30);

  --ok: #0b8f55;
  --ok-solid: #12a35f;
  --ok-soft: #e0f5ea;
  --bad: #d4281c;
  --bad-soft: #fdeceb;
  --warn: #9a5a06;
  --warn-soft: #fff2d9;
  --dev: var(--charcoal);
  --dev-soft: rgba(48, 48, 48, .08);

  --glass: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .86);
  --glass-edge: rgba(255, 255, 255, .85);
  --blur: saturate(1.6) blur(18px);
  --shadow-sm: 0 1px 2px rgba(10, 42, 94, .06);
  --shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 12px 32px rgba(10, 42, 94, .08), 0 1px 3px rgba(10, 42, 94, .06);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; overflow: hidden; position: relative;
  background:
    radial-gradient(900px 520px at 6% -8%, rgba(8, 104, 224, .20), transparent 62%),
    radial-gradient(760px 480px at 100% 2%, rgba(8, 104, 224, .12), transparent 60%),
    radial-gradient(900px 560px at 78% 112%, rgba(48, 48, 48, .07), transparent 62%),
    var(--bg);
  background-attachment: fixed;
}
/* fine technical grid behind the glass, fading out towards the bottom */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: linear-gradient(rgba(8, 104, 224, .055) 1px, transparent 1px), linear-gradient(90deg, rgba(8, 104, 224, .055) 1px, transparent 1px);
  background-size: 36px 36px; -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 78%); mask-image: linear-gradient(180deg, #000 0%, transparent 78%);
}
body > * { position: relative; z-index: 1; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: .005em; font-family: var(--font-display); font-weight: 600; color: var(--charcoal); }
.muted { color: var(--muted); }
/* nothing in the app is heavier than semi-bold (600): bold looks too heavy in Barlow */
strong, b, th, h1, h2, h3, h4, h5, h6, summary { font-weight: 600; }

.small { font-size: 12.5px; }
button, input, select, textarea { font: inherit; color: inherit; }
code { background: var(--surface-3); border-radius: 5px; padding: 0 5px; font-size: .92em; }
a { color: var(--blue-600); }
.ico { flex: none; vertical-align: -2px; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 26px;
  background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-edge); box-shadow: 0 1px 0 var(--line), 0 8px 24px rgba(10, 42, 94, .05);
}
.brand { display: flex; align-items: center; gap: 16px; user-select: none; cursor: default; min-width: 0; }
.brand-logo { display: block; height: 40px; width: auto; }
.brand-by { display: flex; flex-direction: column; line-height: 1.1; padding-left: 16px; border-left: 1px solid var(--line-strong); font-family: var(--font-display); text-transform: uppercase; letter-spacing: .12em; font-size: 10.5px; color: var(--muted); font-weight: 600; }
.brand-by strong { font-size: 13px; letter-spacing: .1em; color: var(--charcoal); font-weight: 600; margin-top: 2px; }
.badge-dev { background: var(--charcoal); color: #fff; font-family: var(--font-display); font-size: 10.5px; letter-spacing: .14em; padding: 3px 9px; border-radius: 6px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
#devHeaderSlot:empty { display: none; }

/* ---- layout ---- */
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(320px, 400px) 1fr; gap: 18px; padding: 18px 26px; }
.panel {
  background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge); border-radius: var(--radius); box-shadow: var(--shadow); min-height: 0;
}
.list-panel { display: flex; flex-direction: column; padding: 16px; gap: 12px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; }
.panel-head h2 { font-size: 17px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; }
.editor-panel { display: flex; flex-direction: column; overflow: hidden; }

/* ---- buttons / inputs ---- */
.btn {
  border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .8); border-radius: var(--radius-sm); padding: 8px 16px; cursor: pointer;
  font-weight: 600; color: var(--charcoal); transition: background .12s, border-color .12s, box-shadow .12s, transform .05s;
  box-shadow: var(--shadow-sm); white-space: nowrap; letter-spacing: .01em;
}
.btn:hover:not(:disabled) { background: #fff; border-color: var(--blue); color: var(--blue-700); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.primary { background: linear-gradient(180deg, #1a7cf0, var(--blue) 60%, var(--blue-600)); border-color: var(--blue-600); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .3) inset, 0 6px 16px rgba(8, 104, 224, .28); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #2487f6, #0b70ee 60%, var(--blue)); border-color: var(--blue-700); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-3); border-color: transparent; color: var(--blue-700); }
.btn.small { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn.dev { background: var(--charcoal); border-color: var(--charcoal); color: #fff; }
.btn.dev:hover:not(:disabled) { background: #1f1f1f; border-color: #1f1f1f; color: #fff; }
.btn.danger { color: var(--bad); }
:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 1px; }

input[type=text], input[type=number], input[type=url], input[type=search], input[type=password], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: rgba(255, 255, 255, .88); min-width: 0;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
input:hover, select:hover, textarea:hover { border-color: rgba(8, 104, 224, .5); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px var(--accent-ring); }
textarea { resize: vertical; min-height: 66px; }
input::placeholder, textarea::placeholder { color: #9aa5b1; }
input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--blue); }
input[type=checkbox] { accent-color: var(--blue); width: 16px; height: 16px; }
.check { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; user-select: none; }
input.mixed, textarea.mixed { border-style: dashed; }
input.mixed::placeholder, textarea.mixed::placeholder { font-style: italic; color: var(--ink-2); }

/* ---- drop zone ---- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 22px 14px;
  border: 1.5px dashed rgba(8, 104, 224, .45); border-radius: var(--radius); cursor: pointer; color: var(--muted);
  background: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(238, 244, 253, .6));
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.dz-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--blue); color: #fff; display: grid; place-items: center; margin-bottom: 4px; box-shadow: 0 8px 18px rgba(8, 104, 224, .3); }
.dropzone strong { color: var(--charcoal); font-family: var(--font-display); font-size: 16px; text-transform: uppercase; letter-spacing: .08em; }
.dropzone:hover, .dropzone.over { border-color: var(--blue); background: rgba(8, 104, 224, .09); box-shadow: 0 0 0 4px var(--accent-ring); }
.list-tools { display: flex; align-items: center; justify-content: space-between; }

/* ---- image list ---- */
.image-list { list-style: none; margin: 0; padding: 0 2px 2px 0; overflow-y: auto; overflow-x: hidden; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.img-item {
  display: grid; grid-template-columns: auto 56px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 9px 10px; border: 1px solid var(--glass-edge); border-radius: 12px; cursor: pointer; background: rgba(255, 255, 255, .72);
  box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s, background .12s, transform .12s;
}
.img-item:hover { border-color: rgba(8, 104, 224, .35); background: rgba(255, 255, 255, .92); }
.img-item.selected { border-color: var(--blue); background: rgba(255, 255, 255, .95); box-shadow: 0 0 0 3px var(--accent-ring), var(--shadow-sm); }
.thumb { width: 56px; height: 56px; border-radius: 9px; overflow: hidden; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); font-size: 10px; font-weight: 600; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-item .info { min-width: 0; }
.img-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--charcoal); }
.img-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.dev { background: var(--dev-soft); color: var(--charcoal); }
.chip.save { background: var(--ok-solid); color: #fff; }
.img-item .act { display: flex; gap: 2px; }
.img-item .dl { color: var(--blue-700); text-decoration: none; padding: 6px 7px; border-radius: 8px; background: none; border: none; cursor: pointer; line-height: 1; display: inline-grid; place-items: center; }
.img-item .dl:hover { background: var(--accent-100); }

/* ---- empty state ---- */
.empty { margin: auto; max-width: 640px; padding: 36px 32px; color: var(--ink-2); }
.eyebrow { margin: 0 0 10px; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .18em; font-size: 12px; font-weight: 600; color: var(--blue); }
.empty h1 { font-size: 46px; line-height: 1.02; font-weight: 600; text-transform: uppercase; letter-spacing: .01em; margin-bottom: 14px; color: var(--charcoal); }
.empty h1 span { color: var(--blue); }
.empty .lede { margin: 0 0 26px; font-size: 16.5px; max-width: 520px; }
.flow { list-style: none; margin: 0 0 24px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 2px solid var(--charcoal); }
.flow li { padding: 14px 16px 4px 0; position: relative; }
.flow li + li { padding-left: 16px; border-left: 1px solid var(--line-strong); }
.flow b { display: block; font-family: var(--font-display); font-size: 30px; line-height: 1; color: var(--blue); font-weight: 600; margin-bottom: 8px; }
.flow strong { display: block; color: var(--charcoal); font-family: var(--font-display); text-transform: uppercase; letter-spacing: .06em; font-size: 14px; }
.flow small { color: var(--muted); font-size: 13px; display: block; margin-top: 2px; }
.specs { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.specs li { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: rgba(255, 255, 255, .6); color: var(--ink-2); }
.privacy { margin-top: 8px; }

/* ---- editor ---- */
#editor { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px 8px; }
.sel-summary { font-family: var(--font-display); font-weight: 600; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--charcoal); }
.tabs { display: flex; gap: 2px; padding: 0 14px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  background: none; border: none; padding: 11px 12px; cursor: pointer; color: var(--muted); font-family: var(--font-display); font-weight: 600; font-size: 14px;
  text-transform: uppercase; letter-spacing: .06em; border-bottom: 3px solid transparent; white-space: nowrap; margin-bottom: -1px; transition: color .12s;
}
.tab:hover { color: var(--charcoal); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab.dev { color: var(--charcoal); }
.tab.dev.active { color: var(--charcoal); border-bottom-color: var(--charcoal); }
.tabpanels { flex: 1; overflow: auto; min-height: 0; }
.tabpanel { display: none; padding: 20px; }
.tabpanel.active { display: block; }

.grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px 16px; }
.f { display: flex; flex-direction: column; gap: 5px; grid-column: span 6; }
.f > span:first-child { font-size: 12.5px; font-weight: 600; color: var(--ink-2); letter-spacing: .02em; }
.f .hint, .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.s1 { grid-column: span 1; } .s2 { grid-column: span 2; } .s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s5 { grid-column: span 5; }
.section-title { grid-column: 1 / -1; margin: 8px 0 0; font-family: var(--font-display); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--blue); font-weight: 600; border-top: 1px solid var(--line); padding-top: 16px; }
.section-title:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.row-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.input-suffix { display: flex; align-items: center; gap: 8px; }
.input-suffix em { font-style: normal; color: var(--muted); font-size: 13px; }

#map { height: 310px; border-radius: var(--radius); border: 1px solid var(--line-strong); grid-column: 1 / -1; z-index: 0; }
.search-wrap { position: relative; grid-column: 1 / -1; }
.search-wrap form { display: flex; gap: 8px; }
.results { position: absolute; z-index: 1000; left: 0; right: 0; top: 100%; margin-top: 6px; background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 260px; overflow: auto; }
.results button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 9px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.results button:last-child { border-bottom: none; }
.results button:hover { background: var(--accent-50); }
.notice { grid-column: 1 / -1; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; background: rgba(255, 255, 255, .6); border: 1px solid var(--line); color: var(--ink-2); }
.notice.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.notice.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.notice.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.notice.accent { background: var(--accent-50); border-color: rgba(8, 104, 224, .16); color: var(--blue-700); }

/* ---- switches, sliders ---- */
.switch-row { grid-column: 1 / -1; display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, .6); }
.switch { position: relative; flex: none; width: 42px; height: 24px; margin-top: 1px; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; background: rgba(16, 42, 80, .22); border-radius: 99px; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + .track { background: var(--blue); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--accent-ring); }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row output { min-width: 44px; text-align: right; font-weight: 600; color: var(--blue-700); font-variant-numeric: tabular-nums; }
.disabled-block { opacity: .5; pointer-events: none; }
.brand-preview { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, .55); padding: 12px; display: grid; place-items: center; }
.brand-preview canvas { max-width: 100%; height: auto; border-radius: 8px; box-shadow: var(--shadow-sm); }
.logo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo-thumb { width: 54px; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: repeating-conic-gradient(#eef2f7 0% 25%, #fff 0% 50%) 50% / 12px 12px; display: grid; place-items: center; overflow: hidden; }
.logo-thumb img { max-width: 100%; max-height: 100%; }

/* ---- preview tags ---- */
.tag-group { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 12px; overflow: hidden; background: rgba(255, 255, 255, .6); }
.tag-group h4 { margin: 0; padding: 8px 14px; background: var(--surface-2); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; display: flex; justify-content: space-between; }
.tag-table { width: 100%; border-collapse: collapse; }
.tag-table td { padding: 6px 14px; border-top: 1px solid var(--line); vertical-align: top; word-break: break-word; }
.tag-table td:first-child { width: 34%; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.tag-table td:last-child { font-size: 13.5px; }

/* ---- footer: actions + credits ---- */
.foot {
  background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-top: 1px solid var(--glass-edge); box-shadow: 0 -1px 0 var(--line), 0 -8px 24px rgba(10, 42, 94, .05);
}
.actionbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 26px 9px; }
.actionbar .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.status { color: var(--muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status .pill { background: var(--accent-50); color: var(--blue-700); font-weight: 600; border-radius: 99px; padding: 3px 11px; font-size: 12.5px; }
.legal { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 2px 26px 4px; border-top: 1px solid var(--line); font-family: var(--font); font-size: 9.5px; letter-spacing: .02em; color: #9aa4af; font-weight: 400; line-height: 1.2; }
.legal a { color: #7f93ad; font-weight: 500; font-size: 9.5px; text-decoration: none; }
.legal a:hover { color: var(--blue-700); text-decoration: underline; }
.legal .sep { width: 2px; height: 2px; border-radius: 50%; background: var(--line-strong); }

/* ---- modal / toast ---- */
.modal-back { position: fixed; inset: 0; background: rgba(10, 42, 94, .32); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 5000; padding: 20px; }
.modal { background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-radius: 16px; border: 1px solid var(--glass-edge); box-shadow: 0 30px 80px rgba(10, 42, 94, .30); width: min(740px, 100%); max-height: 88vh; display: flex; flex-direction: column; }
.modal.narrow { width: min(430px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 18px; text-transform: uppercase; letter-spacing: .08em; }
.modal-body { padding: 18px 20px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.x { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }
.toasts { position: fixed; right: 22px; bottom: 96px; display: flex; flex-direction: column; gap: 8px; z-index: 6000; max-width: min(430px, calc(100vw - 44px)); }
.toast { background: rgba(31, 35, 40, .94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: 0 12px 30px rgba(10, 42, 94, .28); font-size: 13.5px; animation: pop .15s ease-out; border-left: 4px solid var(--blue); }
.toast.bad { background: rgba(212, 40, 28, .95); border-left-color: #fff; }
.toast.ok { background: rgba(11, 143, 85, .95); border-left-color: #fff; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }

.spinner { width: 12px; height: 12px; border: 2px solid var(--line-strong); border-top-color: var(--blue); border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- web version: signed-in user ---- */
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 3px 4px 3px 11px; border: 1px solid var(--line-strong); border-radius: 999px; background: rgba(255, 255, 255, .7); font-size: 13px; }
.user-chip strong { font-weight: 600; color: var(--charcoal); }
.user-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok-solid); }

@media (max-width: 960px) {
  body { overflow: auto; }
  .layout { grid-template-columns: 1fr; padding: 14px; }
  .list-panel { max-height: 360px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .f, .s1, .s2, .s3, .s4, .s5 { grid-column: span 2; }
  .topbar { padding: 10px 14px; flex-wrap: wrap; }
  .brand-by { display: none; }
  .actionbar { padding: 10px 14px; flex-direction: column; align-items: stretch; }
  .empty h1 { font-size: 34px; }
  .flow { grid-template-columns: 1fr; }
  .flow li + li { padding-left: 0; border-left: none; border-top: 1px solid var(--line-strong); }
}

/* ---- Image Analyzer ---- */
.tab-analyzer { color: var(--blue-700); }
.an-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 12px; }
.an-title { font-family: var(--font-display); font-weight: 600; font-size: 18px; color: var(--charcoal); }
.an-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.an-seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: rgba(255, 255, 255, .8); }
.an-seg button { border: none; background: transparent; padding: 6px 12px; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.an-seg button + button { border-left: 1px solid var(--line-strong); }
.an-seg button.active { background: var(--blue); color: #fff; }
.an-seg button:disabled { opacity: .45; cursor: not-allowed; }
.an-seg.small button { padding: 3px 10px; font-size: 12.5px; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; margin-left: 4px; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: livepulse 1.8s infinite; vertical-align: 1px; }
.an-seg button.active .live-dot { background: #fff; }
@keyframes livepulse { 70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.warn-text { color: var(--warn); }
.an-body { display: flex; flex-direction: column; gap: 14px; }
.an-body > .notice { grid-column: auto; }
.an-card { border: 1px solid var(--glass-edge); border-radius: var(--radius); background: rgba(255, 255, 255, .72); box-shadow: var(--shadow-sm); padding: 14px 16px; min-width: 0; }
.an-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.an-card-head h4 { font-size: 14px; margin: 0; text-transform: uppercase; letter-spacing: .1em; }
.an-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.an-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.an-cmp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.an-cmp { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: rgba(255, 255, 255, .6); display: flex; flex-direction: column; gap: 2px; }
.an-cmp.good { background: var(--ok-soft); border-color: transparent; }
.an-cmp.bad { background: var(--warn-soft); border-color: transparent; }
.an-cmp-label { font-family: var(--font-display); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.an-cmp-vals { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.an-before { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, .25); }
.an-after { font-weight: 600; font-size: 16px; color: var(--ink); }
.an-arrow { color: var(--muted); }
.an-cmp-hint { font-size: 12px; color: var(--blue-700); font-weight: 600; }
.an-kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0; font-size: 13.5px; }
.an-kv dt { color: var(--muted); }
.an-kv dd { margin: 0; overflow-wrap: anywhere; }
.an-flags { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.an-flag { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; align-items: start; padding: 8px 10px; border-radius: 10px; background: rgba(238, 244, 253, .7); }
.an-flag.risk { background: var(--bad-soft); } .an-flag.warn { background: var(--warn-soft); } .an-flag.ok { background: var(--ok-soft); }
.an-flag-icon { font-size: 11px; line-height: 20px; }
.an-flag.risk .an-flag-icon { color: var(--bad); } .an-flag.warn .an-flag-icon { color: var(--warn); } .an-flag.ok .an-flag-icon { color: var(--ok); }
.an-flag-title { font-weight: 600; font-size: 13.5px; }
.an-flag-detail { font-weight: 400; color: var(--ink-2); }
.an-added { margin-top: 8px; }
.an-score { font-family: var(--font-display); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.an-bar { position: relative; height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-bottom: 10px; }
.an-bar-before { position: absolute; inset: 0 auto 0 0; background: var(--line-strong); }
.an-bar-after { position: absolute; inset: 0 auto 0 0; background: var(--blue); opacity: .9; mix-blend-mode: multiply; }
.an-seo { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.an-seo li { display: grid; grid-template-columns: 18px 150px 1fr auto; gap: 8px; align-items: center; font-size: 13.5px; padding: 3px 0; border-bottom: 1px solid var(--line); }
.an-seo li:last-child { border-bottom: none; }
.an-tick { font-weight: 600; } .an-seo li.added .an-tick, .an-seo li.kept .an-tick { color: var(--ok); } .an-seo li.missing .an-tick, .an-seo li.lost .an-tick { color: var(--bad); }
.an-seo-label { font-weight: 600; }
.an-seo-val { color: var(--ink-2); overflow-wrap: anywhere; }
.link-btn { background: none; border: none; padding: 0; color: var(--blue-700); font: inherit; cursor: pointer; text-decoration: underline; text-align: left; }
.an-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.an-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.an-chip { border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .8); border-radius: 99px; padding: 3px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.an-chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.an-filters input[type=search] { max-width: 260px; padding: 6px 10px; }
.an-table-wrap { overflow: auto; max-height: 440px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(255, 255, 255, .6); }
.an-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.an-table th { position: sticky; top: 0; background: #eef4fd; text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); font-family: var(--font-display); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); z-index: 1; }
.an-table td { padding: 6px 10px; border-top: 1px solid var(--line); vertical-align: top; }
.an-tag { white-space: nowrap; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.an-fam { color: var(--muted); font-size: 11px; margin-right: 4px; }
.an-val { overflow-wrap: anywhere; max-width: 360px; }
.an-table tr.st-new { background: rgba(34, 197, 94, .08); } .an-table tr.st-changed { background: rgba(245, 158, 11, .10); } .an-table tr.st-removed { background: rgba(239, 68, 68, .08); }
.an-overview tbody tr { cursor: pointer; } .an-overview tbody tr:hover, .an-overview tbody tr.sel { background: var(--accent-50); }
.an-dump { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; background: rgba(255, 255, 255, .6); }
.an-dump summary { cursor: pointer; padding: 8px 12px; background: #eef4fd; border-radius: var(--radius-sm); }
.an-dump[open] summary { border-bottom: 1px solid var(--line); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.an-empty { text-align: center; padding: 50px 20px; }
.an-empty-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: var(--accent-100); color: var(--blue); margin-bottom: 10px; }
.an-empty h3 { font-size: 20px; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 6px; }
.an-loading { padding: 30px; text-align: center; }
.an-more { padding: 8px 4px; }
@media (max-width: 960px) { .an-grid3, .an-two { grid-template-columns: 1fr; } .an-seo li { grid-template-columns: 18px 1fr auto; } .an-seo-val { grid-column: 2 / 4; } }

/* Image Analyzer: keep the diff readable in narrow panes (scroll sideways instead of squeezing the values) */
.an-table-wrap > .an-table { min-width: 680px; }
.an-table .an-val { min-width: 210px; }
.an-table .an-tag { min-width: 170px; }
.an-table td:last-child, .an-table th:last-child { white-space: nowrap; }
.an-dump { overflow-x: auto; }
.an-dump .an-table { min-width: 0; }
.tab { padding: 11px 11px; }

/* Image Analyzer: which photo + what state, and forecasts that look like forecasts */
.an-id { display: flex; gap: 12px; align-items: center; min-width: 0; }
.an-thumb { width: 60px; height: 60px; border-radius: 10px; object-fit: cover; background: var(--surface-3); flex: none; }
.an-status { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-display); font-size: 12.5px; font-weight: 600; letter-spacing: .08em; margin: 2px 0; padding: 2px 10px; border-radius: 99px; }
.an-status.warn { background: var(--warn-soft); color: var(--warn); }
.an-status.ok { background: var(--ok-solid); color: #fff; }
.an-status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.an-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: -2px 0 12px; }
.an-nav select { width: auto; min-width: 220px; max-width: 360px; padding: 5px 10px; font-size: 13px; }
.an-cmp.planned { border-style: dashed; background: rgba(255, 255, 255, .8); }
.an-after.planned { font-style: italic; color: var(--ink-2); }
.an-forecast { font-style: normal; font-family: var(--font-display); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; background: var(--accent-100); color: var(--blue-700); padding: 1px 6px; border-radius: 99px; margin-left: 4px; }

/* ---- red = not optimized, green = optimized — everywhere ---- */
.chip.bad { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.img-item.unopt .thumb { box-shadow: 0 0 0 2px var(--bad); }
.img-item.unopt:not(.selected) { border-color: rgba(212, 40, 28, .38); }
.img-item.opt .thumb { box-shadow: 0 0 0 2px var(--ok-solid); }
.img-item.opt:not(.selected) { border-color: rgba(18, 163, 95, .42); }
.an-head { border-left: 5px solid var(--line-strong); padding-left: 14px; border-radius: 4px; }
.an-head.st-bad { border-left-color: var(--bad); background: linear-gradient(90deg, var(--bad-soft), transparent 70%); }
.an-head.st-ok { border-left-color: var(--ok-solid); background: linear-gradient(90deg, var(--ok-soft), transparent 70%); }
.an-head.st-warn { border-left-color: #f59e0b; }
.an-head.st-bad .an-thumb { box-shadow: 0 0 0 3px var(--bad); }
.an-head.st-ok .an-thumb { box-shadow: 0 0 0 3px var(--ok-solid); }
.an-status.bad { background: var(--bad); color: #fff; }
.an-status.work { background: var(--surface-3); color: var(--ink-2); }
.an-redbox { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; border: 1px solid rgba(212, 40, 28, .32); }
.an-cap { font-family: var(--font-display); font-size: 12.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 4px 0 -4px; }
.an-cap.bad { color: var(--bad); }
.an-overview tbody tr.st-bad { background: rgba(212, 40, 28, .06); }
.an-overview tbody tr.st-bad td:first-child { box-shadow: inset 4px 0 0 var(--bad); }
.an-overview tbody tr.st-ok td:first-child { box-shadow: inset 4px 0 0 var(--ok-solid); }
.an-body:has(.an-head.st-bad) .an-cmp.planned { border-color: rgba(212, 40, 28, .45); }

/* ---- "name these photos" box ---- */
.name-row { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.name-row img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; background: var(--surface-3); }
.name-row .small { margin-bottom: 4px; overflow-wrap: anywhere; }
.chip[data-needname] { cursor: pointer; }
.chip[data-needname]:hover { filter: brightness(.96); text-decoration: underline; }
