/* FluxGIS — interactive ribbon tour. Same chrome, colors and ribbon layout as the real app; every control opens a
   description in the map area instead of doing the real action. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --header-h: 46px;
  --bg: #111312;
  --surface: #1a1c1b;
  --surface-2: #222524;
  --border: #323634;
  --text: #f1f1ee;
  --text-2: #b8b9b4;
  --muted: #868883;
  --accent: #bda062;
  --on-accent: #1c1608;
  --accent-2: #d9c48e;
  --accent-soft: rgba(189, 160, 98, .16);
  --danger: #f07167;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .35);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 13px/1.5 var(--font); background: var(--bg); color: var(--text); display: flex; flex-direction: column; overflow: hidden; }
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--accent) 50%, transparent); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------------------------------------------------------------- header */
.app-header {
  height: var(--header-h); flex: none; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--surface); border-bottom: 1px solid var(--border); position: relative; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: none; }
.logo { color: var(--accent); display: grid; place-items: center; flex: none; }
.brand-text h1 { font-size: 15px; margin: 0; white-space: nowrap; font-weight: 800; }
.brand-text h1 i { font-style: normal; color: var(--accent-2); }
.brand-sub { margin: 0; font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.qat { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); margin-inline-start: 2px; }
.qat-btn { width: 26px; height: 26px; border: 0; border-radius: 7px; background: none; color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.qat-btn:hover { background: var(--accent-soft); color: var(--text); }
.qat-sep { width: 1px; height: 16px; background: var(--border); margin: 0 2px; }
.autosave { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-2); padding: 0 6px; white-space: nowrap; }
.autosave input { accent-color: var(--accent); }
.hdr-divider { width: 1px; height: 26px; background: var(--border); margin: 0 2px; flex: none; }
.proj-btn { display: inline-flex; align-items: center; gap: 7px; margin: 0; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; background: var(--surface-2); color: var(--text); cursor: pointer; flex: 0 1 auto; min-width: 190px; max-width: 320px; }
.proj-btn .caret { width: 13px; height: 13px; color: var(--muted); margin-inline-start: auto; }
.save-state { font-size: 11px; color: var(--accent-2); white-space: nowrap; }
.save-state::before { content: '●'; margin-inline-end: 3px; font-size: 7px; vertical-align: 1.5px; }
.hdr-spacer { flex: 1; }
.g-search { position: relative; display: flex; align-items: center; gap: 7px; height: 32px; width: min(300px, 26vw); padding: 0 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--muted); flex: 0 1 300px; }
.g-search input { all: unset; flex: 1; color: var(--text); font-size: 12.5px; }
.g-search kbd { font-size: 10px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }
.hdr-btn { width: 34px; height: 34px; flex: none; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.hdr-btn:hover { color: var(--text); border-color: var(--accent); }
.lang-btn { display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text-2); cursor: pointer; font-size: 12px; font-weight: 600; }
.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: var(--on-accent); font-size: 11px; font-weight: 700; flex: none; background: var(--accent); }
.user-btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 8px 0 5px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); cursor: pointer; font-weight: 600; font-size: 12.5px; }

/* ---------------------------------------------------------------- ribbon */
.ribbon { position: relative; z-index: 40; flex: none; background: var(--surface); border-bottom: 1px solid var(--border); }
.rb-tabs { display: flex; align-items: flex-end; gap: 2px; height: 30px; padding: 0 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.rb-tabs::-webkit-scrollbar { display: none; }
.rb-tab { flex: none; position: relative; height: 27px; padding: 0 14px; border: 0; background: none; color: var(--text-2); font: 600 13px var(--font); cursor: pointer; border-radius: 8px 8px 0 0; }
.rb-tab:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.rb-tab.on { color: var(--accent-2); background: var(--surface); box-shadow: 0 -1px 0 var(--border), 1px 0 0 var(--border), -1px 0 0 var(--border); }
.rb-tab.on::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 2.5px; border-radius: 2px; background: var(--accent); }
.rb-tab.file { color: var(--on-accent); background: var(--accent); margin-inline-end: 6px; }
.rb-tab.file:hover, .rb-tab.file.on { background: var(--accent-2); color: var(--on-accent); }
.rb-tab.file.on::after { background: var(--on-accent); opacity: .55; }

