body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #FFFFFF;
    min-height: 100vh;
    line-height: 1.5;
    margin: 0;
    padding: 0;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* 認證頁面樣式 */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}
.auth-card {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.auth-title {
    color: #E62727;
    font-size: 2rem;
    margin-bottom: 1rem;
}
.auth-subtitle {
    color: #333333;
    margin-bottom: 2rem;
}
.form-group {
    margin-bottom: 1rem;
    text-align: left;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #000000;
}
.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #333333;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}
.form-group input:focus {
    outline: none;
    border-color: #E62727;
    box-shadow: 0 0 0 3px rgba(230, 39, 39, 0.1);
}
.btn {
    background: #E62727;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 1rem;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(230, 39, 39, 0.3);
}
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.error-message {
    color: #E62727;
    font-size: 14px;
    margin-top: 0.5rem;
}

/* 管理頁面樣式 */
.header {
    background: #F8F8F8;
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
.header h1 {
    color: #E62727;
    margin-bottom: 0.5rem;
    font-size: 2rem;
}
.admin-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}
.btn-secondary {
    background: #000000;
    padding: 8px 16px;
    font-size: 14px;
}
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.user-card {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}
.user-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}
.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.user-id {
    font-size: 1.2rem;
    font-weight: 600;
    color: #000000;
}
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 8px;
}
.status-green { background: #000000; }
.status-red { background: #E62727; }
.status-gray { background: #333333; }
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}
.stat {
    text-align: center;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}
.stat-number {
    font-size: 1.5rem;
    font-weight: 600;
    color: #E62727;
}
.stat-label {
    font-size: 0.8rem;
    color: #333333;
    text-transform: uppercase;
}
.btn-small {
    background: #000000;
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    margin: 2px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}
.btn-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(230, 39, 39, 0.3);
}
.btn-secondary {
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.3);
}
h1 {
    color: #E62727;
    margin-bottom: 0.5rem;
}
.loading { text-align: center; padding: 2rem; color: #333333; }
.empty-state { text-align: center; padding: 3rem; background: white; border-radius: 16px; }

/* Admin 頁面專用樣式 */
.admin-wrapper {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #FFFFFF;
    border-bottom: 1px solid #E5E5E5;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.topbar-left,
.topbar-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.topbar-btn {
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    color: #000000;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-btn:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.topbar-btn.logout {
    background: #E62727;
    border-color: #E62727;
    color: white;
}

.topbar-btn.logout:hover {
    background: #d61e1e;
    border-color: #d61e1e;
}

/* Topbar Title - Pulse Monitor 品牌標識 */
.topbar-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #E62727;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-title i {
  font-size: 1.5rem;
}

/* Topbar 分隔線 */
.topbar-divider {
  width: 1px;
  height: 24px;
  background: rgba(0, 0, 0, 0.2);
  margin: 0 0.5rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.admin-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.action-btn {
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid #333333;
    border-radius: 8px;
    color: #000000;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.user-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.user-btn {
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid #333333;
    border-radius: 6px;
    color: #000000;
    text-decoration: none;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.user-btn:hover {
    background: rgba(0, 0, 0, 0.2);
}

.user-btn.danger {
    background: rgba(230, 39, 39, 0.1);
    border-color: #E62727;
    color: #E62727;
}

.user-btn.danger:hover {
    background: rgba(230, 39, 39, 0.2);
}

/* Admin 頁面響應式設計 */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        padding: 1rem;
    }

    .topbar {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .topbar-left,
    .topbar-right {
        gap: 0.25rem;
    }

    /* ✅ 新增：小螢幕隱藏標題文字 */
    .topbar-title span {
      display: none;
    }

    /* ✅ 新增：小螢幕隱藏分隔線 */
    .topbar-divider {
    display: none;
  }

    .topbar-btn {
        font-size: 12px;
        padding: 6px 12px;
        gap: 0.25rem;
    }

    .header {
        padding: 1.5rem;
    }

    .admin-actions {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .users-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .user-card {
        padding: 1rem;
    }

    .stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .user-actions {
        justify-content: flex-start;
        gap: 0.25rem;
    }

    .user-btn {
        font-size: 11px;
        padding: 4px 8px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .topbar-btn {
        font-size: 11px;
        padding: 4px 8px;
        gap: 0.25rem;
    }

    .topbar {
        padding: 0.5rem;
    }

    .btn {
        width: 100%;
        margin-top: 0.5rem;
    }

    .stat {
        padding: 0.25rem;
    }

    .stat-number {
        font-size: 1.2rem;
    }

    .user-id {
        font-size: 1rem;
    }
}

/* ============================================
   Usage 統計區塊樣式
   ============================================ */

/* Usage 按鈕 - 使用主題的黑紅配色 */
.user-btn.usage {
  background: #E62727;
  color: white;
}

.user-btn.usage:hover {
  background: #d61e1e;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(230, 39, 39, 0.3);
}

/* Usage 區塊 */
.usage-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid rgba(0, 0, 0, 0.1);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    max-height: 500px;
    transform: translateY(0);
  }
}

/* Usage Tab 切換按鈕 */
.usage-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.usage-tab {
  padding: 8px 12px;
  border: 1px solid #333333;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #333333;
  transition: all 0.2s ease;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.usage-tab:hover {
  background: rgba(0, 0, 0, 0.1);
  border-color: #E62727;
  color: #E62727;
}

.usage-tab.active {
  background: #E62727;
  color: white;
  border-color: #E62727;
  font-weight: 600;
}

.usage-tab i {
  font-size: 12px;
}

/* 載入中狀態 */
.usage-loading {
  text-align: center;
  padding: 2rem;
  color: #666;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
}

.usage-loading i {
  margin-right: 0.5rem;
  color: #E62727;
}

/* Usage 統計卡片網格 */
.usage-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

/* 單個 Usage 項目 */
.usage-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  transition: all 0.3s ease;
}

.usage-item:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: #E62727;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Usage 圖示 - Font Awesome */
.usage-icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
  color: #E62727;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.usage-icon i {
  display: block;
}

/* Usage 內容區 */
.usage-content {
  flex: 1;
  min-width: 0;
}

.usage-label {
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  font-weight: 500;
}

.usage-value {
  font-size: 20px;
  font-weight: 700;
  color: #000000;
  line-height: 1.2;
}

/* 特殊數值顏色 - 檢查次數用紅色 */
.usage-item:first-child .usage-value {
  color: #E62727;
}

/* 空狀態 */
.usage-empty {
  text-align: center;
  padding: 2rem;
  color: #999;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.02);
  border: 1px dashed rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

.usage-empty i {
  display: block;
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: #ccc;
}

/* ============================================
   響應式設計 - Usage 區塊
   ============================================ */

@media (max-width: 768px) {
  .usage-stats {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .usage-item {
    padding: 0.75rem;
  }
  
  .usage-icon {
    font-size: 20px;
    width: 28px;
    height: 28px;
  }
  
  .usage-value {
    font-size: 18px;
  }
  
  .usage-tabs {
    gap: 0.25rem;
  }
  
  .usage-tab {
    padding: 6px 8px;
    font-size: 12px;
  }
  
  .usage-tab i {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .usage-section {
    margin-top: 1rem;
    padding-top: 1rem;
  }
  
  .usage-item {
    padding: 0.5rem;
    gap: 8px;
  }
  
  .usage-icon {
    font-size: 18px;
    width: 24px;
    height: 24px;
  }
  
  .usage-label {
    font-size: 10px;
  }
  
  .usage-value {
    font-size: 16px;
  }
  
  .usage-tab {
    padding: 5px 6px;
    font-size: 11px;
  }
  
  .usage-tab i {
    display: none; /* 小螢幕隱藏圖標，只顯示文字 */
  }
}

/* ============================================
   Token 管理頁面樣式
   ============================================ */

/* Tab 導航 */
.tab-navigation {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 0;
}

.tab-btn {
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.05);
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  color: #333333;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  justify-content: center;
  text-align: center;
}

.tab-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  border-color: #E62727;
  color: #E62727;
  transform: translateY(-2px);
}

.tab-btn.active {
  background: #E62727;
  border-color: #E62727;
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(230, 39, 39, 0.3);
}

.tab-btn i {
  font-size: 16px;
}

/* Token 產生區塊 */
.token-create-section {
  background: white;
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.token-create-section h3 {
  color: #E62727;
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.token-form {
  max-width: 100%;
}

.form-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #333333;
  border-radius: 12px;
  font-size: 16px;
  background: white;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.form-group select:focus {
  outline: none;
  border-color: #E62727;
  box-shadow: 0 0 0 3px rgba(230, 39, 39, 0.1);
}

.create-token-btn {
  max-width: 300px;
}

/* Token 列表 */
.tokens-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.token-card {
  background: white;
  padding: 1.5rem;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.token-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.token-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.token-code {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: 600;
  color: #E62727;
  cursor: pointer;
  padding: 8px 12px;
  background: rgba(230, 39, 39, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(230, 39, 39, 0.3);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.token-code:hover {
  background: rgba(230, 39, 39, 0.2);
  transform: translateY(-1px);
}

.token-status {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.token-status.active {
  background: rgba(0, 128, 0, 0.1);
  color: #008000;
  border: 1px solid rgba(0, 128, 0, 0.3);
}

.token-status.expired,
.token-status.exhausted {
  background: rgba(128, 128, 128, 0.1);
  color: #666666;
  border: 1px solid rgba(128, 128, 128, 0.3);
}

.token-status.disabled {
  background: rgba(230, 39, 39, 0.1);
  color: #E62727;
  border: 1px solid rgba(230, 39, 39, 0.3);
}

.token-info {
  space-y: 1rem;
}

.token-note {
  color: #333333;
  font-size: 14px;
  margin-bottom: 1rem;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.token-note i {
  color: #E62727;
}

.token-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.token-stat {
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
  text-align: center;
}

.token-stat .label {
  display: block;
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  font-weight: 500;
}

.token-stat .value {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #000000;
}

.token-usage {
  margin: 1rem 0;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.token-usage h5 {
  color: #E62727;
  margin-bottom: 0.75rem;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.usage-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.token-usage .usage-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  background: white;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.token-usage .usage-item .user {
  font-weight: 600;
  color: #000000;
}

.token-usage .usage-item .time {
  font-size: 12px;
  color: #666;
}

.token-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.token-btn {
  padding: 6px 12px;
  border: 1px solid #333333;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.1);
  color: #000000;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 500;
}

.token-btn:hover {
  background: rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.token-btn.danger {
  background: rgba(230, 39, 39, 0.1);
  border-color: #E62727;
  color: #E62727;
}

.token-btn.danger:hover {
  background: rgba(230, 39, 39, 0.2);
}

.token-btn.success {
  background: rgba(0, 128, 0, 0.1);
  border-color: #008000;
  color: #008000;
}

.token-btn.success:hover {
  background: rgba(0, 128, 0, 0.2);
}

/* ============================================
   響應式設計 - Token 管理
   ============================================ */

@media (max-width: 768px) {
  .tab-navigation {
    flex-direction: column;
    gap: 0.5rem;
  }

  .tab-btn {
    padding: 10px 16px;
    font-size: 13px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .tokens-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .token-card {
    padding: 1rem;
  }

  .token-header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }

  .token-code {
    font-size: 12px;
    word-break: break-all;
    text-align: center;
    width: 100%;
  }

  .token-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .token-actions {
    gap: 0.25rem;
  }

  .token-btn {
    font-size: 11px;
    padding: 4px 8px;
  }
}

@media (max-width: 480px) {
  .token-create-section {
    padding: 1.5rem;
  }

  .token-create-section h3 {
    font-size: 1rem;
  }

  .tab-btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .tab-btn i {
    display: none;
  }

  .token-stats {
    grid-template-columns: 1fr;
  }

  .token-stat {
    padding: 0.5rem;
  }

  .token-usage {
    padding: 0.75rem;
  }
}

/* ============================================
   自定義通知系統 - Modal & Toast
   ============================================ */

/* Modal 背景遮罩 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

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

/* Modal 主體 */
.modal {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 90vw;
  width: 500px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.8);
  transition: transform 0.3s ease;
}

.modal-overlay.show .modal {
  transform: scale(1);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #000000;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #666;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #E62727;
}

.modal-body {
  padding: 1.5rem;
  line-height: 1.6;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Toast 通知 */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 300px;
  pointer-events: auto;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.hide {
  transform: translateX(100%);
  opacity: 0;
}

.toast-icon {
  font-size: 1.25rem;
  margin-top: 0.125rem;
  flex-shrink: 0;
}

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

.toast-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.toast-message {
  color: #333333;
  font-size: 0.85rem;
  word-wrap: break-word;
}

.toast-close {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.3s ease;
  flex-shrink: 0;
  font-size: 1rem;
}

.toast-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #E62727;
}

/* Toast 類型樣式 */
.toast.success {
  border-left: 4px solid #10B981;
}

.toast.success .toast-icon {
  color: #10B981;
}

.toast.error {
  border-left: 4px solid #E62727;
}

.toast.error .toast-icon {
  color: #E62727;
}

.toast.warning {
  border-left: 4px solid #F59E0B;
}

.toast.warning .toast-icon {
  color: #F59E0B;
}

.toast.info {
  border-left: 4px solid #3B82F6;
}

.toast.info .toast-icon {
  color: #3B82F6;
}

/* Modal 按鈕樣式 */
.modal-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.modal-btn-primary {
  background: #E62727;
  color: white;
  border: 2px solid #E62727;
}

.modal-btn-primary:hover {
  background: #d61e1e;
  border-color: #d61e1e;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(230, 39, 39, 0.3);
}

.modal-btn-secondary {
  background: rgba(0, 0, 0, 0.1);
  color: #000000;
  border: 2px solid rgba(0, 0, 0, 0.2);
}

.modal-btn-secondary:hover {
  background: rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.modal-btn-danger {
  background: #E62727;
  color: white;
  border: 2px solid #E62727;
}

.modal-btn-danger:hover {
  background: #d61e1e;
  border-color: #d61e1e;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(230, 39, 39, 0.3);
}

.modal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ============================================
   美化下拉選單
   ============================================ */

/* 自定義 Select 樣式 */
.custom-select {
  position: relative;
  display: inline-block;
  width: 100%;
}

.custom-select select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  padding: 12px 40px 12px 16px;
  border: 2px solid #333333;
  border-radius: 12px;
  font-size: 16px;
  background: white;
  color: #000000;
  cursor: pointer;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.custom-select select:focus {
  outline: none;
  border-color: #E62727;
  box-shadow: 0 0 0 3px rgba(230, 39, 39, 0.1);
}

.custom-select select:hover {
  border-color: #E62727;
}

.custom-select::after {
  content: '\f107';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #333333;
  pointer-events: none;
  transition: all 0.3s ease;
}

.custom-select:hover::after {
  color: #E62727;
}

.custom-select select:focus + .custom-select::after,
.custom-select select:focus ~ .custom-select::after {
  color: #E62727;
  transform: translateY(-50%) rotate(180deg);
}

/* 響應式設計 */
@media (max-width: 768px) {
  .modal {
    width: 95vw;
    margin: 1rem;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1rem;
  }

  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .modal-footer {
    flex-direction: column;
  }

  .modal-btn {
    width: 100%;
    justify-content: center;
  }

  .toast {
    padding: 0.75rem 1rem;
  }

  .toast-title {
    font-size: 0.85rem;
  }

  .toast-message {
    font-size: 0.8rem;
  }
}

/* ============================================ */
/* 檢查間隔管理樣式 */
/* ============================================ */

.interval-section {
    padding: 1.5rem 0;
}

.interval-section h3 {
    color: #E62727;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.intervals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.interval-card {
    background: #FFFFFF;
    border: 1px solid #F0F0F0;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.2s ease;
    position: relative;
}

.interval-card:hover {
    box-shadow: 0 2px 12px rgba(230, 39, 39, 0.1);
    border-color: #E62727;
}

.interval-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.interval-header .user-info h4 {
    color: #000000;
    font-size: 1.2rem;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.interval-header .user-stats {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.interval-header .user-stats .stat {
    font-size: 0.85rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.interval-header .user-stats .stat.up {
    color: #27AE60;
}

.interval-header .user-stats .stat.down {
    color: #E62727;
}

.current-interval .interval-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    min-width: 60px;
}

.interval-badge.interval-fast {
    background: #FF6B6B;
    color: white;
}

.interval-badge.interval-medium {
    background: #FFB347;
    color: white;
}

.interval-badge.interval-normal {
    background: #51CF66;
    color: white;
}

.interval-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.interval-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.interval-info .info-item {
    display: flex;
    flex-direction: column;
}

.interval-info .info-item .label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.interval-info .info-item .value {
    color: #000000;
    font-weight: 600;
}

.interval-controls label {
    color: #000000;
}

.interval-buttons {
    display: flex;
    gap: 0.5rem;
}

.interval-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    background: #FFFFFF;
    color: #333333;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.interval-btn:hover {
    border-color: #E62727;
    background: #FFF5F5;
    color: #E62727;
}

.interval-btn.active {
    background: #E62727;
    border-color: #E62727;
    color: white;
}

.interval-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.interval-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: #E62727;
    font-weight: 500;
    gap: 0.5rem;
}

/* 檢查間隔響應式設計 */
@media (max-width: 768px) {
    .intervals-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .interval-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .interval-info {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .interval-buttons {
        flex-direction: column;
    }

    .interval-btn {
        width: 100%;
    }
}
