:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e2e4e9;
  --text: #1f2328;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Pretendard, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

#app {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 20px;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 32px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 20px 0 10px;
  color: var(--text-muted);
}

/* --- nav / top bar --- */
nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

nav button {
  background: transparent;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}

nav button:hover {
  background: var(--surface);
  color: var(--text);
}

nav a {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}

nav a:hover {
  color: var(--danger);
  text-decoration: underline;
}

/* --- forms --- */
form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  min-width: 0;
}

input:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
}

input::placeholder {
  color: #9ca3af;
}

input[type="file"] {
  border: none;
  padding: 4px 0;
}

button {
  padding: 8px 16px;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

button:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

button:active {
  transform: translateY(1px);
}

/* secondary actions inside table rows */
td button {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
  padding: 4px 10px;
  font-size: 13px;
  margin-right: 4px;
}

td button:hover {
  background: #fef2f2;
  color: var(--danger);
  border-color: var(--danger);
}

/* --- tables --- */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  background: #fafafb;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: #fafbff;
}

/* --- status text --- */
.error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 16px;
}

.message {
  background: #f0fdf4;
  color: var(--success);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 16px;
}

.count-summary {
  color: var(--text-muted);
  font-size: 13px;
  margin: -8px 0 12px;
}

/* --- auth screens --- */
#auth-checking,
#auth-required {
  max-width: 420px;
  margin: 120px auto 0;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 32px;
}

#auth-required h2 {
  margin-bottom: 8px;
}

#auth-required p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

#auth-required a {
  display: inline-block;
  padding: 10px 20px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 500;
}

#auth-required a:hover {
  background: var(--primary-hover);
}