.rb-body { height: 94px; padding: 0 8px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; cursor: grab; }
.rb-body::-webkit-scrollbar { display: none; }
.rb-body.grabbing { cursor: grabbing; user-select: none; }
.rb-edge { position: absolute; top: 30px; bottom: 0; width: 64px; z-index: 5; display: none; align-items: center; justify-content: center; pointer-events: none; }
.rb-edge.show { display: flex; }
.rb-edge.l { left: 0; background: linear-gradient(90deg, var(--surface) 0%, var(--surface) 68%, transparent 100%); justify-content: flex-start; }
.rb-edge.r { right: 0; background: linear-gradient(-90deg, var(--surface) 0%, var(--surface) 68%, transparent 100%); justify-content: flex-end; }
html[dir="rtl"] .rb-edge.l { left: auto; right: 0; background: linear-gradient(-90deg, var(--surface) 0%, var(--surface) 68%, transparent 100%); justify-content: flex-end; }
html[dir="rtl"] .rb-edge.r { right: auto; left: 0; background: linear-gradient(90deg, var(--surface) 0%, var(--surface) 68%, transparent 100%); justify-content: flex-start; }
.rb-edge .edge-badge { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); display: grid; place-items: center; margin: 0 8px; pointer-events: auto; cursor: pointer; }
.rb-edge .edge-badge:hover { background: var(--accent-soft); border-color: var(--accent); }
.rb-edge .ic { width: 22px; height: 22px; color: #22c55e; }
.rb-edge.l .ic { transform: rotate(180deg); animation: edgeNudgeL 1.6s ease-in-out infinite; }
.rb-edge.r .ic { animation: edgeNudgeR 1.6s ease-in-out infinite; }
html[dir="rtl"] .rb-edge.l .ic { transform: none; animation: edgeNudgeR 1.6s ease-in-out infinite; }
html[dir="rtl"] .rb-edge.r .ic { transform: rotate(180deg); animation: edgeNudgeL 1.6s ease-in-out infinite; }
@keyframes edgeNudgeR { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }
@keyframes edgeNudgeL { 0%, 100% { transform: rotate(180deg) translateX(0); } 50% { transform: rotate(180deg) translateX(4px); } }
.rb-panel { display: none; height: 100%; align-items: stretch; }
.rb-panel.on { display: flex; animation: rbIn .15s ease-out; }
@keyframes rbIn { from { opacity: .4; transform: translateY(-3px); } }
.rb-group { display: flex; flex-direction: column; padding: 6px 9px 0; border-inline-end: 1px solid var(--border); flex: none; }
.rb-group:last-child { border-inline-end: 0; }
.rb-items { flex: 1; display: flex; align-items: flex-start; gap: 2px; }
.rb-label { text-align: center; font-size: 11px; color: var(--muted); padding: 2px 0 4px; white-space: nowrap; }
.rb-big { min-width: 58px; max-width: 92px; height: 64px; padding: 5px 6px 4px; border: 1px solid transparent; border-radius: 9px; background: none; color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; cursor: pointer; font: 500 11px/1.16 var(--font); text-align: center; }
.rb-big > .ic { width: 25px; height: 25px; color: var(--accent-2); flex: none; stroke-width: 1.6; }
.rb-big > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.14; }
.rb-col { display: flex; flex-direction: column; gap: 1px; padding-top: 1px; justify-content: center; }
.rb-small { height: 21px; padding: 0 8px 0 5px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--text); display: flex; align-items: center; gap: 6px; cursor: pointer; font: 500 11.5px var(--font); white-space: nowrap; text-align: start; }
.rb-small .ic { width: 14px; height: 14px; color: var(--accent-2); flex: none; }
.rb-big:hover, .rb-small:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.rb-big.seen::after { content: '✓'; position: absolute; }
.rb-big .caret, .rb-small .caret { width: 9px; height: 9px; color: var(--muted); margin-inline-start: 2px; vertical-align: 1px; }
.rb-big.danger, .rb-small.danger { color: var(--danger); }
.rb-big.danger .ic, .rb-small.danger .ic { color: var(--danger); }
.rb-big.accent { color: var(--on-accent); background: var(--accent); }
.rb-big.accent .ic { color: var(--on-accent); }
.rb-big.accent:hover { background: var(--accent-2); }
.rb-small.on, .rb-big.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent-2); }

