:root {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  color: #202024;
  background: #fff;
  font-size: 16px;
  --muted: #71717a;
  --border: #e5e5e9;
  --accent: #202024;
  --action-width: 160px;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 36px; font-weight: 600; letter-spacing: -.7px; }
h2 { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -.4px; }
h3 { font-size: 14px; line-height: 20px; font-weight: 600; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: 14px; line-height: 20px; }
.hint { color: var(--muted); font-size: 12px; line-height: 18px; }
button, a, select { touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 2px solid #71717a; outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #71717a; outline-offset: -2px; }
svg { width: 18px; height: 18px; flex-shrink: 0; }
.skip-link { position: absolute; top: -80px; left: 16px; padding: 12px; z-index: 20; background: #fff; border: 1px solid var(--border); }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.app-header { height: 72px; display: flex; align-items: center; gap: 40px; padding-inline: max(40px, calc((100% - 1100px) / 2)); border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 24px; line-height: 32px; font-weight: 650; letter-spacing: -.8px; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 22px; line-height: 1; letter-spacing: 0; }
nav { height: 100%; display: flex; align-items: center; gap: 24px; font-size: 14px; color: var(--muted); }
nav a { display: flex; align-items: center; height: 100%; border-bottom: 2px solid transparent; }
nav a.active { color: #202024; border-color: #202024; }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 24px; white-space: nowrap; }
.header-tools:has(#logout:not([hidden])) { width: var(--action-width); justify-content: space-between; gap: 12px; }
main { max-width: 1180px; margin: 0 auto; padding: 40px 40px 64px; }
main:focus { outline: none; }
.page-heading { display: grid; grid-template-columns: minmax(0,1fr) var(--action-width); align-items: center; gap: 6px 16px; margin-bottom: 28px; }
.page-heading > div { display: contents; }
.page-heading h1 { grid-column: 1; grid-row: 1; }
.page-heading .muted { grid-column: 1 / -1; grid-row: 2; }
.page-heading > .button { grid-column: 2; grid-row: 1; width: var(--action-width); height: 40px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 14px; border: 1px solid #dcdce2; border-radius: 8px; background: #fff; color: #3f3f46; font-size: 14px; line-height: 20px; font-weight: 500; white-space: nowrap; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button > svg { order: -1; }
.button:hover:not(:disabled) { background: #f4f4f5; }
.button.primary:hover:not(:disabled) { background: #36363b; }
.button.destructive { background: #b42318; color: #fff; border-color: #b42318; }
.button.destructive:hover:not(:disabled) { background: #912018; }
.text-button.danger { color: #b42318; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 8px; border: 0; border-radius: 6px; background: transparent; color: #71717a; flex-shrink: 0; }
.icon-button:hover { background: #f4f4f5; color: #202024; }
.text-button { min-height: 32px; padding: 4px 0; border: 0; background: none; color: #52525b; font-size: 13px; line-height: 20px; }
.text-button:hover { color: #18181b; text-decoration: underline; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.toolbar > select { width: var(--action-width); flex: 0 0 var(--action-width); }
.search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid #dcdce2; border-radius: 8px; color: var(--muted); min-width: 0; }
.search span { display: flex; }
.search:focus-within { outline: 2px solid #71717a; outline-offset: -2px; }
.search input { width: 210px; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: transparent; color: #27272a; font-size: 14px; }
select, .select-trigger { height: 40px; min-width: 0; padding: 0 32px 0 12px; border: 1px solid #dcdce2; border-radius: 8px; background-color: #fff; color: #3f3f46; font-size: 14px; line-height: 20px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m3 4 3 3 3-3' fill='none' stroke='%2371717a'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.select-control { min-width: 0; }
.select-trigger { display: flex; align-items: center; width: 100%; text-align: left; }
.select-trigger > span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.select-trigger:hover:not(:disabled) { border-color: #a1a1aa; }
.select-trigger:focus-visible { outline-offset: -2px; }
.toolbar > .select-control { width: var(--action-width); flex: 0 0 var(--action-width); }
.select-menu { position: fixed; inset: auto; margin: 0; padding: 4px; max-width: calc(100vw - 16px); overflow-y: auto; overscroll-behavior: contain; border: 1px solid #dcdce2; border-radius: 10px; background: #fff; color: #3f3f46; box-shadow: 0 8px 28px #17172424; font-size: 14px; line-height: 20px; }
.select-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.select-option > span { min-width: 0; overflow-wrap: anywhere; }
.select-option.active { background: #f4f4f5; color: #202024; }
.select-option[aria-disabled="true"] { opacity: .45; cursor: default; }
.select-option:not([aria-selected="true"]) > svg { visibility: hidden; }
.table-wrap { position: relative; max-width: 100%; min-width: 0; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; white-space: nowrap; }
th { padding: 13px 20px; text-align: left; font-size: 13px; line-height: 20px; font-weight: 500; color: var(--muted); background: #fafafa; border-bottom: 1px solid var(--border); }
td { padding: 16px 20px; line-height: 20px; color: #52525b; vertical-align: middle; border-bottom: 1px solid #ededf0; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafafa; }
.machine-name { max-width: 240px; padding: 0; border: 0; background: none; color: #27272a; font-size: 14px; line-height: 20px; font-weight: 550; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.machine-meta { display: none; margin-top: 4px; font-size: 12px; line-height: 18px; color: var(--muted); }
.status { display: inline-flex; align-items: center; vertical-align: middle; max-width: 100%; margin-inline-start: -7px; padding: 3px 7px; border-radius: 5px; background: #f1f3f5; color: #526371; font-size: 14px; line-height: 20px; }
.status.running { color: #256843; background: #edf7f0; }
.status.failed, .status.unknown { color: #9c3e21; background: #fff1eb; }
.status.creating, .status.restoring, .status.suspending, .status.migrating { color: #365e80; background: #edf3f9; }
.connect-cell { text-align: right; }
.connect-cell .button { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; line-height: 20px; }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.pagination > div { display: flex; gap: 8px; }
.pagination .button { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.host-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.host { padding: 24px; border: 1px solid var(--border); border-radius: 10px; }
.host h2 { font-size: 20px; margin-bottom: 4px; }
.host > p { font-size: 14px; line-height: 20px; color: var(--muted); }
.host-services, .host-vms { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 16px; font-size: 13px; line-height: 22px; color: #52525b; }
.host-vms h3 { margin-bottom: 8px; }
.host-vms button { display: block; padding: 4px 0; border: 0; background: none; color: #27272a; font-size: 13px; }
.host-vms p { margin-top: 8px; color: var(--muted); }
.footnote { margin-top: 20px; max-width: 730px; font-size: 12px; line-height: 18px; color: var(--muted); }
dialog { width: 480px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain; padding: 24px; border: 1px solid #dedee4; border-radius: 12px; color: #202024; background: #fff; box-shadow: 0 18px 70px #17172424; }
dialog::backdrop { background: #20202444; backdrop-filter: blur(2px); }
.dialog-heading { display: grid; grid-template-columns: minmax(0,1fr) 36px; align-items: center; gap: 4px 16px; margin-bottom: 24px; }
.dialog-heading > div { display: contents; }
.dialog-heading h2 { grid-column: 1; grid-row: 1; }
.dialog-heading .close-dialog { grid-column: 2; grid-row: 1; }
.dialog-heading h2 { overflow-wrap: anywhere; }
.dialog-heading .muted { grid-column: 1 / -1; grid-row: 2; font-size: 13px; }
#create-form, #account-form { display: grid; gap: 20px; }
#create-form > .dialog-heading { margin: 0; }
.field { display: grid; gap: 8px; min-width: 0; }
.field label { display: block; margin: 0; color: #3f3f46; font-size: 14px; line-height: 20px; font-weight: 500; overflow-wrap: anywhere; }
.field input, .field > select, .field > .select-control > .select-trigger { display: block; width: 100%; height: 44px; margin: 0; padding: 10px 12px; border: 1px solid #d9d9df; border-radius: 8px; background-color: #fff; color: #27272a; font-size: 14px; line-height: 22px; }
.field > .select-control > .select-trigger { display: flex; }
.field > select, .field > .select-control > .select-trigger { padding-right: 32px; }
.field input[aria-invalid="true"], .field .select-trigger[aria-invalid="true"] { border-color: #b42318; }
.field-error { color: #b42318; font-size: 12px; line-height: 18px; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 8px; padding-top: 20px; border-top: 1px solid var(--border); }
.notice { margin: 16px 0 0; padding: 12px; border: 1px solid #f4c9c4; border-radius: 8px; background: #fff3f1; color: #a52c22; font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }
#create-form > .notice { margin: 0; }
main > .notice { margin: 0 0 24px; }
.ssh-command { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 20px; padding: 10px 12px; background: #f7f7f8; border: 1px solid var(--border); border-radius: 8px; }
.ssh-command code { min-width: 0; color: #3f3f46; font: 12px/20px ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.details { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 20px 16px; margin: 24px 0; font-size: 14px; line-height: 20px; }
.detail-item { min-width: 0; }
.detail-item dt { margin-bottom: 6px; font-size: 12px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.machine-actions { display: flex; gap: 8px; }
.resize-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.resize-section > .hint { margin-top: 6px; }
.resize-controls { display: grid; grid-template-columns: minmax(0,1fr) 116px; align-items: end; gap: 12px; margin-top: 16px; }
.resize-controls .button { min-height: 44px; }
.detail-footer { display: flex; justify-content: flex-end; margin-top: 16px; }
#delete-form { display: grid; gap: 20px; }
#delete-form > .dialog-heading, #delete-form > .dialog-description, #delete-form > .notice { margin: 0; }
.usage-section { margin-top: 24px; border-top: 1px solid var(--border); }
.disclosure { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 48px; margin: 0; padding: 12px 0; border: 0; background: transparent; color: #3f3f46; font-size: 14px; line-height: 24px; text-align: left; }
.disclosure:hover { color: #18181b; }
.disclosure > span:last-child { display: flex; }
.disclosure[aria-expanded="true"] svg { transform: rotate(180deg); }
.usage-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px 16px; margin: 8px 0 0; font-size: 13px; }
.usage-grid dt { color: var(--muted); margin-bottom: 4px; }
.usage-grid dd { margin: 0; font-variant-numeric: tabular-nums; }
.migration-title { margin: 20px 0 12px; }
.migration-controls { display: flex; gap: 8px; }
.migration-controls select, .migration-controls .select-control { flex: 1; }
.dialog-description { margin-bottom: 24px; color: #52525b; font-size: 14px; line-height: 22px; }
.connection-command { margin-top: 20px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 32px); z-index: 20; padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; color: #27272a; background: #fff; box-shadow: 0 4px 20px #00000012; font-size: 13px; line-height: 20px; }
.login-page { display: grid; grid-template-columns: minmax(0,1fr); place-items: center; min-height: 100dvh; padding: 24px; background: #f6f6f8; }
.login-card { width: 380px; max-width: 100%; margin: 0; padding: 28px; justify-self: center; border: 1px solid var(--border); border-radius: 14px; background: #ffffffeb; box-shadow: 0 8px 30px #0000000f; }
.login-card .brand { margin-bottom: 24px; }
.login-card h1 { font-size: 26px; line-height: 32px; }
#account-form { margin-top: 24px; }
#account-form input { font-size: 16px; }
#account-submit { width: 100%; min-height: 44px; border-radius: 999px; }
.auth-links { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.auth-links .text-button { display: inline-flex; align-items: center; color: #0066d6; text-decoration: none; }
.auth-links .text-button:hover { text-decoration: underline; }
#account-status { color: var(--muted); font-size: 13px; line-height: 20px; margin-top: 16px; }
#account-status:empty { display: none; }
@media (max-width: 760px) {
  .app-header { padding-inline: 20px; gap: 24px; }
  main { padding: 32px 20px 48px; }
  .host-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  :root { --action-width: 135px; }
  .app-header { height: 64px; padding-inline: 16px; gap: 20px; }
  .app-header:has(nav:not([hidden])) { height: auto; min-height: 64px; flex-wrap: wrap; row-gap: 0; }
  .app-header:has(nav:not([hidden])) .brand, .app-header:has(nav:not([hidden])) .header-tools { min-height: 63px; }
  .app-header nav { order: 1; width: 100%; height: 40px; }
  .brand { font-size: 22px; }
  .brand-mark { width: 28px; height: 30px; font-size: 20px; }
  nav { gap: 12px; font-size: 12px; }
  main { padding: 28px 16px 44px; }
  h1 { font-size: 26px; line-height: 34px; }
  .page-heading { gap: 6px 12px; margin-bottom: 24px; }
  .page-heading > .button { padding-inline: 10px; font-size: 12px; }
  .toolbar { gap: 8px; }
  .search { flex: 1; }
  .search input { width: 100%; font-size: 13px; }
  .toolbar select, .toolbar .select-trigger { font-size: 13px; }
  th, td { padding: 12px 10px; }
  .resources-col, .host-col { display: none; }
  .machine-meta { display: block; }
  .machine-name { max-width: min(36vw,180px); }
  .connect-label { display: none; }
  .connect-cell .button { min-width: 36px; min-height: 36px; padding: 8px; border: 0; }
  .status { white-space: normal; }
  .pagination { padding: 10px; }
  dialog { padding: 20px; }
  .details { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .login-card { padding: 28px; }
  .field input, .field > select, .field > .select-control > .select-trigger { font-size: 16px; }
}


.keys-list {margin-top:24px;}
.key-row {display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:16px;padding:16px 0;border-bottom:1px solid var(--border);}
.key-fingerprint {overflow-wrap:anywhere;font-size:13px;}

.key-form textarea {display:block;width:100%;min-height:120px;padding:12px;border:1px solid var(--border);border-radius:8px;font:14px/20px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;resize:vertical;}
.key-form .hint code {overflow-wrap:anywhere;}
.keys-actions {display:flex;justify-content:flex-end;margin-top:24px;}
.key-row > .button, .keys-actions > .button {min-width:96px;}
