:root {
  --bg-start: #f6f8ff;
  --bg-mid: #eefaf6;
  --bg-end: #fff6ea;
  --card: #ffffffd9;
  --ink: #132238;
  --muted: #5f6f84;
  --line: #d8e2ef;
  --accent: #0f8f68;
  --accent-soft: #e6f8f1;
  --warning: #d3651f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, var(--bg-start), var(--bg-mid) 55%, var(--bg-end));
  min-height: 100vh;
}

.bg-layer {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 12% 18%, #8ad4bc47, transparent 32%),
    radial-gradient(circle at 88% 24%, #ffc2793b, transparent 29%),
    radial-gradient(circle at 55% 86%, #8bb7f83b, transparent 35%);
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}

h1, h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.45rem, 2.7vw, 2.2rem);
}

h2 {
  font-size: 1.15rem;
  margin-bottom: 12px;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.server-pill {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.card {
  background: var(--card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 35px #20304012;
  padding: 14px;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 180px 120px;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: var(--muted);
  font-size: 13px;
}

input, select, button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  padding: 10px 12px;
}

input, select {
  background: #fff;
  color: var(--ink);
}

button {
  background: linear-gradient(135deg, #1ca77a, #0f8f68);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px #0f8f6840;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.metric .k {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.metric .v {
  margin: 0;
  font-size: 1.2rem;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 12px;
}

.table-wrap {
  max-height: 560px;
  overflow: auto;
}

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

th, td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 9px 6px;
  font-size: 13px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 700;
  position: sticky;
  top: 0;
  background: #fff;
}

.app-main-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.app-sub-package {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-remark {
  color: #40566f;
  font-size: 12px;
  max-width: 190px;
}

#timeline {
  display: grid;
  gap: 7px;
  max-height: 560px;
  overflow: auto;
}

.app-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #fff;
  max-width: 100%;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.legend-name {
  font-size: 12px;
  font-weight: 700;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-duration {
  font-size: 12px;
  color: var(--muted);
}

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

.slot-block {
  border-bottom: 1px dashed #dbe5f0;
  padding-bottom: 7px;
}

.slot-row {
  display: grid;
  grid-template-columns: 114px 1fr;
  gap: 8px;
  align-items: center;
}

.slot-time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.slot-bar {
  display: flex;
  height: 22px;
  border-radius: 999px;
  overflow: hidden;
  background: #edf2f8;
  border: 1px solid #d9e3f1;
  width: 100%;
  padding: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-align: left;
}

.slot-bar:hover {
  border-color: #95abc7;
}

.slot-bar.active {
  border-color: #0f8f68;
  box-shadow: 0 0 0 2px #0f8f6824;
}

.slot-detail {
  margin: 6px 0 0 122px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
}

.slot-app-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.slot-app-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #eef3f8;
}

.slot-app-item:last-child {
  border-bottom: none;
}

.slot-app-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.slot-app-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.slot-app-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.slot-app-name {
  font-size: 13px;
  font-weight: 700;
}

.slot-app-package {
  color: var(--muted);
  font-size: 11px;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-app-note {
  color: #40566f;
  font-size: 11px;
}

.slot-app-duration {
  font-size: 12px;
  font-weight: 700;
  color: #20446b;
  white-space: nowrap;
}

.seg {
  height: 100%;
  min-width: 2px;
}

.seg.idle {
  background: repeating-linear-gradient(
    45deg,
    #e6ebf3,
    #e6ebf3 6px,
    #d9e1ed 6px,
    #d9e1ed 12px
  );
}

.empty {
  color: var(--warning);
  font-weight: 600;
}

@media (max-width: 1000px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .hero {
    flex-direction: column;
    align-items: stretch;
  }

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

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .slot-row {
    grid-template-columns: 88px 1fr;
  }

  .slot-detail {
    margin-left: 96px;
  }
}