/* ---------------------------------------------------------------- main area ("map") */
.app-body { flex: 1; min-height: 0; display: flex; }
.app-footer { flex: none; height: 24px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 12px; background: var(--surface); border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); }
.footer-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.footer-btn { all: unset; display: flex; align-items: center; gap: 5px; cursor: pointer; color: var(--text-2); padding: 1px 6px; border-radius: 5px; }
.footer-btn:hover { background: var(--accent-soft); color: var(--accent-2); }
.footer-btn .ic, .footer-coord .ic { width: 12px; height: 12px; }
.footer-sep { width: 1px; height: 12px; background: var(--border); flex: none; }
.footer-coord { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.footer-right { display: flex; align-items: center; gap: 8px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-stage { flex: 1; min-width: 0; position: relative; background:
    radial-gradient(circle at 18% 20%, rgba(189, 160, 98, .07), transparent 40%),
    radial-gradient(circle at 82% 78%, rgba(189, 160, 98, .05), transparent 45%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 42px),
    var(--bg);
  overflow-y: auto;
}
.stage-inner { max-width: 880px; margin: 0 auto; padding: 22px 28px 50px; }

/* ---------------------------------------------------------------- floating map controls (zoom/draw toolbar,
   2D/3D navigator, AI launcher) — drawn straight over the map, like the real app */
.map-float { position: absolute; top: 18px; z-index: 20; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px; border-radius: 12px; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border); box-shadow: var(--shadow); backdrop-filter: blur(3px); }
.map-float-l { left: 16px; }
.map-float-r { right: 16px; }
html[dir="rtl"] .map-float-l { left: auto; right: 16px; }
html[dir="rtl"] .map-float-r { right: auto; left: 16px; }
.mf-btn { width: 32px; height: 32px; flex: none; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.mf-btn .ic { width: 16px; height: 16px; }
.mf-btn:hover { color: var(--text); background: var(--accent-soft); }
.mf-btn.hon { color: var(--accent-2); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.mf-btn.mf-text { font: 700 16px/1 var(--font); }
.mf-sep { width: 20px; height: 1px; background: var(--border); margin: 2px 0; }
.mf-toggle { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.mf-toggle-btn { width: 32px; height: 24px; border: 0; background: var(--surface-2); color: var(--text-2); font: 700 10px var(--font); cursor: pointer; }
.mf-toggle-btn:hover { color: var(--text); }
.mf-toggle-btn.on { background: var(--accent); color: var(--on-accent); }
.map-ai-btn { position: absolute; bottom: 18px; right: 18px; z-index: 20; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--accent-2); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); }
html[dir="rtl"] .map-ai-btn { right: auto; left: 18px; }
.map-ai-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.map-ai-btn img { width: 22px; height: 22px; }
.map-ai-btn.hon { border-color: var(--accent); background: var(--accent-soft); }

.map-nav-btn { position: absolute; bottom: 18px; left: 18px; z-index: 20; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--border); background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--accent-2); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); }
html[dir="rtl"] .map-nav-btn { left: auto; right: 18px; }
.map-nav-btn:hover, .map-nav-btn.hon { border-color: var(--accent); background: var(--accent-soft); }
.map-nav-btn .ic { width: 20px; height: 20px; }
.map-nav-chevron { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); width: 20px; height: 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; }
.map-nav-chevron .ic { width: 10px; height: 10px; color: var(--muted); transform: rotate(-90deg); }
html[dir="rtl"] .map-nav-chevron .ic { transform: rotate(-90deg); }
.map-ai-badge { position: absolute; bottom: -3px; right: -4px; padding: 1px 4px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font: 800 8px var(--font); }
html[dir="rtl"] .map-ai-badge { right: auto; left: -4px; }
@media (max-width: 920px) {
  .map-float, .map-ai-btn, .map-nav-btn { display: none; }
}

