/* src/ui/style.css */
:root {
  --buncss-light: ;
  --buncss-dark: initial;
  color-scheme: dark;
  --bg: #07090e;
  --surface: #0d1118;
  --surface-2: #131926;
  --hover: #171e2c;
  --border: #1b2230;
  --border-2: #273044;
  --fg: #e2e7ef;
  --muted: #8892a4;
  --dim: #566075;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --on: #22c55e;
  --off: #4b5563;
  --alarm: #ef4444;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --tone-blue: #60a5fa;
  --tone-cyan: #22d3ee;
  --tone-green: #4ade80;
  --tone-amber: #fbbf24;
  --tone-orange: #fb923c;
  --tone-red: #f87171;
  --tone-pink: #f472b6;
  --tone-violet: #a78bfa;
  --tone-gray: #8892a4;
  --radius: 10px;
  --topbar-h: 52px;
  --sidebar-w: 212px;
  --sidebar-w-collapsed: 58px;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --buncss-light: initial;
    --buncss-dark: ;
    color-scheme: light;
    --bg: #f2f4f8;
    --surface: #fff;
    --surface-2: #f5f7fa;
    --hover: #eef2f7;
    --border: #e1e6ed;
    --border-2: #d0d8e3;
    --fg: #0f172a;
    --muted: #5d6a7e;
    --dim: #98a2b3;
    --accent: #2563eb;
    --accent-2: #2563eb;
    --off: #9ca3af;
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    --series-4: #eda100;
    --series-5: #e87ba4;
    --series-6: #008300;
    --series-7: #4a3aa7;
    --series-8: #e34948;
    --tone-blue: #1d4ed8;
    --tone-cyan: #0e7490;
    --tone-green: #15803d;
    --tone-amber: #b45309;
    --tone-orange: #c2410c;
    --tone-red: #b91c1c;
    --tone-pink: #be185d;
    --tone-violet: #6d28d9;
    --tone-gray: #5d6a7e;
  }
}

*, *:before, *:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  overflow: hidden;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  font: 14px / 1.45 system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  width: 1px;
  height: 1px;
}

.muted {
  color: var(--muted);
}

.strong {
  font-weight: 600;
}

.mono {
  font-family: var(--mono);
  font-size: .92em;
}

.num {
  font-variant-numeric: tabular-nums;
}

:where(a, button, select, label.btn, input[type="checkbox"]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: none;
  align-items:  center;
  gap: 1rem;
  padding-right: 1rem;
}

.brand {
  width: var(--sidebar-w);
  display: flex;
  border-right: 1px solid var(--border);
  color: var(--fg);
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  flex: none;
  align-items:  center;
  gap: .7rem;
  height: 100%;
  padding: 0 1rem 0 1.3rem;
  transition: width .18s;
  font-size: 1.1rem;
  font-weight: 700;
}

.brand i {
  color: var(--accent-2);
  font-size: 1.15rem;
}

.brand:hover {
  background: var(--hover);
  text-decoration: none;
}

.has-menu.menu-collapsed .brand {
  width: var(--sidebar-w-collapsed);
  justify-content: center;
  padding: 0;
}

.has-menu.menu-collapsed .brand span {
  display: none;
}

.crumbs {
  display: flex;
  white-space: nowrap;
  overflow: hidden;
  flex: 1;
  align-items:  center;
  gap: .55rem;
  min-width: 0;
}

.crumb {
  color: var(--muted);
  font-weight: 500;
}

.crumb:hover {
  color: var(--fg);
  text-decoration: none;
}

.crumb-slash {
  color: var(--dim);
}

.crumb-hsm, .crumb-current {
  color: var(--fg);
  letter-spacing: .01em;
  font-size: 1.05rem;
  font-weight: 700;
}

.crumb-status, .crumb-section {
  display: inline-flex;
  align-items:  center;
  gap: .45rem;
  min-width: 0;
}

.crumb-status {
  margin-left: .15rem;
}

.crumb-sep {
  display: inline-flex;
  color: var(--dim);
  font-size: .65rem;
}

