/* app.css — 奥黛丽的工作日记 · 懒羊羊主题（淡黄暖系 / 奶油卡片 / 大圆角） */
:root, [data-theme="lazy"] {
  --primary: #c97a12;        /* 焦糖色：主操作/强调 */
  --accent: #f5b301;         /* 蜂蜜黄：点缀 */
  --bg: #fdf6e3;             /* 淡黄背景 */
  --bg-2: #fbf0d6;           /* 略深淡黄：表头/输入 */
  --card: #fffdf7;           /* 奶油白卡片 */
  --text: #5a4a32;           /* 暖棕文字 */
  --muted: #a99a7e;          /* 柔和灰棕 */
  --border: #efe2c8;         /* 奶油边框 */
  --shadow: 0 2px 8px rgba(180,150,90,.12), 0 6px 20px rgba(180,150,90,.10);
  --radius: 16px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--bg);
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

.app { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 220px; flex: 0 0 220px;
  background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 12px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 14px; background: var(--accent);
  color: #6b4a00; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800;
}
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 15px; }
.brand-text span { font-size: 12px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; min-height: 44px;
  padding: 0 12px; border: none; background: transparent; border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px; text-align: left;
}
.nav-item .ico { width: 20px; text-align: center; color: var(--muted); }
.nav-item.active { background: rgba(245,179,1,.22); color: var(--primary); font-weight: 700; }
.nav-item.active .ico { color: var(--primary); }
.nav-item:active { transform: scale(.98); }

.side-foot { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.sync-btn {
  display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text);
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: #e5484d; flex: 0 0 auto; }

/* ---------- 主区域 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.topbar-left h1 { margin: 0; font-size: 18px; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.topbar-right { display: flex; gap: 8px; }

.icon-btn {
  min-width: 44px; min-height: 44px; border: 1px solid var(--border); background: var(--card);
  border-radius: var(--radius-sm); font-size: 16px; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:active { background: var(--bg); }

.view { padding: 16px; max-width: 1200px; width: 100%; margin: 0 auto; }
.page { display: block; }
.page[hidden] { display: none; }

/* ---------- 通用按钮 ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.toolbar.compact { margin-bottom: 0; }
.week-nav { display: flex; align-items: center; gap: 6px; }
.week-range { font-weight: 600; min-width: 150px; text-align: center; font-size: 14px; }
.toolbar-right { display: flex; gap: 8px; flex-wrap: wrap; }

.ghost-btn {
  min-height: 40px; padding: 0 14px; border: 1px solid var(--border); background: var(--card);
  border-radius: var(--radius-sm); color: var(--text); font-size: 14px;
}
.ghost-btn:active { background: var(--bg); }
.primary-btn {
  min-height: 40px; padding: 0 16px; border: none; background: var(--primary); color: #fff;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 700;
}
.primary-btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.primary-btn.danger { background: #e5484d; }
.primary-btn.on { background: #22a06b; }
.chip-btn {
  min-height: 40px; padding: 0 12px; border: 1px solid var(--border); background: var(--card);
  border-radius: 999px; color: var(--text); font-size: 13px;
}

.hint { color: var(--muted); font-size: 12px; margin: 12px 0 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 16px; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }

/* ---------- 出勤 ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
.legend-item i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.att-table { border-collapse: collapse; width: 100%; min-width: 760px; }
.att-table th, .att-table td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 4px 6px; text-align: center; }
.att-table th:last-child, .att-table td:last-child { border-right: none; }
.att-table thead th { background: var(--bg-2); font-weight: 700; font-size: 13px; }
.day-head span { font-weight: 400; color: var(--muted); font-size: 11px; }
.day-head.is-today { color: var(--primary); }
.day-head.is-today span { color: var(--primary); }
.half-head { font-size: 12px; color: var(--muted); width: 44px; }
.row-head { text-align: left; white-space: nowrap; font-weight: 700; background: var(--card); }
.att-table th.row-head, .att-table td.row-head { position: sticky; left: 0; z-index: 2; }
.att-table thead th.row-head { z-index: 4; }
.staff-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; }
.att-cell { min-width: 56px; height: 50px; cursor: pointer; vertical-align: top; transition: background .15s; }
.att-cell:active { background: var(--bg); }
.att-cell.filled { background: var(--bg); }
.cell-empty { color: var(--border); font-size: 16px; }
.cell-status { display: block; font-weight: 700; font-size: 12px; }
.att-cell small { display: block; font-size: 10px; color: var(--muted); max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.row-toggles { display: flex; flex-direction: column; gap: 8px; }
.row-toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 8px; background: var(--bg); border-radius: var(--radius-sm); }
.row-toggle input { width: 20px; height: 20px; }

/* ---------- 医生跟进 ---------- */
.two-col { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.col-left { display: flex; flex-direction: column; gap: 12px; }
.search { flex: 1; min-height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); }
.cust-list { display: flex; flex-direction: column; gap: 10px; }
.cust-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; cursor: pointer; border: 2px solid transparent; }
.cust-card.active { border-color: var(--accent); }
.cust-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cust-card-top strong { font-size: 15px; }
.cust-card-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.cust-card-last { font-size: 12px; color: var(--muted); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }

.col-right { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); min-height: 300px; position: relative; }
.empty { display: flex; align-items: center; justify-content: center; height: 300px; color: var(--muted); padding: 16px; text-align: center; }
.cust-detail { padding: 16px; }
.detail-bar { display: none; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.back-btn { border: none; background: transparent; color: var(--primary); font-size: 14px; min-height: 40px; padding: 0; font-weight: 700; }
.detail-actions { display: flex; gap: 6px; }
.detail-title { margin: 4px 0 10px; font-size: 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.detail-meta > div { font-size: 14px; }
.detail-meta .muted { display: inline-block; min-width: 42px; }
.detail-note { background: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px; margin: 12px 0; white-space: pre-wrap; }
.detail-section { margin-top: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.section-head h3 { margin: 0; font-size: 16px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); }
.tl-item { position: relative; padding: 0 0 14px 12px; }
.tl-item::before { content: ''; position: absolute; left: -19px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.tl-date { font-size: 12px; color: var(--muted); }
.tl-content { font-size: 14px; margin-top: 2px; }
.tl-next { font-size: 13px; color: var(--primary); margin-top: 2px; }

/* ---------- 任务 ---------- */
.task-progress { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 12px; }
.prog-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.prog-bar { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.prog-bar.big { height: 12px; }
.prog-bar i { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .25s; }
.add-task { display: flex; gap: 10px; margin-bottom: 12px; }
.task-input {
  flex: 1; min-height: 40px; padding: 0 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--card); width: 100%;
}
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 10px 12px; }
.task-item.done .task-text { text-decoration: line-through; color: var(--muted); }
.check { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); background: transparent; color: transparent; font-size: 14px; flex: 0 0 auto; }
.check.on { background: #22a06b; border-color: #22a06b; color: #fff; }
.task-text { flex: 1; font-size: 14px; word-break: break-word; }
.task-item .del { border: none; background: transparent; color: var(--muted); min-width: 36px; min-height: 36px; }

/* 月历 */
.calendar-box { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; margin-bottom: 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-w { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-cell { position: relative; text-align: center; padding: 10px 0; border-radius: var(--radius-sm); font-size: 13px; }
.cal-cell.out { color: var(--border); }
.cal-cell.is-today { background: rgba(245,179,1,.25); color: var(--primary); font-weight: 700; }
.cal-cell.is-cur { outline: 2px solid var(--primary); }
.cal-cell.has .dot { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }

/* ---------- 目标（三态） ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab { flex: 1; min-height: 40px; border: 1px solid var(--border); background: var(--card); border-radius: var(--radius-sm); color: var(--text); font-size: 14px; }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }
.goal-summary { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 12px; }
.sum-row { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.status-counts { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; font-weight: 700; }
.add-goal { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.goal-list { display: flex; flex-direction: column; gap: 10px; }
.goal-item { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.goal-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.goal-text { font-size: 14px; font-weight: 600; word-break: break-word; }
.goal-status { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.goal-note { font-size: 13px; color: var(--muted); margin-top: 6px; background: var(--bg); border-radius: var(--radius-sm); padding: 8px 10px; }
.goal-actions { display: flex; gap: 6px; margin-top: 8px; }
.mini-btn { min-height: 36px; padding: 0 12px; border: 1px solid var(--border); background: var(--bg); border-radius: var(--radius-sm); font-size: 13px; color: var(--text); }
.mini-btn:active { background: var(--border); }
.mini-select { min-height: 40px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); max-width: 220px; }

/* ---------- 记账 ---------- */
.exp-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.sum-card { background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.sum-card span { font-size: 12px; color: var(--muted); }
.sum-card strong { font-size: 16px; }
.add-exp { margin-bottom: 12px; }
.exp-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; align-items: center; }
.exp-filter { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.exp-filter label { font-size: 13px; color: var(--muted); }
.exp-list { display: flex; flex-direction: column; gap: 10px; }
.exp-item { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.exp-row1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.exp-item-name { font-size: 15px; font-weight: 600; }
.exp-amount { font-size: 16px; font-weight: 700; color: var(--primary); }
.exp-row2 { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.exp-date { font-size: 12px; color: var(--muted); }
.exp-note { font-size: 13px; color: var(--muted); margin-top: 6px; background: var(--bg); border-radius: var(--radius-sm); padding: 8px 10px; }
.exp-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(60,45,20,.4); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.modal-mask[hidden] { display: none; }
.modal {
  background: var(--card); width: 100%; max-width: 520px; border-radius: 22px 22px 0 0;
  max-height: 90vh; overflow: auto; animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--card); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--border); }
.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.form-row label { font-size: 13px; color: var(--muted); }
.form-row > div { font-size: 14px; }
.form-row code { background: var(--bg); padding: 1px 5px; border-radius: 6px; }
textarea.task-input { padding: 10px 12px; resize: vertical; min-height: 60px; }
.staff-edit { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.color-pick { width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: #fff; }
.name-in { flex: 1; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: rgba(90,74,50,.94); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 13px; opacity: 0; transform: translateY(10px); transition: all .25s; max-width: 80vw; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-ok { background: rgba(34,160,107,.96); }
.toast-warn { background: rgba(230,162,60,.96); }

/* ---------- 底部 tabbar（移动端） ---------- */
.tabbar { display: none; }

/* ================= 移动端 (≤768px) ================= */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .app { flex-direction: column; }
  .main { padding-bottom: 64px; }
  .view { padding: 12px; }
  .topbar { padding: 10px 12px; }
  .topbar-left h1 { font-size: 16px; }
  .two-col { display: block; }
  .col-left, .col-right { width: 100%; }
  .col-right { border-radius: 0; box-shadow: none; min-height: auto; display: none; }
  .col-left { display: block; }
  .two-col.mobile-detail .col-left { display: none; }
  .two-col.mobile-detail .col-right { display: block; }
  .detail-bar { display: flex; }

  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 56px;
    background: var(--card); border-top: 1px solid var(--border); z-index: 40;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar-item {
    flex: 1; border: none; background: transparent; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px;
  }
  .tabbar-item i { font-style: normal; font-size: 18px; line-height: 1; }
  .tabbar-item.active { color: var(--primary); }
  .tabbar-item:active { opacity: .7; }

  .exp-summary { grid-template-columns: repeat(2, 1fr); }
  .att-cell { min-width: 52px; }
  .half-head { width: 38px; }
}
