/* MadoriQ - drawing analysis workbench.
   Quiet, Apple-like surfaces: frosted bars, white cards with soft shadows, hairline separators,
   blue = interaction / selection, green = confirmed by the user, orange / red = attention. */
:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --bar: rgba(251, 251, 253, .8);
  --bar-solid: #fbfbfd;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --surface-3: #e8e8ed;
  --fill: rgba(118, 118, 128, .12);
  --fill-2: rgba(118, 118, 128, .07);
  --seg-on: #ffffff;
  --ink: #1d1d1f;
  --ink-2: #424245;
  --muted: #86868b;
  --line: rgba(0, 0, 0, .1);
  --line-2: rgba(0, 0, 0, .055);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, .09);
  --accent-ink: #ffffff;
  --ok: #248a3d;
  --ok-fill: #34c759;
  --ok-soft: rgba(52, 199, 89, .12);
  --warn: #b25000;
  --warn-soft: rgba(255, 149, 0, .13);
  --danger: #d70015;
  --danger-soft: rgba(255, 59, 48, .1);
  --badge: #ff3b30;
  --viewer-bg: #e3e3e8;
  --hud: rgba(29, 29, 31, .86);
  --radius: 12px;
  --r-sm: 8px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05), 0 0 0 .5px rgba(0, 0, 0, .06);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, .08), 0 1px 3px rgba(0, 0, 0, .06), 0 0 0 .5px rgba(0, 0, 0, .07);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .16), 0 6px 16px rgba(0, 0, 0, .06), 0 0 0 .5px rgba(0, 0, 0, .08);
  --ring: 0 0 0 4px rgba(0, 113, 227, .2);
  --glass: saturate(180%) blur(20px);
  --mono: "SF Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo UI", "PingFang SC", "Microsoft YaHei UI", system-ui, sans-serif;
  font-size: 13px;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #161617;
    --bar: rgba(29, 29, 31, .78);
    --bar-solid: #1d1d1f;
    --surface: #1c1c1e;
    --surface-2: #232325;
    --surface-3: #2c2c2e;
    --fill: rgba(118, 118, 128, .24);
    --fill-2: rgba(118, 118, 128, .14);
    --seg-on: #636366;
    --ink: #f5f5f7;
    --ink-2: #c7c7cc;
    --muted: #8e8e93;
    --line: rgba(255, 255, 255, .12);
    --line-2: rgba(255, 255, 255, .07);
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-soft: rgba(10, 132, 255, .18);
    --ok: #30d158;
    --ok-fill: #30d158;
    --ok-soft: rgba(48, 209, 88, .16);
    --warn: #ff9f0a;
    --warn-soft: rgba(255, 159, 10, .16);
    --danger: #ff453a;
    --danger-soft: rgba(255, 69, 58, .16);
    --viewer-bg: #111113;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 0 0 .5px rgba(255, 255, 255, .08);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, .45), 0 0 0 .5px rgba(255, 255, 255, .1);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6), 0 0 0 .5px rgba(255, 255, 255, .12);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); display: flex; flex-direction: column; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num, .tabular { font-variant-numeric: tabular-nums; }
::selection { background: rgba(0, 113, 227, .2); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(128, 128, 135, .35); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background-color: rgba(128, 128, 135, .55); }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- app bar (frosted) ---------- */
.topbar {
  position: relative; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 48px; padding: 0 16px; flex: none; background: var(--bar); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass);
  border-bottom: .5px solid var(--line); color: var(--ink);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { color: var(--accent); display: grid; }
.logo img { width: 22px; height: 22px; display: block; object-fit: contain; }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.brand-sub { color: var(--muted); font-size: 12.5px; padding-left: 10px; border-left: 1px solid var(--line); white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar .btn { height: 28px; padding: 0 12px; font-size: 12.5px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.badge.ok::before { background: var(--ok-fill); box-shadow: 0 0 0 3px var(--ok-soft); }
.badge.warn::before { background: #ff9500; box-shadow: 0 0 0 3px var(--warn-soft); }
.lang-toggle { display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--r-sm); background: var(--fill); }
.lang-toggle button { border: 0; background: transparent; height: 24px; padding: 0 10px; font-size: 12px; border-radius: 6px; cursor: pointer; color: var(--ink-2); }
.lang-toggle button.active { background: var(--seg-on); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px;
  padding: 0 14px; border-radius: var(--r-sm); font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
  border: 0; background: var(--fill); color: var(--ink); transition: background .15s, box-shadow .15s, transform .08s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--fill); }
.btn-sm { height: 28px; padding: 0 12px; font-size: 12.5px; }
.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--r-sm); background: var(--fill); flex: none; }
.seg button {
  border: 0; background: transparent; height: 24px; padding: 0 12px; font-size: 12.5px; border-radius: 6px;
  cursor: pointer; color: var(--ink-2); white-space: nowrap; transition: background .15s, color .15s;
}
.seg button:hover:not(.active) { color: var(--ink); }
.seg button.active { background: var(--seg-on); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
select, input[type="number"], input[type="text"], textarea { border-radius: var(--r-sm); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 26px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5l3-3' fill='none' stroke='%2386868b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 12px;
}

/* ---------- start screen ---------- */
.upload-view { width: 100%; max-width: 820px; margin: 0 auto; padding: 64px 20px 64px; overflow-y: auto; }
.hero { text-align: center; }
.hero h1 { font-size: 32px; line-height: 1.15; margin: 0 0 10px; font-weight: 700; letter-spacing: -.02em; }
.hero-lead { color: var(--muted); margin: 0 auto 32px; line-height: 1.7; font-size: 15px; max-width: 620px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 48px 20px; border: 1.5px dashed rgba(0, 113, 227, .35); border-radius: 20px; background: var(--surface);
  cursor: pointer; color: var(--ink-2); box-shadow: var(--shadow-sm); transition: border-color .15s, background .15s, box-shadow .15s;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); outline: none; box-shadow: var(--shadow-md); }
