:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2f6bff;
  --primary-hover: #1f57e6;
  --border: #e5e7eb;
  --danger: #dc2626;
  --sidebar: #1f2430;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--primary);
  text-decoration: none;
}

/* ===== Login (参考截图风格) ===== */
.login-page {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 110%, rgba(120, 160, 255, 0.25), transparent 55%),
    radial-gradient(ellipse at 70% 20%, rgba(255, 200, 120, 0.15), transparent 40%),
    linear-gradient(180deg, #070b16 0%, #10182b 45%, #1a1030 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 40% 70%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 65% 25%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 80% 55%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 10% 80%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1.5px 1.5px at 90% 15%, rgba(255, 255, 255, 0.7), transparent);
  opacity: 0.9;
  pointer-events: none;
}

.login-page::after {
  content: "";
  position: absolute;
  left: -20%;
  right: -20%;
  bottom: -35%;
  height: 70%;
  background:
    radial-gradient(ellipse at center, rgba(255, 180, 90, 0.35), transparent 55%),
    radial-gradient(ellipse at 50% 0%, #2a1a3a 0%, #0b1020 70%);
  border-radius: 50%;
  box-shadow: 0 0 80px rgba(120, 150, 255, 0.15);
  pointer-events: none;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  padding: 36px 32px 28px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.login-title {
  margin: 0 0 28px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: #243447;
}

.login-form .input-with-icon {
  position: relative;
  margin-bottom: 16px;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  display: flex;
}

.input-with-icon input {
  width: 100%;
  height: 44px;
  border: 1px solid #d1d5db;
  border-radius: 2px;
  padding: 0 12px 0 40px;
  font-size: 14px;
  outline: none;
}

.input-with-icon input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12);
}

.btn-login {
  width: 100%;
  height: 44px;
  margin-top: 8px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
}

/* ===== Layout ===== */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 230px;
  background: var(--sidebar);
  color: #f3f4f6;
  padding: 18px 12px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.brand {
  font-size: 15px;
  font-weight: 700;
  padding: 8px 10px 16px;
  letter-spacing: 0.2px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #3b82f6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 14px;
  font-weight: 600;
}

.sidebar-user-role {
  font-size: 12px;
  color: #9ca3af;
}

.sidebar-nav {
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d1d5db;
  padding: 11px 12px;
  border-radius: 8px;
  margin-bottom: 4px;
}

.nav-item:hover,
.nav-item.active {
  background: var(--sidebar-hover);
  color: #fff;
  text-decoration: none;
}

.nav-icon {
  display: flex;
  opacity: 0.9;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-item.logout {
  color: #fca5a5;
}

.main {
  flex: 1;
  padding: 24px;
  min-width: 0;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.page-header h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.stat-card {
  background: #eaf2ff;
  border: 1px solid #d7e6ff;
  border-radius: 8px;
  padding: 16px 18px;
}

.stat {
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
  color: #1e3a8a;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 6px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
}

.btn:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #e5e7eb;
  color: #111827;
}

.btn-secondary:hover {
  background: #d1d5db;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar input[type="text"] {
  width: 240px;
  max-width: 100%;
}

label {
  display: block;
  font-weight: 600;
  margin: 12px 0 6px;
  font-size: 13px;
}

input[type="text"],
input[type="password"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 14px;
}

.data-table th {
  color: #4b5563;
  font-weight: 600;
  background: #f9fafb;
}

.data-table .empty {
  text-align: center;
  color: var(--muted);
  padding: 28px;
}

.feedback-content {
  white-space: pre-wrap;
  max-width: 360px;
  word-break: break-word;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-ok {
  background: #d1fae5;
  color: #065f46;
}

.badge-off {
  background: #fee2e2;
  color: #991b1b;
}

.badge-pending {
  background: #fef3c7;
  color: #92400e;
}

.badge-read {
  background: #dbeafe;
  color: #1e40af;
}

.badge-resolved {
  background: #d1fae5;
  color: #065f46;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.link-btn {
  border: none;
  background: none;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  font-size: 14px;
}

.link-btn.danger {
  color: var(--danger);
}

.alert {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 10px;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.modal-panel h3 {
  margin: 0 0 8px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* 兼容旧页面 */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.topbar h2 {
  margin: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.tabs a {
  display: inline-block;
  padding: 8px 12px;
  margin-right: 8px;
  border-radius: 8px;
  background: #e5e7eb;
  color: #111827;
}

.tabs a.active {
  background: var(--primary);
  color: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .page-header {
    flex-direction: column;
  }

  .toolbar input[type="text"] {
    width: 100%;
  }
}
