/* ==========================================================================
   排班管理系统 · 基础样式（设计令牌 + 布局 + 基础元素）
   ========================================================================== */

:root {
  /* 色彩 */
  --c-bg: #f4f6fa;
  --c-surface: #ffffff;
  --c-surface-2: #f9fafb;
  --c-surface-3: #f1f3f7;
  --c-border: #e2e7f0;
  --c-border-strong: #cbd5e1;

  --c-text: #1e2937;
  --c-text-sub: #64748b;
  --c-text-mute: #94a3b8;

  --c-primary: #2563eb;
  --c-primary-dark: #1d4ed8;
  --c-primary-soft: #eff5ff;
  --c-primary-border: #bfd6fe;

  --c-success: #059669;
  --c-success-soft: #ecfdf5;
  --c-warn: #d97706;
  --c-warn-soft: #fffbeb;
  --c-danger: #dc2626;
  --c-danger-soft: #fef2f2;
  --c-info: #0891b2;
  --c-info-soft: #ecfeff;

  /* 排班图专用 */
  --c-slot-empty: #fafbfc;
  --c-slot-grid: #e8edf5;
  --c-bar: #3b82f6;
  --c-bar-hover: #2563eb;
  --c-bar-locked: #94a3b8;

  /* 尺寸 */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 2px 8px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);

  --sidebar-w: 216px;
  --topbar-h: 56px;

  --font: "Microsoft YaHei UI", "PingFang SC", "Hiragino Sans GB", "Segoe UI",
    system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Mono", Consolas, "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  /* 手机：横竖屏切换时不要自动放大字号 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* 触摸设备：去掉点击时的灰色高亮，并让按钮/可点区域响应更快 */
@media (pointer: coarse) {
  * {
    -webkit-tap-highlight-color: transparent;
  }
  button,
  .btn,
  .nav-item,
  .tab,
  .week-day,
  .segmented__item,
  .gcell {
    touch-action: manipulation;
  }
  /* 手指点选不要被系统的「双击缩放」吃掉 */
  .track {
    touch-action: pan-x pan-y;
  }
}


h1, h2, h3, h4, h5 {
  margin: 0;
  font-weight: 600;
  line-height: 1.4;
}

a {
  color: var(--c-primary);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
  background-clip: content-box;
}

/* ==========================================================================
   应用外壳
   ========================================================================== */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "brand topbar" "sidebar content";
  height: 100vh;
  overflow: hidden;
}

.app-shell.is-auth {
  display: block;
  height: 100%;
}

/* ---- 品牌区 ---- */
.brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 16px;
  background: #111c33;
  color: #fff;
  user-select: none;
}

.brand__logo {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 7px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
}

.brand__name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.brand__ver {
  font-size: 10.5px;
  color: #7f8ea8;
  margin-left: auto;
}

/* ---- 顶栏 ---- */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  z-index: 20;
}

.topbar__title {
  font-size: 15px;
  font-weight: 600;
}

.topbar__path {
  color: var(--c-text-mute);
  font-size: 12.5px;
}

.topbar__spacer {
  flex: 1;
}

.topbar__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--c-surface-3);
  font-size: 12.5px;
  color: var(--c-text-sub);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__chip b {
  color: var(--c-text);
  font-weight: 600;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--c-border);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 600;
  flex: none;
  /* 头像是个按钮（移动端的账号入口），去掉浏览器默认的按钮外观 */
  border: none;
  padding: 0;
  cursor: pointer;
}

.avatar:hover {
  background: var(--c-primary-dark);
}

/* ---- 侧边栏 ---- */
.sidebar {
  grid-area: sidebar;
  background: #16233c;
  overflow-y: auto;
  padding: 12px 0 24px;
}

.sidebar__group {
  padding: 14px 18px 6px;
  font-size: 11px;
  letter-spacing: 1.2px;
  color: #64748b;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: #c3cede;
  cursor: pointer;
  font-size: 13.5px;
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s;
  user-select: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.nav-item.is-active {
  background: rgba(59, 130, 246, 0.16);
  color: #fff;
  border-left-color: #3b82f6;
  font-weight: 600;
}

.nav-item__icon {
  width: 17px;
  text-align: center;
  font-size: 14px;
  flex: none;
  opacity: 0.9;
}

.nav-item__badge {
  margin-left: auto;
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
}

.nav-sub {
  padding-left: 12px;
}

.nav-sub .nav-item {
  font-size: 13px;
  padding: 7px 18px 7px 30px;
  color: #9fb0c7;
}

/* ---- 抽屉模式控件（平板 / 手机） ----
   桌面端默认隐藏：汉堡按钮只在响应式断点里显示。
   「侧边栏折叠成图标栏」的老方案已废弃 —— 它会把子菜单文字一起藏掉，
   改为统一用抽屉，手机与平板一套交互。 */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: -6px;
  flex: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  font-size: 19px;
  line-height: 1;
  color: var(--c-text);
  cursor: pointer;
}

.nav-toggle:hover {
  background: var(--c-surface-3);
}

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(15, 23, 42, 0.45);
  border: none;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* 抽屉里的门店信息与账号操作：桌面端用顶栏，这里只在移动端出现 */
