:root{
  --bg:#F7F8FA; --panel:#FFFFFF; --text:#111114; --muted:#6B7280; --line:#E6E8EC;
  --brand:#0A84FF; --brand-weak:#E9F2FF;
  --ok:#34C759; --warn:#FF9F0A; --err:#FF3B30;
  --shadow:0 8px 26px rgba(17,17,20,.06), 0 2px 10px rgba(17,17,20,.05);
  --shadow-2:0 16px 46px rgba(17,17,20,.10), 0 6px 18px rgba(17,17,20,.06);
  --radius:16px; --radius-lg:22px; --t:.24s cubic-bezier(.2,.6,.2,1);
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;color:var(--text);background:var(--bg);font:14px/1.6 -apple-system,BlinkMacSystemFont,"SF Pro Display","PingFang SC","Hiragino Sans GB","Microsoft YaHei",Segoe UI,Roboto,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased}

/* Login */
.login-body{min-height:100vh;display:grid;place-items:center;padding:32px}
.glass{background:rgba(255,255,255,.78);backdrop-filter:blur(14px);border:1px solid var(--line);border-radius:20px;box-shadow:var(--shadow);padding:24px 22px;text-align:center;width:min(440px,92vw);animation:floatIn .36s var(--t)}
.login-card .logo{height:64px;margin-bottom:10px}
.form .field{margin:.6rem 0}
.muted{color:var(--muted)}