.crumb-title {
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.topbar-link {
  display: inline-flex;
  border: 1px solid var(--border-2);
  color: var(--muted);
  border-radius: 6px;
  flex: none;
  align-items:  center;
  gap: .45rem;
  padding: .35rem .75rem;
  font-size: .85rem;
  font-weight: 500;
}

.topbar-link:hover {
  color: var(--fg);
  border-color: var(--accent);
  text-decoration: none;
}

.top-nav {
  display: inline-flex;
  flex: none;
  align-items:  center;
  gap: .15rem;
}

.top-nav-link {
  color: var(--muted);
  white-space: nowrap;
  border: 1px solid #0000;
  border-radius: 6px;
  padding: .35rem .55rem;
  font-size: .85rem;
  font-weight: 500;
}

.top-nav-link:hover {
  color: var(--fg);
  background: var(--hover);
  text-decoration: none;
}

.top-nav-link.active {
  color: var(--fg);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.topbar-actions {
  display: inline-flex;
  flex: none;
  align-items:  center;
  gap: .5rem;
}

.user-chip {
  display: inline-flex;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 7px;
  align-items:  center;
  gap: .45rem;
  max-width: min(28vw, 20rem);
  padding: .3rem .55rem;
  font-size: .8rem;
}

.user-chip > i {
  color: var(--accent-2);
  flex: none;
}

.user-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.user-chip .tag {
  flex: none;
  font-size: .6rem;
}

.signout-form {
  display: flex;
}

.signout-btn {
  color: var(--muted);
}

.startup-error {
  color: var(--fg);
  text-align: center;
  margin: auto;
  padding: 2rem;
}

.startup-error h1 {
  margin-bottom: .5rem;
  font-size: 1.2rem;
}

.startup-error p {
  color: var(--muted);
}

.shell-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.sidebar {
  width: var(--sidebar-w);
  display: flex;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
  flex-direction: column;
  flex: none;
  padding: .75rem .6rem;
  transition: width .18s;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item, .side-toggle {
  position: relative;
  display: flex;
  color: var(--muted);
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 8px;
  align-items:  center;
  gap: .75rem;
  width: 100%;
  min-height: 2.35rem;
  padding: .45rem .7rem;
  font-weight: 500;
}

.nav-item i, .side-toggle i {
  font-size: .95rem;
}

.nav-item:hover, .side-toggle:hover {
  background: var(--hover);
  color: var(--fg);
  text-decoration: none;
}

.nav-item.active {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--fg);
}

.nav-item.active i {
  color: var(--accent-2);
}

.nav-item.active:before {
  content: "";
  position: absolute;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  width: 3px;
  top: .45rem;
  bottom: .45rem;
  left: -.6rem;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  flex: 1;
  min-width: 0;
}

.nav-badges {
  display: inline-flex;
  gap: .3rem;
}

.nav-dot {
  display: none;
  position: absolute;
  background: var(--tone);
  box-shadow: 0 0 0 2px var(--surface);
  border-radius: 50%;
  width: 8px;
  height: 8px;
  top: .3rem;
  right: .4rem;
}

.side-toggle {
  margin-top: auto;
}

.menu-collapsed .sidebar {
  width: var(--sidebar-w-collapsed);
}

.menu-collapsed .nav-dot {
  display: block;
}

.menu-collapsed .nav-label, .menu-collapsed .nav-badges {
  display: none;
}

.menu-collapsed .nav-item, .menu-collapsed .side-toggle {
  justify-content: center;
  padding-inline-start: 0;
  padding-inline-end: 0;
}

.content {
  overflow: auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  padding: 1.25rem 1.5rem 1.5rem;
}

.panel {
  display: flex;
  flex-direction: column;
  flex: none;
  gap: 1rem;
}

.panel.fill {
  flex: auto;
  min-height: 0;
}

.panel-scroll {
  overflow: auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 1rem;
  min-height: 0;
}

.panel-scroll > * {
  flex: none;
}

@media (width <= 760px) {
  .topbar {
    gap: .45rem;
    padding-right: .45rem;
  }

  .brand {
    width: var(--sidebar-w-collapsed);
    justify-content: center;
    padding: 0;
  }

  .brand span {
    display: none;
  }

  .top-nav {
    gap: 0;
  }

  .top-nav-link {
    padding: .3rem .4rem;
    font-size: .76rem;
  }

  .topbar-actions {
    gap: .3rem;
  }

  .topbar-link {
    padding: .3rem .4rem;
  }

  .topbar-link span {
    display: none;
  }

  .user-chip {
    gap: .3rem;
    max-width: 32vw;
    padding: .25rem .35rem;
    font-size: .72rem;
  }

  .user-chip .tag {
    font-size: .55rem;
  }

  .signout-btn {
    width: 26px;
    height: 26px;
  }

  .sidebar {
    width: var(--sidebar-w-collapsed);
  }

  .sidebar .nav-label, .sidebar .nav-badges, .side-toggle {
    display: none;
  }

  .sidebar .nav-item {
    justify-content: center;
    padding-inline-start: 0;
    padding-inline-end: 0;
  }

  .nav-dot {
    display: block;
  }

  .content {
    padding: 1rem;
  }
}

.tag {
  --tone: var(--tone-gray);
  --fa-width: auto;
  display: inline-flex;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 30%, transparent);
  border-radius: 7px;
  align-items:  center;
  gap: .4em;
  padding: .34em .65em;
  font-size: .69rem;
  font-weight: 650;
  line-height: 1;
}

.tag + .tag {
  margin-left: .3rem;
}

.nav-badges .tag + .tag, .crumbs .tag + .tag {
  margin-left: 0;
}

.tag-dot {
  background: currentColor;
  border-radius: 50%;
  width: .6em;
  height: .6em;
}

.tag.pulse {
  animation: 1.8s ease-in-out infinite tag-pulse;
}

@keyframes tag-pulse {
  50% {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 60%, transparent), 0 0 0 3px color-mix(in srgb, var(--tone) 20%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tag.pulse {
    animation: none;
  }
}

.tone-blue {
  --tone: var(--tone-blue);
}

.tone-cyan {
  --tone: var(--tone-cyan);
}

.tone-green {
  --tone: var(--tone-green);
}

.tone-amber {
  --tone: var(--tone-amber);
}

.tone-orange {
  --tone: var(--tone-orange);
}

.tone-red {
  --tone: var(--tone-red);
}

.tone-pink {
  --tone: var(--tone-pink);
}

.tone-violet {
  --tone: var(--tone-violet);
}

.tone-gray {
  --tone: var(--tone-gray);
}

.status-cell {
  display: inline-flex;
  align-items:  center;
  gap: .6rem;
}

.dot {
  display: inline-block;
  border-radius: 50%;
  flex: none;
  width: 9px;
  height: 9px;
}

.dot.on {
  background: var(--on);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--on) 22%, transparent);
}

