:root {
  --bg: #f5efe3;
  --panel: rgba(255, 251, 245, 0.92);
  --panel-strong: #fffdfa;
  --ink: #201914;
  --muted: #6e6259;
  --line: rgba(32, 25, 20, 0.12);
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --success: #0f766e;
  --danger: #b42318;
  --danger-soft: rgba(180, 35, 24, 0.12);
  --shadow: 0 24px 60px rgba(64, 50, 38, 0.14);
  --radius: 24px;
}

/* Formal sidebar icon set: option B - enterprise badge.
   Keep the icons CSS-drawn so they stay crisp in the collapsed sidebar. */
body.light-dashboard .side-nav-item {
  min-height: 50px;
  border: 1px solid transparent;
  transition:
    background 200ms ease-in-out,
    border-color 200ms ease-in-out,
    color 200ms ease-in-out,
    transform 200ms ease-in-out,
    box-shadow 200ms ease-in-out;
}

body.light-dashboard .side-nav-item:hover {
  border-color: rgba(15, 143, 128, .14);
  box-shadow: 0 10px 26px rgba(15, 23, 42, .06);
  transform: translateY(-1px);
}

body.light-dashboard .side-nav-item.active {
  border-color: rgba(15, 143, 128, .12);
  box-shadow: inset 0 0 0 1px rgba(15, 143, 128, .03);
}

body.light-dashboard .nav-icon {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 34px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 12px;
  background: rgba(255, 255, 255, .74);
  color: #25364a;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .06);
  transition:
    background 200ms ease-in-out,
    border-color 200ms ease-in-out,
    color 200ms ease-in-out,
    box-shadow 200ms ease-in-out,
    transform 200ms ease-in-out;
}

body.light-dashboard .side-nav-item:hover .nav-icon {
  color: var(--ui-green);
  border-color: rgba(0, 135, 104, .18);
  transform: translateY(-1px);
}

body.light-dashboard .side-nav-item.active .nav-icon {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #0f8f80, #087669);
  box-shadow: 0 14px 28px rgba(0, 135, 104, .22);
}

body.light-dashboard .nav-icon::before {
  content: "";
  width: 20px;
  height: 20px;
  display: block;
  background: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

body.light-dashboard .nav-home::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M12%202.6%202.8%2010.2l1.35%201.64L5.4%2010.8V21h5.2v-6.2h2.8V21h5.2V10.8l1.25%201.04%201.35-1.64L12%202.6Zm4.6%2016.4h-1.2v-6.2H8.6V19H7.4v-9.86L12%205.34l4.6%203.8V19Z%27/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M12%202.6%202.8%2010.2l1.35%201.64L5.4%2010.8V21h5.2v-6.2h2.8V21h5.2V10.8l1.25%201.04%201.35-1.64L12%202.6Zm4.6%2016.4h-1.2v-6.2H8.6V19H7.4v-9.86L12%205.34l4.6%203.8V19Z%27/%3E%3C/svg%3E");
}

body.light-dashboard .nav-list::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M5%204h14a2%202%200%200%201%202%202v12a2%202%200%200%201-2%202H5a2%202%200%200%201-2-2V6a2%202%200%200%201%202-2Zm0%202v12h14V6H5Zm3%202.5h8v2H8v-2Zm0%204h8v2H8v-2Z%27/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M5%204h14a2%202%200%200%201%202%202v12a2%202%200%200%201-2%202H5a2%202%200%200%201-2-2V6a2%202%200%200%201%202-2Zm0%202v12h14V6H5Zm3%202.5h8v2H8v-2Zm0%204h8v2H8v-2Z%27/%3E%3C/svg%3E");
}

body.light-dashboard .nav-device::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M4%205h16a2%202%200%200%201%202%202v9a2%202%200%200%201-2%202h-6v2h3v2H7v-2h3v-2H4a2%202%200%200%201-2-2V7a2%202%200%200%201%202-2Zm0%202v9h16V7H4Z%27/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M4%205h16a2%202%200%200%201%202%202v9a2%202%200%200%201-2%202h-6v2h3v2H7v-2h3v-2H4a2%202%200%200%201-2-2V7a2%202%200%200%201%202-2Zm0%202v9h16V7H4Z%27/%3E%3C/svg%3E");
}

body.light-dashboard .nav-users::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M9%202a5%205%200%201%201%200%2010A5%205%200%200%201%209%202Zm0%202a3%203%200%201%200%200%206%203%203%200%200%200%200-6Zm0%2010c4.3%200%207%202.55%207%206v1H2v-1c0-3.45%202.7-6%207-6Zm0%202c-2.58%200-4.25%201.1-4.82%203h9.64c-.57-1.9-2.24-3-4.82-3Zm10-5V8h-3V6h3V3h2v3h3v2h-3v3h-2Z%27/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M9%202a5%205%200%201%201%200%2010A5%205%200%200%201%209%202Zm0%202a3%203%200%201%200%200%206%203%203%200%200%200%200-6Zm0%2010c4.3%200%207%202.55%207%206v1H2v-1c0-3.45%202.7-6%207-6Zm0%202c-2.58%200-4.25%201.1-4.82%203h9.64c-.57-1.9-2.24-3-4.82-3Zm10-5V8h-3V6h3V3h2v3h3v2h-3v3h-2Z%27/%3E%3C/svg%3E");
}

body.light-dashboard .nav-group::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M8%203a4%204%200%201%201%200%208%204%204%200%200%201%200-8Zm0%202a2%202%200%201%200%200%204%202%202%200%200%200%200-4Zm9%201a3.5%203.5%200%201%201%200%207%203.5%203.5%200%200%201%200-7Zm0%202a1.5%201.5%200%201%200%200%203%201.5%201.5%200%200%200%200-3ZM8%2013c3.85%200%206.4%202.2%206.9%205.3A6.5%206.5%200%200%201%2020%2021h-2a4.5%204.5%200%200%200-3.07-1.26V21H1v-1c0-4.13%202.8-7%207-7Zm0%202c-2.32%200-4%201.15-4.7%204h9.4c-.7-2.85-2.38-4-4.7-4Z%27/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M8%203a4%204%200%201%201%200%208%204%204%200%200%201%200-8Zm0%202a2%202%200%201%200%200%204%202%202%200%200%200%200-4Zm9%201a3.5%203.5%200%201%201%200%207%203.5%203.5%200%200%201%200-7Zm0%202a1.5%201.5%200%201%200%200%203%201.5%201.5%200%200%200%200-3ZM8%2013c3.85%200%206.4%202.2%206.9%205.3A6.5%206.5%200%200%201%2020%2021h-2a4.5%204.5%200%200%200-3.07-1.26V21H1v-1c0-4.13%202.8-7%207-7Zm0%202c-2.32%200-4%201.15-4.7%204h9.4c-.7-2.85-2.38-4-4.7-4Z%27/%3E%3C/svg%3E");
}

body.light-dashboard .nav-task::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M4%203h16a1%201%200%200%201%201%201v16a1%201%200%200%201-1%201H4a1%201%200%200%201-1-1V4a1%201%200%200%201%201-1Zm1%202v14h14V5H5Zm4%204h6v6H9V9Zm2%202v2h2v-2h-2Z%27/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M4%203h16a1%201%200%200%201%201%201v16a1%201%200%200%201-1%201H4a1%201%200%200%201-1-1V4a1%201%200%200%201%201-1Zm1%202v14h14V5H5Zm4%204h6v6H9V9Zm2%202v2h2v-2h-2Z%27/%3E%3C/svg%3E");
}