.hero-card { text-align: center; padding: 18px 20px 30px; }
.hero-card .mark { color: var(--accent); margin-bottom: 14px; }
.hero-card .mark img { width: 105px; height: 105px; }
.hero-card h2 { font-size: 26px; margin: 0 0 8px; font-weight: 800; }
.hero-card p { color: var(--text-2); font-size: 14.5px; max-width: 520px; margin: 0 auto; }
.hero-hint { display: inline-flex; align-items: center; gap: 8px; margin-top: 22px; padding: 9px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--accent-2); font-size: 12.5px; font-weight: 600; }
.hero-hint .ic { width: 15px; height: 15px; }
.hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-top: 30px; text-align: start; }
.hero-tile { padding: 14px 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.hero-tile b { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.hero-tile b .ic { color: var(--accent-2); width: 17px; height: 17px; }
.hero-tile p { margin: 6px 0 0; color: var(--text-2); font-size: 12px; }

.detail-card { animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.detail-head { display: flex; align-items: flex-start; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.detail-ic { width: 54px; height: 54px; flex: none; border-radius: 14px; background: var(--accent-soft); color: var(--accent-2); display: grid; place-items: center; }
.detail-ic .ic { width: 28px; height: 28px; }
.detail-head h2 { margin: 0 0 4px; font-size: 21px; font-weight: 800; }
.detail-crumb { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.detail-lede { color: var(--text-2); font-size: 14px; margin: 0; }
.detail-body { font-size: 13.5px; line-height: 1.7; color: var(--text); }
.detail-body p { margin: 0 0 14px; }
.detail-body ul { margin: 0 0 14px; padding-inline-start: 20px; }
.detail-body li { margin-bottom: 6px; color: var(--text-2); }
.detail-body li b { color: var(--text); }

.example-box { margin-top: 22px; padding: 16px 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); border-inline-start: 3px solid var(--accent); }
.example-box h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-2); display: flex; align-items: center; gap: 7px; }
.example-box h4 .ic { width: 14px; height: 14px; }
.example-box p { margin: 0; color: var(--text-2); font-size: 13px; }

.illus-box { margin-top: 22px; padding: 22px 20px 20px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); text-align: center; }
.illus-box svg { max-width: 100%; height: auto; display: block; margin: 0 auto; overflow: visible; }
.illus-cap { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12px; line-height: 1.5; color: var(--muted); }

.back-row { display: flex; align-items: center; gap: 10px; margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--border); }
.back-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; font-size: 12.5px; font-weight: 600; }
.back-btn:hover { color: var(--text); border-color: var(--accent); }
.back-btn .ic { width: 14px; height: 14px; }
.nav-hint { color: var(--muted); font-size: 11.5px; margin-inline-start: auto; }

/* ---------------------------------------------------------------- sidebar (tool tree, optional) */
.sidebar { width: 260px; flex: none; background: var(--surface); border-inline-end: 1px solid var(--border); overflow-y: auto; overflow-anchor: none; padding: 14px; }
.sidebar h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }
.sidebar h3:first-child { margin-top: 0; }
.side-link { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 9px; border: 0; background: none; border-radius: 7px; color: var(--text-2); font-size: 12.5px; cursor: pointer; text-align: start; }
.side-link:hover { background: var(--accent-soft); color: var(--text); }
.side-link.on { background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.side-link .ic { width: 14px; height: 14px; flex: none; }
.progress-pill { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 11.5px; color: var(--text-2); }
.progress-pill b { color: var(--accent-2); }
.pbar { height: 5px; border-radius: 3px; background: var(--border); margin-top: 7px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }

@media (max-width: 920px) {
  .sidebar { display: none; }
  .brand-text { display: none; }
  .g-search { display: none; }
}

/* ---------------------------------------------------------------- light theme (the Theme button actually toggles this) */
:root[data-theme="light"] {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #f0efe9;
  --border: #e3e1da;
  --text: #17140c;
  --text-2: #52514c;
  --muted: #8a8984;
  --accent: #8f7433;
  --on-accent: #ffffff;
  --accent-2: #0f766e;
  --accent-soft: rgba(143, 116, 51, .1);
}
:root[data-theme="light"] .rb-tab:hover { background: rgba(0, 0, 0, .04); }
:root[data-theme="light"] .map-stage {
  background: radial-gradient(circle at 18% 20%, rgba(143, 116, 51, .07), transparent 40%), radial-gradient(circle at 82% 78%, rgba(15, 118, 110, .05), transparent 45%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .025) 0 1px, transparent 1px 42px), repeating-linear-gradient(90deg, rgba(0, 0, 0, .025) 0 1px, transparent 1px 42px), var(--bg);
}

