* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; background: #f5f5f5; color: #333; font-size: 14px; overflow-x: hidden; }
a { color: inherit; text-decoration: none; cursor: pointer; }
input, select { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; outline: none; }
input:focus, select:focus { border-color: #1a1a1a; }
button { cursor: pointer; font-size: 14px; }

.btn { padding: 8px 20px; border: none; border-radius: 6px; font-size: 14px; }
.btn-primary { background: #1a1a1a; color: #fff; }
.btn-primary:hover { background: #333; }
.btn-primary:disabled { background: #999; cursor: not-allowed; }
.btn-default { background: #fff; border: 1px solid #ddd; color: #333; }
.btn-default:hover { background: #f5f5f5; }
.btn-block { width: 100%; padding: 12px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

.red { color: #e54d42; }

/* Toast */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); padding: 12px 28px; border-radius: 8px; color: #fff; font-size: 14px; z-index: 9999; animation: fadeIn 0.3s; }
.toast-success { background: #67c23a; }
.toast-error { background: #e54d42; }
.toast-info { background: #333; }
@keyframes fadeIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* Modal */
.modal-mask { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; border-radius: 12px; width: 90%; max-width: 500px; max-height: 85vh; overflow-y: auto; }
.modal-lg { max-width: 700px; }
.modal-title { padding: 20px 24px; font-size: 18px; font-weight: 600; border-bottom: 1px solid #eee; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #eee; display: flex; justify-content: flex-end; gap: 12px; }

/* Login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #1a1a1a; }
.login-box { width: 360px; text-align: center; }
.login-brand { font-size: 36px; font-weight: 700; color: #fff; letter-spacing: 8px; }
.login-sub { font-size: 14px; color: rgba(255,255,255,0.5); margin-top: 8px; }
.login-form { margin-top: 40px; }
.login-form input { width: 100%; padding: 14px 16px; border: none; border-radius: 8px; font-size: 16px; margin-bottom: 16px; }

/* Main Layout */
.main { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #1a1a1a; color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; }
.sidebar-brand { padding: 32px 20px 4px; font-size: 22px; font-weight: 700; letter-spacing: 4px; text-align: center; }
.sidebar-sub { padding: 0 20px 24px; font-size: 12px; color: rgba(255,255,255,0.4); text-align: center; }
.sidebar-menu { flex: 1; padding: 12px 0; }
.menu-item { display: block; padding: 14px 24px; color: rgba(255,255,255,0.65); font-size: 14px; transition: all 0.2s; }
.menu-item:hover { color: #fff; background: rgba(255,255,255,0.08); }
.menu-item.active { color: #fff; background: rgba(255,255,255,0.12); border-right: 3px solid #fff; }
.sidebar-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 8px 20px; }
.logout-item { color: rgba(255,255,255,0.4) !important; }
.logout-item:hover { color: #e54d42 !important; }
.sidebar-footer { padding: 20px; text-align: center; font-size: 13px; color: rgba(255,255,255,0.4); cursor: pointer; }
.sidebar-footer:hover { color: rgba(255,255,255,0.7); }

.content { flex: 1; margin-left: 220px; padding: 32px; }
.content h2 { font-size: 22px; font-weight: 600; margin-bottom: 24px; color: #1a1a1a; }
.content h3 { font-size: 16px; font-weight: 600; margin: 20px 0 12px; color: #1a1a1a; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.stat-num { font-size: 28px; font-weight: 700; color: #1a1a1a; margin-bottom: 6px; }
.stat-label { font-size: 13px; color: #999; }

/* Page Header */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h2 { margin-bottom: 0; }
.header-actions { display: flex; gap: 12px; align-items: center; }
.search-input { padding: 8px 16px; border: 1px solid #ddd; border-radius: 6px; width: 200px; }

/* Table */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.table th { background: #f8f8f8; padding: 12px 16px; text-align: left; font-weight: 500; color: #666; font-size: 13px; border-bottom: 1px solid #eee; }
.table td { padding: 12px 16px; border-bottom: 1px solid #f5f5f5; }
.table tr:hover td { background: #fafafa; }
.link { color: #1a1a1a; margin-right: 16px; font-weight: 500; }
.link:hover { text-decoration: underline; }
.link-danger { color: #e54d42; }

/* Tags */
.tag { display: inline-block; padding: 2px 10px; border-radius: 4px; font-size: 12px; }
.tag-red { background: #fff0f0; color: #e54d42; }
.tag-green { background: #f0f9eb; color: #67c23a; }
.tag-yellow { background: #fffbe6; color: #e6a23c; }
.tag-grey { background: #f4f4f5; color: #999; }
.muted { color: #999; }

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid #eee; margin-bottom: 24px; }
.tab { padding: 10px 24px; font-size: 15px; color: #666; cursor: pointer; }
.tab.active { color: #1a1a1a; font-weight: 600; border-bottom: 2px solid #1a1a1a; margin-bottom: -2px; }

/* Card */
.card { background: #fff; border-radius: 12px; padding: 24px; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.card h3 { margin-top: 0; }

/* Form */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group select { width: 100%; }
.form-row { display: flex; gap: 16px; margin-bottom: 16px; }
.form-row .form-group { flex: 1; }
.detail-info { display: flex; flex-wrap: wrap; gap: 24px; padding: 16px; background: #f8f8f8; border-radius: 8px; margin-bottom: 20px; }
.detail-info span { font-size: 14px; color: #555; }

/* Search Results */
.search-results { margin-bottom: 16px; border: 1px solid #eee; border-radius: 8px; overflow: hidden; }
.search-item { padding: 12px 16px; cursor: pointer; border-bottom: 1px solid #f5f5f5; }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: #f5f5f5; }
.selected-customer { padding: 12px 16px; background: #f0f9eb; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.input-with-btn { display: flex; gap: 8px; align-items: center; }

/* 美容师时段网格 */
.time-slot-section { margin-top: 10px; padding: 10px 12px; background: #f9fafb; border-radius: 8px; }
.time-slot-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; max-height: 200px; overflow-y: auto; }
.time-slot { text-align: center; padding: 6px 2px; border-radius: 4px; font-size: 12px; cursor: pointer; border: 1px solid #e5e7eb; background: #fff; transition: all 0.15s; }
.time-slot:hover:not(.occupied) { background: #dbeafe; border-color: #3b82f6; }
.time-slot.selected { background: #3b82f6; color: #fff; border-color: #2563eb; }
.time-slot.occupied { background: #fef2f2; border-color: #fca5a5; color: #dc2626; cursor: not-allowed; font-size: 10px; padding: 3px 1px; }

/* Employee Commission */
.emp-commission { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.emp-commission span { width: 80px; font-size: 14px; color: #555; }

/* Empty */
.empty { text-align: center; padding: 60px 20px; color: #999; }

/* Store Bar (HQ top switcher) */
.store-bar { background: #fff; border-radius: 10px; padding: 12px 20px; margin-bottom: 24px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.store-bar-label { font-size: 13px; color: #999; font-weight: 500; }
.store-bar-hint { font-size: 13px; color: #666; margin-left: 4px; }

/* Page badge */
.page-badge { display: inline-block; font-size: 12px; background: #f0f9eb; color: #67c23a; padding: 2px 10px; border-radius: 4px; margin-left: 12px; font-weight: 400; }

/* 手机/APP 布局 */
@media (max-width: 768px) {
  * { box-sizing: border-box; }

  html, body {
    width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    font-size: 14px;
  }

  /* 主容器全宽 */
  .main { display: block !important; width: 100% !important; min-height: 100vh; }

  /* 隐藏左侧边栏 */
  .sidebar { display: none !important; }

  /* 主内容区全宽撑满 */
  .content {
    display: block;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 12px 16px !important;
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden;
  }

  /* 页面标题 */
  .content h2 { font-size: 18px !important; margin-bottom: 16px !important; }

  /* 统计卡片：两列 */
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  .stat-card { padding: 14px 12px !important; }
  .stat-num { font-size: 18px !important; }
  .stat-label { font-size: 11px !important; }

  /* 门店切换栏横向滚动 */
  .store-bar { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .store-bar .btn { flex-shrink: 0; font-size: 12px; padding: 6px 10px; }

  /* 表格横向滚动 */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { font-size: 12px; min-width: 500px; }
  th, td { padding: 8px 6px !important; }

  /* 输入框防缩放 */
  input, select, textarea { font-size: 16px !important; padding: 10px 12px !important; }

  /* 表单 */
  .form-group { margin-bottom: 14px; }
  .form-group label { font-size: 13px; margin-bottom: 4px; display: block; }

  /* 弹窗全屏 */
  .modal { width: 100% !important; height: 100vh !important; border-radius: 0 !important; margin: 0 !important; top: 0 !important; left: 0 !important; }
  .modal-body { padding: 20px !important; }
  .modal-footer { padding: 16px 20px !important; }

  /* 按钮 */
  .btn { padding: 12px 20px !important; font-size: 15px; }
  .btn-sm { padding: 6px 12px !important; font-size: 13px; }

  /* 底部标签栏 */
  .bottom-tab-bar {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid #eee;
    z-index: 9999;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  }
  .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #999;
    font-size: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    padding: 8px 0;
    transition: color 0.2s;
  }
  .tab-item .tab-icon { font-size: 24px; line-height: 1; }
  .tab-item.active { color: #333; font-weight: 500; }
  .tab-item:active { opacity: 0.7; }
  .tab-item.danger { color: #ff4d4f; }
}

/* PC端隐藏底部标签栏 */
.bottom-tab-bar { display: none; }

/* 预约日期切换栏 */
.booking-date-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  margin-bottom: 10px;
}
.date-nav-btn {
  font-size: 15px;
  color: #667eea;
  cursor: pointer;
  padding: 4px 8px;
  user-select: none;
}
.date-nav-btn:hover { color: #764ba2; }
.date-current {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

/* Mobile PWA Styles */
@media screen and (max-width: 768px) {
  .menu { width: 100%; height: auto; position: relative; flex-direction: row; flex-wrap: wrap; padding: 8px; justify-content: center; }
  .menu .logo { font-size: 16px; padding: 8px; }
  .menu a { padding: 8px 12px; font-size: 13px; }
  .container { padding: 10px; margin: 0; }
  .page-header { font-size: 16px; padding: 12px; }
  .card { padding: 12px; margin-bottom: 12px; }
  .modal-title { font-size: 16px; margin-bottom: 12px; }
  .page { padding: 10px; overflow-x: hidden; }
  .booking-date-bar { padding: 10px 16px; }
  .date-nav-btn { font-size: 14px; }
  .date-current { font-size: 15px; }
}

/* ===== 收银台员工多选标签 ===== */
.tag-group { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-sm { display: inline-block; padding: 10px 22px; margin: 5px 8px; border: 1px solid #ddd; border-radius: 20px; font-size: 15px; cursor: pointer; user-select: none; transition: all .15s; background: #fafafa; color: #555; line-height: 1.6; }
.tag-sm:hover { border-color: #999; background: #f0f0f0; }
.tag-active { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.emp-comm-line { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.emp-comm-line input { width: 80px; padding: 4px 8px; font-size: 13px; }

/* ===== 预约看板 ===== */
.view-toggle-btns { display: flex; gap: 0; border: 1px solid #ddd; border-radius: 6px; overflow: hidden; }
.view-toggle-btns button { padding: 6px 16px; font-size: 13px; background: #fff; color: #666; border: none; cursor: pointer; transition: all .15s; }
.view-toggle-btns button:first-child { border-right: 1px solid #ddd; }
.view-toggle-btns button.active { background: #667eea; color: #fff; }

.booking-board-wrapper { background: #fff; border-radius: 8px; overflow: hidden; }

.board-period-filter { display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid #f0f0f0; }
.board-period-filter button { padding: 4px 14px; font-size: 13px; border: 1px solid #e8e8e8; border-radius: 4px; background: #fff; color: #555; cursor: pointer; transition: all .15s; }
.board-period-filter button:hover { border-color: #667eea; color: #667eea; }
.board-period-filter button.active { background: #667eea; color: #fff; border-color: #667eea; }

.board-stats { display: flex; gap: 16px; padding: 8px 16px; font-size: 13px; color: #999; border-bottom: 1px solid #f0f0f0; }

.board-scroll-area { display: grid; grid-template-columns: 110px 1fr; border: 1px solid #e8e8e8; border-radius: 8px; background: #fff; overflow: hidden; }
.board-emp-panel { border-right: 2px solid #e8e8e8; z-index: 2; background: #fafafa; overflow: hidden; }
.emp-corner-header { height: 36px; line-height: 36px; text-align: center; font-size: 12px; font-weight: 600; color: #999; background: #f5f5f5; border-bottom: 2px solid #e8e8e8; padding: 0 14px; white-space: nowrap; }
.emp-name-cell { display: flex; align-items: center; gap: 8px; padding: 10px 14px; height: 72px; border-bottom: 1px solid #f0f0f0; font-size: 13px; font-weight: 500; color: #333; min-width: 90px; white-space: nowrap; }
.emp-name-cell.unassigned { color: #999; font-style: italic; }
.emp-name-cell .emp-label { overflow: hidden; text-overflow: ellipsis; }

.board-time-panel { overflow-x: auto; overflow-y: hidden; }
.board-time-panel::-webkit-scrollbar { height: 6px; width: 6px; }
.board-time-panel::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
.board-time-header { height: 36px; background: #f5f5f5; border-bottom: 2px solid #e8e8e8; position: relative; }
.board-time-row { border-bottom: 1px solid #f0f0f0; }
.board-time-row:last-child { border-bottom: none; }

.time-header-hour { position: absolute; top: 0; height: 36px; line-height: 36px; font-size: 11px; color: #555; font-weight: 600; text-align: center; border-left: 1px solid #ccc; box-sizing: border-box; }
.emp-avatar { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 600; flex-shrink: 0; }

/* 时间槽区域 */
.board-row-slots { position: relative; height: 72px; }

/* 网格竖线 */
.slot-grid-cell { position: absolute; top: 0; height: 72px; border-right: 1px solid #f0f0f0; box-sizing: border-box; user-select: none; }
.slot-grid-cell.hour { border-right-color: #e8e8e8; }
.slot-grid-cell:hover { background: rgba(102,126,234,0.04); cursor: pointer; }

/* 被占用的时间格子 */
.slot-grid-cell.occupied { background: rgba(254,176,25,0.08); }
.slot-grid-cell.occupied:hover { background: rgba(254,176,25,0.15); }

/* 拖选中的区间格子 */
.slot-grid-cell.selected { background: rgba(102,126,234,0.18); border-right-color: rgba(102,126,234,0.3); }

/* 预约卡片 */
.board-card { position: absolute; top: 4px; bottom: 4px; border-radius: 6px; padding: 6px 8px; overflow: hidden; cursor: pointer; transition: box-shadow .15s, transform .1s; z-index: 2; display: flex; flex-direction: column; justify-content: center; min-width: 26px; }
.board-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.15); transform: translateY(-1px); z-index: 10; }

.card-tags { display: flex; gap: 4px; margin-bottom: 2px; flex-wrap: nowrap; }
.card-tag { font-size: 10px; padding: 0px 5px; border-radius: 3px; line-height: 16px; white-space: nowrap; }
.card-tag-status { background: #fff3cd; color: #856404; }
.card-name { font-size: 12px; font-weight: 600; color: #fff; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-phone { font-size: 10px; color: rgba(255,255,255,0.75); white-space: nowrap; }
.card-project { font-size: 10px; color: rgba(255,255,255,0.85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-time { font-size: 9px; color: rgba(255,255,255,0.65); white-space: nowrap; margin-top: 1px; }

/* 卡片颜色 */
.card-default { background: linear-gradient(135deg, #667eea, #764ba2); }
.card-default .card-tag { background: rgba(255,255,255,0.25); color: #fff; }
.card-gold { background: linear-gradient(135deg, #f5a623, #f7b84e); }
.card-gold .card-tag { background: rgba(255,255,255,0.3); color: #7a5500; }
.card-green { background: linear-gradient(135deg, #52c41a, #73d13d); }
.card-green .card-tag { background: rgba(255,255,255,0.3); color: #135200; }
.card-blue { background: linear-gradient(135deg, #1890ff, #40a9ff); }
.card-blue .card-tag { background: rgba(255,255,255,0.3); color: #003a8c; }
.card-purple { background: linear-gradient(135deg, #722ed1, #9254de); }
.card-purple .card-tag { background: rgba(255,255,255,0.3); color: #391085; }
.card-orange { background: linear-gradient(135deg, #fa8c16, #ffa940); }
.card-orange .card-tag { background: rgba(255,255,255,0.3); color: #873800; }
.card-pink { background: linear-gradient(135deg, #eb2f96, #f759ab); }
.card-pink .card-tag { background: rgba(255,255,255,0.3); color: #780650; }
.card-teal { background: linear-gradient(135deg, #13c2c2, #36cfc9); }
.card-teal .card-tag { background: rgba(255,255,255,0.3); color: #00474f; }

/* 看板新增弹窗信息栏 */
.board-add-info { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; padding: 10px 14px; background: #f7f8fc; border-radius: 6px; }
.board-add-info .info-item { font-size: 13px; color: #555; background: #fff; padding: 3px 10px; border-radius: 4px; border: 1px solid #e8e8e8; }

/* 详情弹窗 */
.detail-row { display: flex; gap: 12px; align-items: center; }
.detail-row label { font-size: 13px; color: #999; min-width: 60px; }