body.light-dashboard .nav-settings::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M19.4%2013.5c.08-.48.1-.98.1-1.5s-.02-1.02-.1-1.5l2.05-1.6-2-3.46-2.42.98a7.4%207.4%200%200%200-2.6-1.5L14.05%202h-4.1l-.38%202.92a7.4%207.4%200%200%200-2.6%201.5l-2.42-.98-2%203.46%202.05%201.6c-.08.48-.1.98-.1%201.5s.02%201.02.1%201.5l-2.05%201.6%202%203.46%202.42-.98a7.4%207.4%200%200%200%202.6%201.5l.38%202.92h4.1l.38-2.92a7.4%207.4%200%200%200%202.6-1.5l2.42.98%202-3.46-2.05-1.6ZM12%2015.5a3.5%203.5%200%201%201%200-7%203.5%203.5%200%200%201%200%207Z%27/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M19.4%2013.5c.08-.48.1-.98.1-1.5s-.02-1.02-.1-1.5l2.05-1.6-2-3.46-2.42.98a7.4%207.4%200%200%200-2.6-1.5L14.05%202h-4.1l-.38%202.92a7.4%207.4%200%200%200-2.6%201.5l-2.42-.98-2%203.46%202.05%201.6c-.08.48-.1.98-.1%201.5s.02%201.02.1%201.5l-2.05%201.6%202%203.46%202.42-.98a7.4%207.4%200%200%200%202.6%201.5l.38%202.92h4.1l.38-2.92a7.4%207.4%200%200%200%202.6-1.5l2.42.98%202-3.46-2.05-1.6ZM12%2015.5a3.5%203.5%200%201%201%200-7%203.5%203.5%200%200%201%200%207Z%27/%3E%3C/svg%3E");
}

@media (max-width: 1100px) {
  body.light-dashboard .side-nav-item {
    width: 50px;
    height: 50px;
    min-height: 50px;
    border-radius: 16px;
  }

  body.light-dashboard .nav-icon {
    width: 34px;
    height: 34px;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Noto Sans TC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.2), transparent 28%),
    radial-gradient(circle at top right, rgba(245, 158, 11, 0.16), transparent 24%),
    linear-gradient(180deg, #f9f5ed, #efe6d8 62%, #eadfce);
}

.app-shell {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  min-height: 100vh;
  padding: 20px;
}

body.login-mode .app-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 28px;
}

body.login-mode .sidebar {
  display: none;
}

body.login-mode .workspace {
  width: min(520px, 100%);
}

body.login-mode .login-card {
  position: relative;
  overflow: hidden;
  padding: 34px;
}

html.auth-probing body.login-mode .login-card {
  opacity: 0;
  pointer-events: none;
}

body.login-mode .login-card::before {
  content: "";
  position: absolute;
  inset: -45% -35% auto auto;
  width: 260px;
  height: 260px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.22), transparent 68%);
  pointer-events: none;
}

.login-exiting {
  animation: loginExit 420ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.app-entering {
  animation: appEnter 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes loginExit {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
  to {
    opacity: 0;
    transform: translateY(-18px) scale(0.985);
    filter: blur(8px);
  }
}

@keyframes appEnter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-hero {
  display: grid;
  gap: 10px;
  margin-bottom: 26px;
}

.login-hero h2 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.login-submit {
  width: 100%;
  min-height: 48px;
  font-weight: 800;
}

.sidebar,
.card {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
}

.workspace,
.app-content {
  display: grid;
  gap: 20px;
}

.card {
  padding: 24px;
}

.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.brand h1,
.panel-head h2,
.subpanel h3 {
  margin: 6px 0 0;
}

.muted,
.label,
.small {
  color: var(--muted);
}

.small {
  font-size: 0.9rem;
}

.status-card,
.subpanel,
.task-card,
.task-list-item,
.code-block,
textarea,
input,
select,
.timeline-item {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.status-card,
.subpanel,
.task-card {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.compact-head {
  margin-bottom: 12px;
}

.task-form,
.stack,
.task-layout,
.admin-grid {
  display: grid;
  gap: 16px;
}

.admin-grid {
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  grid-auto-flow: row;
  align-items: start;
}

.admin-grid > *,
.task-cards,
.task-card,
.admin-task-picker,
.task-assignment,
.task-card-head,
.pill-list {
  min-width: 0;
  max-width: 100%;
}

.admin-panel-users,
.admin-panel-groups,
.admin-panel-executor,
.admin-panel-client {
  grid-column: auto;
}

.task-layout {
  grid-template-columns: 320px 1fr;
}

.task-layout.task-layout-merged {
  grid-template-columns: 1fr;
}

.merged-task-panel {
  display: grid;
  gap: 16px;
}

.merged-task-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.section-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.task-list-pane,
.task-execution-pane {
  min-width: 0;
}

.task-form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
}

.operation-error-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  display: none;
  align-items: flex-start;
  gap: 16px;
  width: min(520px, calc(100vw - 32px));
  padding: 18px;
  color: #7a1f16;
  background: #fff4f2;
  border: 1px solid rgba(180, 35, 24, 0.28);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(64, 25, 20, 0.24);
}

.operation-error-toast.visible {
  display: flex;
}

.operation-error-toast p {
  margin: 6px 0 0;
  white-space: pre-wrap;
}

.checkbox-row input[type="checkbox"] {
  width: auto;
}

.form-status {
  min-height: 20px;
}

.form-status.success {
  color: var(--success);
}

.form-status.error {
  color: var(--danger);
}

.task-form.compact,
.task-form.narrow {
  max-width: 100%;
}

textarea,
input,
select {
  width: 100%;
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
}

.actions,
.inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.compact-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.compact-inline select {
  min-width: 160px;
}

.primary-button,
.ghost-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), #115e59);
  color: white;
}

.task-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.task-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 12px;
  font-size: 0.86em;
  line-height: 1;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  color: var(--ink);
}

a.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.setup-download-link {
  margin-top: 8px;
  width: 100%;
  text-align: center;
  font-size: 0.9rem;
}

#logoutButton {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: max(24px, env(safe-area-inset-right));
  z-index: 10000;
  box-shadow: 0 12px 30px rgba(64, 50, 38, 0.16);
}

.global-logout {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: max(24px, env(safe-area-inset-right));
  z-index: 10000;
}

#sopStudioLink,
.global-sop-link {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: calc(max(24px, env(safe-area-inset-right)) + 92px);
  z-index: 10000;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 34px rgba(32, 25, 20, 0.12);
  backdrop-filter: blur(10px);
}

.pill-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-strong);
}

.user-row > div {
  display: grid;
  gap: 3px;
}

.password-reset-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.password-reset-form input {
  min-width: 170px;
  padding: 10px 12px;
}

.admin-task-picker {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(15, 118, 110, 0.05);
  overflow: hidden;
}

.admin-task-picker label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.compact-empty {
  min-height: 80px;
}

.soft-divider {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}

.client-row,
.client-job-row {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-strong);
}

.client-row-head,
.client-job-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upload-zone {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 18px;
  border: 2px dashed rgba(15, 118, 110, 0.28);
  border-radius: 18px;
  background: rgba(15, 118, 110, 0.05);
  text-align: center;
}

.upload-zone.active,
.upload-zone.drag-over {
  background: rgba(15, 118, 110, 0.12);
  border-color: rgba(15, 118, 110, 0.45);
}

.sop-chat-composer {
  display: grid;
  gap: 16px;
}

