/* ============ 居家养老服务中心 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #f59e0b;
  --danger: #e11d48;
  --success: #16a34a;
  --text: #1f2937;
  --text-2: #6b7280;
  --border: #e5e7eb;
  --bg: #f3f4f6;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 16px rgba(0, 0, 0, .06);
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

.hidden { display: none !important; }
.muted { color: var(--text-2); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.page { padding: 24px 20px 60px; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 8px;
  padding: 9px 18px; font-size: 14px; font-weight: 500;
  transition: all .15s ease; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-close { background: none; border: none; font-size: 22px; color: var(--text-2); line-height: 1; padding: 4px; }
.btn-close:hover { color: var(--text); }

/* ============ 徽标 / 状态 ============ */
.badge {
  display: inline-block; min-width: 18px; height: 18px; line-height: 18px; text-align: center;
  background: var(--danger); color: #fff; border-radius: 9px; font-size: 12px; padding: 0 5px;
}
.status-badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.st-pending { background: #fef3c7; color: #b45309; }
.st-paid { background: #dbeafe; color: #1d4ed8; }
.st-completed { background: #dcfce7; color: #15803d; }
.st-cancelled { background: #f3f4f6; color: #6b7280; }

/* ============ 顶栏 ============ */
.site-header {
  background: #fff; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
#site-nav { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; color: var(--text); }
.brand-logo { display: inline-flex; }
.brand-name span { color: var(--primary); }
.nav-links { display: flex; gap: 4px; margin-left: 8px; }
.nav-links a {
  padding: 8px 14px; border-radius: 8px; color: var(--text-2); font-weight: 500;
}
.nav-links a:hover { color: var(--primary); background: var(--primary-light); }
.nav-links a.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.chip-balance {
  background: var(--primary-light); color: var(--primary-dark);
  padding: 5px 14px; border-radius: 20px; font-size: 13px; font-weight: 500;
}
.chip-balance b { font-size: 14px; }
.user-chip { color: var(--text-2); font-size: 13px; }

/* ============ 页头 ============ */
.page-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 20px;
}
.page-head h2 { font-size: 22px; }
.page-head p { margin-top: 2px; }

/* ============ 筛选栏 ============ */
.filter-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: #fff; color: var(--text-2);
  border-radius: 20px; padding: 5px 14px; font-size: 13px;
}
.chip:hover { color: var(--primary); border-color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.filter-right { display: flex; gap: 10px; align-items: center; }
.filter-right select, .filter-right input {
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; outline: none;
  background: #fff;
}
.filter-right select:focus, .filter-right input:focus { border-color: var(--primary); }

/* ============ 服务卡片 ============ */
.service-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px;
}
.svc-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.svc-card:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0, 0, 0, .1); }
.svc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.svc-cat {
  background: var(--primary-light); color: var(--primary-dark);
  font-size: 12px; padding: 2px 10px; border-radius: 20px; font-weight: 500;
}
.svc-org { color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-name { font-size: 16px; margin-bottom: 6px; }
.svc-desc { color: var(--text-2); font-size: 13px; margin-bottom: 14px; flex: 1; }
.svc-foot { display: flex; align-items: center; justify-content: space-between; }
.svc-price { color: var(--danger); font-size: 20px; font-weight: 700; }
.svc-price.free { color: var(--success); font-size: 16px; }
.svc-unit { font-size: 12px; font-weight: 400; color: var(--text-2); margin-left: 2px; }
.svc-price.free .svc-unit { color: var(--success); }

/* 数量控件 */
.qty-ctl { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.qty-ctl button {
  width: 30px; height: 30px; border: none; background: #f9fafb; color: var(--text);
  font-size: 16px; line-height: 1;
}
.qty-ctl button:hover { background: var(--primary-light); color: var(--primary); }
.qty-ctl span { min-width: 34px; text-align: center; font-weight: 600; }

/* ============ 抽屉（点单清单） ============ */
.overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 90;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: -400px; width: 380px; max-width: 92vw; height: 100%;
  background: #fff; z-index: 91; box-shadow: -8px 0 30px rgba(0, 0, 0, .15);
  display: flex; flex-direction: column; transition: right .25s ease;
}
.drawer.show { right: 0; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.drawer-head h3 { font-size: 16px; }
.cart-items { flex: 1; overflow-y: auto; padding: 12px 20px; }
.cart-empty { text-align: center; color: var(--text-2); padding: 60px 0; line-height: 2; }
.cart-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px dashed var(--border);
}
.ci-name { font-weight: 500; }
.ci-meta { color: var(--text-2); font-size: 12px; margin-top: 2px; }
.drawer-foot { padding: 16px 20px; border-top: 1px solid var(--border); }
.cart-total { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 15px; }
.cart-total b { color: var(--danger); font-size: 20px; }

/* 悬浮购物车按钮 */
.cart-fab {
  position: fixed; right: 22px; bottom: 26px; z-index: 89;
  width: 54px; height: 54px; border-radius: 50%; border: none;
  background: var(--primary); color: #fff; font-size: 20px;
  box-shadow: 0 6px 20px rgba(37, 99, 235, .4); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.cart-fab span {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px;
  background: var(--danger); border-radius: 10px; font-size: 12px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.cart-fab:hover { background: var(--primary-dark); }

/* ============ 模态框 ============ */
.modal {
  position: fixed; inset: 0; z-index: 95; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .45); opacity: 0; pointer-events: none; transition: opacity .2s ease;
  padding: 20px;
}
.modal.open { opacity: 1; pointer-events: auto; }
.modal-box {
  background: #fff; border-radius: 14px; width: 440px; max-width: 100%;
  max-height: 86vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 22px; }
.modal-foot { padding: 0 22px 22px; }

/* 表单 */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; outline: none; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 70px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* 收银/回执 */
.receipt { text-align: center; padding: 10px 0 6px; }
.receipt-icon {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%;
  background: #dcfce7; color: var(--success); font-size: 30px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.receipt h4 { font-size: 18px; margin-bottom: 12px; }
.receipt p { color: var(--text-2); margin-bottom: 6px; }
.receipt b { color: var(--text); }
.co-money { color: var(--danger); }
.co-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.co-row .muted { color: var(--text-2); }
.warn { background: #fef3c7; color: #b45309; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 12px 0; }
.co-actions { display: grid; gap: 10px; margin-top: 16px; }

/* ============ 订单卡片 ============ */
.order-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.order-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.order-no { font-weight: 700; margin-right: 10px; font-size: 15px; }
.order-time { color: var(--text-2); font-size: 13px; }
.order-item { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 10px; padding: 6px 0; color: var(--text); font-size: 13px; }
.order-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border);
}
.order-total b { color: var(--danger); font-size: 16px; }
.order-actions { display: flex; gap: 8px; }

/* ============ 空状态 ============ */
.empty { text-align: center; color: var(--text-2); padding: 70px 0; }
.empty::before { content: "· · ·"; display: block; font-size: 28px; margin-bottom: 10px; letter-spacing: 6px; }

/* ============ Toast ============ */
#toast-box { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  background: #111827; color: #fff; padding: 10px 22px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
  opacity: 0; transform: translateY(-8px); transition: all .25s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { background: var(--danger); }
.toast-success { background: var(--success); }

/* ============ 管理后台 ============ */
.tabs-bar { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabs-bar .tab {
  border: none; background: none; padding: 10px 18px; font-size: 15px; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500;
}
.tabs-bar .tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.stat-card .stat-label { color: var(--text-2); font-size: 13px; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat-card .stat-sub { color: var(--text-2); font-size: 12px; margin-top: 4px; }
.stat-blue .stat-value { color: var(--primary); }
.stat-green .stat-value { color: var(--success); }
.stat-orange .stat-value { color: var(--accent); }
.stat-red .stat-value { color: var(--danger); }

.panel-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 20px; }
.panel-card .panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-card h3 { font-size: 16px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: #f9fafb; color: var(--text-2); font-weight: 600; }
tr:hover td { background: #fafbfc; }
.tag { display: inline-block; background: var(--primary-light); color: var(--primary-dark); font-size: 12px; padding: 1px 8px; border-radius: 6px; }
.tag-off { background: #f3f4f6; color: var(--text-2); }

/* 组织营收条形图 */
.bar-row { display: grid; grid-template-columns: 150px 1fr 90px; align-items: center; gap: 12px; padding: 7px 0; }
.bar-label { color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: #f3f4f6; border-radius: 6px; height: 14px; overflow: hidden; }
.bar-fill { background: linear-gradient(90deg, #60a5fa, var(--primary)); height: 100%; border-radius: 6px; min-width: 4px; transition: width .4s ease; }
.bar-val { color: var(--danger); font-weight: 700; font-size: 13px; text-align: right; }

/* ============ 登录页 ============ */
.login-body {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 45%, #3b82f6 100%);
  display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px;
}
.login-wrap {
  display: flex; background: #fff; border-radius: 18px; overflow: hidden;
  width: 860px; max-width: 100%; box-shadow: 0 24px 80px rgba(0, 0, 0, .25); min-height: 520px;
}
.login-side {
  background: linear-gradient(160deg, #1e40af, #2563eb); color: #fff;
  padding: 48px 42px; width: 46%; display: flex; flex-direction: column; justify-content: center;
}
.login-brand h1 { font-size: 24px; margin: 18px 0 10px; line-height: 1.4; }
.login-brand p { opacity: .85; font-size: 14px; }
.login-points { margin-top: 34px; list-style: none; display: grid; gap: 14px; }
.login-points li {
  display: flex; align-items: center; gap: 10px; font-size: 14px; opacity: .95;
}
.login-points li::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fbbf24; flex: none;
}
.login-card { flex: 1; padding: 48px 44px; display: flex; flex-direction: column; justify-content: center; }
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: 26px; }
.tabs .tab {
  border: none; background: none; padding: 8px 2px; font-size: 15px; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500;
}
.tabs .tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.demo-box { margin-top: 26px; background: #f8fafc; border: 1px dashed var(--border); border-radius: 10px; padding: 14px 16px; }
.demo-title { font-size: 12px; color: var(--text-2); margin-bottom: 10px; }
.demo-row { display: flex; gap: 8px; flex-wrap: wrap; }
.demo-row button {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 6px 12px; font-size: 13px; color: var(--primary-dark);
}
.demo-row button:hover { border-color: var(--primary); }
.back-link { display: block; text-align: center; margin-top: 14px; font-size: 13px; color: var(--text-2); }
.back-link:hover { color: var(--primary); }

/* ============ 服务大厅首页 ============ */
.home-nav { display: flex; align-items: center; gap: 24px; height: 60px; }
.hero {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 55%, #3b82f6 100%);
  color: #fff; padding: 56px 0 64px; text-align: center;
}
.hero h1 { font-size: 30px; margin-bottom: 10px; }
.hero-sub { opacity: .9; font-size: 15px; margin-bottom: 40px; }
.mode-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; max-width: 960px; margin: 0 auto; text-align: left;
}
.mode-cards-2 { grid-template-columns: repeat(2, 1fr); max-width: 760px; }
.mode-card {
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 14px; padding: 22px; backdrop-filter: blur(4px);
  color: #fff; text-decoration: none; display: block;
  transition: transform .15s ease, background .15s ease;
}
.mode-card:hover { background: rgba(255, 255, 255, .2); transform: translateY(-3px); }
.mode-card h3 { font-size: 16px; margin-bottom: 8px; }
.mode-card p { font-size: 13px; opacity: .9; line-height: 1.7; margin-bottom: 12px; }
.mode-link { font-size: 13px; font-weight: 600; opacity: .95; }
.mode-icon {
  width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; margin-bottom: 14px;
}
.mode-icon-blue { background: #dbeafe; color: #1d4ed8; }
.mode-icon-green { background: #dcfce7; color: #15803d; }
.mode-icon-orange { background: #fef3c7; color: #b45309; }

.site-footer { border-top: 1px solid var(--border); padding: 28px 0; text-align: center; }
.site-footer p { font-size: 13px; margin-bottom: 4px; }

/* ============ 响应式 ============ */
@media (max-width: 768px) {
  #site-nav { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px; }
  .nav-links { order: 3; width: 100%; }
  .home-nav { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px; }
  .mode-cards { grid-template-columns: 1fr; }
  .hero h1 { font-size: 24px; }
  .login-wrap { flex-direction: column; }
  .login-side { width: 100%; padding: 30px 26px; }
  .login-points { margin-top: 20px; }
  .login-card { padding: 30px 26px; }
  .order-item { grid-template-columns: 1fr auto; }
  .filter-right { width: 100%; }
  .filter-right select, .filter-right input { flex: 1; }
}
