:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-soft: #fbfcfe;
  --text: #111827;
  --muted: #667085;
  --line: #e5e7eb;
  --line-strong: #d6dbe3;
  --red: #d9161f;
  --red-strong: #c91019;
  --red-soft: #fff1f1;
  --teal: #0f9488;
  --teal-soft: #e9f7f5;
  --amber: #d98b00;
  --amber-soft: #fff7e6;
  --ink: #1f2937;
  --shadow: 0 14px 42px rgba(17, 24, 39, 0.08);
  --radius: 8px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, #ffffff 0, var(--bg) 220px),
    var(--bg);
  font-family: var(--font);
  min-width: 320px;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.app-shell {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px;
  background:
    linear-gradient(90deg, rgba(217, 22, 31, 0.1), rgba(217, 22, 31, 0) 38%),
    linear-gradient(135deg, rgba(15, 148, 136, 0.08), rgba(15, 148, 136, 0) 52%),
    repeating-linear-gradient(0deg, rgba(17, 24, 39, 0.035) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, rgba(17, 24, 39, 0.035) 0 1px, transparent 1px 44px),
    var(--bg);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  width: min(1120px, 100%);
  min-height: min(680px, calc(100vh - 80px));
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 22px 70px rgba(17, 24, 39, 0.12);
  overflow: hidden;
}

.auth-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 64px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(13, 20, 33, 0.95), rgba(31, 41, 55, 0.92)),
    #1f2937;
}

.auth-copy::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
  background: var(--red);
}

.auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 15px;
  font-weight: 750;
}

.auth-kicker span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 6px rgba(15, 148, 136, 0.18);
}

.auth-copy h1 {
  max-width: 560px;
  margin: 58px 0 18px;
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 900;
  line-height: 1.08;
}

.auth-copy p {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 18px;
  line-height: 1.9;
}

.auth-status-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 72px;
}

.auth-status-list span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 13px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
}

.auth-card {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 50px 42px;
  background: #fff;
  border-left: 1px solid var(--line);
}

.auth-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}

.auth-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  color: #fff;
  background: var(--red);
  border-radius: 8px;
}

.auth-mark svg {
  width: 27px;
  height: 27px;
}

.auth-card-head strong,
.auth-card-head span {
  display: block;
}

.auth-card-head strong {
  font-size: 24px;
  font-weight: 900;
  line-height: 1.2;
}

.auth-card-head span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.auth-card label,
.auth-card label span {
  display: block;
}

.auth-card label {
  margin-top: 16px;
}

.auth-card label span {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}

.auth-card input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  font-size: 15px;
}

.auth-card input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(217, 22, 31, 0.1);
}

.login-button {
  width: 100%;
  height: 48px;
  margin-top: 24px;
  color: #fff;
  background: linear-gradient(180deg, #e21a24 0%, var(--red-strong) 100%);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 850;
}

.login-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.auth-error {
  margin-top: 14px;
  padding: 10px 12px;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(217, 22, 31, 0.2);
  border-radius: 6px;
  font-size: 13px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  height: 56px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 20px rgba(17, 24, 39, 0.04);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 260px;
  height: 56px;
  padding-right: 16px;
  border-right: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  color: #fff;
  background: var(--red);
}

.brand-mark svg {
  width: 25px;
  height: 25px;
  stroke-width: 1.8;
}

.brand-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.topnav {
  display: flex;
  gap: 8px;
  padding: 0 14px;
}

.topnav a {
  padding: 8px 12px;
  color: var(--muted);
  font-size: 15px;
  border-radius: 6px;
}

.topnav a:hover {
  color: var(--red);
  background: var(--red-soft);
}

.topnav span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 800;
}

.top-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 14px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  white-space: nowrap;
}

.logout-button {
  height: 30px;
  padding: 0 10px;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(217, 22, 31, 0.22);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

.top-button {
  height: 30px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

.top-button:hover {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(217, 22, 31, 0.28);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 5px rgba(15, 148, 136, 0.1);
}

.divider {
  width: 1px;
  height: 24px;
  margin: 0 8px;
  background: var(--line);
}

.workspace {
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr);
  gap: 8px;
  max-width: none;
  height: calc(100vh - 56px);
  min-height: 0;
  margin: 0 auto;
  padding: 8px;
  overflow: hidden;
}

.side-panel,
.panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.side-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
}

