/* xPDM — one stylesheet for the browser and the SOLIDWORKS task pane. */

:root {
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Inter", sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, ui-monospace, monospace;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-hover: #f4f6fa;
  --border: #e3e6ec;
  --border-strong: #cfd4dd;
  --text: #161a23;
  --text-2: #4d5565;
  --text-3: #8189a0;

  --accent: #4f5dff;
  --accent-2: #7a3cff;
  --accent-soft: #eef0ff;
  --accent-text: #3c48e0;

  --part: #3b82f6;
  --asm: #f59e0b;
  --drw: #14b8a6;

  --ok: #16a34a;     --ok-soft: #e8f7ee;
  --warn: #d97706;   --warn-soft: #fef5e6;
  --bad: #dc2626;    --bad-soft: #fdeceb;
  --info: #2563eb;   --info-soft: #eaf1fe;
  --branch: #8b5cf6; --branch-soft: #f2edff;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18), 0 4px 8px -4px rgba(16, 24, 40, .08);
  --row-h: 38px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1015;
    --surface: #161920;
    --surface-2: #1c2029;
    --surface-hover: #1f2430;
    --border: #272c37;
    --border-strong: #353b48;
    --text: #e8eaf0;
    --text-2: #a9b0c0;
    --text-3: #6f7789;
    --accent: #7380ff;
    --accent-soft: #232845;
    --accent-text: #a3abff;
    --ok-soft: #12291c; --warn-soft: #2d2212; --bad-soft: #321718; --info-soft: #14223d; --branch-soft: #251d3d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.45 var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 14px; height: 14px; }
svg.i.lg { width: 20px; height: 20px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--text-3); }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.hidden { display: none !important; }

.boot { height: 100vh; display: grid; place-items: center; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--border); border-top-color: var(--accent); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ shell */

.shell { display: grid; grid-template-rows: 56px 1fr; grid-template-columns: 216px 1fr; height: 100vh; }
.topbar {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; letter-spacing: -.01em; width: 188px; }
.logo {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 2px 8px -2px rgba(79, 93, 255, .6);
}
.brand small { font-weight: 500; color: var(--text-3); font-size: 12px; }

.search {
  flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid transparent; border-radius: 9px; color: var(--text-3);
}
.search:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1; border: 0; outline: 0; background: none; color: var(--text); min-width: 0; }
.kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--border-strong); border-radius: 4px; color: var(--text-3); }

.branch-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 10px 0 12px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap;
}
.branch-btn:hover { border-color: var(--border-strong); }
.branch-btn .dot, .bdot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.branch-btn.side .dot, .bdot.side { background: var(--branch); }
.branch-btn.side { border-color: color-mix(in srgb, var(--branch) 45%, var(--border)); background: var(--branch-soft); }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #ffb86b, #ff6b9a); color: #fff; font-weight: 650; font-size: 13px;
  border: 0; cursor: pointer; overflow: hidden; padding: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }

.nav { padding: 12px 10px; border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500;
}
.nav a:hover { background: var(--surface-hover); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.nav .count { margin-left: auto; font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.nav .sep { height: 1px; background: var(--border); margin: 10px 4px; }
.nav .foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--text-3); }

.main { display: flex; min-width: 0; min-height: 0; overflow: hidden; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.page { padding: 24px 28px; overflow: auto; flex: 1; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; letter-spacing: -.02em; margin: 0; font-weight: 680; }
.page-head p { margin: 2px 0 0; color: var(--text-3); }

/* ------------------------------------------------------------ buttons, chips */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px;
  border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 560; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-hover); }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(79, 93, 255, .35); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface-hover); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 13px; border-radius: 7px; }