.sop-chat-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.inline-field {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-field input {
  flex: 1;
  min-width: 0;
}

.sop-chat-dropzone {
  min-height: 150px;
}

.sop-chat-input-wrap textarea {
  min-height: 160px;
  resize: vertical;
}

.upload-zone-title {
  font-weight: 700;
}

.task-cards,
.task-list,
.runs-list,
.timeline,
.step-list {
  display: grid;
  gap: 12px;
}

.task-select {
  min-height: 48px;
  max-width: 100%;
}

.task-select-meta {
  padding: 0 2px;
  word-break: break-word;
}

.task-card-head {
  margin-bottom: 14px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.task-assignment {
  display: grid;
  gap: 14px;
  overflow: hidden;
}

.step-list {
  max-height: 220px;
  overflow: auto;
  padding-right: 6px;
}

.step-item {
  display: flex;
  align-items: start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(15, 118, 110, 0.04);
}

.step-item input {
  width: auto;
  margin-top: 3px;
}

.task-list-item,
.runs-list button {
  text-align: left;
  padding: 14px 16px;
  cursor: pointer;
}

.task-list-item.active,
.runs-list button.active {
  outline: 2px solid rgba(15, 118, 110, 0.28);
  border-color: rgba(15, 118, 110, 0.28);
}

.run-title {
  display: block;
  font-weight: 700;
}

.run-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.inspector-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.inspector-grid.single-column {
  grid-template-columns: 1fr;
}

.timeline {
  min-height: 420px;
  max-height: 70vh;
  overflow: auto;
}

.timeline.empty,
.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  color: var(--muted);
}

.timeline-item {
  padding: 14px;
}

.conversation-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  align-items: start;
  grid-auto-rows: max-content;
  min-height: 180px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.conversation-panel.empty-state {
  padding-right: 0;
}

.chat-list {
  display: grid;
  gap: 12px;
  max-height: 230px;
  overflow: auto;
  padding-right: 6px;
}

.chat-bubble {
  max-width: 92%;
  width: fit-content;
  height: auto;
  min-height: 0;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.chat-bubble.assistant,
.chat-bubble.agent {
  justify-self: start;
  background: rgba(15, 118, 110, 0.08);
}

.chat-bubble.user {
  justify-self: end;
  background: rgba(32, 25, 20, 0.06);
}

.agent-trace {
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 16px;
  background: rgba(15, 118, 110, 0.045);
  padding: 10px 12px;
}

.agent-trace summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 800;
}

.agent-trace-list {
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
  max-height: 170px;
  overflow: auto;
  list-style: none;
}

.agent-trace li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.agent-trace .trace-check {
  width: 14px;
  height: 14px;
  margin-top: 3px;
  border-radius: 4px;
  border: 1px solid rgba(32, 25, 20, 0.18);
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent);
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  font-weight: 900;
}

.agent-trace li.done .trace-check {
  background: rgba(15, 118, 110, 0.11);
  border-color: rgba(15, 118, 110, 0.25);
}

.agent-trace li.done .trace-text {
  text-decoration: line-through;
  opacity: 0.72;
}

.agent-trace li.failed {
  color: #9f2a1d;
}

.agent-trace li.failed .trace-check {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.35);
  color: #b42318;
}

.sop-reply-actions {
  justify-content: flex-end;
  margin-top: -10px;
}

.sop-reply-submit {
  min-width: 110px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.sop-cancel-operation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.sop-rule-notes {
  min-height: 118px;
}

.usage-stats-panel {
  margin: 18px 0;
}

.usage-stats-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.usage-stats-content {
  display: grid;
  gap: 16px;
}

.usage-email-settings {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.usage-email-settings summary {
  cursor: pointer;
  font-weight: 800;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.settings-grid .wide {
  grid-column: 1 / -1;
}

.settings-grid small {
  display: block;
  margin-top: 6px;
}

.usage-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.usage-stat-card {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(15, 118, 110, 0.045);
}

.usage-stat-card span,
.usage-stat-card small {
  color: var(--muted);
}

.usage-stat-card strong {
  font-size: 1.55rem;
  line-height: 1.1;
}

.usage-stats-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.usage-stats-split > div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-strong);
}

.usage-bars {
  display: flex;
  align-items: end;
  gap: 4px;
  height: 96px;
  padding-top: 8px;
}

.usage-bars span {
  flex: 1;
  min-width: 3px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.75), rgba(15, 118, 110, 0.18));
}

.usage-rank-list {
  display: grid;
  gap: 8px;
  max-height: 150px;
  overflow: auto;
}

.usage-rank-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.usage-rank-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-count-tip {
  cursor: help;
  text-decoration: underline dotted rgba(15, 118, 110, 0.55);
  text-underline-offset: 3px;
}

.usage-failure-list div,
.usage-task-list div {
  align-items: start;
}

.usage-failure-list span,
.usage-task-list span {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .usage-stats-head,
  .usage-stats-split {
    grid-template-columns: 1fr;
  }

  .usage-stats-head {
    display: grid;
  }
}

.sop-project-card-minimal {
  display: grid;
  gap: 12px;
}

.sop-project-card-minimal .chat-list {
  min-height: 280px;
  max-height: 420px;
}

.sop-chat-list-wrap {
  position: relative;
}

.sop-scroll-bottom {
  position: absolute;
  right: 18px;
  bottom: 16px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.24);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 5;
}

.sop-scroll-bottom.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.sop-project-card-minimal .agent-trace-list {
  max-height: 260px;
}

.sop-project-card-minimal .chat-bubble {
  padding: 10px 13px;
  border-radius: 15px;
}

.sop-project-card-minimal .chat-bubble p {
  margin: 6px 0 0;
}

.typing-bubble {
  min-width: 86px;
}

.typing-dots {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  height: 20px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--muted);
  opacity: 0.45;
  animation: typing-dot 1s infinite ease-in-out;
}

.typing-dots i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--muted);
  opacity: 0.45;
  animation: typing-dot 1s infinite ease-in-out;
}

.typing-dots span:nth-child(2),
.typing-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots span:nth-child(3),
.typing-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

.sop-typing-status {
  margin: 8px 0 12px;
  color: var(--muted);
  font-weight: 600;
}

@keyframes typing-dot {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-3px);
    opacity: 0.9;
  }
}

.chat-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.chat-message {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.reply-form {
  margin-top: 14px;
}

.reply-actions {
  align-items: center;
}

.reply-actions .primary-button {
  display: inline-flex;
  min-width: 120px;
  justify-content: center;
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.2);
}

#logoutButton {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: max(24px, env(safe-area-inset-right));
  z-index: 10000;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 34px rgba(32, 25, 20, 0.12);
  backdrop-filter: blur(10px);
}

.timeline-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.event-type {
  color: var(--accent);
  font-weight: 700;
}

.timeline-item pre,
.code-block {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.9rem;
}

.code-block {
  padding: 14px;
  min-height: 140px;
}

.muted-block {
  color: var(--muted);
}

.error-block {
  border-color: rgba(180, 35, 24, 0.2);
  background: var(--danger-soft);
  color: var(--danger);
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.input-row input {
  flex: 1;
}

.error-text {
  color: var(--danger);
}

.schedule-list {
  margin-top: 14px;
}

.assignment-pill {
  gap: 8px;
}

.pill-action {
  border: 0;
  border-left: 1px solid rgba(15, 118, 110, 0.18);
  margin-left: 4px;
  padding: 2px 0 2px 8px;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.operation-error-toast.success {
  border-color: rgba(15, 118, 110, 0.22);
  background: #eef8f5;
  color: var(--accent);
}

.schedule-options {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 180px);
  gap: 12px;
}

.weekday-options,
.monthday-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

.weekday-options label,
.monthday-options label {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  margin: 0;
}

.field-label {
  width: 100%;
  color: var(--muted);
  font-weight: 700;
}

.compact-row {
  padding: 12px;
}

.client-log-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.client-log-head h3,
.client-log-section h4 {
  margin: 0 0 8px;
}

.client-log-section {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.client-job-date-group {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-strong);
  padding: 10px 12px;
}

.client-device-group {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-strong);
  padding: 10px 12px;
}

.user-list-group,
.group-detail {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-strong);
  padding: 10px 12px;
}

.client-job-date-group summary,
.client-device-group summary,
.user-list-group summary,
.group-detail summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--accent);
}

.client-job-date-group[open] summary,
.client-device-group[open] summary,
.user-list-group[open] summary,
.group-detail[open] summary {
  margin-bottom: 10px;
}

.group-detail summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.group-members {
  padding-top: 6px;
}

.group-member-pill {
  gap: 8px;
}

.group-member-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-top: 10px;
}

.group-member-editor select {
  flex: 1 1 220px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .app-shell,
  .admin-grid,
  .task-layout,
  .merged-task-grid,
  .inspector-grid {
    grid-template-columns: 1fr;
  }

  .admin-panel-users,
  .admin-panel-groups,
  .admin-panel-executor,
  .admin-panel-client {
    grid-column: auto;
  }

  .timeline {
    min-height: 280px;
  }
}

/* Autolink AI Light Dashboard Design System
   Mirrors the provided static dashboard while preserving existing Flask IDs and JS hooks. */