.btn{padding:.56rem .9rem;border-radius:12px;border:1px solid var(--line);background:var(--panel);color:var(--text);cursor:pointer;transition:transform var(--t),box-shadow var(--t),background var(--t)}
.btn:hover{transform:translateY(-1px);box-shadow:var(--shadow)}
.btn.primary{background:var(--brand);border-color:transparent;color:#fff;box-shadow:0 10px 22px rgba(10,132,255,.26)}
.btn.ghost{background:#fff}
.btn.text{background:transparent;border:0;color:var(--muted)}
.btn.icon-btn{width:36px;height:36px;border-radius:10px;padding:0;display:grid;place-items:center}
.input{width:100%;padding:.72rem .9rem;border-radius:12px;border:1px solid var(--line);background:#fff;transition:border var(--t),box-shadow var(--t)}
.input:focus{outline:none;border-color:#cbd5e1;box-shadow:0 0 0 4px rgba(10,132,255,.08)}
.select{position:relative;border:1px solid var(--line);border-radius:12px;padding:.65rem .9rem;background:#fff;cursor:pointer;user-select:none}
.select.open{box-shadow:var(--shadow)}
.select-menu{position:absolute;left:0;right:0;top:calc(100% + 6px);background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow);display:none;max-height:260px;overflow:auto;z-index:99}
.select.open .select-menu{display:block}
.select-item{padding:.55rem .9rem}
.select-item:hover{background:#F5F7FB}
.select-text{color:#111;}
.seg{display:inline-flex;border:1px solid var(--line);border-radius:12px;overflow:hidden}
.seg-btn{padding:.45rem .8rem;border:0;background:#fff;cursor:pointer}
.seg-btn.active{背景:var(--brand);background:var(--brand);color:#fff}

/* Layout */
.layout{display:grid;grid-template-columns:92px 1fr;grid-template-rows:64px 1fr;height:100vh}
.topbar{grid-column:1/3;display:flex;align-items:center;justify-content:space-between;padding:0 16px;background:rgba(255,255,255,.86);backdrop-filter:saturate(180%) blur(14px);border-bottom:1px solid var(--line);position:sticky;top:0;z-index:20}
.topbar .left{display:flex;gap:12px;align-items:center}
.topbar .logo-sm{height:30px}
.brand{font-weight:700}
.divider{width:1px;height:24px;background:var(--line);margin:0 8px}
.date-switch{display:flex;gap:8px;align-items:center}
.date-switch input[type=date]{border:1px solid var(--line);border-radius:10px;padding:.4rem .6rem}

/* User menu */
.user-menu{display:flex;align-items:center;gap:12px;position:relative}
.user-display{display:flex;align-items:center;gap:8px;padding:6px 10px;border-radius:12px;border:1px solid transparent}
.user-display:hover{background:#F5F7FB;border-color:var(--line)}
.avatar{width:26px;height:26px;border-radius:50%;object-fit:cover;background:#f2f2f2}
.user-pop{position:absolute;right:0;top:44px;background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow);display:none;min-width:140px;overflow:hidden;z-index:40}
.user-menu:hover .user-pop{display:block}
.pop-item{display:block;padding:.6rem .9rem;color:var(--text);text-decoration:none}
.pop-item:hover{background:#F5F7FB}

/* Store dropdown */
.store-switch{position:relative}
.dropdown{position:absolute;left:0;top:44px;min-width:180px;background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow);display:none;z-index:30;overflow:hidden}
.dropdown.open{display:block}
.dropdown .select-item{padding:.6rem .9rem;cursor:pointer}
.dropdown .select-item:hover{background:#F5F7FB}

/* Sidebar */
.sidebar{grid-row:2;background:#fff;border-right:1px solid var(--line);padding:12px 8px;display:flex;flex-direction:column;gap:10px}
.nav-item{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:10px 6px;border-radius:14px;border:1px solid transparent;color:#222;text-decoration:none}
.nav-item:hover{background:#F5F7FB}
.nav-item.active{background:#EAF2FF;border-color:#D8E7FF;box-shadow:var(--shadow)}
.nav-icon img{width:28px;height:28px;object-fit:contain;background:#F3F4F6;border-radius:8px}
.nav-text{font-size:12px}
.content{grid-row:2;padding:18px;overflow:auto}
.panel{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius-lg);box-shadow:var(--shadow);padding:14px;animation:enter .36s var(--t)}
.panel-head{display:flex;align-items:center;justify-content:space-between;margin:0 0 10px}
.panel-head h2{margin:0;font-size:18px}

/* Schedule */
.schedule{display:grid;grid-template-columns:180px 1fr;gap:12px}
.slot-time{display:flex;align-items:center;justify-content:center;border:1px dashed var(--line);border-radius:12px;background:#FAFBFF;padding:12px 10px;font-weight:600}
.slot-box{position:relative;border:1px solid var(--line);border-radius:12px;background:#fff;min-height:72px;padding:12px;display:flex;gap:10px;flex-wrap:wrap}
.slot-badge{position:absolute;top:8px;right:10px}
.badge{padding:.18rem .55rem;border-radius:999px;border:1px solid var(--line);font-size:12px}
.badge.ok{background:#EAFBF1;color:#0A7F4A;border-color:#BFE9D5}
.badge.warn{background:#FFF7E8;color:#915C00;border-color:#FDE1A2}
.badge.err{background:#FFECEC;color:#A11C1C;border-color:#FFC6C6}
.badge.off{background:#F0F1F3;color:#888;border-color:#E5E7EB}
/* Appointment card by status */
.pill{position:relative;padding:10px 12px 10px 14px;border:1px solid var(--line);border-radius:12px;background:#F9FBFF;min-width:200px;cursor:pointer;transition:var(--t);box-shadow:var(--shadow)}
.pill::before{content:'';position:absolute;left:-1px;top:-1px;bottom:-1px;width:4px;border-top-left-radius:12px;border-bottom-left-radius:12px}
.pill:hover{transform:translateY(-2px);box-shadow:var(--shadow-2)}
.pill-title{font-weight:600}
.pill-meta{color:var(--muted);font-size:12px}
.pill.status-0{background:#FFF9E9} .pill.status-0::before{background:#FFB703}
.pill.status-1{background:#EAF2FF} .pill.status-1::before{background:#0A84FF}
.pill.status-2{background:#EAFBF1} .pill.status-2::before{background:#22C55E}
.pill.status-3{background:#F1F2F4;color:#888} .pill.status-3::before{background:#9CA3AF}

/* Cards / tables / gallery */
.table{width:100%;border-collapse:collapse}
.table th,.table td{padding:.7rem;border-bottom:1px solid var(--line);text-align:left}
.grid-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:14px}
.card{border:1px solid var(--line);border-radius:16px;padding:12px;background:#fff;transition:var(--t)}
.card:hover{box-shadow:var(--shadow)}
.card-title{font-weight:700;margin-bottom:4px}
.gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:8px}
.gallery img{width:100%;height:120px;object-fit:cover;border-radius:12px;border:1px solid var(--line)}
.tags{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}
.chip{display:inline-block;padding:.2rem .5rem;border-radius:999px;background:#F3F4F6;border:1px solid var(--line);font-size:12px}
.rich p{margin:.3em 0}

/* Modal */
.mask{position:fixed;inset:0;background:rgba(0,0,0,.28);backdrop-filter:blur(2px);opacity:0;pointer-events:none;transition:opacity var(--t);z-index:40}
.modal{position:fixed;inset:auto 0 0 0;margin:auto;background:#fff;border:1px solid var(--line);border-radius:18px;box-shadow:var(--shadow-2);width:min(760px,92vw);max-height:86vh;display:flex;flex-direction:column;opacity:0;transform:translateY(10px);pointer-events:none;transition:transform var(--t),opacity var(--t);z-index:50}
.modal-wide{width:min(900px,94vw)}
.modal-head{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid var(--line)}
.modal-body{padding:14px;overflow:auto}
.modal-foot{display:flex;gap:8px;justify-content:flex-end;padding:12px 14px;border-top:1px solid var(--line)}
.modal.show{opacity:1;transform:translateY(0);pointer-events:auto}
.mask.show{opacity:1;pointer-events:auto}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.w100{width:100%}
hr.sep{border:none;border-top:1px solid var(--line);margin:8px 0}

/* Toast */
.toast{position:fixed;left:110px;right:18px;top:66px;background:#ffffff;border:1px solid var(--line);border-left:4px solid var(--brand);border-radius:12px;box-shadow:var(--shadow);padding:10px 12px;z-index:60;opacity:0;transform:translateY(-8px);transition:opacity var(--t),transform var(--t)}
.toast.show{opacity:1;transform:translateY(0)}
.toast.ok{border-left-color:#34C759}
.toast.warn{border-left-color:#FF9F0A}
.toast.err{border-left-color:#FF3B30}

/* Animations */
@keyframes enter{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}
@keyframes floatIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
.enter-anim{animation:enter .36s var(--t)}
.rise{animation:enter .36s var(--t)}
.float-in{animation:floatIn .36s var(--t)}

/* Permission denied UI */
.denied-wrap{padding:48px 18px;display:flex;flex-direction:column;align-items:center;gap:10px;min-height:320px;justify-content:center}
.denied-icon{width:88px;height:88px;opacity:.9;background:url('assets/img/lock.svg') center/contain no-repeat;filter:grayscale(0.2)}
.denied-title{font-size:20px;font-weight:700}
.denied-tip{color:var(--muted)}
/* Sidebar item style when lacking permission (muted look) */
.nav-item.denied{opacity:.5}

/* Controls uniform */
.input, input[type=date], select {
  background:#fff; border:1px solid #e5e7eb; border-radius:10px; padding:10px 12px; font-size:14px; outline:none;
  box-shadow: 0 1px 2px rgba(0,0,0,.03) inset;
}
.input:focus, input[type=date]:focus, select:focus { border-color:#0A84FF; box-shadow:0 0 0 3px rgba(10,132,255,.08); }

/* Panel head right area (for refresh icon) */
.panel-head { position:relative; }
.panel-head-right { position:absolute; right:6px; top:6px; display:flex; gap:8px; }
.icon-btn { width:36px; height:36px; border-radius:10px; background:#fff; border:1px solid #e5e7eb; display:inline-flex; align-items:center; justify-content:center; box-shadow:0 1px 2px rgba(0,0,0,.03); transition:.2s; }
.icon-btn:hover { transform:translateY(-1px); box-shadow:0 4px 10px rgba(0,0,0,.08); }
.icon-btn img { width:18px; height:18px; display:block; }

/* Products spacing */
.catbar { display:flex; gap:12px; flex-wrap:wrap; margin-bottom:12px; }
.grid-cards { display:grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap:16px; }

/* Segment control */
.seg { display:inline-flex; gap:6px; background:#f3f4f6; padding:4px; border-radius:999px; }
.seg-btn { padding:8px 12px; border-radius:999px; background:transparent; border:none; cursor:pointer; font-size:13px; }
.seg-btn.active { background:#0A84FF; color:#fff; box-shadow:0 4px 10px rgba(10,132,255,.25); }

/* Toast color for err */
.toast.err { background: #ffeded; color:#b00020; border-color:#ffb3b3; }

#globalLoading{position:fixed;inset:0;background:rgba(255,255,255,.6);backdrop-filter:blur(1px);display:none;align-items:center;justify-content:center;z-index:9999}
.loader{width:44px;height:44px;border-radius:50%;border:4px solid rgba(0,0,0,.1);border-top-color:#007aff;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.notice-banner{background:#FFF8E1;border:1px solid #FFE58F;color:#8B5E00;border-radius:12px;padding:10px 14px;margin:8px 8px 14px;box-shadow:0 2px 8px rgba(0,0,0,.04)}
.pill.status-4{border:1px solid #FFD591; background:#FFF7E6; box-shadow:0 6px 18px rgba(255,165,0,.15)}

.ico-refresh{display:inline-block;width:18px;height:18px;border-radius:50%;border:1px dashed #ccc;margin-left:8px;vertical-align:middle}

#announcementBar{background:#fff4d1;border:1px solid #f1d48a;color:#7a5d00;padding:8px 12px;border-radius:8px;margin:8px 0 12px;display:none;font-size:14px;line-height:1.5}

.card.status-4{border:1px solid #c7e1ff;background:#f4f9ff}

#notice-bar{display:none;background:#fff3cd;color:#8a6d3b;padding:10px 14px;font-size:14px;border:1px solid #ffeeba;border-radius:8px;margin:8px 16px 0}
.content-root{position:relative;min-height:320px}
.content-loading{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(255,255,255,.6);z-index:9}
.content-loading .spinner{width:36px;height:36px;border:4px solid rgba(0,0,0,.1);border-top-color:#007aff;border-radius:50%;animation:spin .9s linear infinite}
.slot-block{background:#fff;border:1px solid #eee;border-radius:12px;margin-bottom:12px;overflow:hidden}
.slot-head{display:flex;align-items:center;gap:12px;padding:10px 12px;border-bottom:1px solid #f2f2f2}
.slot-body{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px;padding:10px}
.appt-card{border:1px solid #f0f0f0;border-radius:10px;padding:10px;transition:transform .15s,box-shadow .15s;background:#fff}
.badge-running{background:#f0f5ff;border-color:#adc6ff;color:#2f54eb}
.footer-beian{margin-top:auto;padding:12px 16px;text-align:center;color:#9aa1a9;font-size:12px}
.footer-beian .police{display:inline-flex;align-items:center;gap:6px}
.footer-beian .police .icon{width:14px;height:14px;border-radius:50%;background:#c6ccd3;display:inline-block}
.create-tab{display:flex;gap:8px;margin-bottom:8px}
.create-pane{display:none}

/* ===== Appointment Card v2 ===== */
.ap-card{border:1px solid var(--line,#e7e9ee);border-left-width:4px;border-radius:12px;padding:12px 14px;background:#fff;box-shadow:0 1px 3px rgba(16,24,40,.06);display:flex;flex-direction:column;gap:8px;margin-bottom:10px;transition:box-shadow .15s ease,border-color .15s ease;}
.ap-card:hover{box-shadow:0 4px 10px rgba(16,24,40,.10);border-color:#e3e7ef;}
.ap-card .pill-title,.ap-card .card-title{font-weight:600;font-size:14px;line-height:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.ap-card .pill-meta,.ap-card .card-meta{font-size:12px;color:#5b6578;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.ap-badge{display:inline-block;border:1px solid transparent;border-radius:999px;padding:2px 8px;font-size:12px;line-height:18px;vertical-align:middle;}
.ap-card .head{display:flex;align-items:center;justify-content:space-between;gap:8px;}
/* status colors */
.ap-card.status-0{border-left-color:#2b6cb0;background:#f0f6ff;}
.ap-card.status-1{border-left-color:#2f855a;background:#f3faf5;}
.ap-card.status-2{border-left-color:#718096;background:#f7f9fb;}
.ap-card.status-3{border-left-color:#c53030;background:#fff5f5;}
/* badge palette aligned with card */
.ap-card.status-0 .ap-badge{background:#e6f0ff;border-color:#caddff;color:#2b6cb0;}
.ap-card.status-1 .ap-badge{background:#e8f8f0;border-color:#c9f0dd;color:#2f855a;}
.ap-card.status-2 .ap-badge{background:#eef1f6;border-color:#d8dee8;color:#4a5568;}
.ap-card.status-3 .ap-badge{background:#ffe8e8;border-color:#ffc9c9;color:#c53030;}
/* header alignment fix */
.panel-head{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;position:relative;background:#fff;z-index:1;border-bottom:1px solid #eef1f5;}
.panel-head-right{display:flex;align-items:center;gap:8px;position:static;right:auto;top:auto;}
.panel .panel-head + *{margin-top:8px;}



/* === Unified Appointment Card (base + status palette inc. '进行中'=4) === */
.ap-card{
  border:1px solid var(--line,#e7e9ee);
  border-left-width:6px;
  border-radius:14px;
  background:#fff;
  padding:10px 12px 10px 14px;
  cursor:pointer;
  transition:box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
.ap-card:hover{ box-shadow:0 6px 18px rgba(17,17,20,.10); transform:translateY(-2px); }

.ap-card .card-title{
  font-weight:600;
  font-size:14px;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.ap-card .card-meta{
  font-size:12px;
  color:#5b6578;
  margin-top:2px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.ap-card .head{ display:flex; align-items:center; justify-content:space-between; gap:8px; }
.ap-badge{ display:inline-block; border:1px solid transparent; border-radius:999px; padding:2px 8px; font-size:12px; line-height:18px; }

/* Status palette */
.ap-card.status-0{ border-left-color:#f59e0b; background:#fff7e6; } /* 待确认 */
.ap-card.status-1{ border-left-color:#0ea5e9; background:#eaf6ff; } /* 已确认 */
.ap-card.status-2{ border-left-color:#10b981; background:#eafbf1; } /* 已完成 */
.ap-card.status-3{ border-left-color:#9ca3af; background:#f3f4f6; } /* 已取消 */
.ap-card.status-4{ border-left-color:#8b5cf6; background:#f4f1ff; } /* 进行中 */

/* Badge colors aligned with card */
.ap-card.status-0 .ap-badge{ background:#fff1cc; border-color:#fde68a; color:#b45309; }
.ap-card.status-1 .ap-badge{ background:#e6f0ff; border-color:#bfdbfe; color:#0369a1; }
.ap-card.status-2 .ap-badge{ background:#e7faef; border-color:#bbf7d0; color:#047857; }
.ap-card.status-3 .ap-badge{ background:#eef0f3; border-color:#e5e7eb; color:#6b7280; }
.ap-card.status-4 .ap-badge{ background:#eee9ff; border-color:#ddd6fe; color:#6d28d9; }

/* Hide legacy .pill visuals if both classes exist */
.pill.ap-card::before{ display:none!important; }

/* === Enhanced 新增预约弹窗 & 顶栏日期切换 === */
.modal{ border-radius: var(--radius-lg); box-shadow: var(--shadow-2); }
.modal-head h3{ font-size:16px; font-weight:650; }
.field{ display:flex; flex-direction:column; gap:6px; }
.field>label{ font-size:12px; color:var(--muted); }
.input,.select{ padding:10px 12px; border:1px solid var(--line); border-radius:12px; background:#fff; }
.input:focus,.select:focus{ border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-weak); outline: none; }
.seg{ background:#f3f4f6; padding:4px; border-radius:999px; }
.seg-btn{ min-width:54px; }

.date-switch{ display:flex; align-items:center; gap:8px; }
.btn.icon-btn{ width:32px; height:32px; padding:0; border-radius:999px; line-height:30px; text-align:center; }
.btn.icon-btn:hover{ transform:translateY(-1px); box-shadow:var(--shadow); }

/* 兜底：若不小心留下空seg按钮，隐藏空条 */
.seg-btn:empty{ display:none; }