/* ---------------------------------------------------------------- contextual-tab note + tab dot */
.rb-ctx-dot { font-size: 7px; vertical-align: 3px; color: var(--accent-2); opacity: .8; }
.ctx-note { display: flex; align-items: flex-start; gap: 8px; margin: 6px 8px 0; padding: 7px 10px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-2); font-size: 11.5px; line-height: 1.4; }
.ctx-note .ic { width: 14px; height: 14px; flex: none; margin-top: 1px; }

/* ---------------------------------------------------------------- searchable galleries (Geoprocessing / ETL Transformers / Dashboard Blocks) */
.gal-group { flex: 1; min-width: 360px; }
.gal-wrap { display: flex; align-items: stretch; gap: 10px; height: 100%; }
.gal-side { display: flex; flex-direction: column; justify-content: center; gap: 4px; flex: none; width: 128px; }
.gal-search { display: flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); flex: none; }
.gal-search .ic { width: 12px; height: 12px; color: var(--muted); }
.gal-search input { all: unset; flex: 1; font-size: 11px; color: var(--text); width: 100%; }
.gal-all { display: flex; align-items: center; gap: 6px; height: 22px; padding: 0 6px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--accent-2); font: 600 11px var(--font); cursor: pointer; text-align: start; white-space: nowrap; }
.gal-all .ic { width: 13px; height: 13px; }
.gal-all:hover { color: var(--text); }
.gal-all.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--text); }
.gal-body { position: relative; flex: 1; min-width: 0; display: flex; align-items: stretch; }
.gal-edge { position: absolute; top: 0; bottom: 0; width: 58px; z-index: 5; display: none; align-items: center; justify-content: center; pointer-events: none; }
.gal-edge.show { display: flex; animation: galEdgeNudge 1.4s ease-in-out 2; }
.gal-edge.l { left: 0; background: linear-gradient(90deg, var(--surface) 0%, var(--surface) 64%, transparent 100%); justify-content: flex-start; }
.gal-edge.r { right: 0; background: linear-gradient(-90deg, var(--surface) 0%, var(--surface) 64%, transparent 100%); justify-content: flex-end; }
html[dir="rtl"] .gal-edge.l { left: auto; right: 0; background: linear-gradient(-90deg, var(--surface) 0%, var(--surface) 64%, transparent 100%); justify-content: flex-end; }
html[dir="rtl"] .gal-edge.r { right: auto; left: 0; background: linear-gradient(90deg, var(--surface) 0%, var(--surface) 64%, transparent 100%); justify-content: flex-start; }
.gal-edge .edge-badge { width: 36px; height: 36px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); display: grid; place-items: center; margin: 0 7px; pointer-events: auto; cursor: pointer; }
.gal-edge .edge-badge:hover { background: var(--accent-soft); border-color: var(--accent); }
.gal-edge .ic { width: 20px; height: 20px; color: #22c55e; }
.gal-edge.l .ic { transform: rotate(180deg); animation: edgeNudgeL 1.6s ease-in-out infinite; }
.gal-edge.r .ic { animation: edgeNudgeR 1.6s ease-in-out infinite; }
html[dir="rtl"] .gal-edge.l .ic { transform: none; animation: edgeNudgeR 1.6s ease-in-out infinite; }
html[dir="rtl"] .gal-edge.r .ic { transform: rotate(180deg); animation: edgeNudgeL 1.6s ease-in-out infinite; }
@keyframes galEdgeNudge { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.gal-grid { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; overflow-y: hidden; height: 100%; padding: 2px 0; scrollbar-width: none; flex: 1; min-width: 0; cursor: grab; }
.gal-grid::-webkit-scrollbar { display: none; }
.gal-section { flex: none; display: flex; flex-direction: column; align-items: stretch; padding: 0 12px; border-inline-start: 1px solid var(--border); }
.gal-section:first-child { border-inline-start: 0; padding-inline-start: 0; }
.gal-cols { display: flex; flex-flow: column wrap; align-content: flex-start; height: 70px; gap: 1px 16px; padding-top: 2px; }
.gal-cat { flex: none; font-size: 10px; color: var(--muted); text-align: center; padding-top: 2px; white-space: nowrap; }
.gal-tile { flex: none; height: 22px; display: flex; align-items: center; gap: 6px; padding: 0 7px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--text); cursor: pointer; font: 500 11.5px var(--font); white-space: nowrap; text-align: start; }
.gal-tile .ic { width: 14px; height: 14px; color: var(--accent-2); flex: none; }
.gal-tile:hover, .gal-tile.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.gal-none { color: var(--muted); font-size: 11.5px; padding: 0 8px; align-self: center; }

/* ---------------------------------------------------------------- "All tools / All transformers / All blocks" drawer */
.tool-drawer-backdrop { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, .25); z-index: 149; opacity: 0; pointer-events: none; transition: opacity .18s ease; }
.tool-drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.tool-drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(330px, 86vw); background: var(--surface); border-inline-start: 1px solid var(--border); z-index: 150; display: flex; flex-direction: column; box-shadow: -10px 0 28px rgba(0, 0, 0, .35); transform: translateX(100%); transition: transform .2s ease; }
.tool-drawer.open { transform: translateX(0); }
html[dir="rtl"] .tool-drawer { right: auto; left: 0; border-inline-start: 0; border-inline-end: 1px solid var(--border); transform: translateX(-100%); }
html[dir="rtl"] .tool-drawer.open { transform: translateX(0); }
.tool-drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; border-bottom: 1px solid var(--border); flex: none; }
.tool-drawer-head h3 { margin: 0; font-size: 14.5px; font-weight: 800; flex: 1; }
.tool-drawer-count { font-size: 11px; color: var(--muted); }
.tool-drawer-close { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; cursor: pointer; flex: none; }
.tool-drawer-close:hover { color: var(--text); border-color: var(--accent); }
.tool-drawer-search { display: flex; align-items: center; gap: 7px; height: 32px; margin: 10px 14px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); flex: none; }
.tool-drawer-search .ic { width: 13px; height: 13px; color: var(--muted); }
.tool-drawer-search input { all: unset; flex: 1; font-size: 12.5px; color: var(--text); width: 100%; }
.tool-drawer-list { flex: 1; overflow-y: auto; padding: 0 8px 16px; }
.tool-drawer-cat { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 8px 4px; }
.tool-drawer-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 9px; border: 0; border-radius: 8px; background: none; color: var(--text); font: 500 12.5px var(--font); cursor: pointer; text-align: start; }
.tool-drawer-item .ic { width: 16px; height: 16px; color: var(--accent-2); flex: none; }
.tool-drawer-item:hover { background: var(--accent-soft); }
.tool-drawer-none { color: var(--muted); font-size: 12px; padding: 14px 10px; text-align: center; }