body.light-dashboard {
  --ui-bg: #fbfbfa;
  --ui-panel: #ffffff;
  --ui-sidebar: #fdfdfc;
  --ui-text: #121516;
  --ui-muted: #667085;
  --ui-soft: #98a2b3;
  --ui-line: #e6e8eb;
  --ui-line-soft: #eef0f2;
  --ui-green: #007a61;
  --ui-green-hover: #0a8b70;
  --ui-green-soft: #e8f6f1;
  --ui-red: #ef4444;
  --ui-red-bg: #fff1f1;
  --ui-shadow: 0 8px 30px rgba(16, 24, 40, 0.05);
  margin: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16)),
    url("/static/login-background.jpg") center / cover fixed no-repeat;
  color: var(--ui-text);
  font-family: Inter, "Noto Sans TC", system-ui, sans-serif;
  font-size: 14px;
}

body.light-dashboard .app-shell {
  min-height: 100vh;
  display: block;
  background: transparent;
}

body.light-dashboard.login-mode .app-shell {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  min-height: 100vh;
  background: transparent;
}

body.light-dashboard.login-mode .sidebar,
body.light-dashboard.login-mode .global-sop-link,
body.light-dashboard.login-mode .setup-download-link {
  display: none !important;
}

body.light-dashboard .sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 246px;
  min-height: 100vh;
  background: var(--ui-sidebar);
  border-right: 1px solid var(--ui-line);
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  z-index: 10;
}

body.light-dashboard .workspace {
  min-width: 0;
  margin-left: 246px;
  padding: 26px 30px 30px;
}

body.light-dashboard.login-mode .workspace {
  width: min(520px, calc(100vw - 36px));
  margin-left: 0;
  padding: 0;
  background: transparent;
}

body.light-dashboard .brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 0 24px;
  border-bottom: 1px solid var(--ui-line);
}

body.light-dashboard .brand-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #35d6b4, #0a7d70);
  position: relative;
  box-shadow: 0 10px 25px rgba(0, 122, 97, 0.18);
}

body.light-dashboard .brand-logo::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 5px solid #fff;
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 6px;
  transform: rotate(45deg);
}

body.light-dashboard .brand h1 {
  margin: 0;
  color: var(--ui-text);
  font-size: 22px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.02em;
}

body.light-dashboard .brand p,
body.light-dashboard .muted,
body.light-dashboard .small,
body.light-dashboard .form-status {
  color: var(--ui-muted);
}

body.light-dashboard .brand p {
  margin: 6px 0 0;
  font-size: 13px;
}

body.light-dashboard .status-card {
  min-height: 68px;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--ui-shadow);
  display: flex;
  align-items: center;
  padding: 12px 14px;
  gap: 12px;
  flex-wrap: wrap;
  overflow: hidden;
}

body.light-dashboard .avatar-badge {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #dff3ea;
  color: #075f4b;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
}

body.light-dashboard .session-copy {
  min-width: 0;
  flex: 1;
}

body.light-dashboard .session-copy strong,
body.light-dashboard .session-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.light-dashboard .session-copy strong {
  color: var(--ui-text);
}

body.light-dashboard .session-copy span {
  color: var(--ui-muted);
  font-size: 12px;
}

body.light-dashboard .setup-download-link {
  width: 100%;
  max-width: 100%;
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  justify-content: center;
  margin-top: 2px;
}

body.light-dashboard .side-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 16px;
  z-index: 3;
  background: var(--ui-sidebar);
  padding: 4px 0;
}

body.light-dashboard .side-nav-title,
body.light-dashboard .label {
  margin: 0 0 10px 4px;
  color: #1f2937;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

body.light-dashboard .side-nav-item {
  height: 46px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #30363d;
  text-decoration: none;
  border-radius: 9px;
  font-weight: 600;
  transition: background 200ms ease-in-out, color 200ms ease-in-out;
}

body.light-dashboard .side-nav-item:hover,
body.light-dashboard .side-nav-item.active {
  background: var(--ui-green-soft);
  color: var(--ui-green);
}

body.light-dashboard .nav-icon {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 20px;
}

body.light-dashboard .nav-icon::before {
  color: currentColor;
  font-size: 18px;
  line-height: 1;
}

body.light-dashboard .nav-home::before { content: "⌂"; }
body.light-dashboard .nav-list::before { content: "▤"; }
body.light-dashboard .nav-device::before { content: "▱"; }
body.light-dashboard .nav-users::before { content: "♙"; }
body.light-dashboard .nav-group::before { content: "♧"; }
body.light-dashboard .nav-task::before { content: "▣"; }
body.light-dashboard .nav-settings::before { content: "⚙"; }

body.light-dashboard .system-status-card {
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  background: #fff;
  padding: 16px;
  box-shadow: var(--ui-shadow);
  pointer-events: none;
  cursor: default;
  user-select: none;
  display: none !important;
}

body.light-dashboard .status-title {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--ui-text);
  font-weight: 600;
}

body.light-dashboard .status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #39c98f;
}

body.light-dashboard .meter-row {
  display: flex;
  justify-content: space-between;
  color: #4b5563;
  font-size: 13px;
  margin: 18px 0 8px;
}

