/* ── Variables ── */
:root {
  --primary: #0D9488; --primary-hover: #0F766E; --primary-dark: #115E59;
  --primary-light: #F0FDFA; --primary-subtle: #CCFBF1; --primary-glow: rgba(13,148,136,0.15);
  --accent: #F59E0B; --accent-light: #FFFBEB;
  --success: #10B981; --success-light: #ECFDF5;
  --danger: #EF4444; --danger-light: #FEF2F2;
  --warm-50: #FAFAF9; --warm-100: #F5F5F4; --warm-200: #E7E5E4;
  --warm-300: #D6D3D1; --warm-400: #A8A29E; --warm-500: #78716C;
  --warm-600: #57534E; --warm-700: #44403C; --warm-800: #292524; --warm-900: #1C1917;
  --bg: var(--warm-50); --surface: #FFFFFF; --surface-hover: var(--warm-100);
  --text: var(--warm-900); --text2: var(--warm-600); --text3: var(--warm-400);
  --border: var(--warm-200); --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.08); --shadow-xl: 0 20px 60px rgba(0,0,0,0.12);
  --radius: 12px; --radius-sm: 8px; --radius-xs: 6px; --radius-lg: 16px;
  --font: 'Inter', -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --nav-h: 60px; --fs-base: 17px; --fs-sm: 15px; --fs-xs: 13px; --fs-lg: 20px; --fs-xl: 26px;
}
.dark {
  --bg: #1C1917; --surface: #292524; --surface-hover: #44403C;
  --text: #FAFAF9; --text2: #A8A29E; --text3: #78716C;
  --border: #44403C; --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.4); --shadow-xl: 0 20px 60px rgba(0,0,0,0.5);
  --primary-light: #0F2E2A; --primary-subtle: #134E48;
  --success-light: #0A2E1A; --danger-light: #2A1010; --accent-light: #2A1E00;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  min-height: 100vh; transition: background .3s, color .3s;
  font-size: var(--fs-base); line-height: 1.6;
  overflow-x: hidden;
}
::selection { background: var(--primary-subtle); color: var(--primary-dark); }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--warm-300); border-radius: 3px; }
.dark ::-webkit-scrollbar-thumb { background: var(--warm-600); }

/* ── Login ── */