.dot.off {
  background: var(--off);
}

.bell-idle {
  color: var(--dim);
  --fa-width: auto;
  font-size: .8rem;
}

.table-card {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  flex-direction: column;
}

.table-card.fill {
  flex: auto;
  min-height: 15rem;
}

.table-scroll {
  overflow: auto;
}

.table-card.fill .table-scroll {
  flex: 1;
  min-height: 0;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: .93rem;
}

th, td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  padding: .6rem .9rem;
}

th {
  position: sticky;
  z-index: 1;
  background: var(--surface-2);
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  font-size: .7rem;
  font-weight: 600;
  top: 0;
}

th.col-status {
  width: 1%;
}

.select-cell {
  text-align: center;
  width: 1%;
  min-width: 2.25rem;
  padding-inline-start: .55rem;
  padding-inline-end: .55rem;
}

.select-cell input[type="checkbox"] {
  vertical-align: middle;
  accent-color: var(--accent);
  cursor: pointer;
  width: 1rem;
  height: 1rem;
}

.select-cell input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: var(--hover);
}

tbody tr.selected-row td {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

tbody tr.selected-row td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

td.empty {
  color: var(--muted);
  text-align: center;
  padding: 1.75rem .9rem;
}

td.cell-action {
  text-align: right;
  width: 1%;
  padding-block-start: .3rem;
  padding-block-end: .3rem;
}

td.packet-issue {
  white-space: normal;
  overflow-wrap: anywhere;
  min-width: 14rem;
  max-width: 32rem;
}

.packet-issue-detail {
  color: var(--tone-red);
  font-size: .84em;
  line-height: 1.4;
}

td a.strong {
  color: var(--accent-2);
}

.th-filter {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.search-input {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border-2);
  letter-spacing: normal;
  text-transform: none;
  border-radius: 5px;
  width: 100%;
  min-width: 9rem;
  padding: .3rem .5rem;
  font: 400 .8rem / 1.3 inherit;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.th-label {
  display: inline-flex;
  align-items:  center;
  gap: .4rem;
}

.col-help {
  display: inline-flex;
  color: var(--muted);
  opacity: .5;
  letter-spacing: normal;
  cursor: help;
  transition: opacity .15s, color .15s;
  font-size: .8rem;
}

.col-help:hover {
  opacity: 1;
  color: var(--accent-2);
}

.col-help:focus-visible {
  opacity: 1;
  color: var(--accent-2);
}

.col-help:focus-visible {
  outline: none;
}

.help-tip {
  position: fixed;
  z-index: 20;
  color: #fff;
  text-transform: none;
  letter-spacing: normal;
  white-space: normal;
  pointer-events: none;
  background: #000000e6;
  border-radius: 6px;
  max-width: 280px;
  padding: .45rem .7rem;
  font-size: .75rem;
  font-weight: 400;
  line-height: 1.45;
  box-shadow: 0 4px 14px #00000059;
}

.card-head {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex: none;
  justify-content: space-between;
  align-items:  center;
  gap: .75rem;
  min-height: 2.75rem;
  padding: .4rem .6rem .4rem 1rem;
}

.card-head h3 {
  display: flex;
  white-space: nowrap;
  align-items:  center;
  gap: .55rem;
  font-size: .9rem;
  font-weight: 600;
}

.card-head h3 i {
  color: var(--accent-2);
}

.table-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items:  center;
  gap: .5rem;
  min-width: 0;
}

.delete-status {
  color: var(--tone, var(--muted));
  text-align: right;
  white-space: normal;
  overflow-wrap: anywhere;
  flex: 8rem;
  max-width: 32rem;
  font-size: .72rem;
  line-height: 1.25;
}

.card-head h3 .muted {
  margin-left: .2rem;
  font-size: .82rem;
  font-weight: 400;
}

.pager {
  display: flex;
  border-top: 1px solid var(--border);
  color: var(--muted);
  flex-wrap: wrap;
  flex: none;
  align-items:  center;
  gap: .5rem 1.25rem;
  padding: .4rem .6rem .4rem 1rem;
  font-size: .8rem;
}

.pager-info, .pager-pos {
  font-variant-numeric: tabular-nums;
}

.pager-size {
  display: inline-flex;
  align-items:  center;
  gap: .45rem;
}

.pager-size select {
  background: var(--surface-2);
  color: var(--fg);
  border: 1px solid var(--border-2);
  font: inherit;
  cursor: pointer;
  border-radius: 5px;
  padding: .15rem .35rem;
}

.pager-nav {
  display: inline-flex;
  align-items:  center;
  gap: .25rem;
  margin-left: auto;
}

.pager-pos {
  text-align: center;
  min-width: 4.5em;
}

.btn {
  display: inline-flex;
  background: var(--surface-2);
  color: var(--fg);
  border: 1px solid var(--border-2);
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 8px;
  justify-content: center;
  align-items:  center;
  gap: .5rem;
  padding: .5rem .95rem;
  transition: background .15s, border-color .15s, color .15s;
  font-size: .85rem;
  font-weight: 500;
}

.btn:hover:not(:disabled) {
  background: var(--hover);
  border-color: var(--accent);
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.btn.small {
  padding: .3rem .7rem;
  font-size: .8rem;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 85%, white);
}

.btn.danger {
  color: var(--tone-red);
  border-color: color-mix(in srgb, var(--alarm) 45%, transparent);
  background: none;
}

.btn.danger:hover:not(:disabled), .btn.danger.solid {
  background: var(--alarm);
  border-color: var(--alarm);
  color: #fff;
}

.btn.danger.solid:hover:not(:disabled) {
  background: color-mix(in srgb, var(--alarm) 85%, black);
}

.icon-btn {
  display: inline-flex;
  color: var(--muted);
  border: 1px solid var(--border-2);
  cursor: pointer;
  background: none;
  border-radius: 7px;
  flex: none;
  justify-content: center;
  align-items:  center;
  width: 28px;
  height: 28px;
}

.icon-btn i {
  pointer-events: none;
}

a.icon-btn:hover {
  text-decoration: none;
}

.icon-btn:hover:not(:disabled) {
  color: var(--fg);
  background: var(--hover);
}

.icon-btn:disabled {
  opacity: .35;
  cursor: default;
}

.link-btn {
  color: var(--accent-2);
  font: inherit;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  font-weight: 500;
}

.link-btn:hover {
  text-decoration: underline;
}

.sessions-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 1rem;
  min-height: 0;
}