body.light-dashboard .meter {
  height: 5px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

body.light-dashboard .meter span {
  display: block;
  height: 100%;
  background: var(--ui-green);
  border-radius: 999px;
}

body.light-dashboard .runs-panel {
  margin-top: auto;
  border-top: 1px solid var(--ui-line);
  padding-top: 18px;
}

body.light-dashboard .runs-panel h2 {
  color: var(--ui-text);
  font-size: 18px;
  margin: 0;
}

body.light-dashboard .card,
body.light-dashboard .subpanel,
body.light-dashboard .task-card,
body.light-dashboard .client-row,
body.light-dashboard .client-job-row,
body.light-dashboard .user-row,
body.light-dashboard .client-device-group,
body.light-dashboard .client-job-date-group,
body.light-dashboard .user-list-group,
body.light-dashboard .group-detail,
body.light-dashboard .admin-task-picker,
body.light-dashboard .code-block {
  background: var(--ui-panel);
  border: 1px solid var(--ui-line);
  border-radius: 12px;
  box-shadow: var(--ui-shadow);
  color: var(--ui-text);
}

body.light-dashboard .card,
body.light-dashboard .subpanel {
  padding: 24px;
}

body.light-dashboard #adminPanel.card,
body.light-dashboard #userPanel.card,
body.light-dashboard .app-content > .card {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

body.light-dashboard .panel-head {
  min-height: auto;
  margin-bottom: 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

body.light-dashboard .panel-head h2 {
  margin: 0 0 8px;
  color: var(--ui-text);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

body.light-dashboard .eyebrow {
  margin: 0 0 6px;
  color: #4b5563;
  font-size: 13px;
  letter-spacing: 0;
}

body.light-dashboard .admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

body.light-dashboard .admin-grid > .subpanel {
  min-height: 520px;
}

body.light-dashboard .admin-panel-client { order: 1; }
body.light-dashboard .admin-panel-users { order: 2; }
body.light-dashboard .admin-panel-groups { order: 3; }
body.light-dashboard .admin-panel-provider { order: 4; }
body.light-dashboard .admin-panel-import { order: 5; }
body.light-dashboard .admin-panel-tasks { order: 6; }
body.light-dashboard .admin-panel-release { order: 7; }
body.light-dashboard .admin-panel-executor { order: 8; }

body.light-dashboard .subpanel h3 {
  margin: 0 0 16px;
  color: var(--ui-text);
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 16px;
}

body.light-dashboard .admin-grid > .subpanel > h3::before {
  display: none;
}

body.light-dashboard .admin-panel-client > h3::before,
body.light-dashboard .admin-panel-users > h3::before,
body.light-dashboard .admin-panel-groups > h3::before { content: none; }

body.light-dashboard .admin-grid > .admin-collapsible-panel {
  min-height: auto;
  padding: 0;
  overflow: hidden;
}

body.light-dashboard .admin-collapsible-summary {
  width: 100%;
  min-height: 64px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  text-align: left;
  font: inherit;
}

body.light-dashboard .admin-collapsible-summary:hover {
  background: rgba(0, 122, 97, 0.035);
}

body.light-dashboard .admin-collapsible-summary h3 {
  margin: 0;
  min-width: max-content;
  flex: 0 0 auto;
  font-size: 18px;
  letter-spacing: -0.01em;
}

body.light-dashboard .admin-collapsible-summary h3::before {
  display: none;
}

body.light-dashboard .admin-panel-client .admin-collapsible-summary h3::before,
body.light-dashboard .admin-panel-users .admin-collapsible-summary h3::before,
body.light-dashboard .admin-panel-groups .admin-collapsible-summary h3::before { content: none; }

body.light-dashboard .admin-collapsible-index {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(180deg, #0aa689 0%, #007a61 100%);
  color: #fff;
  display: inline-grid;
  place-items: center;
  flex: 0 0 30px;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 12px 22px rgba(0, 122, 97, 0.18);
}

body.light-dashboard .admin-collapsible-description {
  color: var(--ui-muted);
  flex: 1 1 auto;
  font-size: 14px;
  font-weight: 700;
  min-width: 0;
}

body.light-dashboard .admin-collapsible-marker {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(0, 122, 97, 0.16);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #f2faf7 100%);
  color: var(--ui-green);
  display: inline-grid;
  place-items: center;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.06);
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  flex: 0 0 32px;
}

body.light-dashboard .admin-collapsible-marker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 0.18s ease;
}

body.light-dashboard .admin-collapsible-summary:hover .admin-collapsible-marker {
  background: linear-gradient(180deg, #ffffff 0%, #e8f7f1 100%);
  border-color: rgba(0, 122, 97, 0.28);
  box-shadow: 0 10px 24px rgba(0, 122, 97, 0.12);
}

body.light-dashboard .admin-collapsible-body {
  border-top: 1px solid var(--ui-line);
  padding: 22px 24px 24px;
}

body.light-dashboard .admin-collapsible-panel.is-collapsed .admin-collapsible-marker {
  transform: none;
}

body.light-dashboard .admin-collapsible-panel.is-collapsed .admin-collapsible-marker::before {
  transform: rotate(-45deg) translate(1px, 1px);
}

body.light-dashboard .admin-collapsible-panel.is-collapsed .admin-collapsible-body {
  display: none;
}

body.light-dashboard .release-package-note {
  display: grid;
  gap: 6px;
  margin: 14px 0;
  padding: 14px 16px;
  border: 1px solid rgba(0, 122, 97, 0.14);
  border-radius: 14px;
  background: rgba(0, 122, 97, 0.045);
  color: var(--ui-text);
}

body.light-dashboard .release-package-actions {
  display: grid;
  gap: 8px;
  margin: 14px 0 18px;
}

body.light-dashboard .release-package-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

body.light-dashboard .release-package-columns h4 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ui-text);
}

body.light-dashboard .release-package-list {
  display: grid;
  gap: 10px;
}

body.light-dashboard .release-package-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--ui-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

body.light-dashboard .release-package-card > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

body.light-dashboard .release-package-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 150px;
}

body.light-dashboard .release-package-card-actions .primary-button,
body.light-dashboard .release-package-card-actions .ghost-button,
body.light-dashboard .release-package-card-actions .danger-button {
  min-height: 38px;
  padding: 0 14px;
  white-space: nowrap;
}

body.light-dashboard .release-package-card strong,
body.light-dashboard .release-package-card span {
  overflow-wrap: anywhere;
}

body.light-dashboard .release-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

body.light-dashboard .release-flags em {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 122, 97, 0.1);
  color: var(--ui-green);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

body.light-dashboard label span,
body.light-dashboard .field-label {
  display: block;
  color: var(--ui-text);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

body.light-dashboard .task-form {
  gap: 16px;
}

body.light-dashboard input,
body.light-dashboard select,
body.light-dashboard textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  background: #fff;
  padding: 0 14px;
  color: #1f2937;
  outline: none;
  box-shadow: none;
  transition: border-color 200ms ease-in-out, box-shadow 200ms ease-in-out;
}

body.light-dashboard input[type="checkbox"] {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  padding: 0;
  margin: 0;
  border-radius: 4px;
  flex: 0 0 18px;
  accent-color: var(--ui-green);
}

body.light-dashboard .checkbox-row,
body.light-dashboard .step-item {
  min-height: 42px;
  align-items: center;
}

body.light-dashboard .checkbox-row span,
body.light-dashboard .step-item span,
body.light-dashboard .step-item label {
  margin-bottom: 0;
}

body.light-dashboard textarea {
  padding-top: 12px;
  line-height: 1.65;
}

body.light-dashboard input::placeholder,
body.light-dashboard textarea::placeholder {
  color: #98a2b3;
}

body.light-dashboard input:focus,
body.light-dashboard select:focus,
body.light-dashboard textarea:focus {
  border-color: var(--ui-green-hover);
  box-shadow: 0 0 0 3px rgba(10, 139, 112, 0.1);
}

body.light-dashboard .primary-button,
body.light-dashboard .ghost-button,
body.light-dashboard button {
  min-height: 42px;
  border-radius: 7px;
  font-weight: 800;
  transition: background 200ms ease-in-out, color 200ms ease-in-out, border-color 200ms ease-in-out, box-shadow 200ms ease-in-out;
}

body.light-dashboard .primary-button {
  border: 0;
  background: linear-gradient(180deg, #07886b, #00634c);
  color: #fff;
  box-shadow: 0 8px 22px rgba(0, 122, 97, 0.18);
  padding: 0 22px;
}

body.light-dashboard .primary-button:hover {
  background: linear-gradient(180deg, #0a8b70, #00634c);
}

body.light-dashboard .ghost-button {
  border: 1px solid var(--ui-line);
  background: #fff;
  color: #30363d;
}

body.light-dashboard .ghost-button:hover {
  border-color: var(--ui-green-hover);
  color: var(--ui-green);
  background: var(--ui-green-soft);
}

body.light-dashboard .danger-button,
body.light-dashboard .danger-button:hover {
  border-color: #facaca;
  background: var(--ui-red-bg);
  color: #e22f37;
}

body.light-dashboard #clientTokenResult,
body.light-dashboard .code-block {
  min-height: 78px;
  border-radius: 9px;
  box-shadow: none;
}

body.light-dashboard .client-device-group,
body.light-dashboard .client-job-date-group,
body.light-dashboard .user-list-group {
  min-height: 44px;
  border-radius: 8px;
  box-shadow: none;
}

body.light-dashboard .group-detail,
body.light-dashboard .user-row,
body.light-dashboard .client-row {
  border-radius: 10px;
  box-shadow: none;
}

body.light-dashboard .pill,
body.light-dashboard .status-badge,
body.light-dashboard .badge {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

body.light-dashboard .upload-zone {
  border: 1px dashed var(--ui-line);
  border-radius: 10px;
  background: #fff;
}

body.light-dashboard .upload-zone.drag-over {
  border-color: var(--ui-green-hover);
  background: var(--ui-green-soft);
}

body.light-dashboard .global-sop-link:not(.hidden) {
  position: fixed;
  top: 24px;
  right: 108px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 156px;
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: linear-gradient(180deg, #07906f, #00684f);
  color: #fff !important;
  font-weight: 700;
  padding: 0 25px;
  box-shadow: 0 8px 22px rgba(0, 122, 97, 0.18);
  opacity: 1;
  text-indent: 0;
  overflow: visible;
  white-space: nowrap;
}

body.light-dashboard #sopStudioLink.global-sop-link:not(.hidden) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 176px !important;
  min-width: 176px !important;
  max-width: 176px !important;
  height: 42px !important;
  padding: 0 18px !important;
  border: 0 !important;
  border-radius: 7px !important;
  background: linear-gradient(180deg, #07906f, #00684f) !important;
  opacity: 1 !important;
  visibility: visible !important;
  color: #fff !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  text-indent: 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  z-index: 10002 !important;
}

body.light-dashboard #sopStudioLink.global-sop-link:not(.hidden)::before,
body.light-dashboard #sopStudioLink.global-sop-link:not(.hidden)::after {
  display: none !important;
  content: none !important;
}

body.light-dashboard .global-logout-form {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10003;
}

body.light-dashboard .global-logout-form #logoutButton {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  background: transparent;
  color: #384252;
  box-shadow: none;
}

body.light-dashboard .login-card {
  width: min(520px, 100%);
  padding: 34px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.14);
}

body.light-dashboard.login-mode .login-card::before {
  display: none;
}

body.light-dashboard .login-card .login-hero h2 {
  color: var(--ui-text);
  font-size: 24px;
  font-weight: 800;
}

body.light-dashboard .login-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

body.light-dashboard .login-title-row .brand-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
}

body.light-dashboard .login-submit {
  width: 100%;
  border: 0 !important;
  background: linear-gradient(135deg, #0f8f80 0%, #087669 100%) !important;
  color: #fff !important;
  box-shadow: 0 16px 32px rgba(0, 135, 104, .24) !important;
  opacity: 1 !important;
  text-align: center;
  justify-content: center;
}

body.light-dashboard .login-submit:hover {
  background: linear-gradient(135deg, #12a08e 0%, #08685e 100%) !important;
  box-shadow: 0 18px 36px rgba(0, 135, 104, .3) !important;
  transform: translateY(-1px);
}

body.light-dashboard .reply-actions {
  justify-content: center;
}

body.light-dashboard #replySubmitButton {
  min-width: 128px;
  justify-content: center;
  text-align: center;
  display: inline-flex;
  align-items: center;
}

body.light-dashboard .runs-panel {
  max-height: 188px;
  overflow: hidden;
}

body.light-dashboard .runs-list {
  gap: 6px;
  max-height: 118px;
  overflow: auto;
}

body.light-dashboard .runs-list button {
  padding: 7px 8px;
  min-height: 34px;
  font-size: 11px;
}

body.light-dashboard .runs-list .run-title,
body.light-dashboard .runs-list .run-meta {
  font-size: 11px;
  line-height: 1.28;
}

body.light-dashboard .runs-panel .panel-head {
  gap: 8px;
  margin-bottom: 10px;
}

body.light-dashboard .runs-panel h2 {
  font-size: 16px;
  line-height: 1.2;
}

body.light-dashboard .runs-panel .ghost-button {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 12px;
}

body.light-dashboard .task-layout,
body.light-dashboard .inspector-grid {
  grid-template-columns: 1.04fr 0.96fr;
  gap: 18px;
}

body.light-dashboard .task-layout.task-layout-merged {
  grid-template-columns: 1fr;
}

body.light-dashboard .merged-task-grid {
  grid-template-columns: 1fr;
}

body.light-dashboard .section-kicker {
  color: var(--ui-muted);
}

body.light-dashboard .inspector-grid.single-column {
  grid-template-columns: 1fr;
}

body.light-dashboard .conversation-panel,
body.light-dashboard .empty-state {
  background: #fff;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
}

body.light-dashboard .conversation-panel {
  min-height: 360px;
  max-height: 560px;
  overflow: auto;
  align-content: start;
  align-items: start;
  grid-auto-rows: max-content;
}

body.light-dashboard #replyInput {
  min-height: 112px;
}

body.light-dashboard .chat-bubble.agent,
body.light-dashboard .chat-bubble.assistant {
  background: var(--ui-green-soft);
  border-color: rgba(0, 122, 97, 0.12);
}

body.light-dashboard .chat-bubble.user {
  background: #f4f7fb;
  border-color: var(--ui-line);
}

@media (max-width: 1100px) {
  body.light-dashboard .app-shell {
    display: block;
  }

  body.light-dashboard .sidebar {
    padding: 20px 12px;
    width: 80px;
  }

  body.light-dashboard .workspace {
    margin-left: 80px;
  }

  body.light-dashboard .brand h1,
  body.light-dashboard .brand p,
  body.light-dashboard .session-copy,
  body.light-dashboard .side-nav-title,
  body.light-dashboard .side-nav-item span:not(.nav-icon),
  body.light-dashboard .system-status-card,
  body.light-dashboard .runs-panel,
  body.light-dashboard .setup-download-link {
    display: none;
  }

  body.light-dashboard .brand {
    justify-content: center;
  }

  body.light-dashboard .side-nav-item {
    justify-content: center;
    padding: 0;
    position: relative;
  }

  body.light-dashboard .side-nav-item:hover::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 10020;
    min-width: max-content;
    padding: 8px 10px;
    border: 1px solid var(--ui-line);
    border-radius: 8px;
    background: #fff;
    color: var(--ui-text);
    box-shadow: var(--ui-shadow);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
  }

  body.light-dashboard .admin-grid,
  body.light-dashboard .task-layout,
  body.light-dashboard .merged-task-grid,
  body.light-dashboard .inspector-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body.light-dashboard .app-shell {
    display: block;
  }

  body.light-dashboard .sidebar {
    position: static;
    width: auto;
    min-height: auto;
    flex-direction: row;
    overflow-x: auto;
  }

  body.light-dashboard .workspace {
    margin-left: 0;
    padding: 18px;
  }

  body.light-dashboard .admin-grid {
    grid-template-columns: 1fr;
  }

  body.light-dashboard .global-sop-link,
  body.light-dashboard .global-logout-form {
    position: static;
    display: inline-flex;
    margin: 10px;
  }
}

