:root {
  --bg: #eef3f8;
  --bg-accent: #d9e6f2;
  --panel: #ffffff;
  --text: #1c2b3a;
  --muted: #5b6b7c;
  --primary: #1f6f8b;
  --primary-dark: #15556b;
  --danger: #c0392b;
  --danger-dark: #9b2d22;
  --border: #c9d6e3;
  --stripe: #f3f8fc;
  --ok-bg: #e8f6ef;
  --ok-text: #1d6b45;
  --err-bg: #fdecea;
  --err-text: #9b2d22;
  --shadow: 0 10px 28px rgba(28, 43, 58, 0.08);
  --radius: 14px;
  --font: "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at top left, #cfe3f2 0%, transparent 42%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 100%);
  min-height: 100vh;
}

.page {
  width: min(960px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.header h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem 1.4rem;
  margin-bottom: 1.25rem;
}

.panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.form-mode {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.field {
  margin-bottom: 0.9rem;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.field input {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: #f8fbfe;
}

.field input:focus {
  outline: 2px solid rgba(31, 111, 139, 0.35);
  border-color: var(--primary);
  background: #fff;
}

.actions,
.list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.actions {
  margin-top: 0.4rem;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #e8eef4;
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: #d7e1ea;
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: #e8f2f6;
}

.btn-edit {
  background: #e8f2f6;
  color: var(--primary-dark);
}

.btn-edit:hover {
  background: #d5e7ef;
}

.btn-delete {
  background: #fdecea;
  color: var(--danger-dark);
}

.btn-delete:hover {
  background: #f8d7d3;
}

.btn-sm {
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
}

.hidden {
  display: none !important;
}

.message {
  min-height: 1.3rem;
  margin: 0.2rem 0 0.8rem;
  font-size: 0.92rem;
}

.message.ok {
  color: var(--ok-text);
  background: var(--ok-bg);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}

.message.error {
  color: var(--err-text);
  background: var(--err-bg);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  border: 1px solid var(--border);
}

th,
td {
  text-align: left;
  padding: 0.75rem 0.6rem;
  border: 1px solid var(--border);
  vertical-align: middle;
}

th {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 700;
  background: #eaf2f8;
}

/* zebra-stripe */
#users-tbody tr:nth-child(even) {
  background: var(--stripe);
}

#users-tbody tr:hover {
  background: #e7f1f8;
}

td {
  font-size: 0.95rem;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 1.5rem 0.6rem !important;
}

.row-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .page {
    width: min(100% - 1.2rem, 960px);
    padding-top: 1.2rem;
  }

  .panel {
    padding: 1rem;
  }

  .list-header {
    flex-direction: column;
    align-items: flex-start;
  }

  table {
    min-width: 560px;
  }
}