.sessions-col {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
}

.sessions-layout.has-panel > .sessions-col:first-child {
  flex: 3 1 0;
}

.packet-panel-col {
  flex: 2 1 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  flex: none;
  align-items: stretch;
  gap: 1rem;
}

.card {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-direction: column;
  padding: 1.1rem 1.25rem 1.25rem;
}

.card > h3 {
  display: flex;
  align-items:  center;
  gap: .55rem;
  font-size: .95rem;
  font-weight: 600;
}

.card > h3 i {
  color: var(--accent-2);
}

.card-desc {
  color: var(--muted);
  margin: .35rem 0 1rem;
  font-size: .85rem;
  line-height: 1.5;
}

.card-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 1rem;
}

.dropzone {
  display: flex;
  border: 2px dashed var(--border-2);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  flex-direction: column;
  flex: 1;
  justify-content: center;
  align-items:  center;
  gap: .4rem;
  padding: 1.5rem 1rem;
  transition: border-color .15s, background .15s, color .15s;
}

.dropzone i {
  color: var(--accent-2);
  font-size: 1.6rem;
}

.dropzone strong {
  color: var(--accent-2);
  font-weight: 600;
}

.dropzone:hover, .dragging .dropzone {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  color: var(--fg);
}

.dz-hint {
  color: var(--muted);
  font-size: .75rem;
}

