/* ===== 会议室预约系统 全局样式 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: #f3f5f9;
  color: #1f2937;
  font-size: 14px;
  line-height: 1.6;
}
a { color: #2563eb; text-decoration: none; }
a:hover { opacity: .85; }
h1,h2,h3 { color: #111827; font-weight: 600; }
h2 { font-size: 20px; }
h3 { font-size: 15px; margin-bottom: 10px; }
code { background: #eef2ff; padding: 1px 6px; border-radius: 4px; font-size: 12px; }

/* ---- 顶栏 ---- */
.topbar { background: #ffffff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 50; }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; color: #111827; }
.brand-logo { height: 30px; width: auto; max-width: 120px; object-fit: contain; }
.brand-name { white-space: nowrap; }
.main-nav { display: flex; gap: 4px; flex: 1; }
.main-nav a { padding: 6px 12px; border-radius: 8px; color: #4b5563; font-weight: 500; }
.main-nav a:hover { background: #f3f4f6; }
.main-nav a.active { background: #2563eb; color: #fff; }
.user-box { display: flex; align-items: center; gap: 10px; }
.user-name { color: #374151; font-weight: 500; }

/* ---- 布局 ---- */
.container { max-width: 1280px; margin: 20px auto 40px; padding: 0 16px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.page-head h2 { margin-bottom: 2px; }
.week-range { color: #6b7280; font-size: 13px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.footer { text-align: center; color: #9ca3af; font-size: 12px; padding: 20px 0 30px; }
.footer a { color: #9ca3af; }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 8px 16px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff;
  color: #374151; font-size: 13px; cursor: pointer; line-height: 1.4;
  transition: all .15s; text-decoration: none;
}
.btn:hover { border-color: #9ca3af; opacity: 1; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-danger { background: #ef4444; border-color: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: #fff; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }

/* ---- 卡片 ---- */
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.card-sub { color: #6b7280; font-size: 13px; margin-bottom: 10px; }
.row-gap { display: flex; gap: 10px; }
.row-gap-sm { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hint { color: #6b7280; font-size: 12px; margin-top: 4px; }
.muted { color: #9ca3af; }

/* ---- 表单 ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.form-item { display: flex; flex-direction: column; gap: 6px; }
.form-item-wide { grid-column: 1 / -1; }
.form-item label { font-size: 13px; color: #374151; font-weight: 500; }
.req { color: #ef4444; }
.form-item input, .form-item select, .form-item textarea {
  border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 10px; font-size: 14px;
  font-family: inherit; background: #fff; width: 100%; color: #111827;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus {
  outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.checkbox-row { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.check-item { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
.check-item input { width: auto; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; }
#custom-time-wrap { margin-top: 8px; display: none; }
#custom-time-wrap.show { display: flex; }
#custom-time-wrap select { flex: 1; }

/* ---- 周总览表格 ---- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; }
.grid-table { width: 100%; border-collapse: collapse; min-width: 900px; table-layout: fixed; }
.grid-table th, .grid-table td { border: 1px solid #e5e7eb; padding: 6px; vertical-align: top; }
.grid-table thead th { background: #f8fafc; text-align: center; font-size: 13px; padding: 8px 4px; }
.grid-table thead th.today { background: #dbeafe; }
.day-week { font-weight: 600; color: #111827; }
.day-date { color: #6b7280; font-size: 12px; }
.corner { background: #f8fafc !important; text-align: center; font-weight: 600; font-size: 13px; width: 132px; }
.room-cell { background: #fafbfc; }
.room-name { font-weight: 600; font-size: 14px; }
.room-meta { color: #6b7280; font-size: 11px; }
.room-tags { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 3px; }
.room-tags span { background: #eef2ff; color: #4338ca; font-size: 10px; padding: 1px 6px; border-radius: 10px; }
.day-cell { padding: 4px !important; }
.slot-empty { color: #e5e7eb; font-size: 11px; padding: 2px 4px; border-radius: 4px; }
.slot-chip {
  background: #eff6ff; border-left: 3px solid #2563eb; border-radius: 4px;
  padding: 3px 6px; margin-bottom: 3px; font-size: 11px; line-height: 1.45; cursor: default;
}
.slot-chip .chip-time { color: #1d4ed8; font-weight: 600; }
.slot-chip .chip-title { font-weight: 600; color: #111827; display: block; }
.slot-chip .chip-who { color: #4b5563; }
.slot-chip .chip-need { color: #b45309; display: inline-block; margin-top: 1px; }
.legend { display: flex; gap: 18px; margin-top: 10px; color: #6b7280; font-size: 12px; align-items: center; flex-wrap: wrap; }
.legend-box { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.legend-box.booked { background: #eff6ff; border-left: 3px solid #2563eb; }
.legend-box.free { border: 1px solid #e5e7eb; }

/* ---- 列表表格 ---- */
.list-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.list-table th, .list-table td { border-bottom: 1px solid #eef0f3; padding: 9px 10px; text-align: left; font-size: 13px; }
.list-table thead th { background: #f8fafc; font-weight: 600; color: #374151; white-space: nowrap; }
.list-table tbody tr:hover { background: #f9fafb; }
.row-cancelled td { opacity: .55; }
.op-cell { white-space: nowrap; }
.td-detail { max-width: 380px; word-break: break-all; }
.empty { background: #fff; border: 1px dashed #d1d5db; border-radius: 12px; padding: 48px 20px; text-align: center; color: #6b7280; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.tag-ok { background: #dcfce7; color: #15803d; }
.tag-warn { background: #fef3c7; color: #b45309; }
.tag-danger { background: #fee2e2; color: #b91c1c; }
.tag-muted { background: #f3f4f6; color: #6b7280; }

/* ---- 登录页 ---- */
.login-body { background: linear-gradient(135deg, #eef2ff 0%, #f3f5f9 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: #fff; border-radius: 16px; box-shadow: 0 10px 40px rgba(17,24,39,.08); padding: 36px; width: 100%; max-width: 380px; }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo img { max-height: 60px; margin-bottom: 10px; }
.login-logo h1 { font-size: 20px; }
.login-sub { color: #6b7280; font-size: 12px; margin-top: 4px; }
.login-divider { display: flex; align-items: center; gap: 10px; color: #9ca3af; font-size: 12px; margin: 18px 0; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; border-top: 1px solid #e5e7eb; }
.login-card .form-item { margin-bottom: 14px; }
.login-tip { margin-top: 16px; font-size: 12px; color: #9ca3af; text-align: center; }

/* ---- 提示 ---- */
.flash-area { margin-bottom: 14px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
.flash-success { background: #dcfce7; color: #15803d; }
.flash-error { background: #fee2e2; color: #b91c1c; }
.conflict-tip { margin-top: 12px; font-size: 13px; min-height: 20px; }
.conflict-tip.ok { color: #16a34a; }
.conflict-tip.bad { color: #dc2626; }

/* ---- 一句话预约 ---- */
#onesentence { width: 100%; border: 1px solid #d1d5db; border-radius: 8px; padding: 10px; font-size: 14px; font-family: inherit; resize: vertical; }
#onesentence:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.parse-result { margin-top: 10px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #166534; }
.parse-result.bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.hidden { display: none; }

/* ---- 详情/成功 ---- */
.success-card { text-align: center; max-width: 520px; margin: 40px auto; }
.success-icon { width: 56px; height: 56px; border-radius: 50%; background: #dcfce7; color: #16a34a; font-size: 30px; line-height: 56px; margin: 0 auto 12px; }
.detail-table { margin: 16px auto; text-align: left; border-collapse: collapse; }
.detail-table th, .detail-table td { padding: 6px 14px; border-bottom: 1px solid #f0f1f4; font-size: 14px; }
.detail-table th { color: #6b7280; font-weight: 500; white-space: nowrap; }

/* ---- 管理后台 ---- */
.admin-layout { display: flex; gap: 20px; align-items: flex-start; }
.admin-side { width: 180px; flex-shrink: 0; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px; position: sticky; top: 76px; }
.admin-side-title { font-weight: 600; color: #6b7280; font-size: 12px; padding: 6px 10px; text-transform: uppercase; letter-spacing: .5px; }
.admin-side a { display: block; padding: 8px 10px; border-radius: 8px; color: #374151; font-size: 13px; margin-bottom: 2px; }
.admin-side a:hover { background: #f3f4f6; }
.admin-side a.active { background: #2563eb; color: #fff; }
.admin-main { flex: 1; min-width: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 18px; text-align: center; }
.stat-num { font-size: 28px; font-weight: 700; color: #2563eb; }
.stat-label { color: #6b7280; font-size: 13px; margin-top: 4px; }
.slot-editor { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.slot-row { display: flex; gap: 8px; align-items: center; }
.slot-row input { border: 1px solid #d1d5db; border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.logo-preview { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.logo-preview img { height: 36px; }

/* ---- 响应式 ---- */
@media (max-width: 860px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  .main-nav { order: 3; width: 100%; overflow-x: auto; }
  .admin-layout { flex-direction: column; }
  .admin-side { width: 100%; position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .admin-side a { margin-bottom: 0; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
}
