/* ===== 妆造排班表 · 液态金属渐变风格（鲜艳配色） ===== */
:root {
  /* 鲜艳主色 */
  --primary: #7c3aed;        /* 鲜紫 */
  --primary-2: #db2777;      /* 品红 */
  --primary-3: #06b6d4;      /* 青 */
  --primary-accent: #f59e0b; /* 琥珀 */
  --primary-focus: #8b5cf6;
  --primary-tint: rgba(124, 58, 237, 0.10);

  --ink: #1c1030;            /* 深紫墨 */
  --ink-muted-80: #4a4660;
  --ink-muted-48: #908aa6;

  --canvas: #ffffff;
  --parchment: #f6f3ff;      /* 淡紫底 */
  --pearl: #faf8ff;
  --black: #1a0f33;          /* 深紫黑（导航） */

  --hairline: rgba(124, 58, 237, 0.16);
  --divider-soft: #f0ebfb;
  --rest-bg: #f2ecfe;
  --rest-text: #b3a9d6;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 9999px;

  /* ===== 液态金属渐变 ===== */
  --grad-main: linear-gradient(120deg, #7c3aed 0%, #db2777 42%, #f59e0b 72%, #06b6d4 100%);
  --grad-violet: linear-gradient(135deg, #2563eb 0%, #7c3aed 50%, #ec4899 100%);
  --grad-soft: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  /* 金属高光：横向扫光 */
  --metal-sheen: linear-gradient(105deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 35%, rgba(255,255,255,0.25) 55%, rgba(255,255,255,0) 100%);
  /* 页面氛围光晕 */
  --bg-aura:
    radial-gradient(1100px 520px at 10% -12%, rgba(124,58,237,0.20), transparent 60%),
    radial-gradient(900px 480px at 102% 4%, rgba(219,39,119,0.18), transparent 55%),
    radial-gradient(900px 560px at 48% 122%, rgba(6,182,212,0.18), transparent 55%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.47;
  color: var(--ink);
  background: var(--parchment);
  background-image: var(--bg-aura);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

@keyframes metalShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===== 全局导航 ===== */
.global-nav {
  background: var(--grad-main);
  background-size: 220% 220%;
  animation: metalShift 14s ease infinite;
  height: 48px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 6px 22px rgba(124, 58, 237, 0.30);
}
.nav-inner {
  max-width: 1024px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; gap: 14px;
}
.logo {
  color: #ffffff; font-size: 17px; font-weight: 700; letter-spacing: -0.2px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25); white-space: nowrap;
}
.nav-actions { display: flex; gap: 14px; align-items: center; min-width: 0; }
.mode-badge {
  font-size: 11px; padding: 3px 10px; border-radius: var(--radius-pill);
  border: 1px solid rgba(255,255,255,0.4); white-space: nowrap;
  background: rgba(255,255,255,0.16); color: #fff; backdrop-filter: blur(4px);
}
.mode-badge.local { color: #fff; background: rgba(0,0,0,0.22); border-color: transparent; }
.mode-badge.cloud { color: #fff; background: rgba(255,255,255,0.22); border-color: transparent; }
.nav-link {
  background: none; border: none; color: rgba(255,255,255,0.85); font-size: 12px;
  cursor: pointer; padding: 4px 0; font-family: inherit; transition: color .2s; white-space: nowrap;
}
.nav-link:hover { color: #ffffff; }
.nav-link-strong {
  color: #fff; font-weight: 600; border: 1px solid rgba(255,255,255,0.55);
  padding: 5px 14px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.14); backdrop-filter: blur(4px);
}
.nav-link-strong:hover { background: rgba(255,255,255,0.28); border-color: #fff; }

/* ===== 毛玻璃子导航 ===== */
.sub-nav {
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
  height: 54px;
  position: sticky; top: 48px; z-index: 99;
}
.sub-nav-inner {
  max-width: 1024px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; gap: 16px;
}
.segmented {
  display: flex; gap: 2px; background: rgba(255,255,255,0.7);
  border: 1px solid var(--hairline); border-radius: var(--radius-pill);
  padding: 3px; overflow-x: auto; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.seg-btn {
  border: none; background: none; font-family: inherit;
  font-size: 13px; color: var(--ink); padding: 6px 16px;
  border-radius: var(--radius-pill); cursor: pointer;
  transition: background .2s, color .2s; white-space: nowrap;
}
.seg-btn.active {
  background: var(--grad-main); background-size: 200% 200%;
  color: #ffffff; font-weight: 600; box-shadow: 0 4px 12px rgba(124,58,237,0.35);
}
.seg-btn:not(.active):hover { background: rgba(124,58,237,0.08); }

/* ===== 按钮 ===== */
.btn-primary {
  background: var(--grad-main); background-size: 220% 220%;
  animation: metalShift 12s ease infinite;
  color: #ffffff; border: none; font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 9px 22px; border-radius: var(--radius-pill); cursor: pointer;
  position: relative; overflow: hidden;
  box-shadow: 0 8px 20px rgba(124,58,237,0.38), inset 0 1px 0 rgba(255,255,255,0.45);
  transition: transform .15s, box-shadow .2s;
}
.btn-primary::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--metal-sheen); opacity: 0.5; pointer-events: none;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(219,39,119,0.45), inset 0 1px 0 rgba(255,255,255,0.5); }
.btn-primary:active { transform: translateY(0); }
.btn-mini {
  background: var(--grad-soft); color: #fff; border: none; font-family: inherit;
  font-size: 12px; padding: 7px 15px; border-radius: var(--radius-pill); cursor: pointer;
  box-shadow: 0 4px 12px rgba(124,58,237,0.30), inset 0 1px 0 rgba(255,255,255,0.4);
}
.btn-mini:hover { filter: brightness(1.06); }
.btn-ghost {
  background: rgba(255,255,255,0.7); border: 1px solid var(--hairline); color: var(--ink);
  font-family: inherit; font-size: 12px; padding: 6px 15px;
  border-radius: var(--radius-pill); cursor: pointer; transition: all .2s;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); background: #fff; }
.btn-danger-text {
  background: none; border: none; color: var(--ink-muted-48); font-size: 12px;
  cursor: pointer; font-family: inherit; padding: 2px 6px;
}
.btn-danger-text:hover { color: #d70015; }

/* ===== 内容区 ===== */
.content {
  max-width: 1024px; margin: 0 auto; padding: 32px 22px;
  display: flex; flex-direction: column; gap: 24px;
}

.card {
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--hairline);
  box-shadow: 0 14px 38px rgba(124, 58, 237, 0.12);
  padding: 24px;
}
.card-title {
  font-size: 21px; font-weight: 700; letter-spacing: -0.3px; color: var(--ink);
  background: var(--grad-violet); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; display: inline-block;
}
.muted { color: var(--ink-muted-48); font-size: 14px; font-weight: 400; }

/* ===== 快速录入表单 ===== */
.form-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px; margin-top: 18px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-wide { grid-column: span 2; }
.field-time { grid-column: span 2; }
.field label { font-size: 12px; color: var(--ink-muted-48); font-weight: 600; white-space: nowrap; }
.field input, .field select {
  font-family: inherit; font-size: 14px; color: var(--ink);
  background: rgba(255,255,255,0.85); border: 1px solid var(--hairline);
  border-radius: var(--radius-sm); padding: 10px 12px; outline: none;
  transition: border-color .2s, box-shadow .2s; width: 100%; box-sizing: border-box;
}
.field select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237c3aed' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 28px; cursor: pointer;
}
.field input:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.time-pair { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.time-pair input[type="time"] { width: 110px; flex-shrink: 0; }
.time-dash { color: var(--ink-muted-48); white-space: nowrap; }
.form-actions { margin-top: 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.form-msg { font-size: 13px; color: var(--primary); font-weight: 600; }
.form-msg.error { color: #d70015; }

/* ===== 字典管理（弹窗） ===== */
.dict-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.dict-col h3 { font-size: 14px; font-weight: 700; margin-bottom: 10px; color: var(--ink); }
.dict-tag {
  font-size: 11px; color: var(--primary); background: var(--primary-tint);
  border-radius: var(--radius-pill); padding: 1px 8px; margin-left: 4px;
  border: 1px solid var(--hairline);
}
.dict-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; min-height: 8px; }
.dict-list li {
  background: rgba(255,255,255,0.9); border: 1px solid var(--hairline);
  border-radius: var(--radius-pill); padding: 4px 6px 4px 12px;
  font-size: 13px; display: flex; align-items: center; gap: 4px;
}
.dict-del {
  background: none; border: none; color: var(--ink-muted-48); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 2px 6px; border-radius: 50%;
}
.dict-del:hover { color: #d70015; }
.dict-add { display: flex; gap: 8px; flex-wrap: wrap; }
.dict-add input {
  flex: 1; min-width: 0; font-family: inherit; font-size: 13px; background: rgba(255,255,255,0.85);
  border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  padding: 8px 10px; outline: none;
}
.dict-add input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.dict-select {
  flex: 0 0 auto; max-width: 120px; font-family: inherit; font-size: 13px;
  background: rgba(255,255,255,0.85); border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  padding: 8px 10px; outline: none; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237c3aed' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; padding-right: 24px; cursor: pointer;
}
.dict-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
@media (max-width: 720px) {
  .dict-grid { grid-template-columns: 1fr; }
}

/* ===== Tab 面板 ===== */
.tab-panel { display: none; flex-direction: column; gap: 24px; }
.tab-panel.active { display: flex; }

/* ===== 排班区块 ===== */
.schedule-block {
  background: rgba(255,255,255,0.74); border-radius: var(--radius-lg);
  border: 1px solid var(--hairline); overflow: hidden;
  box-shadow: 0 14px 38px rgba(124, 58, 237, 0.12);
}
.block-header {
  background: var(--grad-violet);
  color: #ffffff; height: 46px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}
.block-header .bh-title { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; text-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.block-header .bh-tag {
  background: rgba(255,255,255,0.22); font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: var(--radius-pill);
}

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; margin-top: 8px; -webkit-overflow-scrolling: touch; }
.data-table, .schedule-table { width: 100%; border-collapse: collapse; }
.schedule-table th, .data-table th {
  background: rgba(124,58,237,0.06); font-size: 12px; font-weight: 700;
  color: var(--ink-muted-80); text-align: left; padding: 11px 14px;
  border-bottom: 1px solid var(--hairline); white-space: nowrap;
}
.schedule-table td, .data-table td {
  font-size: 14px; padding: 12px 14px;
  border-bottom: 1px solid var(--divider-soft);
}
.schedule-table td.slot-col { font-weight: 600; white-space: nowrap; width: 120px; color: var(--ink-muted-80); }
.schedule-table td.rest { background: var(--rest-bg); color: var(--rest-text); }
.schedule-table td.cell-click { cursor: pointer; transition: background .15s; }
.schedule-table td.cell-click:hover { background: var(--primary-tint); box-shadow: inset 0 0 0 1px var(--primary); }
.schedule-table td.cell-empty { cursor: pointer; background: repeating-linear-gradient(45deg, transparent, transparent 6px, var(--divider-soft) 6px, var(--divider-soft) 12px); }
.schedule-table td.cell-empty:hover { background: var(--primary-tint); box-shadow: inset 0 0 0 1px var(--primary); }
.schedule-table tr:last-child td, .data-table tr:last-child td { border-bottom: none; }
.cell-note { display: block; font-size: 11px; color: var(--ink-muted-48); margin-top: 2px; }

/* 编辑/删除文字按钮 */
.btn-ghost-text { background: none; border: none; color: var(--primary); font-family: inherit; font-size: 13px; cursor: pointer; padding: 4px 8px; border-radius: 6px; font-weight: 600; }
.btn-ghost-text:hover { background: var(--primary-tint); }
.btn-danger-text { background: none; border: none; color: var(--ink-muted-48); font-family: inherit; font-size: 13px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.btn-danger-text:hover { color: #d70015; background: rgba(215,0,21,0.08); }
.records-actions { display: flex; gap: 4px; white-space: nowrap; }

/* 弹窗内删除按钮（红） */
.btn-danger { background: linear-gradient(135deg, #ff5b6e 0%, #d70015 100%); color: #fff; border: none; padding: 9px 18px; border-radius: var(--radius-pill); font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: 0 6px 16px rgba(215,0,21,0.35); }
.btn-danger:hover { filter: brightness(1.05); }

.records-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
}
.records-toolbar input {
  font-family: inherit; font-size: 13px; background: rgba(255,255,255,0.85);
  border: 1px solid var(--hairline); border-radius: var(--radius-pill);
  padding: 9px 16px; outline: none; min-width: 220px;
}
.records-toolbar input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.att-query { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.att-query input, .att-query select {
  font-family: inherit; font-size: 13px; background: rgba(255,255,255,0.85);
  border: 1px solid var(--hairline); border-radius: var(--radius-pill);
  padding: 8px 14px; outline: none; min-width: 120px;
}
.att-query input[type="month"] { min-width: 150px; }
.att-query input:focus, .att-query select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.empty-hint { text-align: center; color: var(--ink-muted-48); padding: 32px 0; font-size: 14px; }

/* ===== 统计条 ===== */
.stat-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; }
.stat-name { width: 72px; font-size: 14px; font-weight: 600; text-align: right; color: var(--ink); }
.stat-bar-track { flex: 1; height: 26px; background: rgba(124,58,237,0.08); border-radius: var(--radius-sm); overflow: hidden; }
.stat-bar {
  height: 100%; background: var(--grad-main); background-size: 200% 200%;
  animation: metalShift 10s ease infinite; border-radius: var(--radius-sm);
  min-width: 2px; transition: width .4s ease;
}
.stat-num { width: 90px; font-size: 13px; color: var(--ink-muted-48); }

/* ===== 考勤状态 ===== */
.att-status { font-size: 12px; padding: 3px 10px; border-radius: var(--radius-pill); font-weight: 600; }
.att-status.done { background: var(--primary-tint); color: var(--primary); }
.att-status.pending { background: rgba(255,255,255,0.8); color: var(--ink-muted-48); border: 1px solid var(--hairline); }

/* ===== 页脚 ===== */
.page-footer {
  max-width: 1024px; margin: 0 auto; padding: 24px 22px 40px;
  font-size: 12px; color: var(--ink-muted-48); text-align: center;
}

/* ===== 设置弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(26, 15, 51, 0.45);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
  overflow-y: auto;
}
.modal-mask.visible { display: flex; }
.modal {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-radius: var(--radius-lg); border: 1px solid var(--hairline);
  width: 100%; max-width: 440px; padding: 28px; box-shadow: 0 24px 70px rgba(124, 58, 237, 0.30);
  margin: auto;
}
.modal-wide { max-width: 800px; }
.modal-title { font-size: 19px; font-weight: 700; letter-spacing: -0.3px; margin-bottom: 18px;
  background: var(--grad-violet); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.seg-row { display: flex; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.seg-opt { font-size: 14px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
#supaFields { display: flex; flex-direction: column; gap: 8px; }
.cfg-label { font-size: 12px; color: var(--ink-muted-48); font-weight: 600; margin-top: 6px; }
.cfg-input {
  font-family: inherit; font-size: 14px; background: rgba(255,255,255,0.85);
  border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 10px 12px; outline: none; width: 100%;
}
.cfg-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.hint { font-size: 12px; color: var(--ink-muted-48); line-height: 1.5; margin-top: 4px; }
.hint code { background: rgba(124,58,237,0.08); padding: 1px 5px; border-radius: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

.conn-banner {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  max-width: 92vw; display: flex; align-items: center; gap: 14px;
  background: var(--grad-violet); color: #fff; padding: 12px 18px; border-radius: var(--radius-pill);
  font-size: 13px; line-height: 1.4; box-shadow: 0 8px 28px rgba(124,58,237,0.4); z-index: 60;
}
.conn-banner span { opacity: 0.95; }
.conn-banner .btn-mini { background: rgba(255,255,255,0.22); color: #fff; border: none; padding: 6px 14px; border-radius: var(--radius-pill); cursor: pointer; }

/* ============================================================
   移动端响应式适配（框架不变，仅布局/间距/字号/点击区域）
   ============================================================ */
@media (max-width: 720px) {
  .sub-nav-inner { overflow-x: auto; }
  .field-wide { grid-column: span 1; }
  .field-time { grid-column: span 1; }
}

@media (max-width: 600px) {
  .global-nav { height: 48px; }
  .nav-inner { padding: 0 12px; gap: 10px; }
  .logo { font-size: 15px; }
  .nav-actions {
    gap: 10px; overflow-x: auto; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; padding-bottom: 1px;
  }
  .nav-actions::-webkit-scrollbar { display: none; }
  .mode-badge { display: none; }       /* 节省横向空间 */
  .nav-link { font-size: 11px; padding: 4px 2px; }
  .nav-link-strong { padding: 5px 11px; font-size: 11px; }

  .sub-nav { height: 50px; }
  .sub-nav-inner { padding: 0 12px; gap: 10px; }
  .seg-btn { padding: 6px 13px; font-size: 12px; }
  #btnAddCta { padding: 8px 14px; font-size: 13px; white-space: nowrap; }

  .content { padding: 18px 14px; gap: 18px; }
  .card { padding: 18px 15px; border-radius: 18px; }

  .form-row { grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
  .field input, .field select, .field.time-pair { font-size: 16px; }  /* 防止 iOS 缩放 */
  .time-pair input[type="time"] { width: 100%; flex: 1; }
  .time-dash { flex-shrink: 0; }
  .btn-primary, .btn-ghost { padding: 11px 20px; min-height: 44px; }

  .data-table th, .schedule-table th { padding: 9px 11px; font-size: 11px; }
  .schedule-table td, .data-table td { padding: 10px 11px; font-size: 13px; }
  .schedule-table td.slot-col { width: 92px; }
  .records-toolbar { gap: 10px; }
  .records-toolbar input { min-width: 0; width: 100%; }
  .stat-name { width: 58px; font-size: 13px; }
  .stat-num { width: 70px; font-size: 12px; }

  .modal { padding: 22px 18px; border-radius: 18px; }
  .modal-actions { gap: 10px; }
  .modal-actions .btn-primary, .modal-actions .btn-ghost, .modal-actions .btn-danger { flex: 1; min-height: 44px; }

  .page-footer { padding: 20px 14px 36px; font-size: 11px; }
}

@media (max-width: 380px) {
  .logo { font-size: 14px; }
  .nav-actions { gap: 8px; }
  .seg-btn { padding: 6px 10px; }
  .card-title { font-size: 19px; }
  .btn-primary, #btnAddCta { font-size: 13px; }
}

/* 较大触屏：输入框/按钮统一最小点击高度 */
@media (hover: none) and (pointer: coarse) {
  .nav-link, .seg-btn, .btn-ghost-text, .dict-del { min-height: 36px; }
  .field input, .field select, .dict-add input, .dict-select { min-height: 44px; }
}