.connection-list-panel {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.list-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 850;
  line-height: 1.2;
}

.list-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.entry-block h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
}

.entry-block p {
  margin: 6px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  color: #fff;
  background: linear-gradient(180deg, #e21a24 0%, var(--red-strong) 100%);
  border: 0;
  border-radius: 6px;
  box-shadow: 0 16px 30px rgba(217, 22, 31, 0.22);
  cursor: pointer;
  font-size: 17px;
  font-weight: 800;
}

.primary-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(217, 22, 31, 0.28);
}

.primary-action svg {
  width: 22px;
  height: 22px;
}

.new-connection-button {
  justify-self: start;
  width: auto;
  min-width: 112px;
  min-height: 34px;
  gap: 8px;
  padding: 0 12px;
  color: var(--red);
  background: #fff;
  border: 1px solid rgba(217, 22, 31, 0.35);
  box-shadow: none;
  font-size: 13px;
}

.new-connection-button svg {
  width: 16px;
  height: 16px;
}

.new-connection-button:hover {
  background: var(--red-soft);
  box-shadow: none;
}

.connection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.database-action-button {
  color: var(--teal);
  border-color: rgba(15, 148, 136, 0.35);
}

.database-action-button:hover {
  background: var(--teal-soft);
}

.side-menu {
  display: grid;
  gap: 10px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.menu-item {
  display: grid;
  grid-template-columns: 31px 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: 58px;
  padding: 0 4px;
  color: var(--ink);
  border-radius: 6px;
  font-size: 18px;
  font-weight: 750;
}

.menu-item svg {
  width: 29px;
  height: 29px;
  color: currentColor;
}

.menu-item.active,
.menu-item:hover {
  color: var(--red);
  background: linear-gradient(90deg, var(--red-soft), rgba(255, 255, 255, 0));
}

.chevron {
  color: #98a2b3;
  font-size: 30px;
  line-height: 1;
}

.health-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.health-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 50%;
}

.health-icon svg {
  width: 21px;
  height: 21px;
}

.health-card strong,
.health-card span {
  display: block;
}

.health-card strong {
  color: var(--teal);
  font-size: 14px;
}

.health-card span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

.health-card a {
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.connection-tree {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  overflow: hidden;
}

.tree-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tree-heading h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 850;
}