#config-file:focus-visible ~ .dropzone {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#config-file:focus-visible ~ .file-chip {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.file-chip {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  align-items:  center;
  gap: .75rem;
  padding: .65rem .7rem .65rem .9rem;
}

.dragging .file-chip {
  border: 1px dashed var(--accent);
}

.file-chip > i {
  color: var(--accent-2);
  font-size: 1.2rem;
}

.file-chip .btn {
  background: var(--surface);
}

.file-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: .1rem;
  min-width: 0;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.file-size {
  color: var(--muted);
  font-size: .78rem;
}

.notice, .status-line {
  --fa-width: auto;
  display: flex;
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone) 28%, transparent);
  border-radius: 6px;
  align-items:  flex-start;
  gap: .6rem;
  padding: .6rem .8rem;
  font-size: .85rem;
  line-height: 1.45;
}

.notice i, .status-line i {
  margin-top: .15rem;
}

.notice {
  flex: none;
}

.status-line {
  margin-top: 1rem;
}

.action-list {
  display: flex;
  flex-direction: column;
}

.action-row {
  display: grid;
  grid-template-columns: 11rem 1fr;
  border-top: 1px solid var(--border);
  align-items:  center;
  gap: 1rem;
  padding: .75rem 0;
}

.action-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.action-row:last-child {
  padding-bottom: 0;
}

.action-row .btn {
  justify-content: flex-start;
  width: 100%;
}

.action-row p {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  flex: none;
  align-items:  center;
  gap: .75rem 1rem;
}

.segmented {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  gap: 2px;
  padding: 3px;
}

.segmented button {
  display: inline-flex;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 8px;
  align-items:  center;
  gap: .45rem;
  padding: .35rem .85rem;
  font-size: .82rem;
  font-weight: 500;
}

.segmented button:hover {
  color: var(--fg);
}

.segmented button.active {
  background: var(--accent);
  color: #fff;
}

.range-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
}

.toolbar .range-bar {
  margin-left: auto;
}

.range-btn {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border-2);
  font: inherit;
  cursor: pointer;
  border-radius: 7px;
  padding: .3rem .65rem;
  font-size: .8rem;
  font-weight: 500;
}

