.bay {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
  width: min(var(--frame), calc(100% - 44px));
  max-width: 100%;
  margin-inline: auto;
  min-width: 0;
  min-height: calc(100vh - 72px);
}
.rail {
  position: sticky;
  top: 72px;
  min-width: 0;
  padding: 28px 18px 48px 28px;
}
.stage-panel { padding: 32px 48px 80px 12px; min-width: 0; }
.stage-panel > div:not([hidden]) { animation: auth-step 0.4s var(--ease); }
.bay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}
.bay-head h1,
.machine-detail h2 { min-width: 0; overflow-wrap: anywhere; }
.bay-lead { max-width: 36em; margin-top: 16px; color: var(--muted); }
#sub-portal-btn { margin-top: 22px; }
.stage-panel h1 { font-size: clamp(32px, 4vw, 44px); }
.bay-tabs { display: flex; flex-direction: column; gap: 4px; }
.bay-tab {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 10px 14px;
  text-align: left;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.bay-tab:hover { color: var(--ink); }
.bay-tab.is-on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(22, 50, 74, 0.06);
}
.bay-empty {
  margin: 36px 0 0;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.machine-list { display: grid; gap: 8px; margin-top: 36px; max-width: 560px; }
.machine-list:empty { margin-top: 0; }
.machine-list > .bay-empty,
#bill-list > .bay-empty { margin-top: 0; }
.server-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  padding: 14px 16px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.server-item strong { min-width: 0; overflow-wrap: anywhere; }
.server-item small { color: var(--muted); flex: 0 0 auto; }
.server-item.is-on {
  background: #fff;
  border-color: rgba(24, 117, 243, 0.35);
  box-shadow: 0 10px 28px rgba(22, 50, 74, 0.06);
}
.machine-detail { margin-top: 36px; }
.machine-detail:empty { margin-top: 0; }
.machine-detail h2 { font-size: clamp(28px, 3vw, 36px); }
.bay-meta { margin-top: 8px; color: var(--muted); }
.access-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  margin-top: 36px;
}
.access-grid article { padding-top: 22px; border-top: 1px solid var(--line); }
.spec-grid { margin-top: 36px; }
.spec-addons ul { margin: 6px 0 0; padding: 0; list-style: none; }
.spec-addons li { font-size: 16px; font-weight: 500; }
.spec-addons li + li { margin-top: 4px; }
.k {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.access-grid strong,
.access-grid .secret {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  font-weight: 500;
  word-break: break-all;
}
.act {
  border: 0;
  background: transparent;
  color: #0f62d6;
  padding: 0;
  margin: 8px 12px 0 0;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.act:hover { color: var(--ink); }
.bay-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.host-box { margin-top: 32px; max-width: 720px; }
.host-box .k { margin-bottom: 10px; }
#host-filter,
.bay-form input,
.bay-form textarea {
  width: 100%;
  border: 1px solid rgba(22, 50, 74, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  font: inherit;
  font-size: 16px;
}
#host-filter,
.bay-form input { min-height: 48px; padding: 0 16px; }
.bay-form textarea {
  min-height: 120px;
  padding: 12px 16px;
  resize: vertical;
}
#host-filter:focus,
.bay-form input:focus,
.bay-form textarea:focus {
  outline: none;
  border-color: rgba(24, 117, 243, 0.55);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(24, 117, 243, 0.12);
}
.host-list {
  max-height: 220px;
  overflow: auto;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.host-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.host-list li span { min-width: 0; overflow-wrap: anywhere; }
.bay-form {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: min(420px, 100%);
  margin-top: 36px;
}
.bay-form label {
  margin-top: 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.bay-form .btn { justify-self: start; margin-top: 8px; }
.bay-form .auth-link { justify-self: start; margin-top: 4px; }
.bay-code { display: flex; align-items: stretch; gap: 8px; min-width: 0; flex-wrap: wrap; }
.bay-code input { flex: 1; min-width: 0; }
.bay-code .btn { margin-top: 0; white-space: nowrap; }
#password-email .bay-meta { margin: 4px 0 8px; padding: 0; border: 0; color: var(--ink); }
.tkt {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 28px;
  margin-top: 36px;
  align-items: start;
}
.tkt-list,
.tkt-stage,
#ticket-view,
.tkt-msg { min-width: 0; }
.tkt-subject,
.tkt-detail-head h2,
.tkt-msg p {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.tkt-list-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}
.tkt-stage {
  min-height: 0;
  padding: 22px 22px 26px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
}
.tkt-stage.is-idle {
  display: grid;
  place-items: center;
  min-height: 420px;
  padding: 0;
  background: transparent;
}
.tkt-idle {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(100%, 280px);
  padding: 36px 28px 32px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(22, 50, 74, 0.06);
  text-align: center;
}
.tkt-idle strong {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.03em;
}
.tkt-idle span { color: var(--muted); font-size: 14px; }
.tkt-idle .btn { margin-top: 14px; }
.tkt-stage .bay-form { margin-top: 0; max-width: none; }
.tkt-stage .bay-form .bay-meta { margin: 0; }
.ticket-row {
  display: grid;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  padding: 14px 16px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.ticket-row:hover { background: #fff; }
.ticket-row.is-on {
  background: #fff;
  border-color: rgba(24, 117, 243, 0.35);
  box-shadow: 0 10px 28px rgba(22, 50, 74, 0.06);
}
.tkt-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tkt-subject { min-width: 0; font-size: 15px; }
.tkt-time { color: var(--muted); font-size: 12px; }
.tkt-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.4;
  background: rgba(22, 50, 74, 0.06);
  color: var(--muted);
}
.tkt-chip.is-open { background: rgba(24, 117, 243, 0.12); color: #0f62d6; }
.tkt-chip.is-on_hold { background: rgba(246, 234, 211, 0.95); color: #8a5a12; }
.tkt-chip.is-closed { background: rgba(22, 50, 74, 0.06); color: var(--muted); }
.tkt-detail-head h2 { font-size: clamp(26px, 3vw, 34px); }
.tkt-msgs { display: grid; gap: 10px; margin-top: 18px; }
.tkt-msg { padding: 14px 16px; border-radius: 16px; }
.tkt-msg.is-me { background: rgba(255, 255, 255, 0.82); }
.tkt-msg.is-staff { background: rgba(220, 238, 249, 0.75); }
.tkt-msg-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.tkt-msg-meta strong { color: var(--ink); font-weight: 500; min-width: 0; }
.tkt-msg-meta span { flex: 0 0 auto; }
.tkt-msg p + p { margin-top: 8px; white-space: pre-wrap; }
.tkt-closed {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(22, 50, 74, 0.05);
  color: var(--muted);
  text-align: center;
}
.tkt-stage .bay-empty { margin-top: 0; border: 0; padding-top: 0; }
#bill-list { margin-top: 36px; }
.bill-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}
.bill-main { min-width: 0; }
.bill-main strong { font-size: 17px; font-weight: 500; }
.bill-main p {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}
.bill-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: 0 0 auto;
}
.bill-row .money { font-size: 20px; letter-spacing: -0.03em; color: var(--price); }
.bill-side .act { margin: 0; }
#screen-bar { display: flex; align-items: center; gap: 12px; padding: 12px 18px; }
body.screen-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
body.screen-page #screen-bar { position: relative; flex: 0 0 auto; }
#screen-stage { height: calc(100vh - 64px); background: #101820; position: relative; }
body.screen-page #screen-stage { flex: 1 1 auto; height: auto; min-height: 0; }
#rfb-screen { position: absolute; inset: 0; }
.screen-mask { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(16, 24, 32, 0.72); z-index: 2; }
.screen-mask[hidden] { display: none; }
@media (max-width: 900px) {
  #screen-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  #screen-bar .btn { flex: 0 1 auto; white-space: nowrap; }
  .bay { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; min-width: 0; max-width: 100%; padding: 16px 16px 0; }
  .bay-tabs { flex-direction: row; min-width: 0; max-width: 100%; overflow-x: auto; }
  .bay-tab { width: auto; white-space: nowrap; }
  .stage-panel { min-width: 0; max-width: 100%; padding: 24px 18px 64px; }
  .machine-list,
  .machine-detail,
  .host-box,
  .bill-row { min-width: 0; max-width: 100%; }
  .access-grid { grid-template-columns: minmax(0, 1fr); }
  .bill-row { align-items: flex-start; flex-wrap: wrap; }
  .bill-main strong { overflow-wrap: anywhere; }
  .tkt { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .stage-panel > div:not([hidden]),
  .bay-tab,
  .server-item { animation: none; transition: none; }
}
