/* Automation Registry Dashboard v2 · ptsm89 */
:root {
  --bg: #0b0f14;
  --bg-2: #111821;
  --bg-3: #1a2330;
  --border: #253142;
  --text: #e6edf3;
  --text-dim: #8b98a5;
  --text-faint: #5a6676;
  --accent: #4da3ff;
  --accent-2: #7c5cff;
  --green: #22c55e;
  --yellow: #f5b301;
  --red: #ef4444;
  --gray: #6b7280;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px 80px; }

header.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  flex-wrap: wrap;
}
header.hero h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
header.hero .subtitle { color: var(--text-dim); font-size: 14px; margin-top: 4px; }
header.hero .meta { font-size: 12px; color: var(--text-faint); text-align: right; }
header.hero .meta .pill {
  display: inline-block;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  margin-left: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-card .label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .value { font-size: 30px; font-weight: 700; margin-top: 4px; letter-spacing: -0.02em; }
.stat-card.running .value { color: var(--green); }
.stat-card.stopped .value { color: var(--red); }
.stat-card.error .value { color: var(--yellow); }

.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 20px;
}
.filter-bar select, .filter-bar input {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.filter-bar input { flex: 1; min-width: 200px; }
.filter-bar input::placeholder { color: var(--text-faint); }
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--accent); }
.filter-bar .label { font-size: 12px; color: var(--text-dim); margin-right: 4px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 36px;
}
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease, transform 0.15s ease;
  cursor: pointer;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card .top-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card .title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.card .title .icon { font-size: 20px; }
.card .badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
}
.badge.running { background: rgba(34, 197, 94, 0.12); color: var(--green); border-color: rgba(34,197,94,0.3); }
.badge.stopped { background: rgba(239, 68, 68, 0.12); color: var(--red); border-color: rgba(239,68,68,0.3); }
.badge.scheduled { background: rgba(245, 179, 1, 0.12); color: var(--yellow); border-color: rgba(245,179,1,0.3); }
.badge.manual { background: rgba(107, 114, 128, 0.18); color: var(--text-dim); border-color: rgba(107,114,128,0.4); }
.badge.api { background: rgba(77, 163, 255, 0.12); color: var(--accent); border-color: rgba(77,163,255,0.3); }
.badge.error { background: rgba(239, 68, 68, 0.2); color: var(--red); border-color: rgba(239,68,68,0.4); }

.card .tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-3);
  color: var(--text-dim);
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.card .purpose { font-size: 13px; color: var(--text-dim); }
.card .schedule { font-size: 12px; color: var(--text); }
.card .path { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--text-faint); word-break: break-all; }
.card .meta-row { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text-faint); margin-top: auto; padding-top: 6px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal-backdrop.active { display: flex; }
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal h2 { margin: 0 0 6px; font-size: 20px; }
.modal .close {
  float: right;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  cursor: pointer;
}
.modal dl { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 13px; margin-top: 16px; }
.modal dt { color: var(--text-dim); }
.modal dd { margin: 0; word-break: break-all; }
.modal .tech-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* Timeline */
.section-title { font-size: 16px; font-weight: 700; margin: 30px 0 14px; display: flex; align-items: center; gap: 8px; }
.timeline {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 0;
}
.timeline .entry {
  display: grid;
  grid-template-columns: 140px 30px 1fr;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  align-items: start;
}
.timeline .entry:last-child { border-bottom: none; }
.timeline .time { color: var(--text-faint); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.timeline .action-icon { font-size: 16px; text-align: center; }
.timeline .body .target { font-weight: 600; }
.timeline .body .summary { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

.load-more {
  display: block;
  width: 100%;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-top: 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.load-more:hover { border-color: var(--accent); color: var(--accent); }

footer.page-footer { text-align: center; color: var(--text-faint); font-size: 12px; padding: 30px 0 10px; border-top: 1px solid var(--border); margin-top: 40px; }

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  header.hero { flex-direction: column; align-items: flex-start; }
  header.hero .meta { text-align: left; }
  .timeline .entry { grid-template-columns: 1fr; gap: 4px; }
  .timeline .action-icon { text-align: left; }
}