.range-btn:hover {
  color: var(--fg);
}

.range-btn.active, .range-btn.apply {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.custom-range {
  display: flex;
  color: var(--muted);
  flex-wrap: wrap;
  flex: none;
  align-items:  center;
  gap: .5rem;
  font-size: .8rem;
}

.custom-range label {
  display: inline-flex;
  align-items:  center;
  gap: .35rem;
}

.custom-range input[type="datetime-local"] {
  background: var(--surface-2);
  color: var(--fg);
  border: 1px solid var(--border-2);
  font: inherit;
  border-radius: 5px;
  padding: .2rem .4rem;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.chart-card canvas {
  max-height: 380px;
}

.chart-wrapper {
  position: relative;
  min-height: 180px;
}

.hover-tip {
  position: absolute;
  z-index: 10;
  color: #fff;
  white-space: nowrap;
  pointer-events: none;
  background: #000000d9;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: .75rem;
}

.chart-empty {
  position: absolute;
  display: flex;
  color: var(--muted);
  pointer-events: none;
  justify-content: center;
  align-items:  center;
  inset: 0;
}

.legend {
  display: flex;
  color: var(--muted);
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: .75rem;
  font-size: .8rem;
}

.legend:empty {
  margin-top: 0;
}

.lg-item {
  display: inline-flex;
  align-items:  center;
  gap: .35rem;
}

.lg-sw {
  display: inline-block;
  border-radius: 2px;
  width: 14px;
  height: 10px;
}

.lg-marker {
  display: inline-block;
  border: 2px solid var(--accent-2);
  background: var(--surface);
  border-radius: 50%;
  width: 9px;
  height: 9px;
}

#table-view {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.data-page {
  gap: .85rem;
}

.data-picker-card {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-direction: column;
  flex: none;
  gap: .65rem;
  min-width: 0;
  padding: .8rem;
}

.data-picker-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items:  end;
  gap: .6rem;
}

.data-picker-controls label {
  display: flex;
  color: var(--muted);
  flex-direction: column;
  gap: .25rem;
  min-width: 0;
  font-size: .76rem;
}

.data-picker-controls select {
  background: var(--surface-2);
  color: var(--fg);
  border: 1px solid var(--border-2);
  font: inherit;
  border-radius: 6px;
  width: 100%;
  min-width: 0;
  padding: .4rem .5rem;
  font-size: .82rem;
}

.data-picker-controls select:disabled {
  opacity: .6;
}

.data-picker-controls .btn {
  white-space: nowrap;
  align-self:  end;
}

.data-catalog-status:empty {
  display: none;
}

.data-catalog-status .notice {
  padding-block-start: .4rem;
  padding-block-end: .4rem;
  font-size: .78rem;
}

.data-series-list {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  min-width: 0;
}

.data-series-chip {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  align-items:  center;
  gap: .4rem;
  min-width: 0;
  max-width: 100%;
  padding: .3rem .4rem .3rem .55rem;
}

.data-series-chip.missing {
  border-style: dashed;
}

.data-series-key {
  display: inline-block;
  background: var(--series-color);
  border-radius: 2px;
  flex: none;
  width: 15px;
  height: 3px;
}

.data-series-label {
  overflow: hidden;
  color: var(--fg);
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  max-width: min(34vw, 28rem);
  font-size: .78rem;
}

.data-series-chip .tag {
  flex: none;
}

.data-series-remove {
  flex: none;
  width: 24px;
  height: 24px;
}

.data-no-series {
  font-size: .8rem;
}

.data-toolbar {
  gap: .5rem .75rem;
}

.data-toolbar .range-bar {
  margin-left: auto;
}

.data-custom-range {
  gap: .5rem;
}

.data-range-error {
  color: var(--tone-red);
  font-size: .78rem;
}

.data-results {
  gap: .85rem;
  min-width: 0;
}

.data-chart-card {
  position: relative;
  min-height: 14rem;
}

.data-overlay-view {
  min-width: 0;
}

.data-overlay-wrapper {
  height: min(48vh, 380px);
  min-height: 180px;
}

.data-overlay-wrapper canvas, .data-split-plot canvas {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
}