/* ── Theme Variables ── */
.login-wrap[data-login-theme="glass"] {
  --lg-bg: linear-gradient(160deg, #e8f0fe 0%, #f0e8fe 30%, #e8f5f0 60%, #eafef0 100%);
  --lg-card-bg: rgba(255,255,255,0.28);
  --lg-card-blur: 24px;
  --lg-card-border: rgba(255,255,255,0.5);
  --lg-card-shadow: 0 8px 32px rgba(0,0,0,0.06);
  --lg-input-bg: rgba(255,255,255,0.5);
  --lg-input-border: rgba(255,255,255,0.55);
  --lg-input-focus: #6c8cff;
  --lg-input-glow: rgba(108,140,255,0.12);
  --lg-btn: linear-gradient(135deg, #6c8cff, #8b6cff);
  --lg-btn-shadow: rgba(108,140,255,0.25);
  --lg-btn-hover: rgba(108,140,255,0.35);
  --lg-text: #1a1a2e;
  --lg-text2: rgba(40,40,60,0.82);
  --lg-text3: rgba(60,60,80,0.5);
  --lg-label: rgba(40,40,60,0.65);
  --lg-accent: #6c8cff;
  --lg-tab-bg: rgba(255,255,255,0.15);
  --lg-tab-border: rgba(255,255,255,0.4);
  --lg-tab-active: rgba(255,255,255,0.6);
  --lg-err-bg: rgba(239,68,68,0.1);
  --lg-err-color: #dc2626;
  --lg-radius: 24px;
  --lg-shape1: #a0c4ff;
  --lg-shape2: #b8a9ff;
  --lg-shape3: #80d4c0;
  --lg-shape4: #f0a8d0;
}
.login-wrap[data-login-theme="morning"] {
  --lg-bg: linear-gradient(160deg, #fef0ea 0%, #f5eefe 30%, #eaf4fe 60%, #f0fef5 100%);
  --lg-card-bg: rgba(255,252,248,0.3);
  --lg-card-blur: 22px;
  --lg-card-border: rgba(255,248,240,0.55);
  --lg-card-shadow: 0 8px 40px rgba(200,160,140,0.06);
  --lg-input-bg: rgba(255,248,240,0.45);
  --lg-input-border: rgba(255,240,230,0.45);
  --lg-input-focus: #f0a080;
  --lg-input-glow: rgba(240,160,128,0.1);
  --lg-btn: linear-gradient(135deg, #f0a080, #f0c0a0);
  --lg-btn-shadow: rgba(240,160,128,0.2);
  --lg-btn-hover: rgba(240,160,128,0.3);
  --lg-text: #2a2220;
  --lg-text2: rgba(60,45,40,0.78);
  --lg-text3: rgba(80,65,60,0.45);
  --lg-label: rgba(60,45,40,0.6);
  --lg-accent: #f0a080;
  --lg-tab-bg: rgba(255,248,240,0.15);
  --lg-tab-border: rgba(255,240,230,0.5);
  --lg-tab-active: rgba(255,248,240,0.6);
  --lg-err-bg: rgba(239,68,68,0.1);
  --lg-err-color: #dc2626;
  --lg-radius: 28px;
}
.login-wrap[data-login-theme="dusk"] {
  --lg-bg: linear-gradient(160deg, #0f0c29 0%, #1a1a3e 30%, #24243e 60%, #1a1a2e 100%);
  --lg-card-bg: rgba(30,30,60,0.35);
  --lg-card-blur: 20px;
  --lg-card-border: rgba(100,100,160,0.2);
  --lg-card-shadow: 0 8px 32px rgba(0,0,0,0.3);
  --lg-input-bg: rgba(40,40,70,0.4);
  --lg-input-border: rgba(70,70,110,0.3);
  --lg-input-focus: #8b7cf7;
  --lg-input-glow: rgba(108,92,231,0.15);
  --lg-btn: linear-gradient(135deg, #6c5ce7, #a855f7);
  --lg-btn-shadow: rgba(108,92,231,0.3);
  --lg-btn-hover: rgba(108,92,231,0.4);
  --lg-text: #e8e6f0;
  --lg-text2: rgba(180,174,200,0.82);
  --lg-text3: rgba(140,134,160,0.5);
  --lg-label: rgba(180,174,200,0.6);
  --lg-accent: #8b7cf7;
  --lg-tab-bg: rgba(40,40,70,0.2);
  --lg-tab-border: rgba(80,80,120,0.25);
  --lg-tab-active: rgba(50,50,80,0.5);
  --lg-err-bg: rgba(239,68,68,0.12);
  --lg-err-color: #f87171;
  --lg-radius: 24px;
}

/* ── Container ── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  padding: 24px;
  background: var(--lg-bg);
  transition: background 0.8s ease;
}

/* ── Background Decorations ── */
.login-bg-shapes,
.login-bg-morning,
.login-bg-dusk {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
}
[data-login-theme="glass"] .login-bg-shapes { opacity: 1; }
[data-login-theme="morning"] .login-bg-morning { opacity: 1; }
[data-login-theme="dusk"] .login-bg-dusk { opacity: 1; }

/* Glass: floating blobs */
.login-bg-shapes .shape {
  position: absolute; border-radius: 50%; opacity: 0.35;
  animation: lgFloat 20s ease-in-out infinite;
}
.login-bg-shapes .shape:nth-child(1) {
  width: 420px; height: 420px; top: -10%; left: -5%;
  background: radial-gradient(circle, var(--lg-shape1) 0%, transparent 70%);
  animation-delay: 0s;
}
.login-bg-shapes .shape:nth-child(2) {
  width: 350px; height: 350px; bottom: -8%; right: -5%;
  background: radial-gradient(circle, var(--lg-shape2) 0%, transparent 70%);
  animation-delay: -7s;
}
.login-bg-shapes .shape:nth-child(3) {
  width: 250px; height: 250px; top: 50%; left: 60%;
  background: radial-gradient(circle, var(--lg-shape3) 0%, transparent 70%);
  animation-delay: -14s;
}
.login-bg-shapes .shape:nth-child(4) {
  width: 180px; height: 180px; top: 15%; right: 25%;
  background: radial-gradient(circle, var(--lg-shape4) 0%, transparent 70%);
  animation-delay: -4s;
}

/* Morning: sun + curves + leaves */
.login-bg-morning .sun {
  position: absolute; top: -80px; right: 10%;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(255,220,180,0.35) 0%, transparent 70%);
  border-radius: 50%;
  animation: lgSunPulse 12s ease-in-out infinite alternate;
}
.login-bg-morning .curve-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-bg-morning .curve-svg path {
  fill: none; stroke: rgba(180,160,200,0.08); stroke-width: 2;
}
.login-bg-morning .leaf {
  position: absolute; opacity: 0.12;
  animation: lgLeafFloat 30s ease-in-out infinite alternate;
}
.login-bg-morning .leaf:nth-child(3) {
  top: 18%; left: 5%; width: 40px; height: 60px;
  background: #a0d4b0; border-radius: 0 60% 60% 0; transform: rotate(30deg);
}
.login-bg-morning .leaf:nth-child(4) {
  bottom: 22%; right: 8%; width: 30px; height: 50px;
  background: #d4b0c0; border-radius: 60% 0 0 60%; transform: rotate(-20deg);
  animation-delay: -10s;
}
.login-bg-morning .leaf:nth-child(5) {
  top: 45%; right: 15%; width: 25px; height: 40px;
  background: #b0c8d4; border-radius: 0 50% 50% 0; transform: rotate(60deg);
  animation-delay: -20s;
}

/* Dusk: stars + moon */
.login-bg-dusk .moon {
  position: absolute; top: 60px; right: 12%;
  width: 80px; height: 80px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f0e6a0, #d4c878);
  box-shadow: 0 0 60px rgba(212,200,120,0.15);
}
.login-bg-dusk .star {
  position: absolute; width: 4px; height: 4px;
  background: #fff; border-radius: 50%; opacity: 0.6;
  animation: lgTwinkle 3s ease-in-out infinite alternate;
}
.login-bg-dusk .star:nth-child(2) { top: 8%; left: 20%; }
.login-bg-dusk .star:nth-child(3) { top: 15%; left: 50%; width: 3px; height: 3px; animation-delay: -1s; }
.login-bg-dusk .star:nth-child(4) { top: 5%; left: 70%; animation-delay: -2s; }
.login-bg-dusk .star:nth-child(5) { top: 25%; left: 80%; width: 3px; height: 3px; animation-delay: -0.5s; }
.login-bg-dusk .star:nth-child(6) { top: 12%; left: 35%; width: 2px; height: 2px; animation-delay: -1.5s; }
.login-bg-dusk .star:nth-child(7) { top: 30%; left: 15%; animation-delay: -2.5s; }

/* ── Card ── */
.login-card {
  width: 100%; max-width: 420px;
  padding: 44px 40px 36px;
  background: var(--lg-card-bg);
  backdrop-filter: blur(var(--lg-card-blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--lg-card-blur)) saturate(1.4);
  border-radius: var(--lg-radius);
  border: 1px solid var(--lg-card-border);
  box-shadow: var(--lg-card-shadow);
  position: relative; z-index: 1;
  animation: lgCardIn 0.8s cubic-bezier(0.22,1,0.36,1) forwards;
  opacity: 0; transform: translateY(24px);
  transition: background 0.6s ease, backdrop-filter 0.6s ease,
              border-color 0.6s ease, box-shadow 0.6s ease,
              border-radius 0.6s ease;
}
.card-content { position: relative; z-index: 1; }

/* ── Logo / Header ── */
.login-card .logo-area { text-align: center; margin-bottom: 28px; }
.login-card .logo-area .icon {
  width: 52px; height: 52px; display: inline-flex;
  align-items: center; justify-content: center;
  background: var(--lg-btn); border-radius: 14px;
  font-size: 26px; margin-bottom: 14px;
  box-shadow: 0 4px 16px var(--lg-btn-shadow);
  transition: background 0.6s ease, box-shadow 0.6s ease;
}
.login-card .logo-area h1 {
  font-size: 24px; font-weight: 700; letter-spacing: -0.3px;
  color: var(--lg-text); transition: color 0.6s ease;
}
.login-card .logo-area .subtitle {
  font-size: 14px; font-weight: 400;
  color: var(--lg-text3); margin-top: 4px; transition: color 0.6s ease;
}

/* ── Tabs ── */
.login-tabs {
  display: flex; margin-bottom: 24px; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--lg-tab-border);
  background: var(--lg-tab-bg);
  transition: all 0.6s ease;
}
.login-tabs button {
  flex: 1; padding: 11px; border: none; background: transparent; cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: var(--font);
  color: var(--lg-text3); transition: all 0.3s ease;
}
.login-tabs button.active {
  background: var(--lg-tab-active);
  color: var(--lg-accent);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ── Forms ── */
.login-form { display: none; }
.login-form.active { display: block; }
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--lg-label); margin-bottom: 5px; transition: color 0.6s ease;
}
.form-group input, .form-group select {
  width: 100%; padding: 12px 14px;
  background: var(--lg-input-bg); border: 1px solid var(--lg-input-border);
  border-radius: 12px; font-size: 15px; font-family: var(--font);
  color: var(--lg-text); outline: none;
  transition: background 0.6s ease, border-color 0.6s ease,
              box-shadow 0.3s ease, color 0.6s ease;
}
.form-group input:focus, .form-group select:focus {
  border-color: var(--lg-input-focus);
  box-shadow: 0 0 0 3px var(--lg-input-glow);
}
.form-group input::placeholder { color: var(--lg-text3); opacity: 0.6; transition: color 0.6s ease; }
.form-group select { cursor: pointer; appearance: auto; }

/* ── Button ── */
.login-form .btn-login {
  width: 100%; padding: 13px;
  background: var(--lg-btn); color: #fff; border: none; border-radius: 12px;
  font-size: 15px; font-weight: 600; font-family: var(--font);
  cursor: pointer; letter-spacing: 0.3px;
  box-shadow: 0 4px 16px var(--lg-btn-shadow);
  transition: transform 0.2s ease, box-shadow 0.3s ease, background 0.6s ease;
}
.login-form .btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--lg-btn-hover);
}
.login-form .btn-login:active { transform: scale(0.98); }

/* ── Hint ── */
.hint { text-align: center; margin-top: 10px; font-size: 12px; color: var(--lg-text3); transition: color 0.6s ease; }

/* ── Error ── */
.login-form .login-error {
  color: var(--lg-err-color); font-size: 13px; margin-bottom: 12px; display: none;
  background: var(--lg-err-bg); padding: 8px 12px; border-radius: 8px;
}

/* ── Footer ── */
.login-footer { text-align: center; margin-top: 22px; font-size: 12px; color: var(--lg-text3); transition: color 0.6s ease; }
.about-link { text-align: center; margin-top: 12px; }
.about-link a { color: var(--lg-accent); text-decoration: none; font-size: 12px; transition: color 0.6s ease; }
.about-link a:hover { opacity: 0.7; }

/* ── Theme Toggle ── */
.login-theme-toggle {
  position: fixed; top: 24px; right: 24px; z-index: 100;
}
.login-theme-toggle button {
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.3); border-radius: 50%;
  cursor: pointer; font-size: 18px;
  transition: all 0.3s ease; box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.login-theme-toggle button:hover {
  background: rgba(255,255,255,0.35);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.login-theme-toggle button:active { transform: scale(0.92); }

/* ── Animations ── */
@keyframes lgCardIn { to { opacity: 1; transform: translateY(0); } }
@keyframes lgFloat {
  0%, 100% { transform: translate(0,0) scale(1); }
  25% { transform: translate(30px,-40px) scale(1.05); }
  50% { transform: translate(-20px,20px) scale(0.95); }
  75% { transform: translate(40px,30px) scale(1.02); }
}
@keyframes lgSunPulse { 0% { transform: scale(1); opacity: 0.6; } 100% { transform: scale(1.1); opacity: 1; } }
@keyframes lgLeafFloat { 0% { transform: var(--r,0deg) translate(0,0); } 100% { transform: var(--r,0deg) translate(20px,-30px); } }
@keyframes lgTwinkle { 0% { opacity: 0.2; } 100% { opacity: 0.8; } }

/* ── Login Responsive ── */
@media (max-width: 480px) {
  .login-card { padding: 36px 24px 30px; border-radius: calc(var(--lg-radius) - 4px); }
  .login-card .logo-area h1 { font-size: 20px; }
  .login-theme-toggle { top: 16px; right: 16px; }
  .login-theme-toggle button { width: 36px; height: 36px; font-size: 15px; }
}

/* ── Nav ── */
.nav-bar {
  height: var(--nav-h); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px;
  position: sticky; top: 0; z-index: 100; backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.95);
}
.dark .nav-bar { background: rgba(41,37,36,0.95); }
.nav-inner { width: 100%; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; }
.nav-brand {
  display: flex; align-items: center; gap: 10px; font-weight: 700;
  font-size: 17px; color: var(--text); margin-right: 24px; flex-shrink: 0;
}
.nav-brand .nb-icon {
  width: 32px; height: 32px; background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
}
.nav-links { display: flex; gap: 3px; flex: 1; overflow: visible; }
.nav-links button {
  padding: 8px 18px; border: none; background: transparent; cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--text2); border-radius: 8px;
  transition: all .15s; font-family: var(--font); white-space: nowrap;
}
.nav-links button:hover { background: var(--surface-hover); color: var(--text); }
.nav-links button.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.nav-user {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px;
  border-radius: 24px; background: var(--surface-hover); font-size: 13px;
}
.nav-user .u-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.nav-user .u-name { font-weight: 600; }
.nav-user .u-role { font-size: 11px; padding: 2px 10px; border-radius: 8px; font-weight: 600; }
.role-admin { background: var(--primary-subtle); color: var(--primary); }
.role-emp { background: var(--warm-200); color: var(--warm-600); }
.btn-logout {
  padding: 7px 16px; border: 1.5px solid var(--border); background: transparent;
  border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 500; color: var(--text2);
  transition: all .15s; font-family: var(--font);
}
.btn-logout:hover { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }
.btn-theme {
  width: 34px; height: 34px; border: none; background: transparent; cursor: pointer;
  font-size: 17px; border-radius: 50%; transition: background .15s;
  display: flex; align-items: center; justify-content: center;
}
.btn-theme:hover { background: var(--surface-hover); }

.u-score { font-size:11px; color:var(--accent); font-weight:600; margin-left:4px; }
.u-streak { font-size:11px; color:var(--danger); margin-left:2px; }

/* ── Nav Badge ── */
.nav-badge {
  display: none; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--danger); color: #fff; font-size: 9px; font-weight: 700;
  border-radius: 8px; margin-left: 2px; vertical-align: top;
  line-height: 1; position: relative; top: -1px;
}
.nav-badge.show { display: inline-flex; }

/* ── App Container ── */
.app-wrap { max-width: 1140px; margin: 0 auto; padding: 24px; display: none; }
.app-wrap.show { display: block; }
.login-wrap.hide { display: none; }

.page { display: none; }
.page.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.3px; }
.page-header .sub { font-size: var(--fs-base); color: var(--text2); font-weight: 400; }

/* ── Buttons ── */
.btn {
  padding: 9px 20px; border: none; border-radius: var(--radius-xs);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s;
  font-family: var(--font); display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; line-height: 1.4;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: transparent; border: 1.5px solid var(--border); color: var(--text2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); border-color: var(--text3); }
.btn-sm { padding: 7px 16px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 16px; border-radius: 8px; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; transform: translateY(-1px); }

