:root {
  color-scheme: light;
  --ink: #333;
  --muted: #666;
  --line: #e5e5e5;
  --canvas: #f9f9f9;
  --accent: #2b6cf0;
  --link: #245bc6;
  --sidebar-width: 256px;
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
h1 { font-size: 25px; font-weight: 650; letter-spacing: -.6px; }
h2 { font-size: 17px; font-weight: 650; overflow-wrap: anywhere; }
form { margin: 0; }
button, input, select, textarea { font: inherit; }
input, select, textarea { color: inherit; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.startup { display: grid; min-height: 100dvh; place-items: center; color: var(--muted); }

.button {
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid #d6d6d6;
  border-radius: 4px;
  color: var(--ink);
  background: white;
  cursor: pointer;
  white-space: nowrap;
}
.button:hover:not(:disabled) { background: #f2f5fb; }
.button:disabled { opacity: .58; cursor: default; }
.button.primary { border-color: var(--accent); color: white; background: var(--accent); }
.button.primary:hover:not(:disabled) { border-color: var(--link); background: var(--link); }
.button.danger { border-color: #a82c35; color: white; background: #a82c35; }
.button.danger:hover:not(:disabled) { border-color: #89232b; background: #89232b; }
.notice {
  padding: 9px 11px;
  border: 1px solid #f0c5c9;
  border-radius: 4px;
  color: #8f2731;
  background: #fff1f2;
  overflow-wrap: anywhere;
}

.login-page { display: grid; justify-items: center; align-content: start; gap: 32px; min-height: 100dvh; padding: clamp(26px, 10vh, 80px) 20px 24px; }
.login-brand { object-fit: contain; }
.login-card { width: min(100%, 380px); padding: 32px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.login-card > .muted { margin-top: 4px; }
.login-card label { display: block; margin: 18px 0 5px; font-weight: 550; }
.login-card input, .dialog-body input, .dialog-body select, .dialog-body textarea { width: 100%; padding: 7px 9px; border: 1px solid #d6d6d6; border-radius: 4px; background: white; }
.login-card input { min-height: 37px; }
.login-card .notice { margin-top: 14px; }
.login-card .primary { width: 100%; min-height: 37px; margin-top: 22px; }

.skip-link { position: fixed; top: 8px; left: calc(var(--sidebar-width) + 8px); z-index: 1; padding: 8px 12px; border: 1px solid var(--line); background: white; transform: translateY(-130%); }
.skip-link:focus { transform: translateY(0); }
.sidebar { position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; width: var(--sidebar-width); background: #191919; color: #ccc; }
.sidebar-brand { display: flex; align-items: center; min-height: 56px; padding: 0 22px; border-bottom: 1px solid #333; }
.sidebar-brand img { filter: brightness(0) invert(1); }
.sidebar-body { padding: 21px 12px; }
.workspace-label { padding: 0 10px 12px; color: #aaa; font-size: 11px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 4px; color: white; background: #393939; font-weight: 600; text-decoration: none; }
.sidebar nav a:hover { background: #484848; }
.account { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 17px 16px; border-top: 1px solid #333; }
.avatar { display: grid; flex: 0 0 28px; height: 28px; place-items: center; border-radius: 50%; background: #494949; color: #eee; font-size: 11px; }
.account-name { flex: 1; min-width: 0; overflow: hidden; color: #eee; text-overflow: ellipsis; }
.sidebar-button { border-color: #545454; color: #ddd; background: transparent; }
.sidebar-button:hover:not(:disabled) { background: #393939; }
.profile { position: relative; flex: 1; min-width: 0; }
.profile-toggle { display: flex; align-items: center; gap: 6px; width: 100%; padding: 3px 6px; text-align: left; }
.profile-toggle svg { flex: 0 0 auto; }
.profile-toggle[aria-expanded="true"] { background: #393939; }
.profile-menu { position: absolute; bottom: 100%; left: 0; z-index: 3; width: 190px; max-width: calc(100vw - 24px); padding: 5px; border: 1px solid var(--line); border-radius: 4px; background: white; }
.profile-menu .button { width: 100%; border-color: transparent; text-align: left; }
.profile-menu p { padding: 6px; }
.workspace-main { min-width: 0; margin-left: var(--sidebar-width); }
.topbar { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 28px; border-bottom: 1px solid var(--line); color: var(--muted); background: white; }
.topbar strong { color: var(--ink); font-weight: 600; }
.breadcrumb-divider { color: #888; }
.workspace-content { max-width: 1500px; padding: 23px 28px 28px; }
.page-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 8px; }
.super-admin-status { margin-bottom: 12px; }
.super-admin-status.active { color: #216243; }
.inventory { border: 1px solid var(--line); border-radius: 6px; background: white; }
.inventory-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.search-field { display: flex; align-items: center; gap: 7px; width: min(100%, 280px); min-height: 32px; padding: 0 9px; border: 1px solid #d6d6d6; border-radius: 4px; color: var(--muted); }
.search-field:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.search-field svg { flex: 0 0 auto; }
.search-field input { flex: 1; width: 100%; min-width: 0; min-height: 30px; padding: 0; border: none; background: transparent; outline: none; }
.search-clear { flex: 0 0 24px; height: 24px; padding: 0; border: 0; border-radius: 4px; color: var(--muted); background: transparent; cursor: pointer; }
.search-clear:hover { background: #f2f5fb; }
.count { white-space: nowrap; }
.refresh { margin-left: auto; }
.inventory-notice { margin: 10px 13px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 635px; border-collapse: collapse; text-align: left; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { padding-top: 8px; padding-bottom: 8px; color: #555; background: #f8f8f8; font-size: 12px; font-weight: 600; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: none; }
tbody tr:hover { background: #fafbfe; }
.machine-name { max-width: 260px; min-width: 105px; font-weight: 600; overflow-wrap: anywhere; }
.service-cell, .management { white-space: nowrap; }
.service-cell .button { margin-left: 6px; }
.management .button + .button { margin-left: 5px; }
.management .button[aria-disabled="true"] { color: var(--muted); background: #f6f6f6; cursor: not-allowed; }
.manage-tooltip { position: fixed; z-index: 2; width: max-content; max-width: min(300px, calc(100vw - 16px)); padding: 7px 9px; border-radius: 4px; color: white; background: #333; font-size: 12px; }
.last-seen { color: var(--muted); white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); white-space: nowrap; }
.badge::before { width: 7px; height: 7px; border-radius: 50%; background: #8c8c8c; content: ""; }
.badge.ready { color: #216243; }
.badge.ready::before { background: #319365; }
.badge.revoked { color: #942a34; }
.badge.revoked::before { background: #ae3943; }
.empty { padding: 30px 14px; color: var(--muted); text-align: center; }

dialog { width: min(490px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid #d6d6d6; border-radius: 6px; color: var(--ink); background: white; }
dialog::backdrop { background: rgb(20 24 30 / 55%); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.dialog-body { display: grid; gap: 13px; padding: 15px; }
.dialog-body label { display: block; margin-bottom: 4px; font-weight: 550; }
.dialog-body textarea { min-height: 80px; resize: vertical; }
.masked-key { -webkit-text-security: disc; }
@supports not (-webkit-text-security: disc) {
  .dialog-body .masked-key { color: transparent; caret-color: var(--ink); forced-color-adjust: none; }
  .masked-key::selection { color: transparent; }
}
.forward-details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 12px; margin: 0; }
.forward-details dt { color: var(--muted); }
.forward-details dd { margin: 0; overflow-wrap: anywhere; }
.host-key-options summary { cursor: pointer; }
.host-key-options > :not(summary) { margin-top: 7px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.dialog-actions:has(> :not([hidden])) { margin-top: 2px; }
.terminal-dialog { width: min(1120px, calc(100vw - 24px)); }
.terminal-header { flex-wrap: wrap; }
.terminal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.terminal-screen { height: min(68dvh, 680px); min-height: 120px; padding: 8px 10px; overflow: hidden; background: #191919; }
.terminal-screen > .xterm { height: 100%; }
.terminal-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; padding: 8px 15px; color: var(--muted); font-size: 12px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 1100px) {
  :root { --sidebar-width: 190px; }
  .sidebar-brand { padding: 0 14px; }
  .sidebar-brand img { max-width: 145px; }
  .profile-toggle .avatar { display: none; }
  .topbar, .workspace-content { padding-inline: 16px; }
}

@media (max-width: 760px) {
  :root { --sidebar-width: 0px; }
  .sidebar { position: relative; width: auto; flex-flow: row wrap; align-items: center; justify-content: space-between; padding: 0 12px; }
  .sidebar-brand { min-height: 46px; padding: 0; border: 0; }
  .sidebar-brand img { max-width: 128px; }
  .sidebar-body { flex-basis: 100%; order: 3; padding: 0 0 8px; }
  .sidebar nav a { display: inline-flex; min-height: 32px; padding: 5px 8px; }
  .workspace-label { display: none; }
  .account { max-width: 54%; margin: 0; padding: 0; border: 0; }
  .profile-menu { top: 100%; right: 0; bottom: auto; left: auto; }
  .topbar { min-height: 42px; }
  .workspace-content { padding: 14px 12px 24px; }
  .search-field { flex: 1 0 100%; }
  .terminal-screen { height: 56dvh; }
}
