:root {
  color-scheme: light;
  --canvas: #f1f3f6;
  --surface: #ffffff;
  --ink: #16202e;
  --muted: #5b6778;
  --line: #d5dae2;
  --control-line: #6f7a89;
  --control-line-hover: #4b5563;
  --line-soft: #e6e9ee;
  --rail: #17212b;
  --rail-ink: #aab6c4;
  --rail-line: #263341;
  --accent: #0c6e72;
  --accent-deep: #095659;
  --accent-light: #5ad1c8;
  --accent-wash: #e3f2f2;
  --on: #1a7f4b;
  --busy: #a85f00;
  --danger: #b42318;
  --danger-wash: #fdecea;
  --radius: 8px;
  --radius-control: 6px;
  --rail-width: 224px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font:
    13px / 1.6 "Segoe UI Variable Text",
    "Segoe UI",
    "Malgun Gothic",
    "Apple SD Gothic Neo",
    system-ui,
    sans-serif;
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--accent);
}

code {
  font-family: Consolas, "Cascadia Mono", ui-monospace, monospace;
  font-size: 12px;
}

h1 {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}

h2 {
  font-size: 14px;
  font-weight: 650;
  margin: 28px 0 10px;
}

h3 {
  font-size: 13px;
  font-weight: 650;
  margin: 0;
}

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

h1 + .muted {
  margin: 0 0 22px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 8px;
  top: -64px;
  background: var(--accent);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: var(--radius-control);
  z-index: 10;
}

.skip:focus {
  top: 8px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 틀 ---------- */

.shell {
  display: flex;
  min-height: 100vh;
}

.side {
  width: var(--rail-width);
  flex-shrink: 0;
  background: var(--rail);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 18px 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 10px 22px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand img {
  display: block;
  border-radius: 7px;
}

.side h2 {
  font-size: 12px;
  font-weight: 600;
  color: #7d8a99;
  margin: 0;
  padding: 20px 10px 6px;
  border-top: 1px solid var(--rail-line);
  margin-top: 14px;
}

.side ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.side a:not(.brand) {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-control);
  color: var(--rail-ink);
  text-decoration: none;
}

.side a:not(.brand):hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.side a[aria-current="page"],
.side a[aria-current="page"]:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent-light);
}

.icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side a[aria-current="page"] .icon {
  color: var(--accent-light);
}

.side a:focus-visible {
  outline-color: var(--accent-light);
}

.content-area {
  flex: 1;
  min-width: 0;
}

.top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  min-height: 48px;
  padding: 4px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.top form {
  margin: 0;
}

.top a:not(.skip) {
  color: var(--muted);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: var(--radius-control);
}

.top a:not(.skip):hover,
.top a[aria-current="page"] {
  background: var(--canvas);
  color: var(--ink);
}

.who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--accent-deep);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

main {
  max-width: 1240px;
  padding: 28px 32px 64px;
}

main.plain {
  max-width: none;
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
}

/* ---------- 안내 줄 ---------- */

.flash {
  margin: 0 0 18px;
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius-control);
}

.flash.ok {
  border-left-color: var(--on);
}

.flash.problem {
  border-left-color: var(--danger);
  background: var(--danger-wash);
  color: #7a1810;
}

.heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.heading h1 {
  margin: 0;
}

/* ---------- 숫자 띠 ---------- */