/* ── Stats Row ── */
.stats-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.stat-card {
  background: var(--surface); border-radius: 10px; padding: 20px 20px 16px;
  border: 1px solid var(--border); box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.stat-card .sl { font-size: var(--fs-sm); color: var(--text3); margin-bottom: 6px; font-weight: 500; letter-spacing: .3px; }
.stat-card .sv { font-size: 30px; font-weight: 700; line-height: 1.15; }
.stat-card .sv.teal { color: var(--primary); }
.stat-card .sv.green { color: var(--success); }
.stat-card .sv.amber { color: var(--accent); }
.stat-card .sv.red { color: var(--danger); }
.stat-card .ss { font-size: var(--fs-xs); color: var(--text3); margin-top: 2px; }

/* ── Attendance ── */
.attend-bar {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  background: var(--warm-50); border-radius: 10px;
  border: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap;
}
.btn-attend {
  padding: 7px 20px; border: none; border-radius: 20px; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: all .15s; font-family: var(--font);
}
.btn-attend:disabled { opacity: .35; cursor: not-allowed; }
.btn-in { background: var(--success); color: #fff; }
.btn-in:hover:not(:disabled) { background: #059669; transform: scale(1.03); }
.btn-out { background: var(--accent); color: #fff; }
.btn-out:hover:not(:disabled) { background: #D97706; transform: scale(1.03); }
.att-st { font-size: 13px; padding: 4px 16px; border-radius: 20px; font-weight: 500; }
.att-ok { background: var(--success-light); color: var(--success); }
.att-partial { background: var(--accent-light); color: var(--accent); }
.att-none { background: var(--warm-100); color: var(--text3); }

/* ── Board Layout ── */
.board-row { display: flex; gap: 16px; }
.board-task-row { display: flex; gap: 12px; align-items: stretch; }
.board-task-row .time-slot { width: 95px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--primary-light); border-radius: 8px; font-weight: 700; font-size: 14px; color: var(--primary); border: 1px solid var(--primary-subtle); height: auto; min-height: 72px; }
.board-task-row .task-card { flex: 1; min-width: 0; }
.tl-col { display: none !important; }
.board-side { width: 210px; flex-shrink: 0; display: flex; flex-direction: column; gap: 14px; }
.board-main { flex: 1; min-width: 0; }
.side-card {
  background: var(--surface); border-radius: 10px;
  border: 1px solid var(--border); box-shadow: 0 1px 4px rgba(0,0,0,0.04); padding: 16px;
}
.side-card .sc-t { font-size: var(--fs-xs); font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.cd-display { text-align: center; padding: 6px 0; }
.cd-num { font-size: 32px; font-weight: 700; color: var(--primary);
  font-variant-numeric: tabular-nums; line-height: 1.2; }
.cd-num.warning { color: var(--accent); }
.cd-num.urgent { color: var(--danger); animation: pulse 1s infinite; }
.cd-label { font-size: var(--fs-xs); color: var(--text3); }
.cd-task { font-size: var(--fs-sm); color: var(--text2); margin-top: 4px; font-weight: 500; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.chart-wrap canvas { width: 100%; height: 72px; border-radius: 6px; display: block; }

/* ── Timeline ── */
.tl-row { display: flex; gap: 10px; }
.tk-col { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.time-slot {
  height: 72px; display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); border-radius: 8px; font-weight: 700; font-size: 14px;
  color: var(--primary); border: 1px solid var(--primary-subtle); flex-shrink: 0;
}
.task-card {
  height: 72px; padding: 10px 18px; border-radius: 8px;
  border: 1.5px solid var(--border); cursor: default; transition: all .2s;
  display: flex; flex-direction: column; justify-content: center;
  background: var(--surface); color: var(--text3); flex-shrink: 0; position: relative;
  overflow: hidden;
}
.task-card:hover { background: var(--surface-hover); }
.task-card .tk-n { font-weight: 600; font-size: 14px; line-height: 1.4; color: var(--text); }
.task-card .tk-d { font-size: var(--fs-sm); margin-top: 2px; opacity: .65; line-height: 1.3; color: var(--text2); }
.task-wait { border-color: var(--border); background: var(--warm-100);
  opacity: .7; cursor: not-allowed; }
.task-do {
  border-color: var(--accent); background: linear-gradient(135deg, var(--accent-light), #FFF7E6);
  cursor: pointer; color: var(--text);
  box-shadow: 0 2px 12px rgba(245,158,11,0.12);
}
.task-do:hover { transform: translateX(4px); box-shadow: 0 4px 16px rgba(245,158,11,0.18); }
.task-done { border-color: var(--success); background: var(--success-light); color: var(--success); }
.task-done::after {
  content: '✓'; position: absolute; top: 4px; right: 8px;
  font-size: 16px; font-weight: 700; opacity: .5;
}
.task-over { border-color: var(--danger); background: var(--danger-light); color: var(--danger); }

/* ── Bottom Row ── */
.bottom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.bot-card {
  background: var(--surface); border-radius: var(--radius-sm);
  border: 1px solid var(--border); box-shadow: var(--shadow); padding: 16px;
}
.bot-card .bc-t { font-size: var(--fs-sm); font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.inp-row { display: flex; gap: 8px; margin-bottom: 8px; }
.inp-row input {
  flex: 1; padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-xs);
  background: var(--bg); color: var(--text); font-size: 14px; font-family: var(--font);
  transition: border-color .2s, box-shadow .2s;
}
.inp-row input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-subtle); }
.list-box { max-height: 160px; overflow-y: auto; }
.list-item {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 7px 10px; margin: 4px 0; border-radius: 6px;
  background: var(--warm-50); font-size: var(--fs-sm); gap: 6px; line-height: 1.5;
  transition: background .15s;
}
.list-item:hover { background: var(--surface-hover); }
.dark .list-item { background: var(--warm-800); }
.list-item .li-l { flex: 1; display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.list-item .li-t { word-break: break-word; flex: 1; }
.list-item .li-t.done { text-decoration: line-through; color: var(--text3); }
.li-btn { background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px 4px;
  line-height: 1; border-radius: 4px; color: var(--text3); transition: all .1s; flex-shrink: 0; }
.li-btn:hover { background: var(--border); }
.li-btn.ck-btn { color: var(--success); }
.li-btn.dl-btn:hover { color: var(--danger); }
.li-time { font-size: var(--fs-xs); color: var(--text3); white-space: nowrap; }
.remind-badge { font-size: 10px; color: var(--accent); background: var(--accent-light); padding: 1px 6px; border-radius: 8px; margin-left: 4px; font-weight: 600; white-space: nowrap; }
.remind-select { padding: 7px 6px; border: 1.5px solid var(--border); border-radius: var(--radius-xs); background: var(--bg); color: var(--text); font-size: 12px; font-family: var(--font); outline: none; cursor: pointer; min-width: 68px; }
.remind-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-subtle); }
.memo-reminder-modal { max-width: 420px; text-align: center; }
.memo-reminder-modal .btn { margin-top: 4px; }

/* ── Team ── */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.team-card {
  background: var(--surface); border-radius: var(--radius-sm);
  border: 1px solid var(--border); box-shadow: var(--shadow); padding: 18px;
  transition: all .2s; position: relative;
}
.team-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.team-card .tc-a {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff; margin-bottom: 10px;
}
.team-card .tc-n { font-size: 15px; font-weight: 600; }
.team-card .tc-r { font-size: var(--fs-sm); color: var(--text3); margin-top: 3px; }
.team-card .tc-p { margin-top: 10px; height: 4px; background: var(--warm-100); border-radius: 3px; overflow: hidden; }
.dark .team-card .tc-p { background: var(--warm-700); }
.team-card .tc-pb { height: 100%; border-radius: 3px; background: var(--primary); transition: width .4s; }
.team-card .tc-rm {
  position: absolute; top: 8px; right: 8px; background: none; border: none;
  color: var(--text3); cursor: pointer; font-size: 15px; padding: 3px 6px;
  border-radius: 4px; opacity: 0; transition: opacity .15s;
}
.team-card:hover .tc-rm { opacity: 1; }
.team-card .tc-rm:hover { background: var(--danger-light); color: var(--danger); }

.assign-wrap {
  background: var(--surface); border-radius: var(--radius-sm);
  border: 1px solid var(--border); box-shadow: var(--shadow); padding: 20px; overflow-x: auto;
}
.assign-wrap h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.assign-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.assign-table th { text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--border);
  color: var(--text3); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .5px; }
.assign-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.assign-table tr:hover td { background: var(--surface-hover); }
.am-cell { display: flex; align-items: center; gap: 8px; }
.am-av { width: 26px; height: 26px; border-radius: 6px; display: flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; }
.task-chk { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.ap-dots { display: flex; gap: 3px; flex-wrap: wrap; }
.ap-dots .dot { width: 14px; height: 14px; border-radius: 3px; background: var(--warm-200); }
.dark .ap-dots .dot { background: var(--warm-700); }
.ap-dots .dot.done { background: var(--success); }
.ap-dots .dot.over { background: var(--danger); }
.ap-dots .dot.doing { background: var(--accent); }

/* ── Reports ── */
.rpt-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.rpt-sum { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 16px; }
.rpt-box { text-align: center; padding: 14px 6px; border-radius: var(--radius-xs); background: var(--warm-50); }
.dark .rpt-box { background: var(--warm-800); }
.rpt-box .rn { font-size: 24px; font-weight: 700; color: var(--primary); }
.rpt-box .rn.red { color: var(--danger); }
.rpt-box .rl { font-size: var(--fs-xs); color: var(--text3); margin-top: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-hd { text-align: center; font-size: var(--fs-xs); font-weight: 600; color: var(--text3); padding: 4px 0; }
.cal-cell {
  aspect-ratio: 1; border-radius: 8px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-size: var(--fs-sm); cursor: pointer;
  transition: all .15s; border: 2px solid transparent; min-height: 40px;
}
.cal-cell:hover { transform: scale(1.06); }
.cal-cell .d { font-weight: 700; font-size: 14px; }
.cal-cell .s { font-size: 9px; margin-top: 1px; }
.cal-cell.today { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-subtle); }
.cal-cell.lv-done { background: var(--success-light); color: var(--success); }
.cal-cell.lv-partial { background: var(--accent-light); color: var(--accent); }
.cal-cell.lv-poor { background: var(--danger-light); color: var(--danger); }
.cal-cell.lv-none { background: var(--warm-100); color: var(--text3); }
.cal-cell.empty { background: transparent; cursor: default; }
.cal-cell.empty:hover { transform: none; }

/* ── Calendar Views ── */
.view-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.view-tabs button {
  padding: 6px 16px; border: 1.5px solid var(--border); background: transparent;
  border-radius: 8px; cursor: pointer; font-size: var(--fs-sm); font-weight: 500;
  color: var(--text2); transition: all .15s; font-family: var(--font);
}
.view-tabs button:hover { background: var(--surface-hover); }
.view-tabs button.active { background: var(--primary-light); color: var(--primary);
  border-color: var(--primary); font-weight: 600; }
.cal-view { display: none; }
.cal-view.active { display: block; }

/* Day view */
.day-view-grid { display: flex; gap: 10px; flex-direction: column; }
.day-view-row {
  display: flex; gap: 10px; align-items: center; padding: 10px 14px;
  background: var(--surface); border-radius: var(--radius-sm);
  border: 1px solid var(--border); transition: all .15s;
}
.day-view-row:hover { border-color: var(--primary-subtle); }
.day-view-row .dv-time {
  width: 90px; font-weight: 600; font-size: var(--fs-sm);
  color: var(--primary); flex-shrink: 0;
}
.day-view-row .dv-bar {
  flex: 1; height: 8px; border-radius: 4px; background: var(--warm-100);
  position: relative; overflow: hidden;
}
.dark .day-view-row .dv-bar { background: var(--warm-700); }
.day-view-row .dv-fill {
  height: 100%; border-radius: 4px; transition: width .5s;
}
.day-view-row .dv-fill.done { background: var(--success); }
.day-view-row .dv-fill.doing { background: var(--accent); }
.day-view-row .dv-fill.over { background: var(--danger); }
.day-view-row .dv-fill.wait { background: var(--text3); }
.day-view-row .dv-name { font-size: var(--fs-sm); font-weight: 500; width: 120px; flex-shrink: 0; }

/* Week view */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-day {
  background: var(--surface); border-radius: var(--radius-sm);
  border: 1px solid var(--border); padding: 10px; min-height: 100px;
}
.week-day .wd-header { font-size: var(--fs-sm); font-weight: 600; margin-bottom: 6px; color: var(--text2); }
.week-day .wd-header.today { color: var(--primary); }
.week-day .wd-item {
  font-size: var(--fs-xs); padding: 3px 6px; margin: 2px 0;
  border-radius: 4px; background: var(--warm-50);
}
.dark .week-day .wd-item { background: var(--warm-700); }
.week-day .wd-item.done { border-left: 3px solid var(--success); }
.week-day .wd-item.over { border-left: 3px solid var(--danger); }

/* ── Modal ── */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px); display: none; align-items: center;
  justify-content: center; z-index: 999; padding: 20px; }
.mask.show { display: flex; }
.modal {
  width: 460px; max-width: 94vw; max-height: 90vh; background: var(--surface);
  padding: 28px; border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);

  overflow-y: auto; animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); } }
