* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', -apple-system, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: #16202d;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 28px 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #4361ee;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -1px;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 20px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: .5px;
}

.sidebar-nav {
  list-style: none;
  padding: 16px 12px;
  flex: 1;
}

.sidebar-nav li {
  margin-bottom: 4px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  border-radius: 10px;
  transition: background .2s, color .2s;
}

.sidebar-nav a i {
  font-style: normal;
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,.06);
  color: #e2e8f0;
}

.sidebar-nav a.active {
  background: #4361ee;
  color: #fff;
  box-shadow: 0 4px 12px rgba(67, 97, 238, .35);
}

.sidebar-footer {
  padding: 16px 24px;
  font-size: 12px;
  color: #475569;
  border-top: 1px solid rgba(255,255,255,.06);
}

.main {
  margin-left: 240px;
  flex: 1;
  padding: 32px 40px;
  min-width: 0;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.page-header p {
  color: #64748b;
  font-size: 14px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.card .label {
  color: #64748b;
  font-size: 13px;
  margin-bottom: 8px;
  font-weight: 500;
}

.card .value {
  font-size: 32px;
  font-weight: 800;
  color: #0f172a;
}

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

.toolbar h2 {
  font-size: 18px;
  font-weight: 600;
  color: #334155;
}

.btn {
  padding: 9px 18px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
  transition: background .15s, box-shadow .15s;
}

.btn-primary {
  background: #4361ee;
  color: #fff;
}

.btn-primary:hover {
  background: #3651d4;
  box-shadow: 0 4px 12px rgba(67, 97, 238, .3);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }

.btn-toggle { background: #e0e7ff; color: #4338ca; }
.btn-toggle:hover { background: #c7d2fe; }

.row-actions {
  display: inline-flex;
  gap: 6px;
}

.table-wrap {
  overflow: auto;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 16px;
  font-size: 13px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
}

th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
  position: sticky;
  top: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

tbody tr:nth-child(even) td { background: #fafbfc; }
tbody tr:hover td { background: #f0f4ff; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-false { background: #dcfce7; color: #15803d; }
.badge-true  { background: #fee2e2; color: #dc2626; }
.badge-frozen { background: #dbeafe; color: #1d4ed8; }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  width: 620px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px rgba(15, 23, 42, .2);
}

.modal h3 {
  margin-bottom: 16px;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.modal textarea {
  width: 100%;
  min-height: 200px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  resize: vertical;
  margin-bottom: 16px;
  transition: border-color .2s;
}

.modal textarea:focus {
  outline: none;
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67, 97, 238, .12);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-cancel { background: #f1f5f9; color: #475569; }
.btn-cancel:hover { background: #e2e8f0; }

.msg {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 500;
}

.msg-ok  { background: #dcfce7; color: #15803d; }
.msg-err { background: #fee2e2; color: #dc2626; }

.empty {
  text-align: center;
  padding: 48px;
  color: #94a3b8;
  font-size: 14px;
}
