:root {
  --color-bg: #f4f5f7;
  --color-card: #ffffff;
  --color-text: #191f28;
  --color-text-secondary: #8b95a1;
  --color-text-tertiary: #b0b8c1;
  --color-border: #e5e8eb;
  --color-primary: #3182f6;
  --color-primary-light: #e8f3ff;
  --color-success: #00c853;
  --color-success-light: #e8f9ef;
  --color-error: #f04452;
  --color-error-light: #ffebee;
  --color-warning: #ff9100;
  --color-warning-light: #fff8e6;
  --color-gray: #8b95a1;
  --color-gray-light: #f4f5f7;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.header {
  text-align: center;
  margin-bottom: 24px;
}

.header-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
}

.header-subtitle {
  font-size: 14px;
  color: var(--color-text-secondary);
}

.status-banner-section {
  margin-bottom: 24px;
}

.status-banner {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.status-banner.operational {
  background: linear-gradient(135deg, #e8f9ef 0%, #d4f5e4 100%);
  border: 1px solid #a8e6c3;
}

.status-banner.degraded {
  background: linear-gradient(135deg, #fff8e6 0%, #ffecb3 100%);
  border: 1px solid #ffd54f;
}

.status-banner.down {
  background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
  border: 1px solid #ef9a9a;
}

.status-banner.loading {
  background: var(--color-card);
  border: 1px solid var(--color-border);
}

.status-banner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-gray);
}

.status-banner.operational .status-indicator {
  background: var(--color-success);
  box-shadow: 0 0 0 3px rgba(0, 200, 83, 0.2);
}

.status-banner.degraded .status-indicator {
  background: var(--color-warning);
  box-shadow: 0 0 0 3px rgba(255, 145, 0, 0.2);
}

.status-banner.down .status-indicator {
  background: var(--color-error);
  box-shadow: 0 0 0 3px rgba(240, 68, 82, 0.2);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-text {
  font-size: 18px;
  font-weight: 600;
}

.status-banner.operational .status-text { color: #00875a; }
.status-banner.degraded .status-text { color: #b36b00; }
.status-banner.down .status-text { color: #c62828; }

.status-summary {
  text-align: center;
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 8px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.last-updated {
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--color-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
}

.refresh-btn:hover {
  background: var(--color-gray-light);
  color: var(--color-text);
}

.refresh-btn.spinning svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.monitors-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.monitor-card {
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.monitor-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.monitor-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.monitor-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.up {
  background: var(--color-success-light);
  color: #00875a;
}

.status-badge.down {
  background: var(--color-error-light);
  color: #c62828;
}

.status-badge.paused {
  background: var(--color-gray-light);
  color: var(--color-gray);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-dot.up { background: var(--color-success); }
.status-dot.down { background: var(--color-error); }
.status-dot.paused { background: var(--color-gray); }

.uptime-bar {
  display: flex;
  gap: 2px;
  height: 28px;
  margin-bottom: 12px;
}

.uptime-day {
  flex: 1;
  min-width: 2px;
  border-radius: 3px;
  cursor: pointer;
  transition: transform 0.1s ease;
  position: relative;
}

.uptime-day:hover {
  transform: scaleY(1.15);
}

.uptime-day.up { background: var(--color-success); }
.uptime-day.down { background: var(--color-error); }
.uptime-day.partial { background: var(--color-warning); }
.uptime-day.no-data { background: #e5e8eb; }

.uptime-stats {
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.uptime-stat {
  text-align: center;
}

.uptime-stat-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.uptime-stat-label {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

.response-time {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 8px;
}

.incidents-section {
  margin-top: 32px;
}

.incidents-list {
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.no-incidents {
  padding: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--color-text-secondary);
}

.incident-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.incident-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.incident-icon.down {
  background: var(--color-error-light);
  color: var(--color-error);
}

.incident-icon.up {
  background: var(--color-success-light);
  color: var(--color-success);
}

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

.incident-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}

.incident-meta {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.footer {
  text-align: center;
  margin-top: 32px;
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-overlay.visible {
  opacity: 1;
}

.modal {
  position: fixed;
  left: 16px;
  right: 16px;
  top: 50%;
  transform: translateY(-50%) scale(0.95);
  max-width: 480px;
  max-height: calc(100vh - 48px);
  margin: 0 auto;
  background: var(--color-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  z-index: 101;
  overflow: hidden;
  opacity: 0;
  transition: all 0.2s ease;
}

.modal.visible {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.hidden {
  display: none !important;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-card);
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: var(--color-gray-light);
  color: var(--color-text);
}

.modal-content {
  padding: 20px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.modal-status-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.modal-status-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-status-icon.up {
  background: var(--color-success-light);
  color: var(--color-success);
}

.modal-status-icon.down {
  background: var(--color-error-light);
  color: var(--color-error);
}

.modal-status-icon.paused {
  background: var(--color-gray-light);
  color: var(--color-gray);
}

.modal-status-text h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.modal-status-text p {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.modal-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.modal-stat-item {
  background: var(--color-bg);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.modal-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
}

.modal-stat-label {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.modal-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 12px;
}

.modal-uptime-bar {
  height: 40px;
  margin-bottom: 20px;
}

.modal-incidents-list {
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.modal-incident-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.modal-incident-item:last-child {
  border-bottom: none;
}

.modal-incident-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.modal-incident-dot.down { background: var(--color-error); }
.modal-incident-dot.up { background: var(--color-success); }

.modal-incident-info {
  flex: 1;
}

.modal-incident-time {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
}

.modal-incident-duration {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.skeleton {
  pointer-events: none;
}

.skeleton-line {
  background: linear-gradient(90deg, #e5e8eb 25%, #f4f5f7 50%, #e5e8eb 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-line.title {
  height: 18px;
  width: 40%;
  margin-bottom: 8px;
}

.skeleton-line.subtitle {
  height: 14px;
  width: 60%;
  margin-bottom: 16px;
}

.skeleton-bar {
  height: 28px;
  background: linear-gradient(90deg, #e5e8eb 25%, #f4f5f7 50%, #e5e8eb 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.error-message {
  background: var(--color-error-light);
  border: 1px solid #ffcdd2;
  color: #c62828;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 14px;
}

.tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 10;
}

.tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--color-text);
}

.uptime-day:hover .tooltip {
  opacity: 1;
}

.section-with-tabs {
  margin-top: 24px;
}

.section-header-with-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-header-with-tabs .modal-section-title {
  margin-bottom: 0;
}

.tab-buttons {
  display: flex;
  gap: 4px;
  background: var(--color-bg);
  padding: 3px;
  border-radius: 8px;
}

.tab-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--color-text);
}

.tab-btn.active {
  background: var(--color-card);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.history-table {
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.history-header {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--color-border);
}

.history-row {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}

.history-row:last-child {
  border-bottom: none;
}

.history-date {
  font-weight: 500;
  color: var(--color-text);
}

.history-uptime {
  text-align: center;
  font-weight: 600;
}

.history-uptime.up { color: var(--color-success); }
.history-uptime.partial { color: var(--color-warning); }
.history-uptime.down { color: var(--color-error); }
.history-uptime.no-data { color: var(--color-text-tertiary); }

.history-response {
  text-align: right;
  color: var(--color-text-secondary);
}

.incident-group {
  margin-bottom: 16px;
}

.incident-group:last-child {
  margin-bottom: 0;
}

.incident-group-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  padding: 10px 14px;
  background: var(--color-card);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: 1px solid var(--color-border);
}

.incident-count {
  font-weight: 400;
  color: var(--color-text-secondary);
  margin-left: 6px;
}

.incident-group .modal-incident-item:first-child {
  border-radius: 0;
}

.incident-group .modal-incident-item:last-child {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.no-data-text {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-secondary);
}

@media (max-width: 480px) {
  .container {
    padding: 16px 12px 32px;
  }

  .header-title {
    font-size: 20px;
  }

  .monitor-card {
    padding: 14px 16px;
  }

  .uptime-bar {
    height: 24px;
  }

  .uptime-stats {
    gap: 8px;
  }

  .uptime-stat-value {
    font-size: 14px;
  }

  .modal {
    left: 8px;
    right: 8px;
  }

  .modal-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}
