svg.i { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button svg.i { width: 16px; height: 16px; }

/* shell */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
aside { background: var(--bg-elev); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 10px 8px; gap: 8px; position: sticky; top: 0; height: 100vh; z-index: 30; }
.ws { display: grid; gap: 2px; padding: 6px 8px 12px; }
.ws .logo { width: 150px; height: auto; }
.wsname { font-size: 12px; padding-left: 2px; }
img.logo-d { display: none; }
:root[data-theme='dark'] img.logo-l { display: none; }
:root[data-theme='dark'] img.logo-d { display: block; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme='light']) img.logo-l { display: none; }
	:root:not([data-theme='light']) img.logo-d { display: block; }
}
nav { display: grid; gap: 1px; }
.group { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding: 12px 10px 4px; font-weight: 600; }
nav a { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 7px; color: var(--text-2); font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; }
nav a span { overflow: hidden; text-overflow: ellipsis; }
nav a:hover { background: var(--bg-sunk); color: var(--text); text-decoration: none; }
nav a.on { background: var(--accent-soft); color: var(--accent-text); }
nav a.sub { font-size: 12.5px; padding-left: 37px; color: var(--text-3); }
nav a.sub.on { color: var(--accent-text); background: none; }
aside .foot { margin-top: auto; display: flex; gap: 6px; align-items: center; padding: 8px 4px 2px; border-top: 1px solid var(--line); font-size: 12.5px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; height: 54px; padding: 0 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; min-width: 0; overflow: hidden; white-space: nowrap; color: var(--text-3); }
.crumbs b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.burger { display: none; }
.scrim { display: none; }
@media (max-width: 860px) {
	.shell { grid-template-columns: minmax(0, 1fr); }
	aside { position: fixed; left: 0; top: 0; width: 248px; transform: translateX(-100%); transition: transform 0.18s; box-shadow: var(--shadow); }
	.shell.nav-open aside { transform: none; }
	.shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgb(2 6 23 / 0.4); z-index: 25; }
	.burger { display: inline-flex; }
}

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
	background: radial-gradient(1000px 600px at 15% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent), radial-gradient(800px 500px at 110% 110%, color-mix(in srgb, #0ea5e9 16%, transparent), transparent), var(--bg); }
.login form { width: min(400px, 100%); padding: 28px; display: grid; gap: 14px; }
.login .brand { display: grid; gap: 14px; margin-bottom: 6px; }
.login .brand .logo { width: 210px; height: auto; }
.login button.primary { height: 40px; justify-content: center; }

/* modal + toast */
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--bg-elev); color: var(--text); box-shadow: 0 20px 60px rgb(0 0 0 / 0.35); width: min(520px, calc(100vw - 24px)); }
dialog::backdrop { background: rgb(2 6 23 / 0.55); backdrop-filter: blur(2px); }
dialog > header { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
dialog > header h2 { flex: 1; }
dialog .content { padding: 16px; display: grid; gap: 12px; max-height: calc(100vh - 200px); overflow: auto; }
dialog > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
#toasts { position: fixed; bottom: 16px; right: 16px; display: grid; gap: 8px; z-index: 200; }
.toast { padding: 10px 14px; border-radius: 9px; background: var(--text); color: var(--bg); font-size: 13px; box-shadow: var(--shadow); max-width: 380px; animation: tin 0.16s; }
.toast.err { background: var(--err); color: #fff; }
@keyframes tin { from { opacity: 0; transform: translateY(6px); } }

/* misc */
.hint { font-size: 12px; color: var(--text-3); }
.url { display: flex; align-items: center; gap: 6px; background: var(--bg-sunk); border: 1px solid var(--line); border-radius: 8px; padding: 4px 4px 4px 10px; min-width: 0; }
.url code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url button { height: 26px; }
.feeds { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; }
.feed-card { padding: 14px; display: grid; gap: 8px; color: var(--text); }
.feed-card:hover { border-color: var(--accent); text-decoration: none; }
.feed-card .meta { display: flex; gap: 12px; font-size: 12.5px; color: var(--text-3); flex-wrap: wrap; }
.dirty { color: var(--warn); font-size: 12.5px; font-weight: 600; }
.pw { font-family: var(--mono); font-size: 12.5px; }

/* chart */
.chart { width: 100%; height: auto; max-height: 260px; display: block; }
.chart .bar { fill: var(--accent); }
.chart .bar.fail { fill: var(--err); }
.chart .bar:hover { opacity: 0.8; }
.chart text { fill: var(--text-3); font-size: 10px; font-family: var(--font); }
.chart line { stroke: var(--grid); }
.meter { height: 6px; border-radius: 99px; background: var(--bg-sunk); overflow: hidden; min-width: 60px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* grid editor */
.sheet-wrap { overflow: auto; max-height: calc(100vh - 250px); border-top: 1px solid var(--line); }
table.sheet { border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.sheet th, table.sheet td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; }
table.sheet thead th { position: sticky; top: 0; background: var(--bg-sunk); z-index: 2; }
table.sheet th.rn, table.sheet td.rn { position: sticky; left: 0; background: var(--bg-sunk); z-index: 1; color: var(--text-3); font-size: 11.5px; text-align: center; min-width: 52px; }
table.sheet thead th.rn { z-index: 3; }
table.sheet td input, table.sheet th input { border: 0; border-radius: 0; background: transparent; width: 100%; min-width: 140px; height: 30px; padding: 0 8px; }
table.sheet th input { font-weight: 600; color: var(--text-2); font-size: 12.5px; }
table.sheet td input:focus, table.sheet th input:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--bg-elev); }
table.sheet td.chg input { background: color-mix(in srgb, var(--warn) 12%, transparent); }
table.sheet .colh { display: flex; align-items: center; }
table.sheet .colh button, table.sheet td.rn button { height: 22px; width: 22px; padding: 0; justify-content: center; border: 0; background: none; color: var(--text-3); flex: none; }
table.sheet .colh button:hover, table.sheet td.rn button:hover { color: var(--err); }
table.sheet td.rn .n { display: inline-block; min-width: 24px; }
table.sheet tr:hover td.rn button { visibility: visible; }
table.sheet td.rn button { visibility: hidden; }

/* mapping editor */
.mapper { display: grid; grid-template-columns: 230px minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1350px) { .mapper { grid-template-columns: 210px minmax(0, 1fr); } .mapper .preview { grid-column: 1 / -1; } }
@media (max-width: 1000px) { .mapper { grid-template-columns: minmax(0, 1fr); } .cols-list { max-height: 240px; } }
.settings-grid input { width: 100%; }
.cols-list { display: grid; gap: 4px; max-height: calc(100vh - 260px); overflow: auto; }
.col-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-elev); cursor: grab; }
.col-item:hover { border-color: var(--accent); }
.col-item .nm { font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-item .sm { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; grid-column: 1; }
.col-item .add { grid-row: 1 / span 2; grid-column: 2; }
.col-item.used { opacity: 0.6; }
.tree { display: grid; gap: 6px; }
.tag { font-family: var(--mono); font-size: 12.5px; color: var(--accent-text); }
.fld { display: grid; grid-template-columns: 20px 18px minmax(0, 1fr) 16px minmax(0, 1fr); gap: 6px; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg-elev); }
.fld.off { opacity: 0.55; }
.fld.drag-over { border-color: var(--accent); box-shadow: 0 -2px 0 var(--accent); }
.fld.bad { border-color: color-mix(in srgb, var(--err) 60%, transparent); }
.fld .grip { cursor: grab; color: var(--text-3); display: grid; place-items: center; }
.fld input, .fld select { height: 30px; font-size: 13px; }
.fld input.xname { font-family: var(--mono); font-size: 12.5px; }
.fld .arrow { color: var(--text-3); text-align: center; }
.fld .tools { grid-column: 3 / -1; display: flex; gap: 4px; align-items: center; }
.fld .tools input { flex: 1; min-width: 60px; height: 28px; font-size: 12.5px; }
.fld .tpl { grid-column: 3 / -1; font-family: var(--mono); font-size: 12.5px; }
.fld .tools button { height: 28px; padding: 0 7px; font-size: 12px; }
.fld .tools button.icon { width: 28px; padding: 0; }
.fld .sample { grid-column: 3 / -1; font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop-zone { border: 1.5px dashed var(--line-strong); border-radius: 9px; padding: 12px; text-align: center; color: var(--text-3); font-size: 12.5px; }
.drop-zone.drag-over { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
pre.xml { margin: 0; padding: 12px 14px; font: 12px/1.55 var(--mono); overflow: auto; max-height: calc(100vh - 260px); background: var(--bg-sunk); border-radius: 0 0 var(--radius) var(--radius); white-space: pre; }
pre.xml .t { color: var(--accent-text); }
pre.xml .a { color: #0891b2; }
pre.xml .v { color: #16a34a; }
pre.xml .c { color: var(--text-3); }
:root[data-theme='dark'] pre.xml .a { color: #67e8f9; }
:root[data-theme='dark'] pre.xml .v { color: #86efac; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.attr-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 6px; }
@media (min-width: 1351px) { .mapper .preview { position: sticky; top: 70px; } }
