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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #e0e0e0;
  --text-dim: #888;
  --accent: #25D366;
  --accent-hover: #1da851;
  --danger: #e74c3c;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
h2 { font-size: 1.1rem; margin-bottom: 0.75rem; color: var(--text-dim); }
h3 { font-size: 1rem; margin-bottom: 0.5rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

input[type="text"], input[type="password"], input[type="time"], select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #c0392b; }

.btn-secondary {
  background: var(--border);
  color: var(--text);
}
.btn-secondary:hover { background: #333; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.form-group { margin-bottom: 0.75rem; }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-dot.connected { background: var(--accent); }
.status-dot.disconnected { background: var(--danger); }
.status-dot.reconnecting { background: #f39c12; }

.group-list { list-style: none; max-height: 300px; overflow-y: auto; }
.group-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.group-list li:last-child { border-bottom: none; }

.archive-warn {
  margin-left: auto;
  color: #f39c12;
  font-size: 0.85rem;
  cursor: help;
}

.day-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}
.day-row:last-child { border-bottom: none; }

.day-name {
  width: 36px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}

.day-row.disabled .day-name { color: var(--text-dim); }

.day-row input[type="time"] {
  width: 100px;
  margin-bottom: 0;
  padding: 0.3rem 0.4rem;
  font-size: 0.8rem;
}

.day-arrow {
  color: var(--text-dim);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.allday-label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  margin-left: auto;
  cursor: pointer;
}

.switch-sm {
  position: relative;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
}
.switch-sm input { opacity: 0; width: 0; height: 0; }
.switch-sm .slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 18px;
  cursor: pointer;
  transition: background 0.2s;
}
.switch-sm .slider:before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  bottom: 2px;
  background: var(--text);
  border-radius: 50%;
  transition: transform 0.2s;
}
.switch-sm input:checked + .slider { background: var(--accent); }
.switch-sm input:checked + .slider:before { transform: translateX(14px); }

.copy-buttons {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

#day-rows { margin-bottom: 0.25rem; }

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.tabs { display: flex; gap: 0.25rem; margin-bottom: 0.75rem; }
.tab {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
}
.tab.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 600;
}

#qr-img {
  display: block;
  margin: 1rem auto;
  border-radius: 8px;
}

.hidden { display: none; }

.error { color: var(--danger); font-size: 0.85rem; margin-bottom: 0.5rem; }
.success { color: var(--accent); font-size: 0.85rem; margin-bottom: 0.5rem; }

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}
.slider:before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text);
  border-radius: 50%;
  transition: transform 0.2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(20px); }