/* header controls, once clicked, get the same quiet highlight as a ribbon button */
[data-head].hon, .user-btn.hon, .proj-btn.hon { background: var(--accent-soft); border-color: var(--accent); }
.autosave.hon { background: var(--accent-soft); border-radius: 8px; }

/* ---------------------------------------------------------------- language menu (under the globe button) */
.lang-pop { position: fixed; z-index: 500; min-width: 150px; padding: 5px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.lang-pop button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 7px; color: var(--text); font-size: 13px; cursor: pointer; text-align: start; }
.lang-pop button:hover { background: var(--accent-soft); }
.lang-pop button.on { color: var(--accent-2); font-weight: 700; }
.lang-pop .ic { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- sidebar search */
.side-search-wrap { position: sticky; top: -14px; z-index: 3; margin: -14px -14px 10px; padding: 14px 14px 10px; background: var(--surface); }
.side-search-wrap.scrolled { box-shadow: 0 6px 10px -8px rgba(0, 0, 0, .35); }
.side-search { position: relative; display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.side-search .ic { width: 14px; height: 14px; color: var(--muted); flex: none; }
.side-search input { all: unset; flex: 1; font-size: 12.5px; color: var(--text); width: 100%; }
.side-link.hidden, .sidebar h3.hidden { display: none; }
.side-none { color: var(--muted); font-size: 12px; text-align: center; padding: 16px 4px; }
.sidebar h3 small { font-weight: 400; color: var(--muted); }

.fallback-note { margin-top: 10px; font-size: 11.5px; color: var(--muted); font-style: italic; }

/* ---------------------------------------------------------------- right-to-left (Arabic / Farsi) */
html[dir="rtl"] .hero-hint .ic, html[dir="rtl"] .back-btn .ic { transform: scaleX(-1); }
html[dir="rtl"] .nav-hint { margin-inline-start: 0; margin-inline-end: auto; }
html[dir="rtl"] .detail-ic, html[dir="rtl"] .brand, html[dir="rtl"] .hero-hint, html[dir="rtl"] .back-row { direction: rtl; }