.modal h3 { font-size: 18px; margin-bottom: 14px; }
.modal textarea {
  width: 100%; height: 100px; margin: 10px 0 14px; padding: 10px;
  border: 1.5px solid var(--border); border-radius: var(--radius-xs);
  background: var(--bg); color: var(--text); font-size: 14px;
  resize: vertical; font-family: var(--font); transition: border-color .2s;
}
.modal textarea:focus { outline: none; border-color: var(--primary); }
.modal .btn-g { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Sound Toggle ── */
.sound-toggle {
  position: absolute; top: 12px; right: 12px;
  cursor: pointer; font-size: 18px; user-select: none;
  opacity: 0.5; transition: opacity .2s, transform .15s;
  z-index: 1; line-height: 1;
}
.sound-toggle:hover { opacity: 1; transform: scale(1.15); }
.modal { position: relative; }

/* ── Toggle Switch ── */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--warm-300); border-radius: 22px;
  transition: background .2s;
}
.slider::before {
  content: ''; position: absolute; height: 16px; width: 16px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%;
  transition: transform .2s;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ── Sound Settings ── */
.sound-setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.sound-setting-row:last-child { border-bottom: none; }
.sound-setting-label { font-size: 14px; color: var(--text); }
.sound-setting-desc { font-size: 11px; color: var(--text3); margin-top: 1px; }

/* ── Toast ── */
.toast-c { position: fixed; top: 14px; right: 14px; z-index: 9999;
  display: flex; flex-direction: column; gap: 6px; }
.toast {
  padding: 10px 18px; border-radius: var(--radius-xs); color: #fff;
  font-size: var(--fs-sm); font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  animation: toastIn .25s ease; max-width: 300px;
}
.toast-success { background: var(--success); }
.toast-warning { background: var(--accent); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); } }

/* ── Celebration ── */
@keyframes celebIn { from { opacity:0; transform:scale(.5); } 50% { transform:scale(1.2); } to { opacity:1; transform:scale(1); } }
@keyframes celebFade { to { opacity:0; transform:scale(1.5) translateY(-30px); } }
.celebration {
  position:fixed; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center;
  z-index:10000; pointer-events:none; animation:celebIn .4s ease forwards;
}
.celebration-icon { font-size:64px; }
.celebration-text { font-size:24px; font-weight:700; color:var(--accent); margin-top:8px;
  text-shadow:0 2px 8px rgba(245,158,11,0.3); }
.celebration-hide { animation:celebFade .4s ease forwards; }

/* ── Admin Task Editor ── */
.admin-config-wrap { max-width: 780px; }
.ac-actions { display: flex; gap: 12px; justify-content: space-between;
  align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.task-edit-card {
  background: var(--surface); border-radius: var(--radius-sm);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 14px; transition: border-color .15s;
}
.task-edit-card:hover { border-color: var(--primary-subtle); }
.tec-row { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.tec-row label { font-size: var(--fs-sm); font-weight: 600; color: var(--text3); min-width: 28px; }
.tec-row input[type="time"] {
  padding: 6px 10px; border: 1.5px solid var(--border); border-radius: 7px;
  font-size: 14px; background: var(--bg); color: var(--text); font-family: var(--font);
  outline: none; width: 110px;
}
.tec-row input[type="time"]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-subtle); }
.tec-order {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  font-size: var(--fs-sm); font-weight: 700; flex-shrink: 0;
}
.tec-name {
  flex: 1; min-width: 140px; padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 7px;
  font-size: 14px; background: var(--bg); color: var(--text); font-family: var(--font); outline: none;
}
.tec-name:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-subtle); }
.tec-sub {
  width: 100%; min-height: 56px; padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 7px;
  font-size: var(--fs-sm); background: var(--bg); color: var(--text2); font-family: var(--font);
  resize: vertical; outline: none; margin-top: 6px; line-height: 1.5;
}
.tec-sub:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-subtle); }
.tec-sub-hint { font-size: var(--fs-xs); color: var(--text3); margin-top: 4px; }
.tec-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--border); }

/* ─── Calendar View Switcher ─── */
.cal-view-switch { display: flex; gap: 6px; align-items: center; }
.cal-view-switch button {
  padding: 6px 14px; border: 1.5px solid var(--border); background: transparent;
  border-radius: 7px; cursor: pointer; font-size: var(--fs-sm); font-weight: 500;
  color: var(--text2); transition: all .12s; font-family: var(--font);
}
.cal-view-switch button:hover { background: var(--surface-hover); }
.cal-view-switch button.active { background: var(--primary-light);
  color: var(--primary); border-color: var(--primary); font-weight: 600; }

/* ── Export Buttons ── */
.export-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

