:root {
  --ink: #18232e;
  --muted: #67737e;
  --line: #e0e6e8;
  --paper: #f5f7f6;
  --surface: #ffffff;
  --green: #14885f;
  --green-soft: #e7f5ef;
  --red: #d14e4e;
  --red-soft: #fcecec;
  --amber: #a86b10;
  --amber-soft: #fff4d8;
  --navy: #16384e;
  --shadow: 0 16px 42px rgba(32, 50, 60, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(115deg, rgba(18, 86, 75, 0.035), transparent 28%),
    var(--paper);
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }

.page-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 42px;
}

.topbar {
  height: 116px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand-block,
.header-actions,
.section-heading,
.source-banner,
.summary-label,
.card-top,
.status-line,
.activity-row,
footer {
  display: flex;
  align-items: center;
}

.brand-block { gap: 16px; }

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--navy);
  border-radius: 13px 4px 13px 4px;
  font: 700 23px/1 Georgia, serif;
  box-shadow: 6px 6px 0 #b9d8cd;
}

.eyebrow,
.section-kicker {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

h1,
h2,
p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.header-actions { gap: 22px; }

.collector-controls {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.collector-start-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 15px;
  color: #7b4f00;
  background: #fff8e6;
  border: 1px solid #ead8ad;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease;
}

.collector-start-button:hover { transform: translateY(-1px); border-color: #bc9140; }
.collector-start-button i { width: 8px; height: 8px; background: #d99519; border-radius: 50%; }
.collector-start-button.online { color: #285345; background: var(--green-soft); border-color: #b9ddcf; }
.collector-start-button.online i { background: var(--green); box-shadow: 0 0 0 4px rgba(36, 133, 100, 0.12); }

.clock-block {
  display: grid;
  justify-items: end;
  gap: 3px;
  padding-right: 22px;
  border-right: 1px solid var(--line);
}

.clock-block span { color: var(--muted); font-size: 12px; }
.clock-block strong { font-size: 19px; font-variant-numeric: tabular-nums; }

.refresh-button {
  min-height: 42px;
  padding: 0 17px;
  color: var(--navy);
  background: white;
  border: 1px solid #ccd5d8;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease;
}

.refresh-button:hover { transform: translateY(-1px); border-color: var(--navy); }
.refresh-button:disabled { opacity: 0.55; cursor: wait; }
.refresh-button span { display: inline-block; margin-right: 4px; font-size: 18px; }
.refresh-button.loading span { animation: spin 700ms linear infinite; }

main { padding: 32px 0 42px; }

.performance-banner {
  min-height: 92px;
  display: flex;
  align-items: center;
  gap: 17px;
  margin-bottom: 18px;
  padding: 18px 22px;
  color: white;
  background:
    radial-gradient(circle at 82% 20%, rgba(122, 220, 181, 0.24), transparent 26%),
    linear-gradient(120deg, #14384d 0%, #17694f 100%);
  border: 1px solid rgba(22, 56, 78, 0.24);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(22, 56, 78, 0.15);
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.performance-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 17px 36px rgba(22, 56, 78, 0.2);
}

.performance-banner:focus-visible {
  outline: 3px solid rgba(20, 136, 95, 0.28);
  outline-offset: 3px;
}

.performance-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: #123b36;
  background: #d7f3e6;
  border-radius: 14px 5px 14px 5px;
  font: 800 16px/1 Georgia, serif;
  box-shadow: 5px 5px 0 rgba(255, 255, 255, 0.15);
}

.performance-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.performance-kicker {
  color: #9fe2c8;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.performance-copy strong { font-size: 18px; letter-spacing: -0.025em; }
.performance-copy small { color: rgba(255, 255, 255, 0.64); font-size: 10px; }

.performance-action {
  margin-left: auto;
  padding: 10px 13px;
  color: #183d37;
  background: #e6f7ef;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.performance-action b { margin-left: 5px; font-size: 14px; }

.source-banner {
  min-height: 76px;
  gap: 15px;
  padding: 15px 18px;
  color: #285345;
  background: var(--green-soft);
  border: 1px solid #cbe8dc;
  border-left: 5px solid var(--green);
  border-radius: 12px;
}

.source-banner.stale {
  color: #6f4b0c;
  background: var(--amber-soft);
  border-color: #eedba8;
  border-left-color: var(--amber);
}

.source-banner.error {
  color: #7f3434;
  background: var(--red-soft);
  border-color: #efcaca;
  border-left-color: var(--red);
}

.source-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  font-weight: 900;
}

.source-copy { display: grid; gap: 4px; }
.source-copy strong { font-size: 14px; }
.source-copy span { font-size: 12px; opacity: 0.78; }
.source-time { margin-left: auto; font-size: 12px; font-weight: 700; white-space: nowrap; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-top: 20px;
}

.summary-card {
  position: relative;
  min-height: 112px;
  padding: 20px 22px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.summary-card::after {
  content: "";
  position: absolute;
  right: -20px;
  bottom: -30px;
  width: 88px;
  height: 88px;
  border: 16px solid rgba(25, 52, 66, 0.035);
  border-radius: 50%;
}

.summary-label { gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.summary-label i,
.auto-refresh i {
  width: 7px;
  height: 7px;
  display: inline-block;
  background: currentColor;
  border-radius: 50%;
}

.summary-card > div { margin-top: 8px; }
.summary-card strong { font: 700 34px/1 Georgia, serif; }
.summary-card small { margin-left: 5px; color: var(--muted); font-size: 12px; }
.summary-card.online .summary-label { color: var(--green); }
.summary-card.offline .summary-label { color: var(--red); }
.summary-card.unknown .summary-label { color: var(--amber); }

.section-block { margin-top: 42px; }
.section-heading { justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.section-heading h2 { margin-bottom: 0; font-size: 20px; letter-spacing: -0.035em; }

.filter-group {
  display: flex;
  gap: 5px;
  padding: 4px;
  background: #e9eeec;
  border-radius: 10px;
}

.filter-button {
  min-height: 34px;
  padding: 0 13px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.filter-button.active { color: var(--navy); background: white; box-shadow: 0 2px 7px rgba(20, 42, 52, 0.08); }

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

.status-card {
  position: relative;
  min-height: 170px;
  padding: 21px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid #b4bec2;
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.status-card:hover { transform: translateY(-2px); box-shadow: 0 20px 45px rgba(32, 50, 60, 0.12); }
.status-card.online { border-top-color: var(--green); }
.status-card.offline { border-top-color: var(--red); }
.status-card.unknown { border-top-color: var(--amber); }
.status-card.long-remote-session { border-top-color: #5367d8; box-shadow: 0 10px 28px rgba(70, 86, 199, 0.16); }
.card-top { justify-content: space-between; gap: 12px; }

.person-name { margin: 0; font-size: 17px; letter-spacing: -0.025em; }
.person-id { display: block; margin-top: 5px; color: var(--muted); font: 12px/1.2 Consolas, monospace; }
.person-connection { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.person-user {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  color: #14583f;
  background: linear-gradient(135deg, #d9f4e7, #edf9f3);
  border: 1px solid #b9dfcf;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(36, 133, 100, 0.12);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.025em;
}
.person-user::before { content: '●'; margin-right: 6px; color: var(--green); font-size: 7px; }
.person-ip { color: var(--muted); font: 11px/1.2 Consolas, monospace; }
.computer-source {
  display: inline-block;
  margin-top: 9px;
  padding: 4px 7px;
  color: var(--amber);
  background: var(--amber-soft);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
}
.computer-source.connected { color: var(--green); background: var(--green-soft); }
.remote-over-hour-badge { display: inline-flex; align-items: center; margin-top: 8px; padding: 5px 8px; color: #3348a3; background: #e7ebff; border: 1px solid #b2bff4; border-radius: 7px; box-shadow: 0 3px 10px rgba(70, 86, 199, 0.14); font-size: 10px; font-weight: 900; animation: usageAlertPulse 2.4s ease-in-out infinite; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge::before { content: ""; width: 7px; height: 7px; background: currentColor; border-radius: 50%; }
.online .status-badge { color: var(--green); background: var(--green-soft); }
.offline .status-badge { color: var(--red); background: var(--red-soft); }
.unknown .status-badge { color: var(--amber); background: var(--amber-soft); }

.status-line {
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-top: 24px;
  padding-top: 15px;
  border-top: 1px solid #edf0f1;
}

.last-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 700; }
.last-value { font-size: 12px; font-weight: 700; }
.last-relative { color: var(--muted); font-size: 11px; white-space: nowrap; }

.empty-filter,
.activity-empty {
  padding: 32px;
  color: var(--muted);
  text-align: center;
  background: white;
  border: 1px dashed #cdd5d8;
  border-radius: 12px;
  font-size: 13px;
}

.activity-panel {
  margin-top: 35px;
  padding: 23px 24px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.usage-panel {
  margin-top: 22px;
  padding: 25px 27px 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(18, 44, 53, 0.05);
}

.usage-heading { margin-bottom: 8px; }
.usage-range { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.usage-period { margin: 14px 0 13px; }
.usage-period-buttons { width: max-content; max-width: 100%; display: flex; gap: 3px; padding: 4px; background: #f1f4f5; border-radius: 10px; }
.usage-period-button { min-height: 32px; padding: 0 12px; color: #6b7980; background: transparent; border: 0; border-radius: 7px; cursor: pointer; font-size: 11px; font-weight: 750; white-space: nowrap; }
.usage-period-button:hover { color: var(--navy); }
.usage-period-button.active { color: var(--navy); background: white; box-shadow: 0 2px 7px rgba(20, 42, 52, 0.08); }
.usage-custom-period { display: flex; align-items: center; gap: 9px; margin-top: 10px; color: var(--muted); font-size: 11px; }
.usage-custom-period[hidden] { display: none; }
.usage-custom-period label { display: flex; align-items: center; gap: 6px; }
.usage-custom-period input { min-height: 34px; padding: 0 9px; color: var(--navy); background: white; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-variant-numeric: tabular-nums; }
.usage-custom-period button { min-height: 34px; padding: 0 14px; color: white; background: var(--navy); border: 0; border-radius: 8px; cursor: pointer; font-size: 11px; font-weight: 800; }
.usage-custom-period button:disabled { opacity: 0.55; cursor: wait; }
.usage-summary { margin-bottom: 16px; color: #53656d; font-size: 12px; }
.usage-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -2px 0 15px;
  padding: 11px 13px;
  color: #3348a3;
  background: linear-gradient(135deg, #eef1ff, #fafbff);
  border: 1px solid #c5cff7;
  border-left: 4px solid #5367d8;
  border-radius: 9px;
  box-shadow: 0 5px 16px rgba(70, 86, 199, 0.12);
  font-size: 12px;
  font-weight: 800;
  animation: usageAlertPulse 2.4s ease-in-out infinite;
}
.usage-alert[hidden] { display: none; }
.usage-alert-icon { width: 21px; height: 21px; display: inline-grid; flex: 0 0 21px; place-items: center; color: white; background: #5367d8; border-radius: 50%; font-size: 13px; font-weight: 900; }
.usage-over-hour td { background: #f7f8ff; border-bottom-color: #e0e5fb; }
.usage-over-hour .usage-user { color: #3348a3; }
.usage-duration-cell { color: #3f54b5; }
.usage-duration-cell strong { font-size: 13px; }
.usage-over-hour-badge { display: inline-flex; align-items: center; margin-left: 8px; padding: 3px 7px; color: #3348a3; background: #e5eaff; border: 1px solid #afbcf5; border-radius: 999px; font-size: 9px; font-weight: 900; white-space: nowrap; }
.usage-table-wrap { overflow-x: auto; }
.usage-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.usage-table th { padding: 10px 12px; color: #718088; border-bottom: 1px solid var(--line); font-size: 10px; text-align: left; white-space: nowrap; }
.usage-table td { padding: 14px 12px; border-bottom: 1px solid #edf0f1; vertical-align: middle; }
.usage-table tr:last-child td { border-bottom: 0; }
.usage-table td:not(:nth-child(2)) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.rank-badge { width: 25px; height: 25px; display: inline-grid; place-items: center; color: #718088; background: #f1f4f5; border-radius: 8px; font-weight: 800; }
.rank-badge.top { color: #285345; background: var(--green-soft); }
.usage-user, .usage-identity { display: block; }
.usage-user { margin-bottom: 3px; color: var(--navy); font-size: 13px; }
.usage-identity { color: var(--muted); font-size: 10px; }
.usage-active { display: inline-block; margin-top: 6px; padding: 3px 7px; color: #216449; background: var(--green-soft); border-radius: 999px; font-size: 9px; font-weight: 800; }
.usage-empty { padding: 25px; color: var(--muted); text-align: center; }

.activity-heading { margin-bottom: 10px; }
.auto-refresh { display: inline-flex; align-items: center; gap: 7px; color: var(--green); font-size: 11px; font-weight: 700; }
.auto-refresh i { animation: pulse 1.8s ease-in-out infinite; }

.activity-row {
  min-height: 59px;
  display: grid;
  grid-template-columns: 12px minmax(130px, 0.7fr) minmax(130px, 1fr) minmax(170px, 1fr);
  gap: 15px;
  border-top: 1px solid #edf0f1;
  font-size: 12px;
}

.activity-dot { width: 8px; height: 8px; border-radius: 50%; }
.activity-dot.online { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.activity-dot.offline { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.activity-id { font-weight: 800; }
.activity-event { color: var(--muted); }
.activity-time { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

footer {
  min-height: 74px;
  justify-content: space-between;
  gap: 20px;
  color: #7a868e;
  border-top: 1px solid var(--line);
  font-size: 11px;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.25; transform: scale(0.75); } }
@keyframes usageAlertPulse { 50% { box-shadow: 0 5px 19px rgba(70, 86, 199, 0.22); } }

@media (max-width: 1020px) {
  .page-shell { padding: 0 24px; }
  .summary-grid, .status-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 650px) {
  .page-shell { padding: 0 16px; }
  .topbar { height: auto; padding: 22px 0; align-items: flex-start; }
  .clock-block { display: none; }
  .collector-controls { justify-items: center; }
  .collector-start-button { min-width: 42px; padding: 0 11px; font-size: 0; }
  .collector-start-button i { width: 10px; height: 10px; }
  .refresh-button { min-width: 42px; padding: 0 11px; font-size: 0; }
  .refresh-button span { margin: 0; font-size: 19px; }
  main { padding-top: 22px; }
  .performance-banner { min-height: 82px; gap: 13px; padding: 15px 16px; }
  .performance-mark { width: 42px; height: 42px; font-size: 14px; }
  .performance-copy strong { font-size: 15px; }
  .performance-copy small { display: none; }
  .performance-action { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; font-size: 0; }
  .performance-action b { margin: 0; font-size: 16px; }
  .source-banner { align-items: flex-start; }
  .source-time { display: none; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .summary-card { min-height: 102px; padding: 17px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .filter-group { width: 100%; overflow-x: auto; }
  .filter-button { flex: 1 0 auto; }
  .status-grid { grid-template-columns: 1fr; }
  .activity-panel { padding: 20px 17px 6px; }
  .activity-row { grid-template-columns: 12px 1fr auto; gap: 11px; }
  .activity-event { display: none; }
  .usage-panel { padding: 20px 17px 10px; }
  .usage-range { display: none; }
  .usage-period { width: 100%; overflow: hidden; }
  .usage-period-buttons { width: 100%; overflow-x: auto; }
  .usage-period-button { flex: 1 0 auto; }
  .usage-custom-period { align-items: stretch; flex-wrap: wrap; }
  .usage-custom-period label { flex: 1 1 130px; align-items: flex-start; flex-direction: column; }
  .usage-custom-period input { width: 100%; }
  .usage-custom-period > span { display: none; }
  .usage-custom-period button { flex: 0 0 64px; align-self: flex-end; }
  .usage-over-hour-badge { display: table; margin: 5px 0 0; }
  .usage-table thead { display: none; }
  .usage-table, .usage-table tbody, .usage-table tr, .usage-table td { display: block; width: 100%; }
  .usage-table tr { position: relative; padding: 14px 0; border-bottom: 1px solid #edf0f1; }
  .usage-table td { padding: 4px 0 4px 90px; border: 0; white-space: normal !important; }
  .usage-table td:first-child { position: absolute; top: 14px; left: 0; width: 34px; padding: 0; }
  .usage-table td:nth-child(2) { min-height: 38px; padding-left: 42px; }
  .usage-table td[data-label]::before { content: attr(data-label); position: absolute; left: 42px; color: var(--muted); font-size: 10px; }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; }
}
