:root {
  /* 화이트 베이스 */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-hover: #eef2f8;
  --border: #dde3ec;
  --text: #1c2434;
  --muted: #5a6578;
  /* 남색 포인트 */
  --accent: #1e3a6e;
  --accent-hover: #152a52;
  --accent-soft: rgba(30, 58, 110, 0.1);
  --accent-ring: rgba(30, 58, 110, 0.22);
  --success: #0d7a4f;
  --warning: #b45309;
  --danger: #c53030;
  --sidebar-w: 260px;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(28, 36, 52, 0.08);
  --shadow-card: 0 1px 3px rgba(28, 36, 52, 0.06);
  --font: "Pretendard", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(165deg, #f8fafc 0%, #eef2f9 40%, #e8edf6 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.25rem 2rem;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.login-card .sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, border-color 0.15s, color 0.15s;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.5rem;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: #c5cdd9;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

.btn-danger {
  background: rgba(197, 48, 48, 0.08);
  color: var(--danger);
  border: 1px solid rgba(197, 48, 48, 0.35);
}

.btn-danger:hover {
  background: rgba(197, 48, 48, 0.14);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 12px rgba(28, 36, 52, 0.04);
}

.sidebar-brand {
  padding: 0 1.25rem 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.sidebar-brand strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.sidebar-brand span {
  font-size: 0.8rem;
  color: var(--muted);
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-nav a {
  display: block;
  padding: 0.65rem 1.25rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.sidebar-nav a:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.sidebar-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem 0;
  border-top: 1px solid var(--border);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 2rem;
  overflow-x: auto;
  background: var(--bg);
}

.page-title {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.page-desc {
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}

.table-wrap {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f8fafc;
}

.data-table tr:hover td {
  background: #f8fafc;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-pending {
  background: #fffbeb;
  color: var(--warning);
  border: 1px solid #fde68a;
}

.badge-answered {
  background: #ecfdf5;
  color: var(--success);
  border: 1px solid #a7f3d0;
}

.badge-closed {
  background: #f1f5f9;
  color: var(--muted);
  border: 1px solid var(--border);
}

.row-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.row-flex .field {
  flex: 1;
  min-width: 160px;
}

.content-html {
  line-height: 1.65;
  color: var(--text);
}

.content-html p {
  margin: 0 0 0.75rem;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-hover);
}

.pagination-meta {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.pagination-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.pagination-pages a,
.pagination-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.pagination-pages a {
  color: var(--accent);
  border: 1px solid var(--border);
  background: var(--surface);
}

.pagination-pages a:hover {
  background: var(--surface-hover);
  border-color: #c5cdd9;
}

.pagination-current {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

.pagination-disabled {
  font-size: 0.85rem;
  color: var(--muted);
  opacity: 0.65;
  user-select: none;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal.is-open {
  visibility: visible;
  opacity: 1;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 36, 52, 0.45);
  cursor: pointer;
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 920px;
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--accent);
}

.modal-header .sub {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.modal-close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 8px;
  background: var(--surface-hover);
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--border);
}

.modal-body {
  padding: 1rem 1.25rem 1.25rem;
  overflow: auto;
}

.modal-table-wrap {
  max-height: min(60vh, 520px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.modal-table-wrap table {
  margin: 0;
}

.modal-table-wrap .data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.modal-table-wrap .form-control {
  margin: 0;
  padding: 0.4rem 0.5rem;
  font-size: 0.875rem;
}

.modal-table-wrap .score-col {
  width: 7rem;
}

.modal-table-wrap .memo-col {
  min-width: 8rem;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 8px rgba(28, 36, 52, 0.06);
  }

  .sidebar-brand {
    border: none;
    margin: 0;
    padding: 0 1rem 0 0;
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    flex: 1;
  }

  .sidebar-nav a {
    border-left: none;
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
  }

  .sidebar-nav a.active {
    border-left: none;
  }

  .sidebar-footer {
    border: none;
    padding: 0;
    margin: 0;
    width: 100%;
  }

  .main {
    padding: 1rem;
  }
}