/* SOP Studio light dashboard alignment */
body.light-dashboard.sop-studio-page .app-shell {
  display: block;
  background: transparent;
}

body.light-dashboard.sop-studio-page .sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 246px;
  min-height: 100vh;
}

body.light-dashboard.sop-studio-page .workspace {
  margin-left: 246px;
  padding: 26px 30px 30px;
}

body.light-dashboard.sop-studio-page .sop-chat-workspace {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: start;
  width: 100%;
  max-width: 100%;
}

body.light-dashboard.sop-studio-page .sop-chat-card,
body.light-dashboard.sop-studio-page .sop-projects-card,
body.light-dashboard.sop-studio-page #sopErrorPanel {
  background: var(--ui-panel);
  border: 1px solid var(--ui-line);
  border-radius: 12px;
  box-shadow: var(--ui-shadow);
  padding: 24px;
}

body.light-dashboard.sop-studio-page .sop-chat-card {
  position: sticky;
  top: 26px;
  min-width: 0;
  z-index: 1;
}

body.light-dashboard.sop-studio-page .sop-projects-card {
  min-height: calc(100vh - 52px);
  min-width: 0;
  z-index: 0;
}

body.light-dashboard.sop-studio-page #sopErrorPanel {
  grid-column: 2;
  align-self: start;
}

body.light-dashboard.sop-studio-page .sop-chat-dropzone {
  min-height: 118px;
  border: 1px dashed var(--ui-line);
  background: #fff;
}

body.light-dashboard.sop-studio-page .sop-chat-input-wrap textarea {
  min-height: 210px;
}

body.light-dashboard.sop-studio-page .sop-back-link {
  margin-top: auto;
  width: 100%;
  justify-content: center;
}

body.light-dashboard.sop-studio-page .sop-project-card-minimal {
  border-radius: 12px;
  box-shadow: var(--ui-shadow);
}

body.light-dashboard.sop-studio-page .sop-project-card-minimal .chat-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  min-height: 300px;
  max-height: 460px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
}

body.light-dashboard.sop-studio-page .sop-project-card-minimal .chat-bubble {
  display: block;
  width: auto;
  max-width: min(780px, 92%);
  min-height: auto;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

body.light-dashboard.sop-studio-page .sop-project-card-minimal .chat-bubble.assistant,
body.light-dashboard.sop-studio-page .sop-project-card-minimal .chat-bubble.agent {
  align-self: flex-start;
}

body.light-dashboard.sop-studio-page .sop-project-card-minimal .chat-bubble.user {
  align-self: flex-end;
}

body.light-dashboard.sop-studio-page .sop-project-card-minimal .chat-bubble p,
body.light-dashboard.sop-studio-page .sop-project-card-minimal .chat-bubble strong {
  max-width: 100%;
  overflow-wrap: anywhere;
}

body.light-dashboard.sop-studio-page .sop-reply-actions {
  justify-content: center;
  margin-top: 0;
}

@media (max-width: 1280px) {
  body.light-dashboard.sop-studio-page .sop-chat-workspace {
    grid-template-columns: 1fr;
  }

  body.light-dashboard.sop-studio-page .sop-chat-card {
    position: static;
  }

  body.light-dashboard.sop-studio-page #sopErrorPanel {
    grid-column: auto;
  }
}