.dropzone svg { color: var(--accent); width: 40px; height: 40px; padding: 8px; border-radius: 50%; background: var(--accent-soft); }
.dropzone strong { color: var(--ink); font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.dropzone .muted { font-size: 12.5px; }
.dropzone.disabled { opacity: .55; cursor: not-allowed; }
.sample-row { display: flex; justify-content: center; margin: 16px 0 40px; }
.sample-row .btn { background: transparent; color: var(--accent); }
.sample-row .btn:hover { background: var(--accent-soft); }
.how { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.how li { display: flex; flex-direction: column; gap: 8px; padding: 18px 18px 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.how-n {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft);
  font-weight: 700; font-size: 12.5px; color: var(--accent); font-variant-numeric: tabular-nums;
}
.how strong { font-size: 14px; font-weight: 600; }
.how p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.65; }

/* ---------- workbench ---------- */
.work-view { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 400px; }
.viewer-pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--viewer-bg); }
.viewer-toolbar {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; flex: none;
  background: var(--bar); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); border-bottom: .5px solid var(--line);
}
.layer-seg { margin-left: 4px; }
.draw-tools { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.zoom { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; padding: 2px; border-radius: var(--r-sm); background: var(--fill); }
.zoom button {
  min-width: 26px; height: 24px; padding: 0 8px; border-radius: 6px; border: 0; background: transparent;
  cursor: pointer; font-size: 12.5px; color: var(--ink-2);
}
.zoom button:hover { background: var(--seg-on); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
#zoomLabel { min-width: 46px; text-align: center; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tool-btn {
  height: 28px; padding: 0 12px; border-radius: var(--r-sm); border: 0; background: var(--fill);
  color: var(--ink-2); font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.tool-btn:hover { background: var(--surface-3); }
.tool-btn.active { background: var(--accent); color: #fff; }
.draw-hint { font-size: 12px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.viewport { flex: 1; min-height: 0; overflow: auto; cursor: grab; }
.viewport.dragging { cursor: grabbing; }
.viewport.drawing, .viewport.drawing .overlay .box { cursor: crosshair; }
.stage { position: relative; margin: 0 auto; transform-origin: 0 0; box-shadow: 0 2px 6px rgba(0, 0, 0, .06), 0 12px 40px rgba(0, 0, 0, .12); }
.stage img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; background: #fff; }

.statusbar {
  display: flex; align-items: center; gap: 0; height: 26px; flex: none; padding: 0 6px;
  background: var(--bar); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); border-top: .5px solid var(--line);
  color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden;
}
.statusbar span { padding: 0 10px; border-left: 1px solid var(--line-2); }
.statusbar span:first-child { border-left: 0; color: var(--ink-2); font-weight: 500; }

.sheet-tabs {
  display: flex; gap: 4px; overflow-x: auto; padding: 6px 10px; flex: none;
  background: var(--bar); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); border-bottom: .5px solid var(--line);
}
.sheet-tab {
  flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 0; max-width: 220px;
  padding: 5px 12px 4px; border: 0; border-radius: var(--r-sm); background: transparent; cursor: pointer;
  font-size: 12px; color: var(--ink-2); text-align: left; transition: background .15s;
}
.sheet-tab:hover { background: var(--fill-2); }
.sheet-tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.sheet-tab .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 196px; }
.sheet-tab .sub { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- drawing overlay ---------- */
.overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.overlay .dim { fill: rgba(20, 20, 24, .42); pointer-events: none; }
.overlay .box { fill: transparent; stroke-width: 2.5; vector-effect: non-scaling-stroke; cursor: pointer; }
.overlay .box:hover { stroke-width: 3.5; fill: rgba(255, 255, 255, .08); }
.overlay .box.sel { fill: rgba(255, 255, 255, .08); cursor: move; }
.overlay .box.faded, .overlay .tag.faded { opacity: .15; }
.overlay .box.checked { fill: rgba(52, 199, 89, .14); }
.overlay .box.manual { stroke-dasharray: 8 5; }
.overlay .box.pulse { animation: pulse 1s ease-out 2; }
@keyframes pulse { 0% { stroke-width: 9; } 100% { stroke-width: 2.5; } }
.overlay .tag rect { rx: 3; }
.overlay .tag text { fill: #fff; font-weight: 700; font-family: -apple-system, "Segoe UI", system-ui, sans-serif; pointer-events: none; }
.overlay .sel-ring { fill: none; stroke: #0071e3; stroke-width: 1.2; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.overlay .handle { fill: #fff; fill-opacity: .95; stroke: #0071e3; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.overlay .h-nw, .overlay .h-se { cursor: nwse-resize; }
.overlay .h-ne, .overlay .h-sw { cursor: nesw-resize; }
.overlay .h-n, .overlay .h-s { cursor: ns-resize; }
.overlay .h-e, .overlay .h-w { cursor: ew-resize; }
.overlay .draft { fill: rgba(0, 113, 227, .1); stroke: #0071e3; stroke-width: 1.5; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.overlay .room-mask { fill-opacity: .24; stroke-width: 1.2; stroke-opacity: .9; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill-opacity .12s; }
.overlay .room-mask:hover { fill-opacity: .34; }
.overlay .room-mask.sel { fill-opacity: .38; stroke-width: 2.5; cursor: move; }
.overlay .room-label text {
  fill: #1d1d1f; font-weight: 700; font-family: -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Meiryo UI", system-ui, sans-serif;
  paint-order: stroke; stroke: rgba(255, 255, 255, .92); stroke-linejoin: round; pointer-events: none;
}
.overlay .room-label .room-area { font-weight: 600; fill: #424245; font-variant-numeric: tabular-nums; }
.overlay .vertex { fill: #fff; stroke: #0071e3; stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: grab; }
.overlay .midpoint { fill: #0071e3; fill-opacity: .55; stroke: #fff; stroke-width: 1.2; vector-effect: non-scaling-stroke; cursor: copy; }

.scan { position: absolute; inset: 0; pointer-events: none; overflow: hidden; background: rgba(245, 245, 247, .35); }
.scan::after {
  content: ""; position: absolute; left: 0; right: 0; height: 2px; background: rgba(0, 113, 227, .85);
  box-shadow: 0 0 16px 5px rgba(0, 113, 227, .3); animation: scan 2.4s linear infinite;
}
@keyframes scan { from { top: 0; } to { top: 100%; } }

.tooltip {
  position: fixed; z-index: 10; max-width: 320px; pointer-events: none;
  background: var(--surface); color: var(--ink); border-radius: 10px;
  padding: 8px 10px; font-size: 12px; line-height: 1.55; box-shadow: var(--shadow-md);
}
.tooltip b { font-size: 12px; }

.next-banner {
  position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 5;
  display: flex; align-items: center; gap: 14px; padding: 6px 6px 6px 16px; max-width: calc(100% - 32px);
  background: var(--bar); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass);
  border-radius: 999px; box-shadow: var(--shadow-md); font-size: 12.5px; font-weight: 600; color: var(--ok);
}
.next-banner .next-btn { width: auto; margin: 0; border-radius: 999px; }

/* ---------- inspector (right pane) ---------- */
.side-pane { background: var(--surface); border-left: .5px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
.side-pane > .card, #resultPanel > .card { border-bottom: .5px solid var(--line); padding: 16px 16px 14px; }
.card h2 { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 10px; }
.card.error { background: var(--danger-soft); }
.card.error h2 { color: var(--danger); }
#resultPanel { display: flex; flex-direction: column; }
#resultPanel[hidden] { display: none !important; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.steps li { display: grid; grid-template-columns: 16px 1fr auto; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.steps li .ico { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line); }
.steps li.running { color: var(--ink); }
.steps li.running .ico { border-color: var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; }
.steps li.done { color: var(--ink); }
.steps li.done .ico {
  border: 0; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M4 7.2 6 9.2 10 5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.steps li.error .ico { border-color: var(--danger); background: var(--danger); }
.steps .detail { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
@keyframes spin { to { transform: rotate(360deg); } }

.note { font-size: 12px; padding: 8px 12px; border-radius: var(--r-sm); margin-bottom: 10px; background: var(--warn-soft); color: var(--warn); }
.project-line { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.pill { font-variant-numeric: tabular-nums; }
.pill.ok { color: var(--accent); }
.pill.warn { color: var(--warn); font-weight: 600; }
.summary-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.drawing-type { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.total { text-align: right; white-space: nowrap; color: var(--muted); }
.total-n { font-size: 28px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.reason { margin: 6px 0 10px; font-size: 12px; }
.reason summary { cursor: pointer; color: var(--accent); }
.reason p { margin: 6px 0 0; color: var(--ink-2); line-height: 1.65; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border: 0; border-radius: 999px;
  background: var(--fill-2); font-size: 12px; color: var(--ink-2); cursor: pointer; transition: background .15s;
}
.chip:hover { background: var(--fill); }
.chip .sw { width: 10px; height: 10px; border-radius: 50%; border: 2.5px solid; }
.chip b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.chip.off { opacity: .4; text-decoration: line-through; }
.meta { margin-top: 10px; font-size: 11px; color: var(--muted); }

.review-line { margin-top: 12px; }
.review-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.review-bar { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.review-bar span { display: block; height: 100%; background: var(--ok-fill); border-radius: 3px; transition: width .3s; }
.review-line p { margin: 8px 0 0; }
.next-btn { width: 100%; height: 34px; margin-top: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 600; border-radius: 10px; }
.next-btn:hover { background: var(--accent-hover); }
.next-btn.final { background: var(--ok-fill); }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 12px 16px; border-bottom: .5px solid var(--line); }
.actions .btn { height: 28px; padding: 0 8px; font-size: 12px; }

.side-tabs { display: flex; gap: 2px; margin: 10px 16px; padding: 2px; border-radius: var(--r-sm); background: var(--fill); }
.side-tabs button {
  flex: 1; border: 0; border-radius: 6px; background: transparent; height: 26px; padding: 0 8px;
  cursor: pointer; font-size: 12.5px; color: var(--ink-2);
}
.side-tabs button.active { background: var(--seg-on); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }

/* element lists: inset rounded rows; details open on the selected row */
.view-block { padding-bottom: 6px; }
.view-head {
  position: sticky; top: 0; z-index: 1; padding: 8px 16px 6px; cursor: pointer;
  background: var(--bar); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass);
}
.view-head h3 { margin: 0; font-size: 12px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.view-head h3 .muted { font-weight: 400; font-variant-numeric: tabular-nums; }
.view-head p { display: none; }
.op {
  display: grid; grid-template-columns: 40px 1fr; column-gap: 10px; row-gap: 3px; margin: 1px 8px; padding: 8px 10px;
  border-radius: 10px; cursor: pointer; transition: background .12s;
}
.op:hover { background: var(--fill-2); }
.op.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(0, 113, 227, .25); }
.op-id {
  grid-row: span 4; align-self: start; margin-top: 1px; font-weight: 700; font-size: 11px; color: #fff; padding: 2px 0;
  border-radius: 6px; text-align: center; font-family: var(--mono); letter-spacing: -.02em;
}
.op-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; min-width: 0; }
.op-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-sub { font-size: 11.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.op-ev { font-size: 12px; color: var(--ink-2); line-height: 1.65; }
.op:not(.sel) .op-ev, .op:not(.sel) .op-product, .op:not(.sel) .room-controls { display: none; }
.op.manual:not(.sel) .op-category { display: none; }
.op.manual:not(.sel):not(.checked) .op-category { display: block; }
.conf { font-size: 11px; font-weight: 500; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.conf::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.conf.high { color: var(--accent); }
.conf.medium { color: var(--warn); }
.conf.low { color: var(--danger); }
.conf.manual { color: var(--ink-2); }
.feat { font-size: 11px; padding: 0 7px; border-radius: 999px; background: var(--fill); color: var(--ink-2); }
.feat.warn { background: var(--warn-soft); color: var(--warn); }
.link-chip { font-size: 11px; padding: 0 8px; border-radius: 999px; border: 0; color: var(--accent); background: var(--accent-soft); cursor: pointer; }
.link-chip:hover { background: rgba(0, 113, 227, .16); }
.op-product, .op-category {
  grid-column: 2; margin-top: 4px; width: 100%; max-width: 300px; height: 28px; padding: 0 8px; font-size: 12.5px;
  border: .5px solid var(--line); background-color: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow-sm);
}
.op-category { box-shadow: 0 0 0 1.5px var(--accent); }
.op-product:focus, .op-category:focus { outline: none; box-shadow: var(--ring); }
.confirm-btn {
  flex: none; height: 24px; padding: 0 12px; border-radius: 999px; border: 0; background: var(--ok-soft);
  color: var(--ok); font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s;
}
.confirm-btn:hover { background: rgba(52, 199, 89, .22); }
.confirm-btn.on { background: var(--ok-fill); color: #fff; }
.op-del { flex: none; border: 0; background: var(--fill-2); color: var(--muted); font-size: 11px; height: 22px; padding: 0 10px; border-radius: 999px; cursor: pointer; }
.op-del:hover { background: var(--danger-soft); color: var(--danger); }
.op.checked { background: transparent; }
.op.checked .op-name { color: var(--ok); }
.op.checked.sel { background: var(--accent-soft); }
.op.leaving { animation: leave .22s ease-in forwards; overflow: hidden; max-height: 400px; }
@keyframes leave { to { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; margin-top: 0; margin-bottom: 0; } }
.done-group { margin: 4px 8px; }
.done-group > summary {
  list-style: none; cursor: pointer; padding: 6px 10px; font-size: 12px; font-weight: 600; color: var(--ok);
  border-radius: 8px; background: var(--ok-soft);
}
.done-group > summary::-webkit-details-marker { display: none; }
.done-group > summary::before { content: "▸ "; color: var(--ok); }
.done-group[open] > summary::before { content: "▾ "; }
.done-group[open] > .op { margin-left: 0; margin-right: 0; }
.all-done { margin: 4px 8px; padding: 6px 10px; font-size: 12px; color: var(--ok); border-radius: 8px; background: var(--ok-soft); }
.excluded { margin: 2px 8px; padding: 4px 10px 6px; font-size: 12px; color: var(--ink-2); }
.excluded summary { cursor: pointer; color: var(--muted); }
.excluded ul { margin: 4px 0 0; padding-left: 18px; line-height: 1.7; }
.manual-block .view-head h3 { color: var(--accent); }

/* rooms */
.room-name {
  flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--ink); background: transparent;
  border: 0; border-radius: 6px; padding: 0 6px; margin-left: -6px; height: 24px;
}
.room-name:hover { background: var(--fill-2); }
.room-name:focus { outline: none; background: var(--surface); box-shadow: var(--ring); }
.room-controls { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.room-controls .op-category { margin-top: 0; max-width: 170px; box-shadow: var(--shadow-sm); }
.area-input { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-2); }
.area-input input { width: 78px; height: 28px; padding: 0 8px; font-size: 12.5px; border: .5px solid var(--line); background: var(--surface); text-align: right; font-variant-numeric: tabular-nums; box-shadow: var(--shadow-sm); }
.area-input input:focus { outline: none; box-shadow: var(--ring); }
.calc-line { grid-column: 2; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.op:not(.sel) .calc-line { display: none; }
.method { margin: 0 16px 10px; border-radius: var(--radius); background: var(--surface-2); font-size: 12px; overflow: hidden; }
.method > summary { cursor: pointer; padding: 9px 12px; font-weight: 600; color: var(--ink-2); list-style: none; }
.method > summary::-webkit-details-marker { display: none; }
.method > summary::before { content: "▸ "; color: var(--muted); }
.method[open] > summary::before { content: "▾ "; }
.method .kv { width: calc(100% - 24px); margin: 0 12px 6px; border-collapse: collapse; }
.method .kv th { text-align: left; font-weight: 500; color: var(--muted); padding: 3px 10px 3px 0; white-space: nowrap; vertical-align: top; width: 1%; }
.method .kv td { padding: 3px 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.method .kv code { font-family: var(--mono); font-size: 11px; background: var(--fill); padding: 0 5px; border-radius: 4px; }
.method .kv-view th { color: var(--ink-2); font-weight: 700; padding-top: 8px; }
.method p { margin: 2px 12px 10px; color: var(--muted); font-size: 11px; line-height: 1.6; }

/* plan / elevation matching */
.link-group { padding-bottom: 6px; }
.link-group h3 {
  position: sticky; top: 0; margin: 0; padding: 8px 16px 6px; font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--bar); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); display: flex; justify-content: space-between;
}
.link-row { display: grid; grid-template-columns: 1fr 14px 1fr 34px; align-items: center; gap: 6px; margin: 1px 8px; padding: 6px 8px; border-radius: 8px; font-size: 12px; }
.link-row:hover { background: var(--fill-2); }
.link-end { display: flex; align-items: center; gap: 6px; min-width: 0; }
.link-end .op-id { grid-row: auto; cursor: pointer; min-width: 34px; }
.link-end .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.link-end.missing { color: var(--warn); }
.link-arrow { color: var(--muted); text-align: center; }
.link-state { font-size: 11px; font-weight: 600; text-align: right; }
.link-state.ok { color: var(--accent); }
.link-state.warn { color: var(--warn); }
.link-note { margin: 8px 16px; padding: 8px 12px; font-size: 12px; color: var(--ink-2); line-height: 1.6; border-radius: var(--r-sm); background: var(--surface-2); }

/* ---------- modals ---------- */
.modal {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .22); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .18s ease-out;
}
.modal-box {
  width: min(980px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface);
  border-radius: 18px; padding: 20px 24px 22px; box-shadow: var(--shadow-lg); animation: pop .22s cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 12px; border-bottom: .5px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.modal-head p { margin: 2px 0 0; }
.modal-head [data-close] { width: 28px; height: 28px; padding: 0; border-radius: 50%; background: var(--fill); color: var(--muted); font-size: 12px; }
.modal-head [data-close]:hover { background: var(--surface-3); color: var(--ink); }
.lib-section h3 { font-size: 12px; font-weight: 600; color: var(--muted); margin: 18px 0 8px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.lib-item { border-radius: var(--radius); padding: 10px; background: var(--surface-2); }
.lib-imgs { display: flex; gap: 6px; margin-bottom: 8px; }
.lib-item img { display: block; flex: 1; min-width: 0; width: 100%; height: 64px; object-fit: contain; background: #fff; border-radius: 8px; box-shadow: var(--shadow-sm); }
.lib-item .nm { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; }
.lib-item .sw { width: 10px; height: 10px; border-radius: 50%; border: 2.5px solid; flex: none; }
.lib-item code { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.lib-item details { margin-top: 4px; font-size: 11px; }
.lib-item summary { cursor: pointer; color: var(--accent); }
.lib-item p { margin: 4px 0 0; font-size: 11px; color: var(--ink-2); line-height: 1.5; }
.lib-item .noimg { height: 64px; display: grid; place-items: center; font-size: 11px; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; margin-bottom: 8px; }

/* ---------- estimate report ---------- */
.summary-view { flex: 1; overflow-y: auto; }
.summary-wrap { max-width: 1120px; margin: 0 auto; padding: 32px 20px 56px; display: flex; flex-direction: column; gap: 16px; }
.summary-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding-bottom: 8px; }
.summary-header h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.summary-header p { margin: 4px 0 0; font-family: var(--mono); font-size: 11px; }
.summary-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.summary-view .card { background: var(--surface); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.tile-label { font-size: 12px; color: var(--muted); }
.tile-value { font-size: 28px; font-weight: 700; line-height: 1.25; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.tile-sub { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tile.tile-total { background: var(--accent); }
.tile.tile-total .tile-label, .tile.tile-total .tile-sub { color: rgba(255, 255, 255, .8); }
.tile.tile-total .tile-value { color: #fff; }
.ai-card .ai-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ai-card .ai-head h2 { margin: 0; }
.ai-card .badge { color: var(--muted); }
.ai-card p { margin: 8px 0 0; line-height: 1.75; color: var(--ink-2); }
.ai-card .ai-headline { font-weight: 700; font-size: 15px; color: var(--ink); }
.ai-card ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.8; color: var(--ink-2); }
.ai-loading { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--fill); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.summary-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.summary-side { display: flex; flex-direction: column; gap: 16px; }
.est-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.est-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 8px; border-bottom: .5px solid var(--line); font-size: 11.5px; }
.est-table td { padding: 7px 8px; border-bottom: .5px solid var(--line-2); color: var(--ink); }
.est-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.est-table tr.sec td { background: var(--surface-2); font-weight: 600; color: var(--ink-2); }
.est-table tr.sub td { color: var(--muted); }
.est-table tr.tot td { font-weight: 600; }
.est-table tr.grand td { font-size: 14px; font-weight: 700; border-top: 1.5px solid var(--ink); border-bottom: 0; }
.est-table .sw { display: inline-block; width: 10px; height: 10px; border: 2.5px solid; border-radius: 50%; margin-right: 8px; vertical-align: -1px; }
.sum-notes { margin: 0; padding-left: 18px; line-height: 1.8; font-size: 12.5px; color: var(--ink-2); }
.error-text { color: var(--danger); }

/* ---------- narrow screens ---------- */
@media (max-width: 900px) {
  .work-view { grid-template-columns: 1fr; grid-template-rows: 55vh auto; }
  .side-pane { border-left: 0; border-top: .5px solid var(--line); overflow: visible; }
  .how { grid-template-columns: 1fr; }
  .hero h1 { font-size: 26px; }
  .brand-sub, #libraryBtn { display: none; }
  .badge { font-size: 0; gap: 0; }
  .actions { grid-template-columns: 1fr 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-grid { grid-template-columns: 1fr; }
}

/* ---------- tool rail (floating, left) ---------- */
.canvas-row { position: relative; flex: 1; min-height: 0; display: flex; }
.canvas-row > .viewport { flex: 1; min-width: 0; }
.tool-rail {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%); z-index: 6; display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 6px; user-select: none; border-radius: 14px; box-shadow: var(--shadow-md);
  background: var(--bar); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass);
}
.tool-rail button {
  position: relative; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 10px;
  background: transparent; cursor: pointer; padding: 0; color: var(--ink-2); transition: background .12s, color .12s;
}
.tool-rail button:hover { background: var(--fill); color: var(--ink); }
.tool-rail button.active { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(0, 113, 227, .35); }
.tool-rail button svg { width: 18px; height: 18px; }
.tool-rail .lbl { display: none; }
.tool-rail .rail-sep { display: block; flex: none; width: 22px; height: 1px; background: var(--line); margin: 2px 0; }
.tool-rail .swatch { width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface), 0 0 0 2.5px rgba(0, 0, 0, .18); }
/* tooltip flyout: name + shortcut */
.tool-rail button[data-tip-text]:hover::after {
  content: attr(data-tip-text); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  white-space: pre; background: var(--hud); color: #f5f5f7; font-size: 12px; padding: 5px 9px; border-radius: 7px;
  pointer-events: none; box-shadow: 0 4px 12px rgba(0, 0, 0, .2); z-index: 20; font-weight: 500;
  -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass);
}

/* colour picker */
.color-pop {
  position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-20%); z-index: 30;
  display: grid; grid-template-columns: repeat(3, 24px); gap: 8px; padding: 10px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.color-pop button { width: 24px; height: 24px; border-radius: 50%; border: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); cursor: pointer; transition: transform .1s; }
.color-pop button:hover { transform: scale(1.15); }
.color-pop .reset { background: var(--fill) !important; color: var(--muted); font-size: 13px; line-height: 1; }

/* per-tool cursors */
.viewport[data-tool="select"] { cursor: default; }
.viewport[data-tool="hand"], .viewport[data-tool="hand"] .overlay * { cursor: grab !important; }
.viewport[data-tool="hand"].dragging, .viewport[data-tool="hand"].dragging .overlay * { cursor: grabbing !important; }
.viewport[data-tool="rect"], .viewport[data-tool="rect"] .overlay *,
.viewport[data-tool="measure"], .viewport[data-tool="measure"] .overlay *,
.viewport[data-tool="example"], .viewport[data-tool="example"] .overlay * { cursor: crosshair !important; }
.viewport[data-tool="text"], .viewport[data-tool="text"] .overlay * { cursor: text !important; }
.viewport[data-tool="text"] .overlay .note, .viewport[data-tool="text"] .overlay .note * { cursor: pointer !important; }

/* notes */
.overlay .note { cursor: move; }
.overlay .note-pin { stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.overlay .note-num { fill: #fff; font-weight: 700; font-family: -apple-system, "Segoe UI", system-ui, sans-serif; pointer-events: none; }
.overlay .note-box { fill: #fff; fill-opacity: .96; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.overlay .note-text { fill: #1d1d1f; font-family: -apple-system, "Segoe UI", "Yu Gothic UI", "Meiryo UI", system-ui, sans-serif; pointer-events: none; }
.overlay .note.sel .note-pin { stroke: #0071e3; stroke-width: 3; }
.overlay .note.sel .note-box { stroke-width: 2.2; }
.note-editor {
  position: absolute; z-index: 25; width: 260px; padding: 10px; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.note-editor textarea {
  width: 100%; resize: vertical; font-size: 13px; padding: 8px 10px; border: 0; border-radius: var(--r-sm);
  background: var(--fill-2); color: var(--ink); line-height: 1.5;
}
.note-editor textarea:focus { outline: none; box-shadow: var(--ring); background: var(--surface); }
.note-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.note-meta { font-size: 11px; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }

/* measuring */
.overlay .measure-line { stroke: #ff9500; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-dasharray: 6 3; }
.overlay .measure-end { fill: #fff; stroke: #ff9500; stroke-width: 2; vector-effect: non-scaling-stroke; }
.overlay .measure-box { fill: #ff9500; }
.overlay .measure-text { fill: #fff; font-weight: 700; font-family: var(--mono); pointer-events: none; }

/* ---------- AI instruction bar (per sheet, top-right of the canvas) ---------- */
.ai-dock { position: absolute; top: 12px; right: 14px; z-index: 22; width: min(400px, calc(100% - 100px)); display: flex; flex-direction: column; gap: 8px; }
.ai-form {
  display: flex; align-items: center; gap: 4px; height: 40px; padding: 0 5px 0 8px; border-radius: 12px; box-shadow: var(--shadow-md);
  background: var(--bar); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); transition: box-shadow .15s;
}
.ai-form:focus-within { box-shadow: var(--ring), var(--shadow-md); }
.ai-badge {
  flex: none; font: 700 10px/1 var(--mono); letter-spacing: .02em; color: #fff; padding: 5px 6px; border-radius: 6px;
  background: linear-gradient(135deg, #0071e3 0%, #7d5cff 60%, #e34f9a 100%);
}
.ai-form input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; padding: 0 4px; }
.ai-form input::placeholder { color: var(--muted); }
.ai-icon, .ai-send { flex: none; position: relative; width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer; padding: 0; }
.ai-icon { background: transparent; color: var(--muted); }
.ai-icon:hover { background: var(--fill); color: var(--ink); }
.ai-icon svg, .ai-send svg { width: 16px; height: 16px; }
.ai-icon i { position: absolute; top: 0; right: -1px; min-width: 14px; height: 14px; padding: 0 4px; border-radius: 7px; background: var(--accent); color: #fff; font: 600 9px/14px var(--mono); font-style: normal; }
.ai-icon i:empty { display: none; }
.ai-send { background: var(--accent); color: #fff; transition: background .15s; }
.ai-send:hover { background: var(--accent-hover); }
.ai-send:disabled { background: var(--fill); color: var(--muted); cursor: default; }
.ai-dock.busy .ai-send { background: var(--fill); color: transparent; }
.ai-dock.busy .ai-send::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.ai-panel { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.ai-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; border-bottom: .5px solid var(--line); font-size: 11.5px; color: var(--muted); }
.ai-head span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-x { border: 0; background: var(--fill); color: var(--muted); font-size: 14px; line-height: 1; cursor: pointer; width: 22px; height: 22px; border-radius: 50%; }
.ai-x:hover { background: var(--surface-3); color: var(--ink); }
.ai-log { max-height: min(46vh, 420px); overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-empty { color: var(--muted); font-size: 12px; line-height: 1.8; }
.ai-empty code {
  display: inline-block; margin: 2px 0; font-family: inherit; background: var(--fill-2); border-radius: 999px; padding: 1px 10px;
  color: var(--ink-2); cursor: pointer; transition: background .12s, color .12s;
}
.ai-empty code:hover { background: var(--accent-soft); color: var(--accent); }
.msg { max-width: 92%; font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; padding: 6px 12px; border-radius: 16px 16px 4px 16px; }
.msg.ai { align-self: flex-start; color: var(--ink); background: var(--fill-2); padding: 6px 12px; border-radius: 16px 16px 16px 4px; }
.msg.sys { align-self: stretch; max-width: none; font-size: 11.5px; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 6px 10px; }
.msg.sys.ok { color: var(--ok); background: var(--ok-soft); }
.msg.sys.err { color: var(--danger); background: var(--danger-soft); }
.msg .meta { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
.msg .meta.warn { color: var(--warn); }
.msg.pending { color: var(--muted); }
.msg.pending::after { content: "…"; display: inline-block; animation: blink 1.2s steps(4) infinite; width: 1.2em; overflow: hidden; vertical-align: bottom; }
@keyframes blink { from { width: 0; } to { width: 1.2em; } }

/* one sheet being re-analysed: block that sheet only */
.sheet-busy {
  position: absolute; inset: 0; z-index: 21; display: grid; place-items: center;
  background: rgba(245, 245, 247, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.busy-card { display: flex; gap: 12px; align-items: flex-start; padding: 16px 20px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); max-width: 340px; }
.busy-card b { display: block; font-size: 13.5px; }
.busy-card span#busyDetail { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.busy-card small { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); }
.busy-spin { flex: none; width: 18px; height: 18px; margin-top: 1px; border: 2px solid var(--fill); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.sheet-tab .sub.busy { color: var(--accent); }

/* ---------- online: project title, save state, presence, sharing ---------- */
.proj-title { display: flex; align-items: center; gap: 8px; min-width: 0; padding-left: 10px; border-left: 1px solid var(--line); }
.proj-title b { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.save-state { font-size: 12px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.save-state::before {
  content: ""; width: 13px; height: 13px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 18a5 5 0 1 1 .9-9.9A6 6 0 0 1 19 10a4 4 0 0 1-1 7.9H7z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 18a5 5 0 1 1 .9-9.9A6 6 0 0 1 19 10a4 4 0 0 1-1 7.9H7z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.save-state.saving { color: var(--accent); }
.avatar { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; position: relative; letter-spacing: -.02em; }
.avatar.lg { width: 36px; height: 36px; font-size: 14px; }
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; }
.btn-share { display: inline-flex; align-items: center; gap: 5px; background: var(--accent) !important; color: #fff !important; border-radius: 999px !important; }
.btn-share:hover { background: var(--accent-hover) !important; }
.btn-share svg { width: 14px; height: 14px; }
.me-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--ink); cursor: pointer; padding: 2px 8px 2px 2px; border-radius: 999px; font-size: 12.5px; font-weight: 500; }
.me-btn:hover, .bell-btn:hover { background: var(--fill); }
.me-btn::after { content: ""; width: 0; height: 0; border: 4px solid transparent; border-top-color: var(--muted); margin-top: 4px; }

/* share dialog */
.share-box { width: min(560px, 100%); }
.share-sec { padding: 14px 0; border-bottom: .5px solid var(--line); }
.share-sec:last-child { border-bottom: 0; padding-bottom: 0; }
.share-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.share-link-row { display: flex; gap: 8px; }
.share-link-row input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: var(--fill-2); color: var(--ink); font-family: var(--mono); font-size: 12px; }
.share-link-row input:focus { outline: none; box-shadow: var(--ring); }
.share-access { margin: 8px 0 0; font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.share-access .lock { font-size: 11px; }
.req-grid { display: grid; grid-template-columns: 58px 1fr; gap: 8px 10px; align-items: center; }
.req-grid select, .req-grid textarea { font: inherit; font-size: 13px; padding: 6px 10px; border: 0; border-radius: var(--r-sm); background-color: var(--fill-2); color: var(--ink); }
.req-grid select { height: 32px; }
.req-grid select:focus, .req-grid textarea:focus { outline: none; box-shadow: var(--ring); }
.req-grid textarea { resize: vertical; }
.save-summary { margin: 0; font-size: 12px; color: var(--muted); }
.share-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.history { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow-y: auto; }
.history li { display: flex; gap: 10px; padding: 8px 0; font-size: 12.5px; align-items: flex-start; }
.history li + li { border-top: .5px solid var(--line-2); }
.history .when { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.history .msg-q { display: block; color: var(--ink-2); margin-top: 2px; }
.history .empty { color: var(--muted); }
.ev-tag { font-size: 10.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--fill); color: var(--ink-2); white-space: nowrap; }
.ev-tag.request { background: var(--warn-soft); color: var(--warn); }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 70; display: flex; align-items: center; gap: 8px;
  padding: 8px 16px 8px 8px; background: var(--hud); color: #f5f5f7; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .25); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); animation: toast-in .25s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes toast-in { from { transform: translate(-50%, 12px); opacity: 0; } }

/* ---------- login: sky, clouds, glass card (always light) ---------- */
.login-view {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; overflow: hidden; color: #111318;
  background: linear-gradient(180deg, #8cc8ec 0%, #a9d6f2 22%, #cbe6f7 48%, #e6f2fa 70%, #f6f9fc 100%);
}
.sky-clouds { position: absolute; inset: auto -6% -4% -6%; height: 58%; pointer-events: none; filter: blur(14px);
  background:
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) -2.3% 49.4% / 9.6% 23.0% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 4.6% 39.2% / 7.6% 18.2% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 4.1% 31.0% / 7.5% 17.9% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) -3.7% 36.8% / 10.5% 25.1% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 9.9% 36.5% / 10.4% 25.0% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 6.3% 54.1% / 8.8% 21.1% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 2.1% 54.5% / 11.6% 27.9% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 10.5% 40.8% / 7.4% 17.7% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) -2.9% 41.5% / 8.2% 19.6% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 17.6% 73.8% / 13.5% 32.5% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 21.4% 70.7% / 12.1% 29.1% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 15.2% 66.2% / 7.5% 18.0% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 22.6% 64.4% / 12.4% 29.9% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 23.1% 63.8% / 11.7% 28.0% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 28.0% 64.2% / 13.4% 32.1% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 24.5% 77.3% / 11.6% 27.8% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 19.8% 82.1% / 12.8% 30.8% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 22.4% 75.2% / 7.9% 19.1% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 47.7% 73.1% / 8.2% 19.7% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 54.3% 89.6% / 12.3% 29.6% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 43.5% 91.4% / 14.0% 33.6% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 49.9% 84.1% / 11.8% 28.2% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 58.7% 89.8% / 13.7% 32.9% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 37.5% 95.2% / 12.3% 29.6% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 59.8% 98.8% / 12.2% 29.2% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 45.3% 89.7% / 9.3% 22.3% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 47.1% 76.6% / 7.2% 17.2% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 65.2% 77.7% / 7.9% 19.0% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 69.0% 66.4% / 8.0% 19.3% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 65.6% 69.8% / 14.0% 33.5% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 81.7% 78.3% / 11.4% 27.3% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 69.6% 66.6% / 13.9% 33.4% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 81.7% 81.6% / 9.9% 23.7% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 67.5% 63.5% / 8.2% 19.7% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 73.7% 68.3% / 8.9% 21.3% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 64.1% 70.0% / 9.1% 21.8% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 97.2% 51.6% / 10.0% 23.9% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 96.3% 43.0% / 12.5% 30.1% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 88.0% 54.4% / 12.4% 29.8% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 102.7% 51.2% / 13.2% 31.8% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 94.2% 31.6% / 10.1% 24.3% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 88.1% 34.3% / 12.1% 29.0% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 89.9% 39.8% / 8.7% 20.8% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 87.0% 37.0% / 7.4% 17.8% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,0.9) 55%, rgba(255,255,255,0)) 93.5% 30.1% / 7.8% 18.7% no-repeat,
    linear-gradient(180deg, rgba(255, 255, 255, 0) 35%, rgba(255, 255, 255, .95) 88%);
}
.sky-clouds::before { content: ""; position: absolute; inset: 0; filter: blur(5px);
  background:
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 3.6% 46.5% / 10.2% 25.6% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) -0.1% 52.0% / 6.5% 16.3% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 6.9% 68.8% / 5.7% 14.3% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 1.8% 44.2% / 7.8% 19.5% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) -0.2% 49.7% / 5.6% 14.0% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) -2.7% 45.4% / 10.0% 24.9% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 2.4% 45.8% / 10.7% 26.8% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) -4.6% 58.6% / 8.3% 20.6% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 19.4% 55.3% / 10.9% 27.2% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 13.4% 41.0% / 6.6% 16.4% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 15.4% 54.9% / 9.6% 24.1% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 11.7% 57.5% / 7.0% 17.4% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 19.2% 57.9% / 10.9% 27.3% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 17.9% 43.2% / 9.9% 24.8% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 13.3% 37.7% / 8.1% 20.3% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 12.4% 43.8% / 5.2% 12.9% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 41.3% 85.1% / 9.2% 22.9% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 41.8% 97.6% / 10.6% 26.6% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 29.5% 78.1% / 7.2% 18.0% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 29.3% 87.8% / 6.2% 15.5% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 39.4% 84.8% / 10.4% 26.0% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 38.8% 74.9% / 8.9% 22.3% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 40.6% 92.7% / 9.0% 22.4% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 33.6% 74.5% / 9.5% 23.8% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 59.0% 97.0% / 9.7% 24.3% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 60.1% 86.8% / 10.8% 27.1% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 66.0% 82.5% / 10.7% 26.7% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 55.7% 101.5% / 5.8% 14.4% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 55.6% 99.7% / 9.8% 24.6% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 64.8% 86.1% / 10.9% 27.2% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 55.4% 80.3% / 8.3% 20.7% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 64.7% 90.3% / 10.8% 27.1% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 85.1% 63.5% / 10.6% 26.5% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 82.0% 50.5% / 10.0% 24.9% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 82.4% 58.3% / 6.8% 16.9% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 84.9% 45.8% / 6.6% 16.4% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 84.0% 54.2% / 10.5% 26.2% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 91.7% 55.5% / 8.5% 21.3% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 86.0% 54.8% / 10.5% 26.3% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 79.3% 56.6% / 8.1% 20.4% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 94.0% 70.2% / 6.1% 15.2% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 98.7% 65.6% / 6.0% 15.1% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 97.3% 61.5% / 8.3% 20.8% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 101.8% 52.3% / 8.3% 20.8% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 96.5% 56.2% / 8.4% 20.9% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 99.1% 61.5% / 9.6% 24.1% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 103.1% 61.1% / 9.6% 23.9% no-repeat,
    radial-gradient(closest-side, rgba(255,255,255,1) 55%, rgba(255,255,255,0)) 99.1% 60.3% / 8.7% 21.7% no-repeat;
}
.sky-clouds::after { /* soft blue shading under the cloud banks */
  content: ""; position: absolute; inset: 0; mix-blend-mode: multiply; opacity: .5;
  background: radial-gradient(60% 40% at 50% 70%, rgba(200, 222, 240, .6), transparent 70%);
}
.sky-arcs { position: absolute; inset: 0; pointer-events: none;
  -webkit-mask: linear-gradient(180deg, transparent 22%, #000 45%, #000 70%, transparent 92%); mask: linear-gradient(180deg, transparent 22%, #000 45%, #000 70%, transparent 92%); }
.sky-arcs i { position: absolute; left: 50%; top: 100%; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .7); transform: translate(-50%, -50%); }
.sky-arcs i:nth-child(1) { width: 1150px; height: 1150px; }
.sky-arcs i:nth-child(2) { width: 1500px; height: 1500px; border-color: rgba(255, 255, 255, .5); }
.sky-arcs i:nth-child(3) { width: 1850px; height: 1850px; border-color: rgba(255, 255, 255, .35); }
.login-logo { position: absolute; top: 28px; left: 36px; display: flex; align-items: center; gap: 10px; }
.login-mark { display: grid; place-items: center; width: 40px; height: 40px; }
.login-mark img { width: 40px; height: 40px; display: block; object-fit: contain; filter: drop-shadow(0 3px 8px rgba(10, 30, 60, .18)); }
.login-logo b { font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: #111318; }
.login-card {
  position: relative; width: min(440px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 40px 40px 36px; border-radius: 28px;
  background: linear-gradient(180deg, rgba(196, 238, 252, .9) 0%, rgba(232, 247, 253, .94) 28%, rgba(255, 255, 255, .97) 58%);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(30, 80, 130, .18), 0 2px 8px rgba(30, 80, 130, .06); animation: pop .35s cubic-bezier(.2, .9, .3, 1.1);
}
.login-card::before { /* fine dot texture fading out under the icon */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background-image: radial-gradient(rgba(0, 110, 150, .1) 1px, transparent 1.3px); background-size: 7px 7px;
  -webkit-mask: linear-gradient(180deg, #000, transparent 32%); mask: linear-gradient(180deg, #000, transparent 32%);
}
.login-card::after { /* luminous rim: white on top, a hint of lilac at the bottom */
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: linear-gradient(175deg, rgba(255, 255, 255, .95), rgba(200, 235, 255, .7) 55%, rgba(196, 180, 255, .75));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
.login-icon {
  position: relative; align-self: center; display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: 14px; border-radius: 18px;
  color: #1d1f24; background: linear-gradient(180deg, #ffffff, #f3f6f8); box-shadow: 0 8px 20px rgba(30, 80, 130, .14), 0 1px 2px rgba(0, 0, 0, .06), inset 0 1px 0 #fff;
}
.login-icon svg { width: 26px; height: 26px; }
.login-card h2 { position: relative; margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.02em; text-align: center; color: #111318; }
.login-lead { position: relative; margin: 0 0 14px; text-align: center; font-size: 14.5px; line-height: 1.65; color: #6b7280; }
.login-field {
  position: relative; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border-radius: 13px;
  background: #eef1f4; color: #7c838e; transition: background .15s, box-shadow .15s;
}
.login-field:focus-within { background: #fff; box-shadow: 0 0 0 1.5px #0071e3, 0 0 0 5px rgba(0, 113, 227, .15); color: #0071e3; }
.login-field > svg { flex: none; width: 19px; height: 19px; }
.login-field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 15px; color: #111318; }
.login-field input::placeholder { color: #8a909a; }
.login-eye { flex: none; display: grid; place-items: center; width: 30px; height: 30px; margin-right: -6px; border: 0; border-radius: 8px; background: transparent; color: #7c838e; cursor: pointer; }
.login-eye:hover { background: rgba(0, 0, 0, .05); color: #111318; }
.login-eye svg { width: 19px; height: 19px; }
.login-eye .eye-on, .login-eye.on .eye-off { display: none; }
.login-eye.on .eye-on { display: block; }
.login-row { display: flex; justify-content: flex-end; margin-top: -2px; }
.login-forgot { border: 0; background: transparent; padding: 2px 0; font-size: 13.5px; color: #1d1f24; cursor: pointer; }
.login-forgot:hover { text-decoration: underline; }
.login-msg { margin: 0; font-size: 12.5px; text-align: center; }
.login-msg.error { color: #d70015; }
.login-msg.info { color: #4b5563; }
.login-submit {
  height: 50px; margin-top: 6px; border: 0; border-radius: 13px; cursor: pointer; font-size: 16px; font-weight: 600; color: #fff;
  background: linear-gradient(180deg, #3b3d45 0%, #16171b 55%, #0d0e11 100%);
  box-shadow: 0 8px 18px rgba(10, 20, 40, .22), inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 -1px 0 rgba(0, 0, 0, .4);
  transition: filter .15s, transform .08s;
}
.login-submit:hover { filter: brightness(1.18); }
.login-submit:active { transform: scale(.99); }
@media (max-width: 520px) { .login-card { padding: 32px 22px 28px; } .login-logo { left: 20px; top: 20px; } }

/* ---------- bell + notifications, confirmation request ---------- */
.user-area { position: relative; display: flex; align-items: center; gap: 4px; }
.bell-btn { position: relative; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); cursor: pointer; padding: 0; }
.bell-btn svg { width: 19px; height: 19px; }
.bell-btn i {
  position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--badge); color: #fff;
  font: 700 10px/16px -apple-system, "Segoe UI", system-ui, sans-serif; font-style: normal; box-shadow: 0 0 0 2px var(--bar-solid);
}
.bell-btn i:empty { display: none; }
.bell-btn.ring svg { animation: ring .9s ease-in-out 2; transform-origin: 50% 10%; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(9deg); } 60% { transform: rotate(-6deg); } 75% { transform: rotate(3deg); } }
.notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 45; width: 370px; color: var(--ink); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden;
  background: var(--surface); animation: drop .2s cubic-bezier(.2, .9, .3, 1.1); transform-origin: top right;
}
@keyframes drop { from { transform: scale(.96) translateY(-4px); opacity: 0; } }
.np-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; font-size: 15px; }
.np-head b { font-weight: 700; letter-spacing: -.01em; }
.np-link { border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; padding: 3px 8px; border-radius: 999px; }
.np-link:hover { background: var(--accent-soft); }
.np-list { max-height: min(60vh, 460px); overflow-y: auto; padding: 0 8px 8px; }
.np-sec { padding: 8px 8px 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.np-item {
  display: flex; gap: 10px; width: 100%; text-align: left; padding: 10px 10px 10px 18px; border: 0; border-radius: 12px; background: transparent;
  color: var(--ink); font: inherit; cursor: pointer; position: relative; transition: background .12s;
}
.np-item:hover { background: var(--fill-2); }
.np-item.unread::before { content: ""; position: absolute; left: 6px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--accent); }
.np-item.read { opacity: .55; }
.np-body { flex: 1; min-width: 0; font-size: 12px; line-height: 1.5; }
.np-body .ttl { display: block; font-size: 13px; font-weight: 600; }
.np-body .where { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-body .msg-q { display: block; color: var(--ink-2); margin-top: 2px; }
.np-body .when { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.np-empty { padding: 30px 12px; text-align: center; color: var(--muted); font-size: 12.5px; }
.np-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px; border-top: .5px solid var(--line); font-size: 12.5px; }
.np-foot span { display: inline-flex; align-items: center; gap: 8px; }

.notify-btn { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; }
.notify-btn svg { width: 14px; height: 14px; }
.notify-btn + .zoom { margin-left: 8px; }
.notify-pop {
  position: absolute; top: 10px; right: 14px; z-index: 30; width: 340px; padding: 0 16px 16px; background: var(--surface);
  border-radius: 16px; box-shadow: var(--shadow-lg); animation: drop .2s cubic-bezier(.2, .9, .3, 1.1); transform-origin: top right;
}
.notify-pop .np-head { padding: 14px 0 12px; }
.notify-target { font-size: 12.5px; color: var(--ink); }

/* ---------- who is on which sheet (avatars on the sheet tabs) ---------- */
.sheet-tab { position: relative; flex-direction: row; align-items: center; gap: 10px; }
.sheet-tab .tab-text { display: flex; flex-direction: column; min-width: 0; }
.sheet-tab.peer::before { /* a line in the colour of whoever else is here, like a shared-doc cursor */
  content: ""; position: absolute; left: 10px; right: 10px; top: 0; height: 2.5px; border-radius: 0 0 3px 3px; background: var(--peer);
}
.tab-peers { display: flex; align-items: center; flex: none; }
.tab-peers .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); animation: peer-in .25s cubic-bezier(.2, .9, .3, 1.3); }
.tab-peers .avatar:first-child { margin-left: 0; }
.tab-peers .avatar::after { /* online dot */
  content: ""; position: absolute; right: -2px; bottom: -2px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok-fill); box-shadow: 0 0 0 2px var(--surface);
}
.tab-peers .avatar.editing::after { /* pencil = making changes right now */
  width: 12px; height: 12px; right: -4px; bottom: -4px; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 9l.4-1.8L7.6 3 9 4.4 4.8 8.6z' fill='white'/%3E%3C/svg%3E") center / 10px no-repeat;
}
.tab-peers .avatar.editing { animation: peer-in .25s cubic-bezier(.2, .9, .3, 1.3), editing 1.6s ease-in-out infinite; }
@keyframes peer-in { from { transform: scale(.4); opacity: 0; } }
@keyframes editing { 0%, 100% { box-shadow: 0 0 0 2px var(--surface), 0 0 0 2px var(--peer-ring, transparent); } 50% { box-shadow: 0 0 0 2px var(--surface), 0 0 0 5px var(--peer-ring, transparent); } }
.sheet-tab:not(.active) .tab-peers .avatar { box-shadow: 0 0 0 2px var(--bar-solid); }
.share-sheet { font-weight: 500; color: var(--ink); }

/* ---------- 拾い出し帳票 preview (PDF viewer) ---------- */
.report-view { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.report-bar {
  display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 16px; flex: none;
  background: var(--bar); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); border-bottom: .5px solid var(--line);
}
.report-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; margin-right: auto; }
.report-title b { font-size: 15px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.report-title span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-zoom { margin-left: 0; }
.report-page { min-width: 54px; text-align: center; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.report-state { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.report-state.warn { background: var(--warn-soft); color: var(--warn); }
.report-state.ok { background: var(--ok-soft); color: var(--ok); }
.report-state.done { background: var(--ok-fill); color: #fff; }
.report-complete { height: 32px; padding: 0 16px; border-radius: 999px; }
.report-complete:disabled { background: var(--fill); color: var(--muted); cursor: not-allowed; }
.report-pages { flex: 1; min-height: 0; overflow: auto; display: flex; justify-content: center; background: #fff; }
.report-empty { margin: auto; color: var(--muted); }

/* a report page in HTML: positioned in PDF points (1em = 1pt), so it matches the PDF */
.paper { position: relative; flex: none; background: #fff; color: #1b1d22; overflow: hidden; animation: page-in .18s ease-out;
  font-family: Meiryo, "Yu Gothic UI", "Hiragino Sans", sans-serif; }
@keyframes page-in { from { opacity: 0; transform: translateX(var(--from, 0)); } }
.paper > * { position: absolute; }
.pp-proj { font-size: 9.5em; color: #6b7280; }
.pp-title { font-size: 18em; font-weight: 700; line-height: 1.4; }
.pp-right { display: flex; flex-direction: column; align-items: flex-end; gap: .2em; }
.pp-no { font-size: 10em; }
.pp-time { font-size: 9em; color: #3a3f47; }
.pp-issuer { font-size: 11.5em; }
.pp-panel { border: .6em solid #c5cad3; border-width: 1px; display: flex; justify-content: center; background: #fff; }
.pp-panel svg { display: block; }
.pp-panel .mk { cursor: pointer; }
.pp-panel .mk circle { fill: rgba(255, 255, 255, .88); stroke: #e03131; stroke-width: 1.3; vector-effect: non-scaling-stroke; transition: fill .12s; }
.pp-panel .mk text { fill: #e03131; font-weight: 700; text-anchor: middle; font-family: Meiryo, sans-serif; pointer-events: none; }
.pp-panel .mk.hl circle { fill: #e03131; }
.pp-panel .mk.hl text { fill: #fff; }
.pp-table { border-collapse: collapse; table-layout: fixed; font-size: 8.5em; }
.pp-table th { background: #222326; color: #fff; font-weight: 700; padding: 0 .7em; white-space: nowrap; }
.pp-table td { height: var(--row); padding: 0 .7em; border-bottom: 1px solid #b9bec7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-table td.c { text-align: center; padding: 0; }
.pp-table td.r { text-align: right; }
.pp-table tr { transition: background .12s; }
.pp-table tr.todo { background: rgba(255, 149, 0, .09); }
.pp-table tr.hl, .pp-table tr.flash { background: rgba(0, 113, 227, .09); }
.pp-table tr.flash { animation: flash .9s ease-out; }
@keyframes flash { from { background: rgba(0, 113, 227, .3); } }
.pp-muted { color: #6b7280; }
.pp-num { display: inline-grid; place-items: center; width: 1.55em; height: 1.55em; border: 1px solid #1b1d22; border-radius: 50%; font-size: .85em; }
.pp-check { width: 1.9em; height: 1.9em; border-radius: 50%; border: 1.5px solid #f08c00; background: #fff; color: #fff; font: inherit; font-weight: 700; cursor: pointer; padding: 0; line-height: 1; }
.pp-check:hover { background: rgba(52, 199, 89, .15); border-color: #34c759; }
.pp-check.on { background: #34c759; border-color: #34c759; }
.pp-code { border: 0; background: transparent; color: #0071e3; font: inherit; cursor: pointer; padding: .2em .4em; border-radius: .4em; }
.pp-code:hover { background: rgba(0, 113, 227, .1); text-decoration: underline; }
.pp-select, .pp-input { width: 100%; height: 2.3em; font: inherit; color: #1b1d22; border: 1px solid transparent; border-radius: .45em;
  background-color: transparent; padding: 0 .5em; cursor: pointer; transition: background .12s, border-color .12s; }
.pp-select { padding-right: 1.8em !important; background-position: right .4em center; background-size: 1em; }
.pp-select.empty { color: #6b7280; }
.pp-select:hover, .pp-input:hover { background-color: #f3f5f8; border-color: #d6dae0; }
.pp-select:focus, .pp-input:focus { outline: none; background-color: #fff; border-color: #0071e3; box-shadow: 0 0 0 3px rgba(0, 113, 227, .18); cursor: text; }
.pp-input.num { text-align: right; }
.pp-input.manual { color: #0071e3; font-weight: 700; }
.pp-foot { display: flex; justify-content: space-between; font-size: 7.5em; color: #6b7280; }
.pp-stamp { font-size: 1.07em; }
.pp-stamp.done { color: #1e7a3c; font-weight: 700; }

/* pager in the report bar */
.pager { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: var(--r-sm); background: var(--fill); }
.pager-btn { width: 30px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font-size: 18px; line-height: 1; cursor: pointer; }
.pager-btn:hover:not(:disabled) { background: var(--seg-on); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.pager-btn:disabled { color: var(--muted); opacity: .4; cursor: default; }
.pager-select { height: 28px; max-width: 260px; border: 0; border-radius: 6px; background-color: var(--seg-on); color: var(--ink); font-size: 12.5px; font-weight: 600;
  padding: 0 10px; box-shadow: 0 1px 2px rgba(0, 0, 0, .1); cursor: pointer; }
.pp-section { font-size: 11em; font-weight: 700; }
.pp-target { min-width: 4.6em; height: 2em; border-radius: 1em; border: 1px solid #c5cad3; background: #fff; color: #6b7280; font: inherit; cursor: pointer; padding: 0 .8em; }
.pp-target.on { background: #1b1d22; border-color: #1b1d22; color: #fff; }
.pp-target:hover { border-color: #0071e3; }
.pp-table tr.off td { color: #9aa0a8; }
.pp-panel .outline { fill-opacity: 0; stroke-width: 1.6; vector-effect: non-scaling-stroke; transition: fill-opacity .12s; }
.pp-panel .outline.filled { fill-opacity: .16; }
.pp-panel .outline.hl { fill-opacity: .35; stroke-width: 3; }

/* ---------- element tools on the selected card ---------- */
.op-tools { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.op:not(.sel) .op-tools:not(.busy), .op:not(.sel) .op-form { display: none; }
.op-tool { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 11px; border: 0; border-radius: 999px;
  background: var(--fill); color: var(--ink-2); font-size: 12px; font-weight: 500; cursor: pointer; }
.op-tool:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.op-tool.danger:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }
.op-tool:disabled { cursor: default; color: var(--accent); background: var(--accent-soft); }
.op-tool .spinner { width: 11px; height: 11px; }
.op-form { grid-column: 2; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding: 10px; border-radius: 10px; background: var(--surface-2); }
.op-form textarea, .op-form input { width: 100%; font: inherit; font-size: 12.5px; padding: 6px 9px; border: .5px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); }
.op-form textarea:focus, .op-form input:focus { outline: none; box-shadow: var(--ring); }
.op-form .row { display: grid; grid-template-columns: 90px 1fr; gap: 8px; }
.op-form label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); }
.op-form-actions { display: flex; justify-content: flex-end; gap: 6px; }
.op-form-actions .btn { height: 26px; font-size: 12px; }
.op-name small { font-weight: 400; color: var(--muted); margin-left: 6px; }

/* ---------- administrator examples ---------- */
.ex-box { width: min(760px, 100%); }
.ex-body { display: grid; grid-template-columns: 260px 1fr; gap: 20px; padding-top: 16px; }
.ex-preview { display: grid; place-items: center; min-height: 200px; border-radius: var(--radius); background: var(--surface-2); padding: 12px; }
.ex-preview svg { max-width: 100%; max-height: 300px; background: #fff; border-radius: 6px; box-shadow: var(--shadow-sm); }
.ex-form { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ex-kinds { align-self: flex-start; }
.ex-help { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.6; }
.ex-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.ex-field input, .ex-field select, .ex-field textarea { font: inherit; font-size: 13px; padding: 7px 10px; border: 0; border-radius: var(--r-sm); background-color: var(--fill-2); color: var(--ink); }
.ex-field select { height: 34px; }
.ex-field input:focus, .ex-field select:focus, .ex-field textarea:focus { outline: none; box-shadow: var(--ring); }
.ex-badge { font-size: 10.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.ex-badge.counter { background: var(--danger-soft); color: var(--danger); }
.ex-badge.positive { background: var(--accent-soft); color: var(--accent); }
.ex-badge.new { background: var(--ok-soft); color: var(--ok); }
.ex-item .ex-del { margin-top: 8px; height: 24px; font-size: 11.5px; }
.ex-item .ex-del:hover { background: var(--danger-soft); color: var(--danger); }
@media (max-width: 700px) { .ex-body { grid-template-columns: 1fr; } }

/* ---------- home: project list ---------- */
.upload-view { max-width: 1120px; }
.projects { margin-top: 44px; }
.projects-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.projects-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.projects-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.proj-search { width: 220px; height: 30px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: var(--fill); color: var(--ink); font-size: 13px; }
.proj-search:focus { outline: none; box-shadow: var(--ring); background: var(--surface); }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.proj-card { display: flex; flex-direction: column; text-align: left; padding: 0; border: 0; border-radius: var(--r-lg); background: var(--surface);
  box-shadow: var(--shadow-sm); cursor: pointer; overflow: hidden; color: var(--ink); font: inherit; transition: box-shadow .15s, transform .15s; }
.proj-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.proj-thumb { height: 140px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; border-bottom: .5px solid var(--line-2); }
.proj-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.proj-thumb .ph { color: var(--muted); font-size: 12px; }
.proj-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.proj-top { display: flex; align-items: center; gap: 8px; }
.proj-top b { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-status { flex: none; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.proj-status.reviewing { background: var(--warn-soft); color: var(--warn); }
.proj-status.confirmed { background: var(--accent-soft); color: var(--accent); }
.proj-status.completed { background: var(--ok-soft); color: var(--ok); }
.proj-status.running { background: var(--fill); color: var(--ink-2); }
.proj-status.error { background: var(--danger-soft); color: var(--danger); }
.proj-progress { height: 5px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.proj-progress span { display: block; height: 100%; background: var(--ok-fill); border-radius: 3px; }
.proj-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.proj-meta .dot::before { content: "・"; }
.proj-empty { grid-column: 1 / -1; padding: 40px; text-align: center; color: var(--muted); border-radius: var(--r-lg); background: var(--surface); }

/* ---------- learning candidates ---------- */
.lib-btn { position: relative; }
.lib-btn i { font-style: normal; margin-left: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--badge); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px; }
.lib-btn i:empty { display: none; }
.cand-badge { font-size: 10.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.cand-badge.missed { background: var(--warn-soft); color: var(--warn); }
.cand-badge.false_positive { background: var(--danger-soft); color: var(--danger); }
.cand-badge.reclassified { background: var(--accent-soft); color: var(--accent); }
.cand-item .cand-text { margin: 4px 0 0; font-size: 12px; color: var(--ink-2); line-height: 1.5; }
.cand-actions { display: flex; gap: 6px; margin-top: 8px; }
.cand-actions .btn { height: 24px; font-size: 11.5px; padding: 0 10px; }
.ex-preview img { max-width: 100%; max-height: 300px; background: #fff; border-radius: 6px; box-shadow: var(--shadow-sm); }
.toast .toast-act { margin-left: 6px; height: 24px; padding: 0 10px; border: 0; border-radius: 999px; background: #0071e3; color: #fff; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.toast .toast-act:hover { background: #0077ed; }