.tree-heading span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.tree-refresh {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

.tree-refresh:hover {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(217, 22, 31, 0.25);
}

.tree-refresh svg {
  width: 17px;
  height: 17px;
}

.tree-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.connection-list {
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.connection-list .tree-node {
  min-height: 52px;
  padding: 7px 8px;
}

.tree-section-title {
  margin-top: 4px;
  color: #8a93a3;
  font-size: 12px;
  font-weight: 850;
}

.tree-group {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}

.tree-group summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  cursor: pointer;
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
  list-style: none;
}

.tree-group summary::-webkit-details-marker {
  display: none;
}

.tree-group summary em {
  min-width: 24px;
  height: 22px;
  padding: 2px 7px;
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-style: normal;
  font-size: 12px;
  text-align: center;
}

.tree-group-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-delete {
  width: 22px;
  height: 22px;
  color: #98a2b3;
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.group-delete:hover {
  color: var(--red);
  background: var(--red-soft);
}

.tree-children {
  display: grid;
  gap: 3px;
  padding: 0 6px 6px;
}

.tree-node {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-height: 40px;
  padding: 3px 4px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 6px;
  text-align: left;
}

.tree-node:hover,
.tree-node.active {
  background: var(--red-soft);
  color: var(--red);
}

.tree-open {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 34px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
}

.tree-node strong,
.tree-node em {
  display: block;
}

.tree-node strong {
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.tree-node em {
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
}

.tree-edit {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #98a2b3;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.tree-edit:hover {
  color: var(--red);
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(217, 22, 31, 0.2);
}

.tree-edit svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.tree-empty {
  padding: 10px;
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.4;
}

.tree-empty.small {
  margin-top: 4px;
  padding: 10px;
}

.content-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.dashboard-view {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.panel {
  min-width: 0;
  padding: 16px;
}

.session-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: calc(100vh - 106px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.session-head {
  display: none;
}

.session-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 850;
  line-height: 1.2;
}

.session-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
}

.ghost-button:hover {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(217, 22, 31, 0.35);
}

.session-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 5px 8px;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
}

.session-toolbar .ghost-button,
.session-toolbar .ghost-action {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.session-tabs {
  display: flex;
  flex: 1 1 auto;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
}

.session-tab-wrap {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  height: 32px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.session-tab-wrap.active {
  color: var(--red);
  border-color: rgba(217, 22, 31, 0.35);
  background: var(--red-soft);
}

.session-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  max-width: 230px;
  padding: 0 9px;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.session-tab span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-tab .type-badge {
  width: 18px;
  height: 18px;
}

.session-tab .type-badge svg {
  width: 18px;
  height: 18px;
}

.tab-close {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 30px;
  color: inherit;
  background: transparent;
  border: 0;
  border-left: 1px solid rgba(17, 24, 39, 0.08);
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
}

.tab-close:hover {
  color: #fff;
  background: var(--red);
}

.session-frame-wrap {
  position: relative;
  min-height: 560px;
  height: 100%;
  background: #101827;
}

.session-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 560px;
  border: 0;
  outline: 0;
  background: #101827;
}

.database-session {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 560px;
  background: #f6f8fb;
  outline: 0;
}

.database-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 0;
  height: 100%;
  min-height: 0;
  background: #fff;
}

.db-schema-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
  overflow: hidden;
}

.db-panel-head,
.db-query-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.db-panel-head strong,
.db-query-head strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.db-panel-head span,
.db-query-head span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.db-panel-tools {
  display: grid;
  grid-template-columns: minmax(112px, 1fr) 30px;
  align-items: center;
  gap: 6px;
  min-width: 150px;
}

.db-select {
  width: 100%;
  height: 30px;
  min-width: 0;
  padding: 0 8px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  font-size: 12px;
  font-weight: 800;
}

.db-select:focus {
  border-color: rgba(217, 22, 31, 0.35);
  box-shadow: 0 0 0 3px rgba(217, 22, 31, 0.1);
}

.db-select-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.db-schema-list {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 0;
  padding: 8px;
  overflow: auto;
}

.db-schema-group {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.db-schema-group summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 30px;
  padding: 0 8px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  list-style: none;
}

.db-schema-group summary::-webkit-details-marker {
  display: none;
}

.db-schema-group summary em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.db-schema-group div {
  display: grid;
  gap: 2px;
  padding: 0 8px 8px;
}

.db-schema-group span,
.db-object span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-schema-group > div > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.db-object {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  min-height: 26px;
  padding: 0 6px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.7;
  text-align: left;
}

.db-object em {
  color: #98a2b3;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.db-object:hover,
.db-object.active {
  color: var(--red);
  background: var(--red-soft);
}

.db-query-panel {
  display: grid;
  grid-template-rows: auto auto 160px auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  background: #fff;
  overflow: hidden;
}

.db-query-helper {
  display: grid;
  gap: 7px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.db-query-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.db-ai-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.db-ai-input {
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  color: var(--text);
  background: #fafbfc;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  font-size: 13px;
}

.db-ai-input:focus {
  border-color: rgba(217, 22, 31, 0.35);
  box-shadow: 0 0 0 3px rgba(217, 22, 31, 0.1);
}

.db-ai-error {
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.db-ai-box .ghost-button {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
}

.db-query-editor {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.db-query-highlight,
.db-query-input {
  position: absolute;
  inset: 0;
  width: 100%;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 10px 12px;
  color: #111827;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.db-query-highlight {
  z-index: 1;
  overflow: hidden;
  color: #111827;
  background: #fff;
  border: 0;
  pointer-events: none;
}

.db-query-input {
  z-index: 2;
  resize: none;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: #111827;
  background: transparent;
  border: 0;
  outline: 0;
}

.db-query-input:focus {
  box-shadow: inset 0 0 0 2px rgba(217, 22, 31, 0.16);
}

.db-query-input::selection {
  background: rgba(217, 22, 31, 0.18);
}

.db-token.keyword {
  color: #c01822;
  font-weight: 900;
}

.db-token.function {
  color: #0b6f67;
  font-weight: 850;
}

.db-token.string {
  color: #8f5f00;
}

.db-token.identifier {
  color: #5b6171;
}

.db-token.number {
  color: #2563eb;
}

.db-token.comment {
  color: #8a93a3;
  font-style: italic;
}

.db-token.operator {
  color: #6b7280;
}

.db-suggestions {
  position: absolute;
  right: 10px;
  bottom: 8px;
  z-index: 8;
  display: grid;
  width: min(420px, calc(100% - 20px));
  max-height: 168px;
  overflow: auto;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
}

.db-suggestions[hidden] {
  display: none;
}

.db-suggestion {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  padding: 5px 8px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
}

.db-suggestion strong {
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-suggestion span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.db-suggestion:hover,
.db-suggestion.active {
  color: var(--red);
  background: var(--red-soft);
}

.db-query-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
}

.db-query-actions .primary-action {
  min-height: 32px;
}

.db-query-actions .ghost-button {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.db-query-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.db-query-actions span {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.db-import-button {
  position: relative;
  overflow: hidden;
}

.db-import-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.db-result-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
  padding: 10px;
  overflow: hidden;
}

.db-result-empty,
.db-result-error {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 180px;
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.db-result-error {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(217, 22, 31, 0.28);
}

.db-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.db-fields-panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}

.db-fields-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  padding: 0 9px;
  cursor: pointer;
  color: var(--ink);
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 900;
  list-style: none;
}

.db-fields-panel summary::-webkit-details-marker {
  display: none;
}

.db-fields-panel summary em {
  color: var(--muted);
  font-style: normal;
}

.db-fields-wrap {
  max-height: 138px;
  overflow: auto;
}

.db-fields-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.db-fields-table th,
.db-fields-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.db-fields-table th {
  position: sticky;
  top: 0;
  color: var(--ink);
  background: #fff;
  font-weight: 900;
}

.db-table-wrap {
  height: 100%;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.db-result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.db-result-table th,
.db-result-table td {
  max-width: 320px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.db-result-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--ink);
  background: #f6f8fb;
  font-weight: 900;
}

.db-result-table td {
  color: #344054;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.session-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.session-placeholder strong,
.session-placeholder span {
  display: block;
}

.session-placeholder strong {
  color: #fff;
  font-size: 20px;
}

.app-shell.session-active .workspace {
  grid-template-columns: 318px minmax(0, 1fr);
  gap: 8px;
  max-width: none;
  min-height: 0;
  height: calc(100vh - 56px);
  padding: 8px;
}

.app-shell.session-active .side-panel {
  position: static;
  max-height: none;
  overflow: hidden;
}

.app-shell.session-active .content-area {
  min-height: 0;
}

.app-shell.session-active .session-panel {
  min-height: 0;
  height: 100%;
}

.app-shell.session-active .session-toolbar {
  min-height: 36px;
  padding: 3px 6px;
}

.app-shell.session-active .session-tab-wrap {
  height: 28px;
}

.app-shell.session-active .session-tab {
  height: 26px;
  max-width: 190px;
  padding: 0 8px;
}

.app-shell.session-active .tab-close {
  height: 26px;
}

.app-shell.session-active .session-frame-wrap,
.app-shell.session-active .session-frame,
.app-shell.session-active .database-session {
  min-height: 0;
  height: 100%;
}

.app-shell.session-active.sidebar-collapsed .workspace {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell.session-active.sidebar-collapsed .side-panel {
  display: none;
}

.app-shell.session-active.focus-mode .topbar {
  display: none;
}

.app-shell.session-active.focus-mode .workspace {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  height: 100vh;
  padding: 0;
}

.app-shell.session-active.focus-mode .side-panel {
  display: none;
}

.app-shell.session-active.focus-mode .session-panel {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.app-shell.session-active.focus-mode .session-toolbar {
  min-height: 32px;
  padding: 2px 6px;
}

.app-shell.session-active.focus-mode .session-toolbar .ghost-button {
  height: 28px;
}

.app-shell.session-active.focus-mode .database-shell {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell.session-active.focus-mode .db-schema-panel,
.app-shell.session-active.focus-mode .db-query-helper {
  display: none;
}

.app-shell.session-active.focus-mode .db-query-panel {
  grid-template-rows: auto minmax(230px, 34vh) auto minmax(0, 1fr);
}

.app-shell.session-active.focus-mode .db-query-head {
  min-height: 38px;
  padding: 5px 8px;
}

.app-shell.session-active.focus-mode .db-query-actions {
  min-height: 38px;
  padding: 4px 8px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.3;
}

.panel-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 260px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: #98a2b3;
}

.search-box:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 148, 136, 0.1);
}

.search-box svg {
  width: 17px;
  height: 17px;
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 14px;
}

.list-search {
  width: 100%;
}

.custom-group-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.custom-group-bar input {
  min-width: 0;
  height: 32px;
  padding: 0 9px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  font-size: 13px;
}

.custom-group-bar input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(217, 22, 31, 0.1);
}

.custom-group-bar button {
  height: 32px;
  padding: 0 10px;
  color: var(--red);
  background: #fff;
  border: 1px solid rgba(217, 22, 31, 0.35);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.custom-group-bar button:hover {
  background: var(--red-soft);
}

.operation-panel {
  display: grid;
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.operation-empty {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 0;
  height: 100%;
  padding: 48px;
  text-align: center;
}

.operation-mark {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(217, 22, 31, 0.16);
  border-radius: 8px;
}

.operation-mark svg {
  width: 36px;
  height: 36px;
}

.operation-empty h1 {
  margin: 20px 0 0;
  font-size: 30px;
  font-weight: 900;
  line-height: 1.16;
}

.operation-empty p {
  max-width: 560px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.operation-actions,
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.compact-action {
  width: auto;
  min-height: 38px;
  padding: 0 16px;
  box-shadow: none;
  font-size: 14px;
}

.compact-action svg {
  width: 18px;
  height: 18px;
}

.group-select-field select {
  width: 100%;
  height: 28px;
  margin-top: 6px;
  padding: 0 8px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  font-size: 13px;
  font-weight: 800;
}

.group-select-field select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(217, 22, 31, 0.1);
}

.operation-detail {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 18px;
  height: 100%;
  min-height: 0;
  padding: 24px;
}

.detail-head {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-head .type-badge {
  width: 46px;
  height: 46px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.detail-head .type-badge svg {
  width: 28px;
  height: 28px;
}

.detail-title {
  min-width: 0;
}

.detail-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-title h2 {
  margin: 3px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.18;
  white-space: nowrap;
}

.detail-title p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 10px;
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid rgba(15, 148, 136, 0.2);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.detail-field {
  min-width: 0;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-field span,
.detail-field strong {
  display: block;
}

.detail-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-field strong {
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
  font-size: 16px;
  font-weight: 850;
  white-space: nowrap;
}

.detail-note {
  align-self: start;
  padding: 13px 14px;
  color: #495266;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
}

.detail-actions {
  align-self: end;
  margin-top: 0;
}

.protocol-tabs {
  display: flex;
  gap: 8px;
  margin: -2px 0 10px;
}

.tab {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.tab.active,
.tab:hover {
  color: var(--red);
  border-color: rgba(217, 22, 31, 0.35);
  background: var(--red-soft);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.quick-item {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 5px;
  min-height: 112px;
  padding: 13px 12px 10px;
  text-align: center;
  border-right: 1px solid var(--line);
}

.quick-item:last-child {
  border-right: 0;
}

.quick-item:hover {
  background: var(--panel-soft);
}

.quick-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 2px;
}

.quick-icon svg {
  width: 34px;
  height: 34px;
  stroke-width: 1.7;
}

.quick-item strong {
  font-size: 14px;
  line-height: 1.2;
}

.quick-item span:not(.quick-icon) {
  color: var(--muted);
  font-size: 12px;
}

.quick-item em {
  margin-top: 0;
  font-style: normal;
  font-size: 14px;
  font-weight: 800;
}

.quick-item.red,
.type-badge.red {
  color: var(--red);
}

.quick-item.teal,
.type-badge.teal {
  color: var(--teal);
}

.quick-item.amber,
.type-badge.amber {
  color: var(--amber);
}

.quick-item.ink,
.type-badge.ink {
  color: var(--ink);
}

.text-icon {
  border: 2px solid currentColor;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 900;
}

.ghost-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  color: var(--red);
  background: #fff;
  border: 1px solid rgba(217, 22, 31, 0.35);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.ghost-action:hover {
  background: var(--red-soft);
}

.table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.table-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-height: 0;
  overflow: hidden;
}

table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  white-space: nowrap;
}

th {
  color: #596273;
  background: #fafbfc;
  font-weight: 750;
}

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

tbody tr:hover {
  background: #fcfdff;
}

.host-cell,
.type-cell,
.state-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.type-badge {
  display: inline-grid;
  place-items: center;
  width: 21px;
  height: 21px;
}

.type-badge svg {
  width: 21px;
  height: 21px;
  stroke-width: 1.9;
}

.state-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--teal);
}

.state-dot.warn {
  background: var(--amber);
}

.connect-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 28px;
  color: var(--red);
  border: 1px solid rgba(217, 22, 31, 0.55);
  border-radius: 5px;
  font-size: 13px;
  font-weight: 750;
}

.connect-btn:hover {
  color: #fff;
  background: var(--red);
}

.empty-state {
  margin: 10px 0 0;
  padding: 12px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.empty-state a {
  color: var(--red);
  font-weight: 800;
}

.notice {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  padding: 10px 12px;
  color: #8a5700;
  background: var(--amber-soft);
  border: 1px solid #ffd58a;
  border-radius: 6px;
  font-size: 13px;
}

.notice svg {
  width: 18px;
  height: 18px;
  color: var(--amber);
}

.capability-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-height: 0;
  padding-bottom: 0;
}

.capability-strip article {
  min-height: 64px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.capability-strip strong,
.capability-strip span {
  display: block;
}

.capability-strip strong {
  font-size: 14px;
  font-weight: 800;
}

.capability-strip span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.remote-body {
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  background: #0d1320;
}

.remote-shell {
  display: grid;
  grid-template-rows: 38px minmax(0, 1fr);
  height: 100vh;
  color: var(--text);
  background: #0d1320;
}

.remote-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 4px 8px;
  background: #f8fafc;
  border-bottom: 1px solid #d9dee8;
}

.remote-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.remote-title strong {
  overflow: hidden;
  color: #111827;
  font-size: 13px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remote-title span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remote-actions,
.drawer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.remote-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  color: #1f2937;
  background: #fff;
  border: 1px solid #d7dce5;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.remote-tool:hover {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(217, 22, 31, 0.28);
}

.remote-tool.primary {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.remote-tool.danger {
  color: var(--red);
}

.remote-tool.active {
  color: #fff;
  background: #116d6e;
  border-color: #116d6e;
}

.remote-stage {
  position: relative;
  display: grid;
  min-height: 0;
  background: #0d1320;
}

.remote-display {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  outline: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    #0d1320;
}

.remote-display:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(217, 22, 31, 0.55);
}

.remote-display-mount {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.xterm-mount {
  display: block;
  padding: 10px 8px;
  background: #05070b;
}

.xterm-mount .xterm {
  width: 100%;
  height: 100%;
}

.guac-display {
  display: block;
  transform-origin: center center;
}

.remote-loading {
  position: absolute;
  inset: auto auto 18px 18px;
  padding: 8px 11px;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(17, 24, 39, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 750;
}

.remote-drawer,
.clipboard-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  width: min(360px, calc(100vw - 24px));
  max-height: calc(100vh - 64px);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid #d9dee8;
  border-radius: 7px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.22);
}

.clipboard-panel {
  grid-template-rows: auto minmax(160px, 1fr) auto;
}

.drawer-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.drawer-head strong,
.drawer-head span {
  display: block;
}

.drawer-head strong {
  font-size: 14px;
  font-weight: 850;
}

.drawer-head span {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 850;
  line-height: 1;
}

.icon-button:hover {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.drawer-path-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 9px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.drawer-path-form input {
  min-width: 0;
  height: 28px;
  padding: 0 9px;
  color: #475467;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  outline: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.drawer-path-form input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(217, 22, 31, 0.1);
}

.drawer-actions {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.file-list {
  min-height: 190px;
  overflow: auto;
}

.file-empty {
  padding: 18px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.file-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 7px 12px;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
}

.file-row:hover {
  background: var(--red-soft);
}

.file-row strong,
.file-row em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row strong {
  font-size: 13px;
  font-weight: 800;
}

.file-row em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.file-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 24px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 900;
}

.file-mark.directory {
  color: var(--teal);
  background: var(--teal-soft);
}

.file-mark.file {
  color: var(--ink);
  background: #eef2f7;
}

.transfer-log {
  min-height: 34px;
  padding: 9px 12px;
  color: var(--muted);
  background: #f8fafc;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.clipboard-panel textarea {
  width: 100%;
  min-height: 180px;
  padding: 12px;
  color: #111827;
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
  outline: 0;
  resize: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 24, 39, 0.42);
}

.connection-modal {
  display: grid;
  gap: 18px;
  width: min(720px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.24);
}

.settings-modal {
  width: min(640px, 100%);
}

.modal-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 22px 24px 0;
}

.modal-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
}

.modal-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0 24px;
}

.settings-section {
  display: grid;
  gap: 5px;
  margin: 0 24px;
  padding: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.settings-section strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.settings-section span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.full-field {
  grid-column: 1 / -1;
}

.form-grid label,
.form-grid label span {
  display: block;
}

.form-grid label span {
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.form-grid input,
.form-grid select {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  font-size: 14px;
}

.form-grid input:focus,
.form-grid select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(217, 22, 31, 0.1);
}

.check-line {
  display: flex !important;
  grid-column: span 1;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding-top: 22px;
}

.check-line input {
  width: 16px;
  height: 16px;
}

.check-line span {
  margin: 0 !important;
}

.form-error {
  margin: 0 24px;
  padding: 10px 12px;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(217, 22, 31, 0.2);
  border-radius: 6px;
  font-size: 13px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px 24px;
}

.login-button.compact {
  width: auto;
  min-width: 112px;
  height: 38px;
  margin: 0;
  padding: 0 16px;
  font-size: 14px;
}

@media (max-width: 1320px) {
  .topbar {
    grid-template-columns: auto 1fr;
  }

  .topnav {
    display: none;
  }

  .top-status {
    justify-self: end;
  }

  .workspace {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .app-shell.session-active .workspace {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .database-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .quick-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .quick-item {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 900px) {
  .auth-screen {
    align-items: start;
    padding: 14px;
  }

  .auth-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .auth-copy {
    padding: 36px 28px;
  }

  .auth-copy h1 {
    margin-top: 36px;
    font-size: 38px;
  }

  .auth-status-list {
    margin-top: 36px;
  }

  .auth-card {
    padding: 32px 28px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .topbar {
    position: static;
    grid-template-columns: 1fr;
    height: auto;
  }

  .brand {
    min-width: 0;
    width: 100%;
  }

  .brand-title {
    font-size: 22px;
  }

  .top-status {
    justify-self: stretch;
    padding: 14px 18px;
    border-top: 1px solid var(--line);
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .app-shell.session-active .workspace {
    grid-template-columns: 1fr;
  }

  .app-shell.session-active .side-panel {
    position: static;
    max-height: none;
  }

  .side-panel {
    padding: 20px;
  }

  .session-panel {
    min-height: 70vh;
  }

  .database-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(160px, 34%) minmax(0, 1fr);
  }

  .db-schema-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .session-head {
    display: grid;
  }

  .session-actions {
    flex-wrap: wrap;
  }

  .panel-heading {
    display: grid;
  }

  .search-box {
    width: 100%;
  }

  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-item {
    min-height: 148px;
  }

  .capability-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .auth-screen {
    padding: 10px;
  }

  .auth-copy {
    padding: 30px 22px;
  }

  .auth-copy h1 {
    font-size: 32px;
  }

  .auth-copy p {
    font-size: 15px;
  }

  .auth-card {
    padding: 26px 20px;
  }

  .auth-card-head {
    margin-bottom: 26px;
  }

  .brand-mark {
    width: 58px;
    height: 58px;
  }

  .brand {
    height: 58px;
    gap: 12px;
  }

  .top-status {
    flex-wrap: wrap;
    font-size: 13px;
  }

  .primary-action {
    min-height: 58px;
    font-size: 18px;
  }

  .quick-grid {
    grid-template-columns: 1fr;
  }

  .quick-item {
    border-right: 0;
  }

  .protocol-tabs {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .session-frame-wrap,
  .session-frame {
    min-height: 520px;
  }

  .notice {
    grid-template-columns: auto 1fr;
  }

  .notice a {
    grid-column: 2;
  }
}