@media (max-width: 1100px) {
  body.light-dashboard.sop-studio-page .sidebar {
    width: 80px;
  }

  body.light-dashboard.sop-studio-page .workspace {
    margin-left: 80px;
  }
}

@media (max-width: 760px) {
  body.light-dashboard.sop-studio-page .sidebar {
    position: static;
    width: auto;
    min-height: auto;
  }

  body.light-dashboard.sop-studio-page .workspace {
    margin-left: 0;
    padding: 18px;
  }

  body.light-dashboard.sop-studio-page .sop-chat-card {
    position: static;
  }
}

@media (max-width: 1100px) {
  body.light-dashboard .sidebar,
  body.light-dashboard.sop-studio-page .sidebar {
    overflow: visible !important;
  }

  body.light-dashboard .side-nav,
  body.light-dashboard.sop-studio-page .side-nav {
    overflow: visible !important;
  }

  body.light-dashboard .side-nav-item:hover::after,
  body.light-dashboard .side-nav-item:focus-visible::after,
  body.light-dashboard.sop-studio-page .side-nav-item:hover::after,
  body.light-dashboard.sop-studio-page .side-nav-item:focus-visible::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 10050;
    min-width: max-content;
    padding: 8px 10px;
    border: 1px solid var(--ui-line);
    border-radius: 8px;
    background: #fff;
    color: var(--ui-text);
    box-shadow: var(--ui-shadow);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
  }

  body.light-dashboard.sop-studio-page .sop-back-link {
    display: inline-flex !important;
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    padding: 0 !important;
    margin-top: auto !important;
    position: relative;
    overflow: visible !important;
    font-size: 0 !important;
  }

  body.light-dashboard.sop-studio-page .sop-back-link::before {
    content: "↩";
    font-size: 20px;
    line-height: 1;
    color: var(--ui-green);
  }

  body.light-dashboard.sop-studio-page .sop-back-link:hover::after,
  body.light-dashboard.sop-studio-page .sop-back-link:focus-visible::after {
    content: "返回 Autolink AI 智動化平台";
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 10050;
    min-width: max-content;
    padding: 8px 10px;
    border: 1px solid var(--ui-line);
    border-radius: 8px;
    background: #fff;
    color: var(--ui-text);
    box-shadow: var(--ui-shadow);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
  }
}

/* Final override: formal enterprise badge sidebar icons (option B). */
body.light-dashboard .side-nav-item,
body.light-dashboard.sop-studio-page .side-nav-item {
  min-height: 50px;
  border: 1px solid transparent;
  transition:
    background 200ms ease-in-out,
    border-color 200ms ease-in-out,
    color 200ms ease-in-out,
    transform 200ms ease-in-out,
    box-shadow 200ms ease-in-out;
}

body.light-dashboard .side-nav-item:hover,
body.light-dashboard.sop-studio-page .side-nav-item:hover {
  border-color: rgba(15, 143, 128, .14);
  box-shadow: 0 10px 26px rgba(15, 23, 42, .06);
  transform: translateY(-1px);
}

body.light-dashboard .side-nav-item.active,
body.light-dashboard.sop-studio-page .side-nav-item.active {
  border-color: rgba(15, 143, 128, .12);
  box-shadow: inset 0 0 0 1px rgba(15, 143, 128, .03);
}

body.light-dashboard .nav-icon,
body.light-dashboard.sop-studio-page .nav-icon {
  width: 34px !important;
  height: 34px !important;
  display: inline-grid !important;
  place-items: center;
  flex: 0 0 34px !important;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 12px;
  background: rgba(255, 255, 255, .74);
  color: #25364a;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .06);
  transition:
    background 200ms ease-in-out,
    border-color 200ms ease-in-out,
    color 200ms ease-in-out,
    box-shadow 200ms ease-in-out,
    transform 200ms ease-in-out;
}

body.light-dashboard .side-nav-item:hover .nav-icon,
body.light-dashboard.sop-studio-page .side-nav-item:hover .nav-icon {
  color: var(--ui-green);
  border-color: rgba(0, 135, 104, .18);
  transform: translateY(-1px);
}

body.light-dashboard .side-nav-item.active .nav-icon,
body.light-dashboard.sop-studio-page .side-nav-item.active .nav-icon {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #0f8f80, #087669);
  box-shadow: 0 14px 28px rgba(0, 135, 104, .22);
}

body.light-dashboard .nav-icon::before,
body.light-dashboard.sop-studio-page .nav-icon::before {
  content: "" !important;
  width: 20px !important;
  height: 20px !important;
  display: block !important;
  background: currentColor;
  color: inherit;
  font-size: 0 !important;
  line-height: 0 !important;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

body.light-dashboard .nav-group::before,
body.light-dashboard.sop-studio-page .nav-group::before {
  width: 21px !important;
  height: 21px !important;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cg%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%278%27%20cy%3D%278%27%20r%3D%273.5%27/%3E%3Ccircle%20cx%3D%2717%27%20cy%3D%279%27%20r%3D%273%27/%3E%3Cpath%20d%3D%27M2%2021a6%206%200%200%201%2012%200%27/%3E%3Cpath%20d%3D%27M14%2020a5%205%200%200%201%208%200%27/%3E%3C/g%3E%3C/svg%3E") !important;
  mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cg%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%278%27%20cy%3D%278%27%20r%3D%273.5%27/%3E%3Ccircle%20cx%3D%2717%27%20cy%3D%279%27%20r%3D%273%27/%3E%3Cpath%20d%3D%27M2%2021a6%206%200%200%201%2012%200%27/%3E%3Cpath%20d%3D%27M14%2020a5%205%200%200%201%208%200%27/%3E%3C/g%3E%3C/svg%3E") !important;
}

body.light-dashboard .nav-home::before,
body.light-dashboard.sop-studio-page .nav-home::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cg%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M3%2010.8%2012%203l9%207.8%27/%3E%3Cpath%20d%3D%27M5%2010v10h5v-6h4v6h5V10%27/%3E%3C/g%3E%3C/svg%3E") !important;
  mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cg%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M3%2010.8%2012%203l9%207.8%27/%3E%3Cpath%20d%3D%27M5%2010v10h5v-6h4v6h5V10%27/%3E%3C/g%3E%3C/svg%3E") !important;
}

body.light-dashboard .nav-list::before,
body.light-dashboard.sop-studio-page .nav-list::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cg%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Crect%20x%3D%274%27%20y%3D%274%27%20width%3D%2716%27%20height%3D%2716%27%20rx%3D%272%27/%3E%3Cpath%20d%3D%27M8%209h8M8%2013h8M8%2017h5%27/%3E%3C/g%3E%3C/svg%3E") !important;
  mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cg%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Crect%20x%3D%274%27%20y%3D%274%27%20width%3D%2716%27%20height%3D%2716%27%20rx%3D%272%27/%3E%3Cpath%20d%3D%27M8%209h8M8%2013h8M8%2017h5%27/%3E%3C/g%3E%3C/svg%3E") !important;
}

body.light-dashboard .nav-device::before,
body.light-dashboard.sop-studio-page .nav-device::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cg%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Crect%20x%3D%273%27%20y%3D%275%27%20width%3D%2718%27%20height%3D%2712%27%20rx%3D%273%27/%3E%3Cpath%20d%3D%27M8%2021h8M12%2017v4%27/%3E%3C/g%3E%3C/svg%3E") !important;
  mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cg%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Crect%20x%3D%273%27%20y%3D%275%27%20width%3D%2718%27%20height%3D%2712%27%20rx%3D%273%27/%3E%3Cpath%20d%3D%27M8%2021h8M12%2017v4%27/%3E%3C/g%3E%3C/svg%3E") !important;
}

