:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --muted: #8b92a8;
  --border: #e8eaf2;
  --primary: #4a6cf7;
  --accent: #f3e5ff;
  --accent-2: #ffe5ee;
  --toggle-off: #e8f1ff;
  --danger: #ff6b9d;
  --text: #1a1d2e;
  --shadow: 0 4px 20px rgba(28, 39, 63, 0.06);
  --shadow-lg: 0 10px 40px rgba(28, 39, 63, 0.12);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: linear-gradient(135deg, #f5f7fa 0%, #f9fafb 100%);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    "Apple SD Gothic Neo", "Noto Sans KR", "맑은 고딕", sans-serif;
}

/* alert */
.alert-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  visibility: hidden;
  width: 90%;
  max-width: 400px;
  background: linear-gradient(135deg, #ff6b9d 0%, #f7a8b8 100%);
  color: white;
  padding: 32px 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transition: all 0.3s ease;
  text-align: center;
}

.alert-banner.show {
  opacity: 1;
  visibility: visible;
}
.alert-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.alert-content h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px;
}
.alert-content p {
  font-size: 15px;
  margin: 0;
  opacity: 0.95;
}
.alert-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: white;
  font-size: 20px;
  cursor: pointer;
  position: absolute;
  top: 16px;
  right: 16px;
}

/* layout */
.app {
  max-width: 1100px;
  margin: 24px auto 80px;
  padding: 0 20px;
}
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-weight: 700;
  letter-spacing: 0.3px;
}
.brand b {
  padding: 8px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4a6cf7 0%, #6c8aff 100%);
  color: white;
  box-shadow: var(--shadow);
}
.actions {
  display: flex;
  gap: 14px;
  align-items: center;
}
.icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  box-shadow: var(--shadow);
  color: #555;
  cursor: pointer;
  transition: 0.2s;
}
.icon:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* grid */
.grid {
  display: grid;
  grid-template-columns: 1.2fr 320px;
  gap: 24px;
}
@media (max-width: 980px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* left column */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 23px;
  min-height: 130px;
  transition: all 0.3s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.card h4 {
  margin: 0 0 12px;
  font-size: 15px;
  color: #586174;
}
.badge {
  display: inline-block;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px dashed #e3e6ef;
  color: #21b684;
  background: #fafbff;
}

/* toggle tile */
.tile-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}
.tile {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 16px;
  background: linear-gradient(180deg, var(--toggle-off), #f1f6ff);
  min-height: 120px;
}
.toggle {
  width: 220px;
  height: 64px;
  background: #e7f0ff;
  border-radius: 40px;
  padding: 6px;
  position: relative;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
  cursor: pointer;
}
.knob {
  width: 52px;
  height: 52px;
  background: #b42f2f;
  border-radius: 50%;
  position: absolute;
  right: 6px;
  top: 6px;
  transition: all 0.25s ease;
}
.toggle.on .knob {
  transform: translateX(-156px);
  background: #35aa25;
}

/* login panel */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  min-height: 360px;
}
.panel .lock {
  margin: 26px auto 16px;
  width: 68px;
  height: 68px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #fafbff;
  border: 1px solid var(--border);
  color: #888;
  font-size: 28px;
}
.input {
  width: 100%;
  background: #fafbff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.loginbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fccef6;
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
  cursor: pointer;
  margin-top: 10px;
  font-weight: 800;
}

/* board */
.board {
  background: #fff0fb;
  border: 2px dashed #e8b3ff;
  border-radius: var(--radius);
  min-height: 120px;
  padding: 16px;
}
.placeholder {
  color: #b28ac9;
}

/* buttons */
.emergency {
  border: none;
  background: linear-gradient(135deg, #ff6b9d 0%, #f7a8b8 100%);
  color: white;
  padding: 40px 140px;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  font-weight: 700;
  cursor: pointer;
  transition: 0.3s;
}
.emergency:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(255, 107, 157, 0.4);
}
.condevice {
  border: none;
  background: linear-gradient(135deg, #1f54c5 0%, #3e4796 100%);
  color: white;
  padding: 40px 140px;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  font-weight: 700;
  cursor: pointer;
}