.stats {
  display: flex;
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stats div {
  flex: 0 0 168px;
  padding: 12px 20px 14px;
  border-left: 1px solid var(--line-soft);
}

.stats div:first-child {
  border-left: 0;
}

.stats dt {
  color: var(--muted);
  font-size: 12px;
}

.stats dd {
  margin: 2px 0 0;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.facts dt,
.facts dd {
  margin: 0;
  padding: 9px 20px;
  border-top: 1px solid var(--line-soft);
}

.facts dt {
  color: var(--muted);
  padding-right: 40px;
}

.facts dt:first-of-type,
.facts dt:first-of-type + dd {
  border-top: 0;
}

.fingerprint code {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 12px 16px;
  font-size: 14px;
  letter-spacing: 0.04em;
  line-height: 1.8;
  word-break: break-word;
}

/* ---------- 표 ---------- */

.table-wrap {
  position: relative;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

th {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  background: #f8f9fb;
  border-bottom: 1px solid var(--line);
}

tbody th {
  color: var(--ink);
  font-size: 13px;
  background: transparent;
  border-bottom: 1px solid var(--line-soft);
}

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

tbody tr:hover {
  background: #fafbfc;
}

td.when {
  white-space: nowrap;
}

/* 접속 PC 에서 대상 PC 로 이어지는 선. 접속 이력 표에서만 쓴다. */
td.from {
  position: relative;
  padding-right: 54px;
}

td.from::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 50%;
  width: 38px;
  height: 7px;
  transform: translateY(-50%);
  background:
    radial-gradient(circle at 3.5px 3.5px, var(--accent) 3.5px, transparent 4px),
    radial-gradient(circle at 34.5px 3.5px, var(--accent) 3.5px, transparent 4px),
    linear-gradient(var(--accent), var(--accent)) 4px 3px / 30px 1px no-repeat;
}

/* ---------- 입력과 버튼 ---------- */

input,
select,
button,
.button {
  font: inherit;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
}

input,
select {
  max-width: 100%;
  border-color: var(--control-line);
}

input:hover,
select:hover {
  border-color: var(--control-line-hover);
}

input:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.table-wrap input {
  width: 8rem;
}

button,
.button {
  display: inline-block;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}

button:hover,
.button:hover {
  background: #f3f5f8;
  border-color: #aeb6c2;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
}

button.primary:hover,
button.primary:active {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

button.danger {
  color: var(--danger);
}

button.danger:hover {
  background: var(--danger-wash);
  border-color: #e7a39d;
}

button.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

button.quiet:hover {
  background: var(--canvas);
  border-color: transparent;
  color: var(--ink);
}

button:disabled {
  cursor: progress;
  opacity: 0.55;
}

form.inline {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0;
}

form.stack {
  display: grid;
  gap: 14px;
}

form.narrow {
  max-width: 380px;
}

form.row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.field {
  display: grid;
  gap: 4px;
}

.field label {
  font-weight: 600;
}

.required {
  color: var(--danger);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.field-error {
  margin: 0;
  color: var(--danger);
  font-weight: 600;
}

.field.has-error input {
  border-color: var(--danger);
}

/* ---------- 상태등 ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  color: var(--muted);
}

.badge::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid #98a2b0;
}

.badge.online {
  color: var(--ink);
}

.badge.online::before {
  background: var(--on);
  border-color: var(--on);
  box-shadow: 0 0 0 3px rgba(26, 127, 75, 0.16);
}

.badge.busy {
  color: var(--ink);
}

.badge.busy::before {
  background: #d98200;
  border-color: #d98200;
  box-shadow: 0 0 0 3px rgba(217, 130, 0, 0.18);
}

/* ---------- 로그인 ---------- */

.sign-in {
  width: 360px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px 30px 26px;
  box-shadow: 0 1px 2px rgba(22, 32, 46, 0.06);
}

.sign-in img {
  display: block;
  border-radius: 10px;
  margin-bottom: 14px;
}

.sign-in h1 {
  margin-bottom: 18px;
}

.sign-in .field input {
  min-height: 38px;
}

.sign-in button.primary {
  min-height: 38px;
  margin-top: 4px;
}

.sign-in > .muted {
  margin: 18px 0 0;
  font-size: 12px;
}

.notice {
  margin-top: 8vh;
  text-align: center;
}

/* ---------- 탭 · 묶음 · 목록 ---------- */

.tabs {
  display: flex;
  gap: 2px;
  margin: 0 0 14px;
  border-bottom: 1px solid var(--line);
}

.tabs a {
  padding: 8px 14px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs a:hover {
  color: var(--ink);
}

.tabs a[aria-current="page"] {
  color: var(--accent-deep);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-top: 12px;
}

.group .heading {
  margin-bottom: 2px;
}

ul.plain {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: grid;
  gap: 8px;
}

ul.chips {
  list-style: none;
  padding: 0;
  margin: 8px 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

ul.chips li {
  display: inline-flex;
  align-items: center;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 0 2px 0 10px;
}

/* ---------- 좁은 화면 ---------- */

@media (max-width: 900px) {
  .shell {
    flex-direction: column;
  }

  .side {
    width: 100%;
    height: auto;
    position: static;
    padding: 10px 10px 6px;
  }

  .brand {
    padding-bottom: 10px;
  }

  .side h2 {
    margin-top: 6px;
    padding-top: 10px;
  }

  .side ul {
    display: flex;
    overflow-x: auto;
  }

  .side li {
    flex: none;
  }

  .top {
    padding: 0 12px;
  }

  main {
    padding: 20px 14px 48px;
  }

  main.plain {
    padding: 20px;
  }

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

  .facts dt {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .facts dd {
    border-top: 0;
    padding-top: 0;
  }
}