body.light-dashboard .nav-users::before,
body.light-dashboard.sop-studio-page .nav-users::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cg%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%279%27%20cy%3D%278%27%20r%3D%274%27/%3E%3Cpath%20d%3D%27M3%2021a6%206%200%200%201%2012%200%27/%3E%3Cpath%20d%3D%27M18%208v6M21%2011h-6%27/%3E%3C/g%3E%3C/svg%3E") !important;
  mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cg%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%279%27%20cy%3D%278%27%20r%3D%274%27/%3E%3Cpath%20d%3D%27M3%2021a6%206%200%200%201%2012%200%27/%3E%3Cpath%20d%3D%27M18%208v6M21%2011h-6%27/%3E%3C/g%3E%3C/svg%3E") !important;
}

body.light-dashboard .nav-task::before,
body.light-dashboard.sop-studio-page .nav-task::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cg%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Crect%20x%3D%275%27%20y%3D%275%27%20width%3D%2714%27%20height%3D%2714%27%20rx%3D%272%27/%3E%3Cpath%20d%3D%27M9%209h6v6H9zM12%202v3M12%2019v3M2%2012h3M19%2012h3%27/%3E%3C/g%3E%3C/svg%3E") !important;
  mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cg%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Crect%20x%3D%275%27%20y%3D%275%27%20width%3D%2714%27%20height%3D%2714%27%20rx%3D%272%27/%3E%3Cpath%20d%3D%27M9%209h6v6H9zM12%202v3M12%2019v3M2%2012h3M19%2012h3%27/%3E%3C/g%3E%3C/svg%3E") !important;
}

body.light-dashboard .nav-settings::before,
body.light-dashboard.sop-studio-page .nav-settings::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cg%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%2712%27%20cy%3D%2712%27%20r%3D%273%27/%3E%3Cpath%20d%3D%27M19.4%2015a1.65%201.65%200%200%200%20.33%201.82l.06.06a2%202%200%200%201-2.83%202.83l-.06-.06a1.65%201.65%200%200%200-1.82-.33%201.65%201.65%200%200%200-1%201.51V21a2%202%200%200%201-4%200v-.09a1.65%201.65%200%200%200-1-1.51%201.65%201.65%200%200%200-1.82.33l-.06.06a2%202%200%201%201-2.83-2.83l.06-.06A1.65%201.65%200%200%200%204.6%2015a1.65%201.65%200%200%200-1.51-1H3a2%202%200%200%201%200-4h.09A1.65%201.65%200%200%200%204.6%209a1.65%201.65%200%200%200-.33-1.82l-.06-.06a2%202%200%200%201%202.83-2.83l.06.06A1.65%201.65%200%200%200%209%204.6a1.65%201.65%200%200%200%201-1.51V3a2%202%200%200%201%204%200v.09A1.65%201.65%200%200%200%2015%204.6a1.65%201.65%200%200%200%201.82-.33l.06-.06a2%202%200%200%201%202.83%202.83l-.06.06A1.65%201.65%200%200%200%2019.4%209c.66.22%201.1.83%201.1%201.5s-.44%201.28-1.1%201.5Z%27/%3E%3C/g%3E%3C/svg%3E") !important;
  mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cg%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%2712%27%20cy%3D%2712%27%20r%3D%273%27/%3E%3Cpath%20d%3D%27M19.4%2015a1.65%201.65%200%200%200%20.33%201.82l.06.06a2%202%200%200%201-2.83%202.83l-.06-.06a1.65%201.65%200%200%200-1.82-.33%201.65%201.65%200%200%200-1%201.51V21a2%202%200%200%201-4%200v-.09a1.65%201.65%200%200%200-1-1.51%201.65%201.65%200%200%200-1.82.33l-.06.06a2%202%200%201%201-2.83-2.83l.06-.06A1.65%201.65%200%200%200%204.6%2015a1.65%201.65%200%200%200-1.51-1H3a2%202%200%200%201%200-4h.09A1.65%201.65%200%200%200%204.6%209a1.65%201.65%200%200%200-.33-1.82l-.06-.06a2%202%200%200%201%202.83-2.83l.06.06A1.65%201.65%200%200%200%209%204.6a1.65%201.65%200%200%200%201-1.51V3a2%202%200%200%201%204%200v.09A1.65%201.65%200%200%200%2015%204.6a1.65%201.65%200%200%200%201.82-.33l.06-.06a2%202%200%200%201%202.83%202.83l-.06.06A1.65%201.65%200%200%200%2019.4%209c.66.22%201.1.83%201.1%201.5s-.44%201.28-1.1%201.5Z%27/%3E%3C/g%3E%3C/svg%3E") !important;
}

/* Keep SOP Studio anchors from horizontally shifting the fixed sidebar layout. */
html:has(body.sop-studio-page),
body.light-dashboard.sop-studio-page {
  overflow-x: hidden;
}

body.light-dashboard.sop-studio-page .workspace {
  width: calc(100vw - 246px);
  max-width: calc(100vw - 246px);
  overflow-x: clip;
}

body.light-dashboard.sop-studio-page .sop-chat-workspace {
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  min-width: 0;
  overflow-x: clip;
}

body.light-dashboard.sop-studio-page .sop-chat-card,
body.light-dashboard.sop-studio-page .sop-projects-card,
body.light-dashboard.sop-studio-page #sopErrorPanel {
  max-width: 100%;
  min-width: 0;
}

body.light-dashboard.sop-studio-page #sopUploadForm,
body.light-dashboard.sop-studio-page #sopProjects {
  scroll-margin-left: 270px;
  scroll-margin-top: 24px;
}

@media (max-width: 1280px) {
  body.light-dashboard.sop-studio-page .sop-chat-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  body.light-dashboard.sop-studio-page .workspace {
    width: calc(100vw - 80px);
    max-width: calc(100vw - 80px);
  }
}

@media (max-width: 760px) {
  body.light-dashboard.sop-studio-page .workspace {
    width: 100%;
    max-width: 100%;
  }

  body.light-dashboard.sop-studio-page #sopUploadForm,
  body.light-dashboard.sop-studio-page #sopProjects {
    scroll-margin-left: 0;
  }
}

@media (max-width: 1100px) {
  body.light-dashboard .side-nav-item,
  body.light-dashboard.sop-studio-page .side-nav-item {
    width: 50px;
    height: 50px;
    min-height: 50px;
    border-radius: 16px;
  }

  body.light-dashboard .nav-icon,
  body.light-dashboard.sop-studio-page .nav-icon {
    width: 34px !important;
    height: 34px !important;
  }

  body.light-dashboard #sessionCard.status-card {
    width: 50px;
    min-height: 112px;
    height: auto;
    padding: 6px 0;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
    overflow: visible;
    position: relative;
  }

  body.light-dashboard #sessionCard .avatar-badge {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  body.light-dashboard #sessionCard .session-copy {
    display: none;
  }

  body.light-dashboard #sessionCard:hover::after,
  body.light-dashboard #sessionCard:focus-within::after,
  body.light-dashboard .setup-download-link:hover::after,
  body.light-dashboard .setup-download-link:focus-visible::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 10060;
    min-width: max-content;
    padding: 8px 10px;
    border: 1px solid var(--ui-line);
    border-radius: 8px;
    background: #fff;
    color: var(--ui-text);
    box-shadow: var(--ui-shadow);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
  }

  body.light-dashboard .setup-download-link {
    display: inline-grid !important;
    place-items: center;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    margin: 0;
    position: relative;
    overflow: visible;
    font-size: 0;
    border-radius: 12px;
  }

  body.light-dashboard .setup-download-link::before {
    content: "";
    width: 20px;
    height: 20px;
    background: currentColor;
    -webkit-mask:
      linear-gradient(#000 0 0) center 3px / 4px 12px no-repeat,
      linear-gradient(135deg, transparent 43%, #000 44% 56%, transparent 57%) center 13px / 14px 14px no-repeat,
      linear-gradient(#000 0 0) center 20px / 18px 3px no-repeat;
    mask:
      linear-gradient(#000 0 0) center 3px / 4px 12px no-repeat,
      linear-gradient(135deg, transparent 43%, #000 44% 56%, transparent 57%) center 13px / 14px 14px no-repeat,
      linear-gradient(#000 0 0) center 20px / 18px 3px no-repeat;
  }

  body.light-dashboard .side-nav,
  body.light-dashboard.sop-studio-page .side-nav {
    margin-top: 4px;
  }
}
