/* NexyCell cross-surface quality contract: brand, shell, typography and data controls. */
:root {
  --nc-shell-max: 1440px;
  --nc-font-sans: Inter, "Pretendard Variable", Pretendard, "Noto Sans KR", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --nc-font-display: Inter, "Pretendard Variable", Pretendard, "Noto Sans KR", -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html,
body,
button,
input,
select,
textarea {
  font-family: var(--nc-font-sans);
  font-variant-numeric: tabular-nums;
}

h1,
h2,
h3,
h4,
.nc-brand__word {
  font-family: var(--nc-font-display);
}

/* One clickable wordmark on public, Hosted, Private, Admin and Manual surfaces. */
.nc-brand {
  display: inline-flex !important;
  min-width: max-content;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  color: var(--txt, var(--text, #edf4ff)) !important;
  font-size: 18px !important;
  font-weight: 780 !important;
  letter-spacing: -.025em !important;
  line-height: 1 !important;
  text-decoration: none !important;
  white-space: nowrap;
}

.nc-brand__mark {
  width: 28px !important;
  height: 28px !important;
  flex: 0 0 28px;
  overflow: visible;
}

.nc-brand__shell {
  fill: color-mix(in srgb, var(--acc, var(--accent, #4ed7be)) 7%, transparent);
  stroke: var(--acc, var(--accent, #4ed7be));
}

.nc-brand__terminal { fill: var(--acc, var(--accent, #4ed7be)); }
.nc-brand__pulse {
  fill: none;
  stroke: var(--acc2, var(--accent2, #68a9ff));
}

.nc-brand__word { color: inherit; }
.nc-brand__word b { color: var(--acc, var(--accent, #4ed7be)); font-weight: 820; }
.nc-brand__context,
.nc-brand + [data-t="workspace"] {
  color: var(--txt3, var(--muted, #8191a8));
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .095em;
  line-height: 1.25;
  text-transform: uppercase;
}

.nc-brand:hover .nc-brand__shell,
.nc-brand:focus-visible .nc-brand__shell { stroke-width: 2.5; }

/* Dense utility actions live in one labeled, keyboard-dismissable control. */
.top-actions { position: relative; }
.top-actions-toggle { display: inline-flex; min-width: 44px; min-height: 36px; align-items: center; gap: 7px; }
.top-actions-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  width: 220px;
  gap: 4px;
  padding: 7px;
  border: 1px solid var(--line, #26364d);
  border-radius: 11px;
  background: var(--panel, #111b2a);
  box-shadow: 0 18px 44px color-mix(in srgb, var(--shadow-color, #000) 45%, transparent);
}
.top-actions-menu[hidden] { display: none !important; }
.top-actions-menu .pill.share-btn {
  display: flex;
  width: 100%;
  min-height: 44px;
  justify-content: flex-start;
  gap: 9px;
  border-color: transparent;
  border-radius: 7px;
  background: transparent;
  font-family: var(--nc-font-sans);
  font-size: 12px;
}
.top-actions-menu .pill.share-btn:hover,
.top-actions-menu .pill.share-btn:focus-visible { border-color: var(--line, #26364d); background: var(--panel2, #162235); }
.top-actions-menu .pill.share-btn span { display: inline-grid !important; }
.top-actions-menu .cmp-badge { margin-left: auto; }
html[dir="rtl"] .top-actions-menu { right: auto; left: 0; }

/* All product surfaces align to one horizontal rhythm. */
.wrap { max-width: var(--nc-shell-max) !important; }
.workspace-topbar { padding-inline: max(20px, calc((100% - var(--nc-shell-max)) / 2)) !important; }
.workspace-topbar ~ main { max-width: var(--nc-shell-max) !important; }
.admin-page { --admin-max: var(--nc-shell-max); }
.admin-top { padding-inline: max(20px, calc((100% - var(--nc-shell-max)) / 2)) !important; }
.private-page .topbar { padding-inline: max(20px, calc((100% - var(--nc-shell-max)) / 2)) !important; }
.private-page main { width: min(var(--nc-shell-max), calc(100% - 40px)) !important; }
.manual-page > header { padding-inline: max(20px, calc((100% - var(--nc-shell-max)) / 2)) !important; }
.manual-page .shell { max-width: var(--nc-shell-max) !important; }

/* Segmented choices read as a control, not as unrelated white boxes. */
.seg,
.tabs,
[data-ui-segmented] {
  gap: 3px !important;
  padding: 4px !important;
  border: 1px solid var(--line, #26364d);
  border-radius: 10px !important;
  background: var(--field-surface, var(--bg2, #101927)) !important;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--txt, #fff) 4%, transparent);
}

.seg > button,
.tabs > button,
[data-ui-segmented] > button {
  position: relative;
  min-height: 36px;
  border: 1px solid transparent !important;
  border-radius: 7px !important;
  background: transparent !important;
  color: var(--txt2, var(--muted, #b7c5d8)) !important;
  box-shadow: none !important;
}

.seg > button:is(.active, [aria-pressed="true"], [aria-checked="true"]),
.tabs > button[aria-selected="true"],
[data-ui-segmented] > button:is([aria-selected="true"], [aria-pressed="true"], [aria-checked="true"]) {
  border-color: color-mix(in srgb, var(--acc, #4ed7be) 34%, var(--line, #26364d)) !important;
  background: color-mix(in srgb, var(--acc, #4ed7be) 12%, var(--panel2, #162235)) !important;
  color: var(--acc, #4ed7be) !important;
  box-shadow: 0 1px 6px color-mix(in srgb, var(--shadow-color, #000) 34%, transparent) !important;
}

/* Technical tables: stable columns, sticky headings and a clear row target. */
.table-shell,
.cmp-wrap,
:where(.card, .panel) > table.tbl {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line, #26364d);
  border-radius: 10px;
  background: var(--panel, #111b2a);
  scrollbar-gutter: stable;
}

table.tbl,
.data-table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

table.tbl thead,
.data-table thead { position: sticky; top: 0; z-index: 2; }

table.tbl th,
.data-table th {
  background: var(--panel2, #162235);
  color: var(--txt2, #b7c5d8) !important;
  font-size: 10px !important;
  font-weight: 780 !important;
  letter-spacing: .055em;
  line-height: 1.35;
  text-transform: uppercase;
  white-space: nowrap;
}

table.tbl th,
table.tbl td,
.data-table th,
.data-table td {
  min-width: 84px;
  padding: 10px 12px !important;
  border-right: 1px solid color-mix(in srgb, var(--line, #26364d) 72%, transparent);
  border-bottom: 1px solid var(--line, #26364d) !important;
  vertical-align: middle;
}

table.tbl th:last-child,
table.tbl td:last-child,
.data-table th:last-child,
.data-table td:last-child { border-right: 0; }
table.tbl tbody tr:last-child td,
.data-table tbody tr:last-child td { border-bottom: 0 !important; }
table.tbl tbody tr:nth-child(even) td,
.data-table tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--panel2, #162235) 38%, transparent);
}
table.tbl tbody tr:hover td,
.data-table tbody tr:hover td {
  background: color-mix(in srgb, var(--acc, #4ed7be) 7%, var(--panel2, #162235)) !important;
}

/* Cell views use a technical inspection surface instead of decorative pseudo-3D. */
.cell-section-card,
.tech-network-card,
.ternary-card,
.crystal-card {
  background: var(--panel, #111b2a) !important;
}

.cell-viz-toggle { min-width: 260px !important; }
.cell-viz-toggle button { min-height: 42px; padding-inline: 14px !important; font-family: var(--nc-font-sans); }
.cell-viz-toggle button::before {
  display: inline-grid;
  width: 20px;
  height: 20px;
  margin-right: 7px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 5px;
  content: "◇";
  font-size: 10px;
  opacity: .78;
}
.cell-viz-toggle button[data-cell-viz="3d"]::before { content: "⬡"; }
#cell-xray {
  min-height: 390px !important;
  border: 1px solid var(--line, #26364d);
  border-radius: 12px !important;
  background: var(--bg2, #101927);
}
#cell-xray[data-viz-mode="3d"] { min-height: 460px !important; }
.technical-cell-svg { width: 100%; height: auto; max-height: 520px !important; }
.technical-cell-svg text { font-family: var(--nc-font-sans); }
.technical-cell-svg .cell-layer { cursor: pointer; }
.technical-cell-svg .cell-layer:focus-visible { outline: none; }
.technical-cell-svg .cell-layer:focus-visible > :first-child { stroke: var(--acc, #4ed7be) !important; stroke-width: 4 !important; }

@media (max-width: 760px) {
  .nc-brand__context,
  .nc-brand + [data-t="workspace"] { display: none; }
  .nc-brand { min-width: 44px; gap: 7px; font-size: 16px !important; }
  .nc-brand__mark { width: 25px !important; height: 25px !important; flex-basis: 25px; }
  .private-page main { width: min(100% - 24px, var(--nc-shell-max)) !important; }
  .cell-viz-toggle { min-width: 0 !important; }
  #cell-xray,
  #cell-xray[data-viz-mode="3d"] { min-height: 300px !important; }
  .top-actions { position: static; }
  .top-actions-toggle > span:last-child { display: none; }
  .top-actions-menu { position: fixed; top: 62px; right: 12px; left: 12px; width: auto; }
}