.data-hover-tip {
  position: absolute;
  z-index: 10;
  background: color-mix(in srgb, var(--surface) 96%, black);
  color: var(--fg);
  border: 1px solid var(--border-2);
  pointer-events: none;
  border-radius: 7px;
  min-width: 15rem;
  max-width: min(34rem, 100% - 16px);
  padding: .55rem .65rem;
  font-size: .75rem;
  box-shadow: 0 8px 24px #00000047;
}

.data-tip-time {
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  margin-bottom: .3rem;
  padding-bottom: .3rem;
}

.data-tip-row {
  display: grid;
  grid-template-columns: 15px minmax(3rem, 1fr) auto auto;
  align-items:  center;
  gap: .4rem;
  padding: .12rem 0;
}

.data-tip-label {
  overflow-wrap: anywhere;
  color: var(--muted);
  min-width: 0;
}

.data-tip-value {
  overflow-wrap: anywhere;
  font-family: var(--mono);
  text-align: right;
  max-width: 12rem;
  font-size: .78rem;
}

.data-tip-value.invalid {
  color: var(--tone-red);
}

.data-tip-row .tag {
  font-size: .58rem;
}

.data-legend-key {
  display: inline-block;
  border-top: 2px solid var(--series-color);
  width: 16px;
}

.data-end-marker {
  border-color: var(--muted);
}

.data-split-view {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  min-width: 0;
}

.data-split-chart {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 0;
  padding: .65rem .75rem .75rem;
}

.data-split-heading {
  display: flex;
  align-items:  center;
  gap: .45rem;
  min-width: 0;
  margin-bottom: .3rem;
}

.data-split-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  font-size: .82rem;
}

.data-split-heading .tag {
  flex: none;
}

.data-split-plot {
  position: relative;
  min-width: 0;
  height: 140px;
}

.data-legend {
  gap: .65rem .9rem;
}

.data-legend-item {
  min-width: 0;
}

.data-table-view {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  min-width: 0;
}

.data-table-hint {
  flex: none;
  font-size: .8rem;
  line-height: 1.45;
}

.data-table-view .table-card {
  min-width: 0;
}

.data-table-view .table-scroll {
  max-height: min(58vh, 46rem);
}

.data-table-view table {
  min-width: 36rem;
}

.data-time-heading {
  white-space: nowrap;
  min-width: 11rem;
}

.data-series-heading {
  white-space: nowrap;
  min-width: 14rem;
}

.data-series-heading .data-series-key {
  vertical-align: middle;
  margin-right: .4rem;
}

.data-value-td {
  white-space: nowrap;
  min-width: 11rem;
}

.data-value-cell {
  display: flex;
  flex-wrap: wrap;
  align-items:  center;
  gap: .3rem;
  min-height: 1.6rem;
}

.data-carried-value {
  color: var(--muted);
}

.data-value-cell .tag {
  font-size: .58rem;
}

.data-compare {
  white-space: nowrap;
  margin-left: .25rem;
}

@media (width <= 900px) {
  .data-picker-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .data-picker-controls .btn {
    justify-self: start;
  }
}

@media (width <= 760px) {
  .data-picker-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .data-toolbar {
    align-items:  flex-start;
  }

  .data-toolbar .range-bar {
    width: 100%;
    margin-left: 0;
  }

  .data-series-chip {
    width: 100%;
  }

  .data-series-label {
    flex: 1;
    max-width: none;
  }

  .data-overlay-wrapper {
    height: min(42vh, 320px);
  }

  .data-table-view .table-scroll {
    max-height: 54vh;
  }

  .data-tip-label {
    max-width: 40vw;
  }
}

.modal {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  width: min(92vw, 30rem);
  margin: auto;
  padding: 0;
  box-shadow: 0 24px 48px #00000073;
}

.modal::backdrop {
  backdrop-filter: blur(2px);
  background: #02040899;
}

.modal form {
  padding: 1.25rem 1.35rem 1.15rem;
}

.modal h3 {
  display: flex;
  align-items:  center;
  gap: .6rem;
  font-size: 1rem;
  font-weight: 650;
}

.modal h3 i {
  color: var(--tone-red);
}

.modal p {
  color: var(--muted);
  margin: .6rem 0 1.25rem;
  font-size: .88rem;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
}
