/* 抢休助手 · 共享样式 */
:root {
  --bg1: #f6f8fc;
  --bg2: #eef2fb;
  --card: #ffffff;
  --line: #e5eaf3;
  --text: #1e2740;
  --muted: #6f7a90;
  --primary: #4666f0;
  --primary-2: #5f7bf5;
  --primary-soft: #eef2ff;
  --success: #12a97a;
  --success-soft: #e4f7ef;
  --warn: #d9822b;
  --warn-soft: #fff3e6;
  --danger: #e05252;
  --danger-soft: #fdeeee;
  --shadow: 0 10px 34px rgba(35, 55, 110, .08);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 26px 16px 60px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  background: linear-gradient(135deg, var(--primary), #7b5cf0);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px; letter-spacing: 1px;
}
.brand h1 { font-size: 21px; margin: 0; letter-spacing: .5px; }
.brand .tag { color: var(--muted); font-size: 13px; margin-top: 1px; }
.top-actions { display: flex; gap: 8px; align-items: center; }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 8px 15px; border-radius: 10px; transition: .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.05); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f3cccc; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.month-nav .btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 20px 22px; margin-bottom: 16px; }
.section-title { font-size: 16px; font-weight: 700; margin: 0 0 14px; }
.muted { color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { padding: 14px 16px; border-radius: 13px; background: var(--primary-soft); }
.stat:nth-child(2) { background: #f3f6fc; }
.stat:nth-child(3) { background: var(--success-soft); }
.stat:nth-child(4) { background: var(--warn-soft); }
.stat .num { font-size: 25px; font-weight: 700; line-height: 1.2; }
.stat .label { color: var(--muted); font-size: 12px; margin-top: 3px; }

.monthbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.monthbar h2 { margin: 0; font-size: 19px; }
.month-nav { display: flex; gap: 6px; align-items: center; }

.notice {
  background: var(--warn-soft); color: #8a551d; border-radius: 10px;
  padding: 9px 13px; margin-bottom: 14px; font-size: 13px;
}

.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 9px; }
.weekday { text-align: center; color: var(--muted); font-size: 12px; padding: 4px 0 8px; }
.day {
  min-height: 132px; border: 1px solid var(--line); border-radius: 13px;
  padding: 10px 10px 9px; background: #fff; display: flex; flex-direction: column; gap: 6px;
  transition: .15s;
}
.day:hover { border-color: #b9c6ea; }
.day.today { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(70,102,240,.10); }
.day.other { background: #fafbfd; color: #a5aebe; }
.day.full { background: #fcfcfd; }
.day-head { display: flex; justify-content: space-between; align-items: center; }
.day-num { font-weight: 700; font-size: 15px; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 20px; background: #f1f4f9; color: var(--muted); }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.full { background: var(--danger-soft); color: var(--danger); }
.badge.mine { background: var(--primary-soft); color: var(--primary); }
.names { font-size: 12px; color: var(--muted); flex: 1; }
.names .n { display: inline-block; background: #f3f6fc; border-radius: 6px; padding: 1px 7px; margin: 0 4px 4px 0; color: #3c485c; }
.names .n.me { background: var(--primary-soft); color: var(--primary); }
.day .btn { margin-top: auto; }

.mine-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.mine-item {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--primary-soft); color: #2b53c4; border-radius: 9px; padding: 6px 10px; font-size: 13px;
}
.mine-item b { font-weight: 700; }
.mi-week { color: #6a7fc4; font-size: 12px; }
.mi-tag { background: #dfe7ff; color: #2b53c4; font-size: 11px; border-radius: 20px; padding: 0 8px; }

.overlay {
  position: fixed; inset: 0; background: rgba(23,33,56,.44); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50;
}
.modal {
  width: 100%; max-width: 470px; max-height: 90vh; overflow: auto;
  background: #fff; border-radius: 18px; padding: 24px;
  box-shadow: 0 20px 70px rgba(18,28,52,.25);
}
.modal.wide { max-width: 680px; }
.modal h3 { margin: 0 0 6px; font-size: 19px; }
.modal p.sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(70,102,240,.10);
}
.check-line { display: flex; gap: 9px; align-items: center; margin: 9px 0; font-size: 13px; }
.check-line input { width: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }

.rule-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 9px 7px; border-bottom: 1px solid var(--line); text-align: left; }
.data-table th { color: var(--muted); font-weight: 500; }
.data-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.data-tools select, .data-tools input { border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; background: #fff; }
.booking-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.qr-box { text-align: center; }
.qr-box img { width: 250px; height: 250px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.qr-box .url { word-break: break-all; font-size: 12px; color: var(--muted); margin-top: 12px; }

#toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #24304a; color: #fff; padding: 10px 17px; border-radius: 9px; font-size: 13px; box-shadow: 0 8px 22px rgba(0,0,0,.18); }
.toast.err { background: #b23b3b; }
.toast.ok { background: #12805d; }
.loading { text-align: center; padding: 70px 0; color: var(--muted); }
.footer-entry { text-align: center; padding: 8px 0 26px; }
.footer-entry a { color: var(--muted); font-size: 13px; text-decoration: none; opacity: .7; }
.footer-entry a:hover { opacity: 1; text-decoration: underline; }
.bar-row { display: flex; align-items: center; gap: 9px; margin: 7px 0; font-size: 13px; }
.bar-row .bar-name { width: 78px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bar-track { flex: 1; height: 9px; background: #eef2fb; border-radius: 20px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #8a6af0); border-radius: 20px; }
.bar-row .bar-num { width: 44px; text-align: right; color: var(--muted); flex: none; font-size: 12px; }

/* 每日名额使用 · 热力日历 */
.usage-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.usage-legend { display: flex; gap: 13px; font-size: 12px; color: var(--muted); }
.usage-legend span { display: inline-flex; align-items: center; gap: 5px; }
.usage-legend i.lg { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.lg.free { background: #e8edf7; }
.lg.part { background: #f7b733; }
.lg.full { background: #e05252; }
.usage-summary { font-size: 12px; color: var(--muted); }
.usage-summary b { color: var(--primary); font-size: 14px; }
.usage-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.usage-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.usage-pad { min-height: 4px; }
.usage-cell {
  border-radius: 10px; padding: 6px 3px 5px; text-align: center;
  background: #f7f9fd; display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: .15s; min-width: 0;
}
.usage-cell.part { background: #fff8e9; }
.usage-cell.full { background: #fdeeee; }
.usage-cell.today { box-shadow: 0 0 0 2px var(--primary); }
.usage-cell.past { opacity: .45; }
.uc-date { font-size: 12px; font-weight: 700; line-height: 1; }
.usage-cell.today .uc-date { color: var(--primary); }
.uc-ring {
  --pct: 0%; --rc: #cfd8ea;
  width: 34px; height: 34px; border-radius: 50%; position: relative;
  background: conic-gradient(var(--rc) var(--pct), #e6ebf5 0);
  display: flex; align-items: center; justify-content: center;
}
.usage-cell.part .uc-ring { --rc: #f7b733; }
.usage-cell.full .uc-ring { --rc: #e05252; }
.uc-ring::before { content: ''; position: absolute; inset: 4px; background: #fff; border-radius: 50%; }
.usage-cell.part .uc-ring::before { background: #fff8e9; }
.usage-cell.full .uc-ring::before { background: #fdeeee; }
.uc-num { position: relative; z-index: 1; font-size: 11px; font-weight: 700; color: var(--text); }
.uc-week { font-size: 10px; color: var(--muted); line-height: 1; }

/* 抢休信息 · 休息日期徽标 */
.rest-date { display: flex; align-items: center; gap: 9px; }
.rd-day {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 6px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #7b5cf0); color: #fff;
  font-size: 16px; font-weight: 700; line-height: 1;
}
.rd-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.person-name { font-weight: 600; }
.data-table td { vertical-align: middle; }

/* 操作日志 */
.oplog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.op-filter { border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; background: #fff; font-size: 13px; }
#opLogBox { max-height: 420px; overflow-y: auto; }
.op-item { display: flex; gap: 11px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.op-item:last-child { border-bottom: none; }
.op-icon {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
}
.op-icon.claim { background: linear-gradient(135deg, #4666f0, #5f7bf5); }
.op-icon.cancel { background: linear-gradient(135deg, #d9822b, #e8a24c); }
.op-icon.admin { background: linear-gradient(135deg, #7b5cf0, #9a6ff5); }
.op-icon.other { background: #9aa5b8; }
.op-body { flex: 1; min-width: 0; }
.op-line { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.op-tag { font-size: 11px; padding: 1px 8px; border-radius: 20px; flex: none; font-weight: 600; }
.op-tag.claim { background: var(--primary-soft); color: var(--primary); }
.op-tag.cancel { background: var(--warn-soft); color: var(--warn); }
.op-tag.admin { background: #f1eaff; color: #7b5cf0; }
.op-tag.other { background: #eef1f6; color: var(--muted); }
.op-detail { font-size: 13px; color: var(--text); word-break: break-word; }
.op-time { font-size: 11px; color: var(--muted); margin-top: 3px; }

.slogan {
  background: linear-gradient(135deg, #4666f0, #7b5cf0);
  color: #fff; border-radius: var(--radius); padding: 16px 22px;
  margin-bottom: 16px; font-size: 15px; font-weight: 600; letter-spacing: .5px;
  box-shadow: 0 10px 30px rgba(70,102,240,.22);
}

@media (max-width: 760px) {
  .wrap { padding: 14px 10px 40px; }
  .panel { padding: 13px 12px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat { padding: 11px 13px; }
  .stat .num { font-size: 22px; }
  .brand h1 { font-size: 18px; }
  .topbar { margin-bottom: 14px; }
  .top-actions { width: 100%; }

  .monthbar { flex-wrap: wrap; gap: 8px; }
  .monthbar h2 { font-size: 17px; }
  .month-nav .btn { padding: 4px 9px; font-size: 12px; }

  /* 日历：允许列收缩，格子改紧凑堆叠，避免撑破屏幕产生横向滚动 */
  .calendar { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
  .weekday { font-size: 11px; padding: 2px 0 4px; }
  .day { min-width: 0; min-height: 84px; padding: 5px 1px 4px; gap: 2px; border-radius: 8px; overflow: hidden; }
  .day-head { flex-direction: column; align-items: center; gap: 1px; }
  .day-num { font-size: 13px; line-height: 1.15; }
  .badge { font-size: 9px; padding: 1px 5px; line-height: 1.25; max-width: 96%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .names { font-size: 10px; text-align: center; line-height: 1.25; }
  .names .n { font-size: 9px; padding: 0 3px; margin: 0 0 2px 0; white-space: nowrap; }
  .day .btn { width: 100%; font-size: 10px; padding: 4px 1px; margin-top: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.2px; border-radius: 7px; }
  .btn-remain { display: none; }
  /* 已过期/仅查看的日子整体淡化，减少视觉噪音（不支持 :has 的旧浏览器自动忽略） */
  .day:has(.badge:not(.ok):not(.full):not(.mine)) { opacity: .58; }

  .rule-grid { grid-template-columns: 1fr; }
  .data-tools { width: 100%; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 8px 4px; }
  .rd-day { min-width: 28px; height: 28px; font-size: 14px; }
  .rd-meta { font-size: 11px; }
  .usage-grid, .usage-weekdays { gap: 3px; }
  .usage-cell { padding: 5px 1px; }
  .uc-ring { width: 30px; height: 30px; }
  .uc-date { font-size: 11px; }
  .uc-week { font-size: 9px; }
  .modal { padding: 18px; }
}