.btn.icon { width: 34px; padding: 0; }
.btn.icon.sm { width: 28px; }
.btn.busy { pointer-events: none; opacity: .7; }
.btn.busy svg.i { animation: spin .8s linear infinite; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--text-2);
}
.chip.InWork { background: var(--info-soft); color: var(--info); }
.chip.InReview { background: var(--warn-soft); color: var(--warn); }
.chip.Released { background: var(--ok-soft); color: var(--ok); }
.chip.Obsolete { background: var(--surface-2); color: var(--text-3); text-decoration: line-through; }
.chip.branch { background: var(--branch-soft); color: var(--branch); }
.chip.main { background: var(--ok-soft); color: var(--ok); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.kind { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; flex: none; }
.kind svg.i { width: 14px; height: 14px; }
.kind.Part { background: color-mix(in srgb, var(--part) 14%, transparent); color: var(--part); }
.kind.Assembly { background: color-mix(in srgb, var(--asm) 16%, transparent); color: var(--asm); }
.kind.Drawing { background: color-mix(in srgb, var(--drw) 16%, transparent); color: var(--drw); }
.kind.big { width: 44px; height: 44px; border-radius: 11px; }
.kind.big svg.i { width: 22px; height: 22px; }

/* ------------------------------------------------------------ vault table */

.toolbar { display: flex; align-items: center; gap: 8px; padding: 14px 20px 12px; flex-wrap: wrap; }
.toolbar h1 { font-size: 18px; margin: 0 8px 0 0; letter-spacing: -.015em; font-weight: 680; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 9px; gap: 2px; }
.seg button { border: 0; background: none; height: 28px; padding: 0 10px; border-radius: 7px; cursor: pointer; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; font-weight: 560; font-size: 13px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.stats { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }

.table-wrap { flex: 1; overflow: auto; margin: 0 20px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; }
.grid th {
  position: sticky; top: 0; z-index: 1; background: var(--surface); text-align: left; font-size: 12px; font-weight: 600;
  color: var(--text-3); padding: 0 12px; height: 36px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.grid td { padding: 0 12px; height: var(--row-h); border-bottom: 1px solid var(--border); white-space: nowrap; }
.grid tr:last-child td { border-bottom: 0; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover td { background: var(--surface-hover); }
.grid tbody tr.sel td { background: var(--accent-soft); }
.grid tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.grid .num { font-variant-numeric: tabular-nums; }
.name-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.name-cell .fn { font-weight: 560; overflow: hidden; text-overflow: ellipsis; }
.name-cell .desc { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.twisty { width: 20px; height: 20px; display: grid; place-items: center; border: 0; background: none; border-radius: 5px; color: var(--text-3); cursor: pointer; padding: 0; flex: none; }
.twisty:hover { background: var(--surface-2); color: var(--text); }
.twisty svg.i { width: 14px; height: 14px; transition: transform .12s; }
.twisty.open svg.i { transform: rotate(90deg); }
.twisty.none { visibility: hidden; }
.mark-changed { width: 7px; height: 7px; border-radius: 50%; background: var(--branch); flex: none; }

.lock { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); }
.lock.mine { color: var(--info); font-weight: 600; }
.lock.other { color: var(--bad); font-weight: 600; }
.lock.free svg.i { opacity: .45; }

.local { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 560; }
.local .d { width: 8px; height: 8px; border-radius: 50%; }
.local.current { color: var(--ok); } .local.current .d { background: var(--ok); }
.local.outdated { color: var(--warn); } .local.outdated .d { background: var(--warn); }
.local.modified { color: var(--info); } .local.modified .d { background: var(--info); }
.local.missing { color: var(--text-3); } .local.missing .d { background: transparent; border: 1.5px solid var(--text-3); }

.outputs-dot { display: inline-flex; gap: 3px; }
.outputs-dot span { font: 600 10px var(--mono); padding: 1px 4px; border-radius: 4px; background: var(--surface-2); color: var(--text-3); }
.outputs-dot.has span { background: var(--ok-soft); color: var(--ok); }

.empty { padding: 56px 24px; text-align: center; color: var(--text-3); }
.empty .kind, .empty .ill { margin: 0 auto 14px; }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 16px; }
.empty p { margin: 0 auto; max-width: 420px; }
.ill { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.ill svg.i { width: 26px; height: 26px; }

.thumb { width: 22px; height: 22px; border-radius: 6px; object-fit: cover; flex: none; background: var(--surface-2); border: 1px solid var(--border); }
svg.i.filled { fill: #f5b301; stroke: #f5b301; }
.star-mark { display: inline-flex; }
.star-btn.on { color: #f5b301; }
.toolbar h1 svg.i { vertical-align: -3px; }
/* With the detail panel open, keep the table readable: drop secondary columns. */
.main.with-detail .desc, .main.with-detail .col-material, .main.with-detail .col-number { display: none; }

/* ------------------------------------------------------------ detail panel */

.detail {
  width: 440px; flex: none; border-left: 1px solid var(--border); background: var(--surface);
  display: flex; flex-direction: column; overflow: hidden; animation: slidein .16s ease-out;
}
@keyframes slidein { from { transform: translateX(16px); opacity: 0; } }
.detail-head { padding: 18px 20px 0; }
.detail-title { display: flex; gap: 12px; align-items: flex-start; }
.detail-title h2 { margin: 0; font-size: 16.5px; letter-spacing: -.01em; word-break: break-all; font-weight: 650; }
.detail-title .sub { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.detail-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 0; }
.detail-body { flex: 1; overflow: auto; padding: 16px 20px 24px; }
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--border); padding: 0 20px; margin-top: 14px; }
.tabs button { border: 0; background: none; padding: 9px 0; margin-bottom: -1px; cursor: pointer; color: var(--text-3); font-weight: 580; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs button .n { font-size: 11px; color: var(--text-3); margin-left: 3px; }

.preview {
  height: 180px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 14px; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, var(--surface) 0%, var(--surface-2) 100%); display: grid; place-items: center;
}
.preview { position: relative; height: 200px; }
.preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview .kind.big { opacity: .8; }
.preview-cap { position: absolute; left: 10px; bottom: 8px; font-size: 11.5px; color: var(--text-3); background: color-mix(in srgb, var(--surface) 85%, transparent); padding: 2px 7px; border-radius: 6px; }
.preview-add { position: absolute; right: 8px; bottom: 8px; opacity: 0; transition: opacity .12s; }
.preview:hover .preview-add, .preview:not(:has(img)) .preview-add { opacity: 1; }
.thumbs { display: flex; gap: 6px; margin: -6px 0 14px; overflow-x: auto; }
.thumbs button { width: 52px; height: 52px; padding: 0; border-radius: 8px; border: 1.5px solid var(--border); background: var(--surface-2); cursor: pointer; overflow: hidden; flex: none; }
.thumbs button.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 9px; font-size: 13px; margin-bottom: 12px; }
.banner svg.i { margin-top: 1px; }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.info { background: var(--info-soft); color: var(--info); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.branch { background: var(--branch-soft); color: var(--branch); }
.banner b { font-weight: 650; }
.banner .grow { color: var(--text-2); }
.banner .grow b { color: inherit; }

.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.section { margin-bottom: 20px; }
.section h4 { margin: 0 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 650; display: flex; align-items: center; gap: 8px; }
.props { display: grid; grid-template-columns: 112px 1fr; gap: 7px 12px; font-size: 13.5px; }
.props dt { color: var(--text-3); }
.props dd { margin: 0; min-width: 0; overflow-wrap: anywhere; display: flex; align-items: center; gap: 6px; }
.props dd .btn { margin-left: auto; }

.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.file {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); cursor: pointer; text-align: left; min-width: 0;
}
.file:hover { border-color: var(--accent); background: var(--accent-soft); }
.file .ext { font: 700 10.5px var(--mono); padding: 4px 5px; border-radius: 5px; background: var(--surface-2); color: var(--text-2); flex: none; }
.file .ext.STEP { background: color-mix(in srgb, var(--part) 15%, transparent); color: var(--part); }
.file .ext.PDF { background: var(--bad-soft); color: var(--bad); }
.file .ext.DXF { background: color-mix(in srgb, var(--drw) 15%, transparent); color: var(--drw); }
.file .ext.PNG { background: var(--branch-soft); color: var(--branch); }
.file .meta { min-width: 0; font-size: 12px; }
.file .meta div:first-child { font-weight: 600; font-size: 12.5px; }
.file .meta div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.list { border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.list .li { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.list .li:last-child { border-bottom: 0; }
.list .li:hover { background: var(--surface-hover); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); border-radius: 2px; }
.tl { position: relative; padding: 0 0 16px; }
.tl::before { content: ""; position: absolute; left: -21px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--text-3); }
.tl.head::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tl.on-branch::before { border-color: var(--branch); }
.tl.rel::before { border-color: var(--ok); }
.tl-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tl-top b { font-weight: 650; }
.tl-meta { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.tl-comment { margin-top: 5px; color: var(--text-2); font-size: 13px; background: var(--surface-2); padding: 6px 9px; border-radius: 7px; }
.tl-actions { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }

.feed .ev { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.feed .ev:last-child { border-bottom: 0; }
.ev-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.ev-icon.checkin { background: var(--info-soft); color: var(--info); }
.ev-icon.lock { background: var(--bad-soft); color: var(--bad); }
.ev-icon.branch { background: var(--branch-soft); color: var(--branch); }
.ev-icon.state { background: var(--ok-soft); color: var(--ok); }
.ev-body { flex: 1; min-width: 0; }
.ev-body .t { font-size: 13.5px; }
.ev-body .t b { font-weight: 620; }
.ev-body .d { color: var(--text-3); font-size: 12.5px; margin-top: 1px; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ cards (branches, materials, users) */

.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.card.current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.card-top { display: flex; align-items: center; gap: 10px; }
.card-top h3 { margin: 0; font-size: 15px; font-weight: 650; word-break: break-all; }
.card .meta { color: var(--text-3); font-size: 12.5px; }
.card .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel .grid td, .panel .grid th { padding: 0 16px; }
.panel.pad { padding: 4px 18px; }

/* ------------------------------------------------------------ menus, modal, toasts */

.menu {
  position: fixed; z-index: 50; min-width: 240px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 11px; box-shadow: var(--shadow-lg); padding: 6px; animation: pop .12s ease-out;
}
@keyframes pop { from { transform: translateY(-4px) scale(.98); opacity: 0; } }
.menu .mi { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 7px; cursor: pointer; text-align: left; }
.menu .mi:hover { background: var(--surface-hover); }
.menu .mi.on { font-weight: 650; }
.menu .mi .r { margin-left: auto; color: var(--text-3); font-size: 12px; }
.menu .mh { padding: 8px 10px 4px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 650; }
.menu .sep { height: 1px; background: var(--border); margin: 5px 0; }
.menu .who { padding: 8px 10px 10px; display: flex; gap: 10px; align-items: center; }
.menu .who div { min-width: 0; }
.menu .who b { display: block; }
.menu .who span { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; display: block; }

.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(12, 14, 20, .42); display: grid; place-items: center; padding: 16px; animation: fade .12s; backdrop-filter: blur(2px); }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .14s ease-out; }
.modal.wide { max-width: 760px; }
.modal-head { padding: 18px 20px 0; display: flex; align-items: flex-start; gap: 12px; }
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 660; letter-spacing: -.01em; }
.modal-head p { margin: 3px 0 0; color: var(--text-3); font-size: 13px; }
.modal-body { padding: 16px 20px; overflow: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 13px; }
.field .hint { color: var(--text-3); font-size: 12.5px; }
.input, select.input, textarea.input {
  height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); outline: 0; width: 100%;
}
textarea.input { height: auto; min-height: 76px; padding: 8px 11px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.merge-list { display: flex; flex-direction: column; gap: 8px; }
.merge-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.merge-item.Conflict { border-color: color-mix(in srgb, var(--warn) 50%, var(--border)); background: color-mix(in srgb, var(--warn-soft) 50%, var(--surface)); }
.merge-item .choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.choice { border: 1.5px solid var(--border); border-radius: 9px; padding: 8px 10px; cursor: pointer; background: var(--surface); font-size: 12.5px; display: flex; gap: 8px; }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.choice input { margin: 2px 0 0; accent-color: var(--accent); }
.choice b { display: block; font-size: 13px; }

#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); animation: pop .16s ease-out; font-size: 13.5px; }
.toast.err { background: var(--bad); color: #fff; }
.toast.ok svg.i { color: #4ade80; }

/* ------------------------------------------------------------ login / device */

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 34px 32px 28px; text-align: center; }
.auth-card .logo { width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 16px; }
.auth-card .logo svg.i { width: 26px; height: 26px; }
.auth-card h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.auth-card p { color: var(--text-3); margin: 6px 0 24px; }
.google-btn { width: 100%; height: 44px; justify-content: center; font-size: 14.5px; gap: 12px; border-radius: 10px; }
.google-btn svg { width: 18px; height: 18px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.code { font: 700 26px var(--mono); letter-spacing: .12em; padding: 12px; border-radius: 10px; background: var(--surface-2); margin: 0 0 20px; }
.auth-foot { margin-top: 20px; color: var(--text-3); font-size: 12px; }

/* ------------------------------------------------------------ narrow: SOLIDWORKS task pane, phones */

@media (max-width: 1180px) { .col-material, .col-number { display: none; } }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  .nav { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--border); padding: 6px 10px; overflow-x: auto; }
  .nav a { padding: 6px 10px; white-space: nowrap; }
  .nav .sep, .nav .foot, .nav .count { display: none; }
  .brand { width: auto; }
  .brand .name { display: none; }
  .detail { position: fixed; inset: 0; width: auto; z-index: 40; border-left: 0; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar > * { min-width: 0; }
  .search { padding: 0 8px; }
  .search .kbd { display: none; }
  .branch-btn .lbl { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  .toolbar { padding: 10px 10px 8px; }
  .toolbar h1 { display: none; }
  .table-wrap { margin: 0 8px 8px; }
  .col-state, .col-outputs, .desc { display: none; }
  .grid td, .grid th { padding: 0 8px; }
  .page { padding: 16px 12px; }
  .stats { display: none; }
  .lock .who { display: none; }
}
/* In the task pane the nav is in the top bar, the rest is the same app. */
.embedded .nav a .lbl { display: inline; }
