:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --border: #e2e2e7;
  --text-1: #1a1a1f;
  --text-2: #55555f;
  --text-3: #8a8a94;
  --primary: #6d28d9;
  --primary-dark: #5b21b6;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --r-sm: 6px;
  --r-md: 10px;
}

* { box-sizing: border-box; }

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

.wrap { max-width: 1100px; margin: 0 auto; padding: 40px 20px; }
.top-row { display: grid; grid-template-columns: 2fr 3fr; gap: 20px; align-items: start; }
.top-row > .card:last-child .scroll-table { max-height: 520px; }
@media (max-width: 800px) { .top-row { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px 24px;
  margin-bottom: 20px;
}

h1 { font-size: 1.4rem; margin: 0 0 4px; }
h2 { font-size: 1rem; margin: 0 0 16px; }
p.hint { color: var(--text-2); font-size: 0.875rem; margin: 0 0 14px; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card { width: 320px; }

label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="date"], input[type="file"], textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 0.9rem;
  margin-bottom: 12px;
  background: var(--surface);
  color: var(--text-1);
}
textarea { min-height: 52px; resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--primary); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

button {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  border: none;
  cursor: pointer;
}
button.primary { background: var(--primary); color: white; }
button.primary:hover { background: var(--primary-dark); }
button.ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
button.danger { background: var(--danger-light); color: var(--danger); }
button.delete-icon { background: none; border: none; color: var(--text-3); font-size: 1.1rem; padding: 4px 6px; line-height: 1; }
button.delete-icon:hover { color: var(--danger); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.banner { padding: 10px 14px; border-radius: var(--r-sm); font-size: 0.85rem; margin-bottom: 16px; }
.banner.error { background: var(--danger-light); color: var(--danger); }
.banner.success { background: var(--success-light); color: var(--success); }
.hidden { display: none !important; }

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }

.scroll-table { max-height: 360px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r-sm); }
.scroll-table table { margin: 0; }
.scroll-table thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-3); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
.muted { color: var(--text-3); }

.changelog-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.78rem;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.changelog-link:hover { color: var(--primary-dark); }
.changelog-link.muted { color: var(--text-3); text-decoration: none; cursor: default; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 24, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-md);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { margin: 0; font-size: 1rem; }
.icon-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px;
}
.icon-btn:hover { color: var(--text-1); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-body h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  margin: 0 0 8px;
}
.modal-body section + section { margin-top: 18px; }
.modal-body ul { margin: 0; padding-left: 20px; font-size: 0.88rem; line-height: 1.5; }
.modal-body li { margin-bottom: 6px; }
.modal-body li:last-child { margin-bottom: 0; }