.sidebar__foot {
  display: none;
  margin: 16px 14px 0;
  padding: 12px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.sidebar__foot-label {
  font-size: 11px;
  letter-spacing: 1.2px;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.sidebar__foot .topbar__chip {
  display: block;
  max-width: 100%;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #c3cede;
}

.sidebar__foot .topbar__chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.sidebar__foot .topbar__chip b {
  color: #fff;
}

.sidebar__foot-actions {
  display: grid;
  gap: 6px;
}

.sidebar__foot .btn {
  width: 100%;
  height: 36px;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: #dbe4f0;
}

.sidebar__foot .btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
  color: #fff;
}

/* ---- 内容区 ---- */
.content {
  grid-area: content;
  overflow: auto;
  padding: 18px 20px 40px;
  scroll-behavior: smooth;
}

/* 每次路由渲染的独立容器（见 core.beginView）。min-width:0 是为了让内部的
   表格 / 甘特图在自己的滚动区里收缩，不会把整页顶出横向滚动条。 */
.page-view {
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.page-head__main {
  flex: 1;
  min-width: 240px;
}

.page-head h2 {
  font-size: 18px;
  letter-spacing: 0.2px;
}

.page-head__desc {
  color: var(--c-text-sub);
  font-size: 12.5px;
  margin-top: 3px;
}

.page-head__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ==========================================================================
   基础元素
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s;
  user-select: none;
}

.btn:hover:not(:disabled) {
  border-color: var(--c-primary);
  color: var(--c-primary);
  background: var(--c-primary-soft);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
}
.btn--primary:hover:not(:disabled) {
  background: var(--c-primary-dark);
  border-color: var(--c-primary-dark);
  color: #fff;
}

.btn--danger {
  background: var(--c-danger);
  border-color: var(--c-danger);
  color: #fff;
}
.btn--danger:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

.btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--c-text-sub);
}
.btn--ghost:hover:not(:disabled) {
  background: var(--c-surface-3);
  color: var(--c-text);
  border-color: transparent;
}

.btn--sm {
  height: 26px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
}

.btn--xs {
  height: 23px;
  padding: 0 8px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn--block {
  width: 100%;
}

.btn--link {
  border: none;
  background: none;
  color: var(--c-primary);
  padding: 0 4px;
  height: auto;
}
.btn--link:hover:not(:disabled) {
  background: none;
  text-decoration: underline;
}

.input,
.select,
.textarea {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  background: var(--c-surface);
  outline: none;
  transition: border-color 0.14s, box-shadow 0.14s;
}

.textarea {
  height: auto;
  min-height: 62px;
  padding: 7px 10px;
  resize: vertical;
  line-height: 1.55;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--c-surface-3);
  color: var(--c-text-mute);
  cursor: not-allowed;
}

.input--sm,
.select--sm {
  height: 28px;
  font-size: 12.5px;
  padding: 0 8px;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8.5 1.5 4h9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 10px;
  padding-right: 26px;
}

label.field {
  display: block;
  margin-bottom: 12px;
}

label.field > .field__label {
  display: block;
  font-size: 12.5px;
  color: var(--c-text-sub);
  margin-bottom: 5px;
}

label.field > .field__label .req {
  color: var(--c-danger);
  margin-left: 2px;
}

.field__hint {
  font-size: 11.5px;
  color: var(--c-text-mute);
  margin-top: 4px;
}

.field__error {
  font-size: 11.5px;
  color: var(--c-danger);
  margin-top: 4px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}

.checkbox input {
  width: 15px;
  height: 15px;
  accent-color: var(--c-primary);
  cursor: pointer;
}

.muted {
  color: var(--c-text-sub);
}

.mute-2 {
  color: var(--c-text-mute);
}

.mono {
  font-family: var(--font-mono);
}

.nowrap {
  white-space: nowrap;
}

.text-right {
  text-align: right;
}
.text-center {
  text-align: center;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   登录页
   ========================================================================== */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 600px at 12% -10%, #1e3a8a 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 100%, #0e7490 0%, transparent 50%), #0f172a;
  padding: 24px;
}

.auth__card {
  width: 100%;
  max-width: 380px;
  background: var(--c-surface);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 30px 30px 26px;
}

.auth__logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  display: grid;
  place-items: center;
  font-size: 20px;
  color: #fff;
  font-weight: 700;
  margin-bottom: 14px;
}

.auth__title {
  font-size: 19px;
}

.auth__sub {
  color: var(--c-text-sub);
  font-size: 12.5px;
  margin: 4px 0 22px;
}

.auth__form .input {
  height: 38px;
}

.auth__submit {
  height: 38px;
  margin-top: 6px;
}

.auth__tip {
  margin-top: 16px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: var(--c-primary-soft);
  color: #1e40af;
  font-size: 12px;
  line-height: 1.6;
}

.auth__err {
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: var(--c-danger-soft);
  color: var(--c-danger);
  font-size: 12.5px;
}

/* 全屏加载 */
.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--c-text-sub);
  gap: 12px;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 说明：原来这里有一条「≤860px 把侧边栏压成图标栏」的规则。
   它会把「员工列表 / 参数配置」这类子菜单的文字一起藏掉（图标位是空的），
   现在统一改用「抽屉 + 汉堡按钮」，规则见 css/responsive.css。 */
