/* ═══════ 全局 ═══════ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f7fa;
  color: #333;
  min-height: 100vh;
}
.hidden { display: none !important; }
.error { color: #e53e3e; font-size: 13px; margin-top: 8px; min-height: 18px; }
.required { color: #e53e3e; }

/* ═══════ 登录页 ═══════ */
#login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
  background: #fff; border-radius: 12px; padding: 40px;
  width: 380px; max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.login-card h2 { text-align: center; margin-bottom: 24px; font-size: 22px; }
.login-card label { display: block; margin-bottom: 4px; font-size: 14px; color: #555; }
.login-card input {
  width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px;
  font-size: 15px; margin-bottom: 16px; outline: none; transition: border 0.2s;
}
.login-card input:focus { border-color: #667eea; }
.login-card button {
  width: 100%; padding: 12px; background: #667eea; color: #fff;
  border: none; border-radius: 6px; font-size: 16px; cursor: pointer;
  transition: background 0.2s;
}
.login-card button:hover { background: #5a6fd6; }
.login-card button:disabled { background: #aaa; cursor: not-allowed; }

/* ═══════ 主页 ═══════ */
#main-page { padding: 24px; max-width: 1100px; margin: 0 auto; }
header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
header h1 { font-size: 22px; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ═══════ 页签 ═══════ */
.tab-bar {
  display: flex; gap: 0; margin-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
}
.tab-btn {
  padding: 10px 20px; background: none; border: none;
  font-size: 15px; color: #666; cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.2s;
}
.tab-btn:hover { color: #667eea; }
.tab-btn.active {
  color: #667eea; font-weight: 600;
  border-bottom-color: #667eea;
}
.tab-panel { }

/* ═══════ 按钮 ═══════ */
.btn-primary {
  padding: 8px 16px; background: #667eea; color: #fff;
  border: none; border-radius: 6px; font-size: 14px; cursor: pointer;
}
.btn-primary:hover { background: #5a6fd6; }
.btn-secondary {
  padding: 8px 16px; background: #edf2f7; color: #333;
  border: 1px solid #ddd; border-radius: 6px; font-size: 14px; cursor: pointer;
}
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger {
  padding: 8px 16px; background: #e53e3e; color: #fff;
  border: none; border-radius: 6px; font-size: 14px; cursor: pointer;
}
.btn-danger:hover { background: #c53030; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 4px; }
.btn-warning {
  padding: 5px 10px; background: #ed8936; color: #fff;
  border: none; border-radius: 4px; font-size: 12px; cursor: pointer;
}
.btn-warning:hover { background: #dd6b20; }
.btn-success {
  padding: 5px 10px; background: #38a169; color: #fff;
  border: none; border-radius: 4px; font-size: 12px; cursor: pointer;
}
.btn-success:hover { background: #2f855a; }

/* ═══════ 表格 ═══════ */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse;
  background: #fff; border-radius: 8px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
th { background: #f7fafc; text-align: left; padding: 12px 14px; font-size: 13px; color: #666; }
td { padding: 12px 14px; border-top: 1px solid #edf2f7; font-size: 14px; }
tr:hover td { background: #f7fafc; }
.loading { text-align: center; color: #999; padding: 32px !important; }
.badge {
  display: inline-block; padding: 3px 8px; border-radius: 10px;
  font-size: 12px; font-weight: 500;
}
.badge-active { background: #c6f6d5; color: #22543d; }
.badge-disabled { background: #fed7d7; color: #9b2c2c; }
.actions-cell { display: flex; gap: 4px; flex-wrap: wrap; }

/* ═══════ Modal ═══════ */
.modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); display: flex;
  align-items: center; justify-content: center; z-index: 100;
}
.modal-content {
  background: #fff; border-radius: 12px; padding: 28px;
  width: 420px; max-width: 90vw; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-content h3 { margin-bottom: 20px; font-size: 18px; }
.modal-content label { display: block; margin-bottom: 4px; font-size: 14px; color: #555; }
.modal-content input {
  width: 100%; padding: 9px 12px; border: 1px solid #ddd; border-radius: 6px;
  font-size: 14px; margin-bottom: 14px; outline: none;
}
.modal-content input:focus { border-color: #667eea; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ═══════ 租户详情页 ═══════ */
.detail-header {
  display: flex; align-items: center; margin-bottom: 20px;
}
.detail-card {
  background: #fff; border-radius: 10px; padding: 20px 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.detail-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.detail-card-header h3 { font-size: 16px; margin: 0; }
.detail-info-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.info-item { display: flex; flex-direction: column; gap: 4px; }
.info-label { font-size: 12px; color: #888; }
.info-value { font-size: 14px; color: #333; font-weight: 500; }
.info-input {
  padding: 6px 10px; border: 1px solid #ddd; border-radius: 5px;
  font-size: 14px; outline: none; width: 100%;
}
.info-input:focus { border-color: #667eea; }
.account-row-clickable { cursor: pointer; }
.account-row-clickable:hover td { background: #edf2f7; }

/* ═══════ 响应式 ═══════ */
@media (max-width: 600px) {
  #main-page { padding: 12px; }
  header { flex-direction: column; align-items: flex-start; }
  .header-actions { width: 100%; }
  .login-card { padding: 24px; }
  th, td { padding: 8px 10px; font-size: 13px; }
}
