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

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1a1d21;
  --muted: #6b7280;
  --accent: #2563eb;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0, 0, 0, .07), 0 6px 20px rgba(0, 0, 0, .05);
}

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

/* ---------- shared ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.btn:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.center-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

/* ---------- login ---------- */
.login-card {
  padding: 48px 44px;
  text-align: center;
  max-width: 380px;
  width: 100%;
}
.login-card .logo { font-size: 44px; margin-bottom: 12px; }
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card p { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.login-error {
  display: none;
  margin-top: 18px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
}

/* ---------- error pages ---------- */
.error-card { padding: 48px 44px; text-align: center; max-width: 420px; }
.error-card .error-icon { font-size: 44px; margin-bottom: 12px; }
.error-card h1 { font-size: 20px; margin-bottom: 8px; }
.error-card p { color: var(--muted); font-size: 14px; margin-bottom: 24px; }

/* ---------- dashboard ---------- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
header .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; }
header .user { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
header .user img { width: 30px; height: 30px; border-radius: 50%; }
header .user a { color: var(--accent); text-decoration: none; font-weight: 500; }

main { max-width: 1080px; margin: 0 auto; padding: 36px 24px; }
main h2 { font-size: 15px; font-weight: 500; color: var(--muted); margin-bottom: 20px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.tool-card {
  display: block;
  padding: 22px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s, transform .15s;
}
.tool-card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,.08), 0 12px 28px rgba(0,0,0,.08); }
.tool-card .icon-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.tool-card .icon { font-size: 32px; }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; }
.dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .15); }
.dot.off { background: #d1d5db; }

.pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .55; transform: scale(.92); }
}
.tool-card h3 { font-size: 16px; margin-bottom: 6px; }
.tool-card p { font-size: 13px; color: var(--muted); line-height: 1.45; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 15px;
}

/* ---------- admin ---------- */
.brand-sub { color: var(--muted); font-weight: 400; }
.admin-note { font-size: 13px; color: var(--muted); margin: -8px 0 20px; max-width: 720px; }
.admin-card { padding: 18px 22px; margin-bottom: 14px; }
.admin-card.tool-off { opacity: .55; }
.admin-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.admin-icon { font-size: 24px; }
.admin-name { font-weight: 600; font-size: 15px; flex: 1; }
.toggle-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 13px;
}
.chip button {
  border: 0; background: none; cursor: pointer; font-size: 15px;
  color: var(--muted); line-height: 1; padding: 2px 6px; border-radius: 999px;
}
.chip button:hover { color: #b91c1c; background: #fee2e2; }
.chip-empty { color: var(--muted); padding-right: 12px; }
.add-form { display: flex; gap: 8px; }
.add-form input {
  flex: 0 1 280px; padding: 7px 12px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 8px;
}
.btn-small { padding: 6px 14px; font-size: 13px; }