/* ── Badge / Medal ── */
.badge-area { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
  border-radius: 20px; font-size: var(--fs-xs); font-weight: 600;
  background: var(--accent-light); color: var(--accent);
}
.badge.badge-gold { background: #FEF3C7; color: #D97706; }
.badge.badge-silver { background: #F1F5F9; color: #64748B; }
.badge.badge-bronze { background: #FFF7ED; color: #9A3412; }

/* ── Quick Links ── */
#quickLinksWrap { right: 16px; }
#quickLinksToggle:hover { transform: scale(1.12); }
.ql-item:last-child { margin-bottom: 0; }
#quickLinkAdminList > div[draggable].drag-over {
  border-color: var(--accent) !important;
  background: var(--primary-light) !important;
}
.ql-folder-hd { user-select: none; }
.ql-folder-hd:hover { background: var(--primary-light); }

/* ── Recurring Reminders ── */
.wl-card {
  display: flex; gap: 12px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 8px;
  transition: all .2s; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.wl-card:hover { border-color: var(--primary-subtle); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.wl-card.wl-overdue { border-left: 3px solid var(--danger); }
.wl-card.wl-done { opacity: .65; }
.wl-card.wl-done:hover { opacity: .85; }
.wl-card-left {
  display: flex; align-items: flex-start; padding-top: 2px; flex-shrink: 0;
}
.wl-card-body { flex: 1; min-width: 0; }
.wl-card-top {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px;
}
.wl-time {
  font-size: 13px; font-weight: 700; color: var(--primary);
  background: var(--primary-light); padding: 1px 8px; border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.wl-badge {
  font-size: 11px; padding: 1px 8px; border-radius: 6px; font-weight: 600;
}
.wl-important { background: #FEF3C7; color: #D97706; }
.wl-fixed { background: var(--primary-light); color: var(--primary); }
.dark .wl-important { background: #2A1E00; color: #F59E0B; }
.dark .wl-fixed { background: #0F2E2A; color: #14B8A6; }
.wl-schedule-badge {
  font-size: 11px; padding: 1px 8px; border-radius: 6px; font-weight: 600;
  background: var(--warm-100); color: var(--text3);
}
.dark .wl-schedule-badge { background: var(--warm-700); color: var(--text2); }
.wl-schedule-daily { background: #D1FAE5; color: #059669; }
.wl-schedule-weekly { background: #DBEAFE; color: #2563EB; }
.wl-schedule-monthly { background: #EDE9FE; color: #7C3AED; }
.dark .wl-schedule-daily { background: #064E3B; color: #34D399; }
.dark .wl-schedule-weekly { background: #1E3A5F; color: #60A5FA; }
.dark .wl-schedule-monthly { background: #2E1065; color: #A78BFA; }
.wl-date {
  font-size: 11px; color: var(--text3);
  margin-left: auto; white-space: nowrap;
}
.wl-overdue-tag {
  font-size: 10px; color: #fff; background: var(--danger);
  padding: 1px 6px; border-radius: 4px; font-weight: 600;
}
.wl-title {
  font-size: 15px; font-weight: 600; color: var(--text);
  line-height: 1.4; word-break: break-word;
}
.wl-detail {
  font-size: 13px; color: var(--text2); margin-top: 3px;
  line-height: 1.5; word-break: break-word;
}
.wl-next {
  font-size: 11px; color: var(--primary); margin-top: 4px;
  font-weight: 500; line-height: 1.4;
}
.wl-config-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: all .15s;
}
.wl-config-card:hover { border-color: var(--primary-subtle); }
.wl-config-card.wl-inactive { opacity: .55; }
.wl-config-card.wl-inactive:hover { opacity: .8; }

/* ── Remark UI ── */
.wl-remark-wrap { margin-top: 6px; }
.wl-remark {
  font-size: 12px; color: var(--text2); margin-top: 4px;
  padding: 4px 8px; background: var(--warm-50); border-radius: 6px;
  line-height: 1.5; word-break: break-word; display: flex; align-items: flex-start; gap: 4px;
}
.dark .wl-remark { background: var(--warm-800); }
.wl-remark-icon { flex-shrink: 0; font-size: 12px; }
.wl-remark-actions { margin-top: 4px; }
.remark-img { max-width:100%; max-height:150px; border-radius:6px; margin:4px 0; display:block; cursor:pointer; }
.wl-remark .remark-img,
#wlContent .remark-img,
#adminRemarksList .remark-img,
#homeTaskFeedback .remark-img { width:25px; height:25px; object-fit:cover; border-radius:4px; margin:2px; display:inline-block; vertical-align:middle; max-width:none; max-height:none; }
/* Containers: keep thumbnails on one row */
#wlContent .assign-table td div:has(.remark-img),
#adminRemarksList td div:has(.remark-img),
#homeTaskFeedback div:has(.remark-img) { display:flex; flex-wrap:wrap; align-items:center; gap:3px; }

/* ── Status Badge + Card Toggle ── */
.wl-status-badge {
  font-size: 11px; padding: 1px 8px; border-radius: 6px; font-weight: 600;
  cursor: pointer; transition: all .15s; user-select: none;
}
.wl-status-badge:hover { transform: scale(1.05); }
.status-pending { background: var(--warm-100); color: var(--text3); }
.dark .status-pending { background: var(--warm-700); color: var(--text3); }
.status-doing { background: #E0F2FE; color: #0369A1; }
.dark .status-doing { background: #0C2D48; color: #38BDF8; }
.status-done { background: var(--success-light); color: var(--success); }

/* Due now highlight */
.wl-card.wl-due-now {
  border-left: 4px solid #EF4444;
  background: linear-gradient(135deg, var(--surface), #FEF2F2);
  box-shadow: 0 0 0 1px rgba(239,68,68,0.15), 0 4px 16px rgba(239,68,68,0.1);
  animation: dueNowPulse 2s ease-in-out infinite;
}
.dark .wl-card.wl-due-now { background: linear-gradient(135deg, var(--surface), #2A1010); }
@keyframes dueNowPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(239,68,68,0.2), 0 4px 16px rgba(239,68,68,0.1); border-left-color: #EF4444; }
  50% { box-shadow: 0 0 0 6px rgba(239,68,68,0.35), 0 8px 32px rgba(239,68,68,0.3); border-left-color: #FCA5A5; }
}
@keyframes breatheBadge {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.18); opacity: 0.6; }
}
.dark .status-due-now {
  animation: dueNowPulse 2s ease-in-out infinite, breatheBadge 1.2s ease-in-out infinite;
}
.status-due-now {
  background: #FEF2F2; color: #DC2626;
  animation: dueNowPulse 2s ease-in-out infinite, breatheBadge 1.5s ease-in-out infinite;
  font-weight: 700;
}
.dark .status-due-now { background: #2A1010; color: #EF4444; }
/* Urgent action button pulse */
.wl-card.wl-due-now .btn-primary {
  animation: btnUrgent 1.2s ease-in-out infinite;
}
@keyframes btnUrgent {
  0%, 100% { background: var(--primary); transform: scale(1); }
  50% { background: #EF4444; transform: scale(1.08); box-shadow: 0 0 12px rgba(239,68,68,0.5); }
}

/* Toggle button: 3 states */
.wl-toggle {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--bg);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 400; color: var(--text3);
  transition: all .2s; flex-shrink: 0; position: relative;
}
.wl-toggle:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.dark .wl-toggle:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.wl-toggle.wl-toggled {
  background: var(--success); border-color: var(--success);
  color: #fff; font-size: 13px;
  box-shadow: 0 2px 6px rgba(16,185,129,0.3);
}
.wl-toggle.wl-doing-toggle {
  border-color: #0EA5E9; color: #0EA5E9;
  background: #E0F2FE; font-size: 13px;
  box-shadow: 0 2px 6px rgba(14,165,233,0.2);
}
.dark .wl-toggle.wl-doing-toggle { background: #0C2D48; color: #38BDF8; border-color: #38BDF8; }

/* Card visual states */
.wl-card.wl-doing {
  border-left: 3px solid #0EA5E9;
  background: linear-gradient(135deg, var(--surface), #F0F9FF);
}
.dark .wl-card.wl-doing { background: linear-gradient(135deg, var(--surface), #0C2D48); }

/* ── Responsive ── */
@media (max-width: 900px) {
  /* 导航压缩提前到 900px：全量导航（品牌+9 链接+用户信息）在 720-900px 之间会溢出视口（实测 800px 溢出到 1171px） */
  .nav-user .u-name, .nav-user .u-role { display: none; }
  .nav-bar { overflow-x: auto; }
  .board-row { flex-direction: column; }
  .board-side { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .board-side .side-card { flex: 1; min-width: 160px; }
  .bottom-row { grid-template-columns: 1fr; }
  .rpt-sum { grid-template-columns: repeat(3, 1fr); }
  .team-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .week-grid { grid-template-columns: repeat(3, 1fr); }
  .board-task-row .time-slot { min-height: 56px; font-size: var(--fs-sm); }
  .board-task-row .task-card { min-height: 56px; padding: 6px 12px; }
}
@media (max-width: 720px) {
  .app-wrap { padding: 16px; }
  .page-header h1 { font-size: var(--fs-lg); }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .nav-bar { padding: 0 10px; }
  .nav-brand span:not(.nb-icon) { display: none; }
  .nav-user .u-name, .nav-user .u-role { display: none; }
  .nav-links button { padding: 6px 10px; font-size: var(--fs-sm); }
  .rpt-sum { grid-template-columns: repeat(2, 1fr); }
  .week-grid { grid-template-columns: repeat(2, 1fr); }
  .day-view-row { flex-wrap: wrap; }
  .day-view-row .dv-time { width: 100%; }
  .day-view-row .dv-name { width: 100%; }
  .cal-cell { min-height: 32px; }
  .cal-cell .d { font-size: var(--fs-sm); }
  .login-card { padding: 28px 20px; }
  /* Mobile table scroll */
  .assign-table-wrap, .rpt-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .assign-table { min-width: 600px; }
  /* Full-width modals on mobile */
  .modal:not(#quickLinksWrap .modal):not(#costCalcWrap) { max-width: 94vw !important; margin: 10px auto; }
  .mask.show .modal { max-height: 90vh; overflow-y: auto; }
  /* Better card spacing */
  .wl-card { padding: 12px 14px; }
  .wl-card-body { min-width: 0; }
  .wl-card-top { flex-wrap: wrap; gap: 4px; }
  .wl-title { font-size: 14px; }
  .task-edit-card { padding: 14px; }
  .admin-config-wrap { max-width: 100% !important; }
  /* Team grid */
  .team-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
  .tm-card { padding: 14px; }
  .tm-card .tm-name { font-size: 13px; }
}
@media (max-width: 480px) {
  /* Root container: 12px safe margin, no max-width */
  .app-wrap { padding: 0 12px !important; max-width: none !important; width: 100% !important; }
  .nav-bar { margin: 0 -12px 0 !important; max-width: none !important; width: auto !important; padding: 0 12px !important; }
  /* All containers fill width */
  .page, .board-main, .board-side, .tk-col, .admin-config-wrap, .set-tab,
  .side-card, .wl-card, .wl-config-card, .tm-card, .login-card, .home-card,
  .task-card, .board-task-row, .board-row, .tl-row, .wl-content,
  .chart-wrap, #homeOverdueList, #homeAfterSalesList { width: 100% !important; max-width: none !important; }
  /* Stats: 2 equal columns */
  .stats-row { grid-template-columns: repeat(2, 1fr) !important; gap: 6px; }
  .stat-card { padding: 8px; } .stat-card .sl { font-size: 10px; } .stat-card .sv { font-size: 18px; } .stat-card .ss { font-size: 9px; }
  /* Charts fill parent */
  .chart-wrap { width: 100% !important; }
  .chart-wrap canvas { width: 100% !important; height: 90px !important; display: block; }
  /* Cards and lists */
  .side-card { padding: 8px; } .side-card .sc-t { font-size: 10px; margin-bottom: 4px; }
  .wl-card { padding: 10px 12px; margin-bottom: 6px; }
  .wl-title { font-size: 13px; } .wl-time { font-size: 11px; }
  .wl-badge, .wl-schedule-badge { font-size: 10px !important; padding: 1px 6px !important; }
  .board-task-row { margin-bottom: 6px; }
  /* Board side cards: 2 columns side by side */
  .board-side { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .board-side .side-card { flex: 1; min-width: calc(50% - 6px); }
  /* Board layout: stack vertically */
  .board-row { flex-direction: column; }
  /* Settings tabs */
  .set-tab { max-width: none !important; }
  .set-tab-btns .btn { padding: 5px 8px; font-size: 11px; }
  /* Calendar */
  .week-grid { grid-template-columns: 1fr; }
  .rpt-sum { grid-template-columns: repeat(2, 1fr); gap: 4px; }
  .rpt-sum .stat-card { padding: 8px; } .rpt-sum .stat-card .sv { font-size: 18px; }
  .cal-cell { min-height: 28px; } .cal-cell .d { font-size: 10px; }
  /* Login */
  .login-card { padding: 20px 16px; margin: 10px; } .login-card h1 { font-size: 18px; }
  .login-tabs button { padding: 8px 12px; font-size: 12px; }
  /* Config cards */
  .wl-config-card { padding: 10px 12px !important; }
  .wl-config-card .btn { font-size: 11px !important; padding: 3px 6px !important; }
  .tec-row { flex-wrap: wrap; gap: 4px; } .tec-name { font-size: 12px; } .tec-sub { font-size: 11px; }
  /* Home admin */
  .home-grid { grid-template-columns: 1fr; gap: 10px; } .home-card { padding: 14px; }
  #page-home > div[style*="grid-template-columns:1fr 1fr 1fr"] { grid-template-columns: 1fr !important; gap: 6px !important; }
  #page-home > div[style*="grid-template-columns:1fr 1fr 1fr"] .side-card { grid-column: 1 !important; grid-row: auto !important; }
  #page-home > div[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; gap: 6px !important; margin-top: 6px !important; }
  #homeTrendChart { height: 90px !important; } #homeRankChart { height: 80px !important; }
  /* Modal */
  .mask.show .modal { max-width: 96vw !important; width: 96vw; margin: 5vh auto; max-height: 90vh; overflow-y: auto; }
  .mask.show .modal .btn { padding: 8px 14px; font-size: 13px; }
  /* Quick links */
  #quickLinksWrap { width: auto; right: auto; }
  #quickLinksToggle { position: fixed !important; right: 10px !important; z-index: 999; }
  #quickLinksPanel { position: fixed !important; right: 10px !important; top: 76px !important; width: 260px !important; }
  /* Nav compact */
  .nav-bar { height: 48px; overflow-x: auto; }
  .nav-links button { padding: 4px 6px; font-size: 10px; border-radius: 6px; flex-direction: column; gap: 1px; line-height: 1.1; flex: 1; }
  .nav-brand .nb-icon { width: 24px; height: 24px; font-size: 12px; }
  .nav-user { padding: 2px 6px 2px 2px; font-size: 11px; } .nav-user .u-avatar { width: 22px; height: 22px; font-size: 10px; }
  .btn-logout { padding: 4px 8px; font-size: 10px; }
}
@media (max-width: 480px) {
  .app-wrap { padding: 0 12px; }
  .nav-bar { margin: 0 -12px 0 !important; max-width: calc(100% + 24px) !important; padding: 0 12px !important; }
  .stats-row { grid-template-columns: repeat(2, 1fr) !important; gap: 6px; }
  .page-header { margin-bottom: 10px; }
  .page-header h1 { font-size: 16px; }
  .nav-bar { padding: 0 6px; height: 52px; }
  .nav-inner { gap: 4px; }
  .nav-brand { margin-right: 6px; }
  .nav-brand .nb-icon { width: 26px; height: 26px; font-size: 13px; }
  .nav-links { gap: 1px; }
  .nav-links button {
    padding: 4px 6px; font-size: 10px; border-radius: 6px;
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    line-height: 1.1; min-width: 0; flex: 1;
  }
  .nav-right { gap: 4px; }
  .nav-user { padding: 2px 6px 2px 2px; font-size: 11px; }
  .nav-user .u-avatar { width: 24px; height: 24px; font-size: 11px; }
  .btn-logout { padding: 4px 8px; font-size: 10px; }
  .btn-theme { padding: 4px; }
  /* Stats */
  .stats-row { gap: 6px; grid-template-columns: repeat(2, 1fr); }
  .stat-card { padding: 10px; }
  .stat-card .sv { font-size: 20px; }
  /* WL cards */
  .wl-card { padding: 10px 12px; margin-bottom: 8px; }
  .wl-time { font-size: 11px; }
  .wl-title { font-size: 13px; }
  .wl-badge, .wl-schedule-badge { font-size: 10px !important; padding: 1px 6px !important; }
  .wl-overdue-tag { font-size: 9px; }
  /* Settings */
  .set-tab { max-width: 100% !important; }
  #homeOverdueList, #homeAfterSalesList { max-height: 160px; overflow-y: auto; }
  /* Admin home page */
  .stats-row[style*="repeat(4"] { grid-template-columns: repeat(2,1fr) !important; gap: 6px; }
  .stats-row .stat-card { padding: 8px; }
  .stats-row .sl { font-size: 10px; }
  .stats-row .sv { font-size: 18px; }
  .stats-row .ss { font-size: 9px; }
  #page-home > div[style*="grid-template-columns:1fr 1fr 1fr"] { grid-template-columns: 1fr !important; gap: 6px !important; }
  #page-home > div[style*="grid-template-columns:1fr 1fr 1fr"] .side-card { grid-column: 1 !important; grid-row: auto !important; }
  #page-home > div[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; gap: 8px !important; margin-top: 8px !important; }
  .chart-wrap canvas { height: 100px !important; }
  #homeTrendChart { height: 100px !important; }
  #homeRankChart { height: 80px !important; }
  .set-tab-btns { gap: 2px; }
  .set-tab-btns .btn { padding: 5px 8px; font-size: 11px; }
  /* Calendar */
  .week-grid { grid-template-columns: repeat(1, 1fr); }
  .rpt-sum { grid-template-columns: repeat(2, 1fr); gap: 4px; }
  .rpt-sum .stat-card { padding: 8px; }
  .rpt-sum .stat-card .sv { font-size: 18px; }
  .cal-cell { min-height: 28px; padding: 2px; }
  .cal-cell .d { font-size: 10px; }
  /* Timeline — card style */
  .board-task-row {
    display: flex; flex-direction: column; gap: 0; margin-bottom: 6px;
    background: var(--surface); border-radius: 8px; border: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  }
  .board-task-row .time-slot {
    width: auto; min-height: 28px; font-size: 10px; padding: 3px 10px;
    display: flex; align-items: center; justify-content: flex-start; gap: 6px;
    border: none; border-radius: 0; background: var(--primary-light); color: var(--primary);
  }
  .board-task-row .time-slot::before { content: '⏰'; font-size: 11px; }
  .board-task-row .task-card {
    min-height: auto; padding: 8px 10px; border: none; border-radius: 0;
    height: auto;
  }
  .board-task-row .task-card .tk-n { font-size: 13px; }
  .board-task-row .task-card .tk-d { font-size: 11px; margin-top: 2px; }
  .board-row { flex-direction: column; }
  .board-side { flex-direction: row; flex-wrap: wrap; }
  .board-side .side-card { flex: 1; min-width: 120px; padding: 8px; }
  .side-card .sc-t { font-size: 9px; margin-bottom: 4px; letter-spacing: 0; }
  .cd-display { padding: 0; }
  .cd-num { font-size: 18px; line-height: 1.1; }
  .cd-label { font-size: 9px; }
  .cd-task { font-size: 10px; margin-top: 2px; }
  .chart-wrap canvas { height: 36px; }
  .tk-status { font-size: 10px; }
  /* Login */
  .login-card { padding: 20px 16px; margin: 10px; }
  .login-card h1 { font-size: 18px; }
  .login-tabs button { padding: 8px 12px; font-size: 12px; }
  /* Config cards */
  .wl-config-card { padding: 10px 12px !important; }
  .wl-config-card .btn { font-size: 11px !important; padding: 3px 6px !important; }
  .tec-row { flex-wrap: wrap; gap: 4px; }
  .tec-name { font-size: 12px; }
  .tec-sub { font-size: 11px; }
  /* Home dashboard */
  .home-grid { grid-template-columns: 1fr; gap: 10px; }
  .home-card { padding: 14px; }
  /* Modal full screen on mobile */
  .mask.show .modal {
    max-width: 96vw !important; width: 96vw; margin: 5vh auto;
    max-height: 90vh; overflow-y: auto;
  }
  .mask.show .modal .btn { padding: 8px 14px; font-size: 13px; }
  /* Quick links — mobile */
  #quickLinksWrap { width: auto; right: auto; }
  #quickLinksToggle { position: fixed !important; right: 10px !important; z-index: 999; }
  #quickLinksPanel { position: fixed !important; right: 10px !important; top: 76px !important; width: 260px !important; }
}

/* ── Worklist Admin Pills (time range + status filter) ── */
.wl-pill-group {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.wl-pill {
  padding: 4px 14px; border-radius: 20px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text2); cursor: pointer; transition: all .2s;
  font-family: var(--font); line-height: 1.4; white-space: nowrap;
}
.wl-pill:hover { border-color: var(--primary); color: var(--primary); }
.wl-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.dark .wl-pill.active { color: #fff; }
.wl-pill.active:hover { opacity: .9; }

/* ── AI 服装生成模块 ── */
/* 布局：≥1200px 左右两栏；<1200px 上下堆叠 */
.ai-wrap { display: grid; grid-template-columns: 340px 1fr; gap: 14px; align-items: start; }
.ai-left, .ai-right { display: flex; flex-direction: column; gap: 14px; }
.ai-warn { display: flex; align-items: center; gap: 8px; padding: 10px 16px; margin-bottom: 14px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; color: #92400e;
  background: var(--accent-light); border: 1px solid #fcd34d; }
.dark .ai-warn { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.4); color: #fbbf24; }

/* 上传区：点击 + 拖拽，悬浮高亮 */
.ai-upload { border: 2px dashed var(--border); border-radius: var(--radius); padding: 32px 16px;
  text-align: center; cursor: pointer; color: var(--text3); font-size: 14px;
  transition: all .2s ease; background: var(--bg); }
.ai-upload:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.ai-upload.dragover { border-color: var(--primary); color: var(--primary); background: var(--primary-light);
  transform: scale(1.02); box-shadow: 0 0 0 3px var(--primary-light); }
.ai-upload-icon { font-size: 32px; margin-bottom: 8px; }
.ai-upload-hint { font-size: 12px; margin-top: 6px; }

/* 预览缩略图 + HEIC 提示 */
.ai-preview { text-align: center; }
.ai-preview-main { position: relative; display: inline-block; width: 100%; }
.ai-preview-main img { width: 100%; max-height: 220px; object-fit: contain; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: #fff; }
.ai-preview-heic { margin: 6px 0; font-size: 12px; color: var(--accent); }
.ai-preview .btn { margin-top: 8px; }

/* 模板卡片：选中底色 + 已选中徽章 + 加载失败占位 */
.ai-templates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 14px; }
.ai-tpl { border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 8px;
  cursor: pointer; text-align: center; transition: all .18s ease; background: var(--surface); position: relative; }
.ai-tpl:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow); }
.ai-tpl:active { transform: translateY(0) scale(.98); }
.ai-tpl.active { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 1px var(--primary); }
.ai-tpl-img { position: relative; height: 90px; border-radius: 6px; overflow: hidden;
  background: var(--bg); display: flex; align-items: center; justify-content: center; }
.ai-tpl-img::after { content: '🧍'; font-size: 30px; opacity: .35; } /* 图片加载失败时的占位 */
.ai-tpl-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ai-tpl-badge { position: absolute; top: 4px; right: 4px; display: none; padding: 2px 7px;
  border-radius: 20px; font-size: 10px; font-weight: 700; color: #fff; background: var(--primary); z-index: 1; }
.ai-tpl.active .ai-tpl-badge { display: inline-block; }
.ai-tpl-name { font-size: 13px; font-weight: 600; margin-top: 6px; color: var(--text); }
.ai-tpl-desc { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* 生成按钮：缺参数置灰 + hover 提示 */
.ai-gen-btn { width: 100%; transition: all .18s ease; }
.ai-gen-btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.ai-gen-btn:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(13,148,136,.35); }
.ai-gen-btn:not(:disabled):active { transform: translateY(0) scale(.98); }

/* 三图对比 */
.ai-compare { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 10px; }
.ai-compare-col { text-align: center; }
.ai-cmp-label { font-size: 12px; color: var(--text3); margin-bottom: 6px; }
.ai-cmp-img { width: 100%; max-height: 260px; object-fit: contain; border-radius: var(--radius-sm);
  border: 1px solid var(--border); cursor: zoom-in; background: #fff; transition: opacity .15s; }
.ai-cmp-img:hover { opacity: .85; }
.ai-cmp-empty { height: 200px; display: flex; align-items: center; justify-content: center;
  color: var(--text3); font-size: 13px; border: 1px dashed var(--border);
  border-radius: var(--radius-sm); background: var(--bg); }

/* 生成记录卡片：双缩略图 + 徽章行 + 操作行 */
.ai-item { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--surface);
  transition: all .18s ease; }
.ai-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.ai-thumbs { display: flex; gap: 6px; flex-shrink: 0; align-items: flex-start; }
.ai-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border); cursor: zoom-in; background: #fff; transition: all .15s; }
.ai-thumb:hover { transform: scale(1.06); border-color: var(--primary); }
.ai-thumb-ok { border-color: var(--success); }
.ai-thumb-empty { width: 52px; height: 52px; display: flex; align-items: center; justify-content: center;
  color: var(--text3); background: var(--bg); border-radius: 6px; font-size: 15px; }
.ai-item-main { flex: 1; min-width: 0; }
.ai-item-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-item-tpl { font-weight: 600; font-size: 13px; color: var(--text); }
.ai-item-time { color: var(--text3); font-size: 11px; }
.ai-item-err { margin-top: 6px; cursor: pointer; border: 1px solid var(--border);
  border-radius: var(--radius-xs); padding: 6px 10px; background: var(--bg); transition: all .15s; }
.ai-item-err:hover { border-color: var(--danger); }
.ai-err-short { font-size: 12px; color: var(--danger); }
.ai-err-toggle { float: right; font-size: 11px; color: var(--text3); }
.ai-err-full { display: none; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border);
  font-size: 11px; color: var(--text2); word-break: break-all; white-space: pre-wrap; }
.ai-item-err.open .ai-err-full { display: block; }
.ai-item-btns { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.ai-item-btns .btn { font-size: 12px; padding: 4px 10px; transition: all .15s ease; }
.ai-item-btns .btn:not(.ai-del):hover { border-color: var(--primary); color: var(--primary); }
.ai-del:hover { border-color: var(--danger); color: var(--danger); }
.ai-item-btns .btn:active { transform: scale(.95); }

/* 状态徽章（对齐后端 status 枚举） */
.ai-badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.ai-badge-gray   { background: var(--bg); color: var(--text2); border: 1px solid var(--border); }            /* pending */
.ai-badge-blue   { background: #EFF6FF; color: #1d4ed8; }                                                       /* processing */
.dark .ai-badge-blue { background: rgba(29,78,216,.2); color: #93c5fd; }
.ai-badge-orange { background: #FFF7ED; color: #c2410c; }                                                       /* submitted */
.dark .ai-badge-orange { background: rgba(194,65,12,.2); color: #fb923c; }
.ai-badge-cyan   { background: #ECFEFF; color: #0e7490; }                                                       /* downloading */
.dark .ai-badge-cyan { background: rgba(14,116,144,.2); color: #67e8f9; }
.ai-badge-green  { background: var(--success-light); color: var(--success); }                                  /* succeeded */
.ai-badge-red    { background: var(--danger-light); color: var(--danger); }                                    /* failed */

/* 空白记录：引导插画 */
.ai-empty { text-align: center; padding: 40px 16px; }
.ai-empty-art { font-size: 52px; margin-bottom: 12px; animation: aiFloat 3s ease-in-out infinite; }
.ai-empty-title { font-size: 16px; font-weight: 700; color: var(--text2); margin-bottom: 14px; }
.ai-empty-steps { display: inline-block; text-align: left; font-size: 13px; color: var(--text3); line-height: 2; }
@keyframes aiFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* 刷新按钮加载旋转 */
.spinning { animation: aiSpin .8s linear infinite; display: inline-flex; }
@keyframes aiSpin { to { transform: rotate(360deg); } }

/* ── 响应式 ── */
@media (max-width: 1200px) { .ai-wrap { grid-template-columns: 1fr; } }  /* 左右 → 上下堆叠 */
@media (max-width: 900px) {  /* 平板/手机：模板横向滚动 */
  .ai-templates { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 45%;
    overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; }
  .ai-tpl { scroll-snap-align: start; }
}
@media (max-width: 480px) {  /* 手机：按钮铺满 */
  .ai-compare { grid-template-columns: 1fr; }
  .ai-item { flex-direction: column; }
  .ai-item-btns { margin-left: 0; }
  .ai-item-btns .btn { flex: 1; justify-content: center; }
  .ai-templates { grid-auto-columns: 70%; }
}

/* ── 重绘模式：参数区 + 批次卡片 ── */
.ai-param-label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin: 12px 0 6px; }
.ai-param-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#aiReverseBtn:disabled { opacity: .45; cursor: not-allowed; }
.ai-reverse-text {
  max-height: 240px; overflow: auto; padding: 12px 14px;
  border-radius: 8px; background: var(--surface-hover); color: var(--text);
  font-size: 14px; line-height: 1.7; margin: 10px 0 4px; border: 1px solid var(--border);
}
.ai-reverse-provider { font-size: 12px; color: var(--text3); margin-bottom: 14px; }
.ai-cap-badge {
  display: inline-block; padding: 1px 8px; border-radius: 20px; margin-left: 6px;
  font-size: 11px; font-weight: 600; vertical-align: 1px;
  background: var(--accent-light); color: #B45309; border: 1px solid var(--accent);
}
#aiPromptInput { width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-xs); font-size: 13px; background: var(--bg); color: var(--text); font-family: var(--font); box-sizing: border-box; resize: vertical; }
.ai-param-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ai-stepper { display: flex; align-items: center; gap: 6px; }
.ai-stepper input { width: 52px; padding: 4px 6px; text-align: center; border: 1.5px solid var(--border); border-radius: 6px; font-size: 14px; background: var(--bg); color: var(--text); font-family: var(--font); }
#aiStrengthInput { flex: 1; accent-color: var(--primary); }
.ai-param-hint { font-size: 11px; color: var(--text3); margin: 8px 0 0; }
.ai-tpl-emoji { font-size: 30px; opacity: .5; }
.ai-batch-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; background: var(--surface); transition: all .18s ease; }
.ai-batch-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.ai-batch-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.ai-batch-src { flex-shrink: 0; position: relative; }
.ai-batch-src img { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); cursor: zoom-in; background: #fff; transition: transform .2s; }
.ai-batch-src:hover img { transform: scale(2.2); z-index: 5; position: relative; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.ai-batch-info { flex: 1; min-width: 0; }
.ai-batch-id { font-size: 11px; font-weight: 700; color: var(--primary); }
.ai-batch-progress { height: 6px; background: var(--bg); border-radius: 10px; overflow: hidden; margin: 6px 0; }
.ai-batch-bar { height: 100%; background: var(--success); border-radius: 10px; transition: width .4s ease; }
.ai-batch-meta { font-size: 11px; color: var(--text3); word-break: break-all; }
.ai-batch-row { display: flex; gap: 10px; padding: 8px 0; border-top: 1px dashed var(--border); align-items: flex-start; }

/* ── AI v2：模型通道卡片（配额角标/禁用态）+ 参考图区 ── */
.ai-model-quota { font-size: 11px; color: var(--text3); margin-top: 4px; line-height: 1.5; }
.ai-model-quota.warn { color: var(--danger); }
.ai-tpl.disabled { opacity: .45; cursor: not-allowed; }
.ai-tpl.disabled:hover { transform: none; box-shadow: none; }
.ai-ref-section { margin-top: 2px; }
.ai-ref-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; background: var(--surface); }
.ai-ref-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); flex-shrink: 0; background: var(--bg); }
.ai-ref-item select { flex: 1; min-width: 0; padding: 5px 6px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 12px; background: var(--bg); color: var(--text); font-family: var(--font); }
.ai-ref-item .btn { flex-shrink: 0; }

/* ── AI v2：设置页模型配置卡片 ── */
/* 两列分组并行：生成模型 | 反推提示词 */
.ai-pc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.ai-pc-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ai-pc-col-title { font-size: 13px; font-weight: 700; color: var(--text2); display: flex; align-items: center; gap: 6px; }
.ai-pc-col-count { font-size: 11px; font-weight: 600; color: var(--text3); background: var(--surface-hover); border: 1px solid var(--border); border-radius: 20px; padding: 0 8px; }
.ai-pc-card { background: var(--surface); border-radius: var(--radius-sm); border: 1px solid var(--border); padding: 14px 16px; }
.ai-pc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.ai-pc-title { font-size: 13px; font-weight: 600; }
.ai-pc-desc { font-size: 11px; color: var(--text3); margin-top: 3px; }
.ai-pc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ai-pc-field label { display: block; font-size: 11px; color: var(--text3); margin-bottom: 4px; }
.ai-pc-field input, .ai-pc-field select { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 12px; background: var(--bg); color: var(--text); font-family: var(--font); }
.ai-pc-field input:focus, .ai-pc-field select:focus { outline: none; border-color: var(--primary); }
.ai-pc-key-state { font-size: 11px; color: var(--text3); margin-top: 3px; }
.ai-pc-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.ai-pc-test-result { font-size: 12px; color: var(--text3); }
@media (max-width: 720px) {
  .ai-pc-grid { grid-template-columns: 1fr; }
  .ai-pc-cols { grid-template-columns: 1fr; }  /* 小屏两列上下堆叠 */
}

/* ═══ AI 页标题 Tab 栏（标题即页签，点击切换图生成/图生视频）═══ */
.ai-title-tabs { display: flex; align-items: baseline; gap: 20px; flex-wrap: wrap; }
.ai-title-tab { background: none; border: none; cursor: pointer; font-family: var(--font); font-size: 17px; font-weight: 600; color: var(--text3); padding: 2px 0; transition: all .15s; border-bottom: 3px solid transparent; }
.ai-title-tab:hover { color: var(--text); }
.ai-title-tab.active { color: var(--text); border-bottom-color: var(--primary); }
.ai-panel { display: none; }
.ai-panel.active { display: block; }
/* 设置页 AI 配置的内嵌 Tab：比 AI 页标题 Tab 小一号（15px），不喧宾夺主 */
#aiProviderConfig .ai-title-tabs { margin-bottom: 12px; }
#aiProviderConfig .ai-title-tab { font-size: 15px; }

/* ═══ AI 图生视频面板 ═══ */
.ai-video-box { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: #000; }
.ai-video-box video { width: 100%; display: block; border-radius: var(--radius-sm); }
.ai-video-meta { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.ai-video-meta span { font-size: 12px; padding: 2px 10px; border-radius: 99px; background: var(--primary-light); color: var(--primary-dark); }
.ai-param-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 5px 12px; border: 1px solid var(--border); border-radius: 99px; cursor: pointer; color: var(--text2); background: var(--surface); transition: all .15s; }
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.ai-video-thumb { width: 120px; aspect-ratio: 16/9; border-radius: var(--radius-xs); background: #000; overflow: hidden; flex: none; position: relative; }
.ai-video-thumb video, .ai-video-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ai-video-thumb .dur { position: absolute; right: 4px; bottom: 4px; font-size: 10px; background: rgba(0,0,0,.65); color: #fff; padding: 1px 6px; border-radius: 4px; }
.ai-video-thumb .play-ov { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; background: rgba(0,0,0,.25); color: #fff; }
.ai-video-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text2); margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-hover); }
.ai-video-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: blink 1s infinite; flex: none; }
@keyframes blink { 50% { opacity: .3; } }

/* ═══ 素材库（现代简约：固定尺寸网格 + 点击预览）═══ */
/* 素材库弹窗：fixed 定位 + 标题栏拖拽（初始居中；拖动后由 JS 控制 left/top；modalIn 动画的
   transform 关键帧会与 fixed 定位冲突故禁用） */
#aiMediaModal .modal {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  margin: 0; animation: none;
}
#aiMediaModal .modal h3 { cursor: move; user-select: none; }
.ai-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.ai-media-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; transition: all .18s ease; position: relative; }
.ai-media-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary-subtle); }
.ai-media-thumb { width: 100%; aspect-ratio: 1; background: linear-gradient(135deg, var(--surface-hover), var(--border)); display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.ai-media-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.ai-media-item:hover .ai-media-thumb img { transform: scale(1.06); }
.ai-media-thumb .ai-media-ico { font-size: 30px; opacity: .8; }
.ai-media-dur { position: absolute; right: 6px; bottom: 6px; font-size: 10px; background: rgba(0,0,0,.65); color: #fff; padding: 1px 6px; border-radius: 5px; }
.ai-media-name { font-size: 12px; padding: 7px 9px 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-media-meta { font-size: 10px; color: var(--text3); padding: 0 9px 8px; }
.ai-media-del { position: absolute; top: 6px; right: 6px; opacity: 0; transition: opacity .15s; padding: 2px 6px; font-size: 12px; }
.ai-media-item:hover .ai-media-del { opacity: 1; }
.ai-media-use { width: calc(100% - 14px); margin: 0 7px 8px; padding: 5px 0; font-size: 11px; border-radius: 7px; }
.ai-media-tab.active { border-color: var(--primary); color: var(--primary); font-weight: 600; }
.ai-media-cat { font-size: 10px; color: var(--text3); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; margin-left: 4px; white-space: nowrap; }
.ai-media-prev-body { background: #0f0f0f; border-radius: 10px; display: flex; align-items: center; justify-content: center; min-height: 260px; max-height: 46vh; overflow: hidden; }
.ai-media-prev-body img { max-width: 100%; max-height: 46vh; object-fit: contain; }
.ai-media-prev-body video { max-width: 100%; max-height: 46vh; }

/* ═══ AI 页提示词输入框统一样式（此前无全局样式：默认 173px 宽 + monospace，导致输入框偏小）═══ */
#page-ai textarea { width: 100%; box-sizing: border-box; background: var(--surface); color: var(--text); border: 1.5px solid var(--border); border-radius: 8px; font-family: var(--font); outline: none; resize: vertical; }
#page-ai textarea:focus { border-color: var(--primary); }

/* ═══ 批量生成页 ═══ */
.b-main-item { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; border: 2px solid var(--border); background: var(--surface-hover); }
.b-main-item img { width: 100%; height: 100%; object-fit: cover; }
.b-main-item .rm { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.b-main-item .num { position: absolute; left: 3px; top: 3px; font-size: 9px; background: var(--primary); color: #fff; border-radius: 5px; padding: 0 5px; }
.b-main-add { width: 76px; height: 76px; border: 2px dashed var(--border); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; color: var(--text3); font-size: 10px; gap: 2px; transition: all .15s; background: var(--surface); }
.b-main-add:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.b-main-attr { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(13,148,136,.85); color: #fff; font-size: 9px; line-height: 1.3; padding: 2px 5px; cursor: pointer; max-height: 34px; overflow: hidden; }
.b-main-attr.has { background: rgba(13,148,136,.85); }
.b-main-attr:not(.has) { background: rgba(0,0,0,.55); }
.b-main-attr:hover { background: rgba(13,148,136,1); }
.b-ref-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-subtle); border-radius: 99px; padding: 4px 10px; font-size: 12px; }
.b-ref-chip .x { cursor: pointer; opacity: .6; font-size: 11px; }
.b-ref-chip .x:hover { opacity: 1; }
.b-mode-card { flex: 1 1 150px; min-width: 0; border: 2px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; transition: all .15s; background: var(--surface); }
.b-mode-card:hover { border-color: var(--primary-subtle); }
.b-mode-card.active { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 3px var(--primary-glow); }
.b-mode-card.active div:nth-child(2) { color: var(--primary); }
.b-item { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.b-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; background: var(--surface); }
.b-head:hover { background: var(--surface-hover); }
.b-head .b-ico { font-size: 16px; }
.b-head .b-title { font-size: 13px; font-weight: 700; }
.b-head .b-meta { font-size: 11px; color: var(--text3); margin-left: auto; }
.b-head .b-arrow { transition: transform .2s; color: var(--text3); font-size: 11px; }
.b-item.open .b-arrow { transform: rotate(180deg); }
.b-body { display: none; border-top: 1px solid var(--border); padding: 6px 14px; background: var(--surface-hover); }
.b-item.open .b-body { display: block; }
.b-row { display: flex; align-items: center; gap: 10px; padding: 6px 2px; font-size: 12px; border-bottom: 1px dashed var(--border); }
.b-row:last-child { border-bottom: none; }
.b-row .b-status { margin-left: auto; font-size: 11px; }
