:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --ink: #1b2430;
  --muted: #66788a;
  --line: #d7e1ee;
  --brand: #0b6cff;
  --brand-2: #00a86b;
  --warn: #f5a524;
  --danger: #e5484d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at 20% 10%, #e9f1ff 0%, var(--bg) 40%), var(--bg);
  color: var(--ink);
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.auth-card {
  width: min(460px, 96vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}

.auth-card h2 {
  margin: 0 0 8px;
}

.auth-form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.auth-submit {
  width: 100%;
}

.auth-message {
  margin-top: 10px;
}

.auth-message.warn {
  color: #8f5a00;
}

.auth-message.ok {
  color: #0b6b41;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, #152238 0%, #0e1727 100%);
  color: #dce9ff;
  padding: 20px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
}

.brand p {
  margin: 6px 0 18px;
  color: #98b3d9;
  font-size: 13px;
}

.nav-btn {
  width: 100%;
  margin-bottom: 10px;
  border: 1px solid #314968;
  background: #182842;
  color: #dce9ff;
  padding: 10px 12px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: 0.2s;
}

.nav-btn.active,
.nav-btn:hover {
  background: #0b6cff;
  border-color: #0b6cff;
  color: #fff;
}

.main {
  padding: 20px;
}

.topbar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.topbar h2 {
  margin: 0;
  font-size: 22px;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.role-box {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.backend-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: #f7fbff;
  color: #3b5874;
  font-size: 12px;
}

.backend-status.ok {
  background: #eaf8f0;
  border-color: #bde5cb;
  color: #0b6b41;
}

.backend-status.warn {
  background: #fff7e8;
  border-color: #ffe1ac;
  color: #8f5a00;
}

.backend-status.loading {
  background: #eef5ff;
  border-color: #cadfff;
  color: #204b85;
}

.current-user {
  color: #1f3b57;
  font-size: 13px;
}

.role-box select,
input,
textarea,
button {
  font: inherit;
}

select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
}

.view {
  margin-top: 14px;
}

.hidden {
  display: none;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.card h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 10px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  color: #3a4a5c;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
}

a.btn {
  text-decoration: none;
  display: inline-block;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
}

.btn.secondary {
  background: #eef3fb;
  border-color: var(--line);
  color: #18324f;
}

.btn.success {
  background: var(--brand-2);
  color: #fff;
}

.btn.warn {
  background: var(--warn);
  color: #fff;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-compact {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 8px;
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

.table th {
  color: #3b5874;
  background: #f7fbff;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.tag.blue {
  background: #dceaff;
  color: #12457f;
}

.tag.green {
  background: #d8f7ea;
  color: #0c6642;
}

.tag.orange {
  background: #fff1d6;
  color: #995d00;
}

.tag.gray {
  background: #edf1f7;
  color: #556577;
}

.inquiry-actions-cell {
  min-width: 190px;
}

.table-action-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.table-action-select {
  min-width: 120px;
}

.table-pager {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.pager-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.notice {
  padding: 10px;
  border-radius: 10px;
  background: #eef5ff;
  border: 1px solid #cadfff;
  color: #204b85;
  font-size: 13px;
}

.notice.warn {
  background: #fff7e8;
  border-color: #ffe1ac;
  color: #8f5a00;
}

.score-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 12px;
  }

  .main {
    padding: 12px;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .score-row {
    grid-template-columns: 1fr;
  }
}
