@import url("fonts.css");

/* Global Search Panel */
.global-search-panel {
  position: fixed;
  top: calc(var(--header-height, 68px) + 0.75rem);
  right: 1rem;
  width: min(500px, calc(100vw - 2rem));
  max-height: 60vh;
  background: var(--panel-bg);
  border-radius: 12px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  z-index: 1000;
  transform: translateY(-10px) scale(0.98);
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

@media (max-width: 640px) {
  .global-search-panel {
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    border-radius: 12px;
    max-height: calc(100vh - var(--header-height, 68px) - 1.5rem);
  }
}

.global-search-panel[open] {
  pointer-events: auto;
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Light mode - white background */
:root .global-search-panel {
  background: #ffffff;
}

/* Dark mode - use panel-bg */
html[data-theme="dark"] .global-search-panel {
  background: var(--panel-bg);
}

.global-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--stroke);
}

.global-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 16px;
  padding: 0;
  font-family: inherit;
}

.global-search-input::placeholder {
  color: var(--muted);
}

.global-search-input:focus {
  outline: none;
}

html[data-theme="dark"] .global-search-input {
  background: transparent;
}

.global-search-results {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

.global-search-result-type {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 600;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

.global-search-result-item {
  width: 100%;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 150ms ease;
  text-align: left;
  border: none;
  background: transparent;
}

.global-search-result-item:hover {
  background: var(--hover-bg, rgba(255, 255, 255, 0.05));
}

.global-search-result-title {
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.35;
}

.global-search-result-summary {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
  margin-top: 0.25rem;
}

.global-search-empty {
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}

:root {
  color-scheme: light;
  --page-bg: #fafafa;
  --bg: #f4efe6;
  --bg-2: #e7d9c5;
  --ink: #3D3D3D;
  --muted: #6c5f52;
  --accent: #c07a2a;
  --accent-2: #3f6b56;
  --card: #fffaf2;
  --stroke: rgba(42, 34, 28, 0.15);
  --shadow: 0 18px 50px rgba(42, 34, 28, 0.18);
  --panel-bg: #f4efe6;
  --panel-elevated: #fffaf2;
  --menu-sub-bg: #ffffff;
  --text-primary: #3d3d3d;
  --text-secondary: #6c5f52;
  --border-subtle: rgba(42, 34, 28, 0.12);
  --border-soft: rgba(42, 34, 28, 0.08);
  --hover-bg: rgba(42, 34, 28, 0.04);
  --field-bg: #ffffff;
  --field-border: rgba(42, 34, 28, 0.18);
  --table-head-bg: #f8f5f0;
  --table-row-bg: #fffaf2;
  --btn-ghost-ink: #4b5563;
  --cta-border-color: rgba(42, 34, 28, 0.5);
  --danger-accent: #dc2626;
  --btn-disabled-bg: #a8937f;
  --btn-disabled-ink: #ffffff;
  --btn-disabled-border: #a8937f;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #161616;
  --bg: #1e1e1e;
  --bg-2: #2a2a2a;
  --ink: #ececec;
  --muted: #b5b5b5;
  --accent: #d1913f;
  --accent-2: #5f8f78;
  --card: #242424;
  --stroke: rgba(255, 255, 255, 0.14);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  --panel-bg: #1b1f26;
  --panel-elevated: #1d222a;
  --menu-sub-bg: #171a1f;
  --text-primary: #e6ebf2;
  --text-secondary: #b8c0cb;
  --border-subtle: rgba(255, 255, 255, 0.12);
  --border-soft: rgba(255, 255, 255, 0.1);
  --hover-bg: rgba(255, 255, 255, 0.08);
  --field-bg: #1f242c;
  --field-border: rgba(255, 255, 255, 0.18);
  --table-head-bg: #242a33;
  --table-row-bg: #1d222a;
  --btn-ghost-ink: #dbe2ec;
  --cta-border-color: rgba(255, 255, 255, 0.5);
  --danger-accent: #d07a7a;
  --btn-disabled-bg: #42474f;
  --btn-disabled-ink: #ffffff;
  --btn-disabled-border: #42474f;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .page-bg,
html[data-theme="dark"] .dashboard {
  background: var(--page-bg);
  color: var(--ink);
}

html[data-theme="dark"] header,
html[data-theme="dark"] .side-menu,
html[data-theme="dark"] .side-menu-profile,
html[data-theme="dark"] .side-menu-footer,
html[data-theme="dark"] .history-panel,
html[data-theme="dark"] .rag-qa-panel {
  background: var(--bg);
  border-color: var(--stroke);
}

html[data-theme="dark"] .menu-item,
html[data-theme="dark"] .menu-sub-item,
html[data-theme="dark"] .menu-sub,
html[data-theme="dark"] .menu-status,
html[data-theme="dark"] .menu-version,
html[data-theme="dark"] .menu-user-time {
  border-color: var(--stroke);
  color: var(--muted);
}

html[data-theme="dark"] .menu-item:hover,
html[data-theme="dark"] .menu-sub-item a:hover,
html[data-theme="dark"] .menu-item.active:not(summary),
html[data-theme="dark"] .menu-sub-item.active a {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .section-card,
html[data-theme="dark"] .hero,
html[data-theme="dark"] .timeline,
html[data-theme="dark"] .home-tool,
html[data-theme="dark"] .prompt-card,
html[data-theme="dark"] .prompt-mini-card,
html[data-theme="dark"] .canvas-output,
html[data-theme="dark"] .account-card,
html[data-theme="dark"] .account-panel,
html[data-theme="dark"] .inventory-panel,
html[data-theme="dark"] .inventory-kpi,
html[data-theme="dark"] .inventory-table-wrap,
html[data-theme="dark"] .rag-table-wrap,
html[data-theme="dark"] .rag-folder-dialog {
  background: transparent;
  border-color: var(--stroke);
  color: var(--ink);
}

html[data-theme="dark"] .btn.secondary,
html[data-theme="dark"] .logout-btn,
html[data-theme="dark"] .inventory-btn,
html[data-theme="dark"] .rag-action-btn,
html[data-theme="dark"] .theme-card,
html[data-theme="dark"] .pill-tab,
html[data-theme="dark"] .ai-tab,
html[data-theme="dark"] .account-tab,
html[data-theme="dark"] .dropdown-trigger {
  background: #2a2a2a;
  border-color: var(--stroke);
  color: var(--ink);
}

html[data-theme="dark"] .btn.secondary:hover,
html[data-theme="dark"] .logout-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .inventory-btn:not(.primary):not(:disabled):hover,
html[data-theme="dark"] .logout-btn:hover:not(:disabled),
html[data-theme="dark"] .attendance-action-trigger:hover:not(:disabled),
html[data-theme="dark"] .inventory-action-trigger:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.28);
}

html[data-theme="dark"] .language-switcher-btn {
  color: #c2c9d4;
}

html[data-theme="dark"] .language-switcher-btn.is-active {
  color: #f3b34d;
}

html[data-theme="dark"] .language-switcher-divider {
  color: rgba(255, 255, 255, 0.24);
}

html[data-theme="dark"] .pull-refresh-pill {
  background: rgba(29, 34, 42, 0.94);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .pull-refresh-spinner {
  border-color: rgba(255, 255, 255, 0.16);
  border-top-color: var(--accent);
}

html[data-theme="dark"] .btn:not(:disabled):hover {
  filter: brightness(1.08);
}

html[data-theme="dark"] .btn,
html[data-theme="dark"] .btn.cta,
html[data-theme="dark"] .inventory-btn.primary,
html[data-theme="dark"] .assistant-send.is-ready,
html[data-theme="dark"] .assistant-send.is-sending {
  color: #fff;
}

/* Green button - preserve in dark mode */
html[data-theme="dark"] .articles-add-open {
  background: #5f8f78 !important;
}

html[data-theme="dark"] .articles-add-open:hover:not(:disabled) {
  filter: brightness(1.08);
}

html[data-theme="dark"] .articles-add-open:active:not(:disabled) {
  filter: brightness(0.95);
}

/* AI Mode button - preserve in dark mode with strong specificity */
html[data-theme="dark"] .btn.primary.articles-ai-mode-open:not(.secondary):not(.danger):not(.ghost) {
  background: linear-gradient(135deg, #5B69D9 0%, #9B6BA8 100%) !important;
  border-color: transparent !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .articles-ai-mode-open:hover:not(:disabled) {
  filter: brightness(1.08);
}

html[data-theme="dark"] .articles-ai-mode-open:active:not(:disabled) {
  filter: brightness(0.95);
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .account-search,
html[data-theme="dark"] .account-sort,
html[data-theme="dark"] .assistant-input,
html[data-theme="dark"] .inventory-input-row input,
html[data-theme="dark"] .dropdown-search {
  background: #222;
  border-color: var(--stroke);
  color: var(--ink);
}

html[data-theme="dark"] input:hover:not(:disabled):not([readonly]),
html[data-theme="dark"] select:hover:not(:disabled),
html[data-theme="dark"] textarea:hover:not(:disabled):not([readonly]),
html[data-theme="dark"] .account-search:hover,
html[data-theme="dark"] .account-sort:hover,
html[data-theme="dark"] .assistant-input:hover,
html[data-theme="dark"] .inventory-input-row input:hover,
html[data-theme="dark"] .dropdown-search:hover,
html[data-theme="dark"] .dropdown-trigger:hover:not(:disabled) {
  background: #252b34;
  border-color: #606060;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #9ca3af;
}

html[data-theme="dark"] .account-table,
html[data-theme="dark"] .inventory-table,
html[data-theme="dark"] .rag-table,
html[data-theme="dark"] .assistant-table {
  color: var(--ink);
}

html[data-theme="dark"] .account-table th,
html[data-theme="dark"] .account-table td,
html[data-theme="dark"] .inventory-table th,
html[data-theme="dark"] .inventory-table td,
html[data-theme="dark"] .rag-table th,
html[data-theme="dark"] .rag-table td,
html[data-theme="dark"] .assistant-table th,
html[data-theme="dark"] .assistant-table td {
  border-color: var(--stroke);
}

html[data-theme="dark"] .account-table th,
html[data-theme="dark"] .inventory-table th,
html[data-theme="dark"] .rag-table th,
html[data-theme="dark"] .assistant-table th {
  background: #262626;
}

html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .rag-folder-dialog-list,
html[data-theme="dark"] .account-sort-dropdown .dropdown-menu,
html[data-theme="dark"] .home-tool-menu,
html[data-theme="dark"] .prompt-dialog-menu,
html[data-theme="dark"] .orders-page .dropdown-menu {
  background: #242424;
  border-color: var(--stroke);
  color: var(--ink);
}

html[data-theme="dark"] .dropdown-item,
html[data-theme="dark"] .home-tool-menu-item,
html[data-theme="dark"] .prompt-dialog-menu-item,
html[data-theme="dark"] .orders-page .dropdown-item {
  color: var(--ink);
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .home-tool-menu-item:hover,
html[data-theme="dark"] .prompt-dialog-menu-item:hover,
html[data-theme="dark"] .orders-page .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .orders-page .dropdown-item.is-active {
  background: rgba(255, 255, 255, 0.12);
}

/* Override orders-page dropdown for dark mode */
html[data-theme="dark"] .orders-page .dropdown-menu {
  background: #242424 !important;
  border-color: var(--stroke) !important;
  color: var(--ink) !important;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] .orders-page .dropdown-item {
  color: var(--ink) !important;
}

html[data-theme="dark"] .orders-page .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06) !important;
}

html[data-theme="dark"] .orders-page .dropdown-item.is-active {
  background: rgba(255, 255, 255, 0.12) !important;
}

html[data-theme="dark"] dialog,
html[data-theme="dark"] .account-dialog-inner,
html[data-theme="dark"] .prompt-dialog-inner,
html[data-theme="dark"] .inventory-move-inner {
  background: #202020;
  border-color: var(--stroke);
  color: var(--ink);
}

html[data-theme="dark"] .account-dialog,
html[data-theme="dark"] .prompt-dialog,
html[data-theme="dark"] .inventory-move-dialog {
  background: transparent;
}

html[data-theme="dark"] .account-dialog::backdrop,
html[data-theme="dark"] .prompt-dialog::backdrop,
html[data-theme="dark"] .inventory-move-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .history-panel-header,
html[data-theme="dark"] .prompt-dialog-header,
html[data-theme="dark"] .inventory-move-header,
html[data-theme="dark"] .inventory-move-tabs {
  border-color: var(--stroke);
}

html[data-theme="dark"] .login-card {
  background: var(--panel-elevated);
  border-color: var(--stroke);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .login-brand,
html[data-theme="dark"] .login-subtitle,
html[data-theme="dark"] .login-form label,
html[data-theme="dark"] .login-forgot {
  color: var(--text-secondary);
}

html[data-theme="dark"] .login-form input {
  background: var(--field-bg);
  border-color: var(--field-border);
  color: var(--text-primary);
}

html[data-theme="dark"] .login-form input::placeholder {
  color: #8f99a8;
}

html[data-theme="dark"] .login-form input:focus {
  outline-color: rgba(95, 143, 120, 0.45);
  border-color: rgba(95, 143, 120, 0.75);
}

html[data-theme="dark"] .login-error {
  background: rgba(140, 54, 41, 0.25);
  border-color: rgba(180, 79, 62, 0.55);
  color: #ffd6cd;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Metropolis", "Noto Sans TC", sans-serif;
  color: var(--ink);
  min-height: 100vh;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.5rem;
  color: #496F4B;
}

h3 {
  font-size: 1.2rem;
  font-family: "Noto Sans TC", "Metropolis", sans-serif !important;
}

.hero h3,
.hero.hero-plain h3,
.section-card h3,
.mascot-summary h3,
.card h3 {
  font-family: "Noto Sans TC", "Metropolis", sans-serif !important;
}

h4 {
  font-size: 1rem;
}

p {
  font-size: 0.75rem;
}

.footnote {
  font-size: 0.8rem;
}

h1,
h2,
h3,
h4,
p {
  margin-block-start: 0;
  margin-block-end: 0;
}

h1,
h2,
h3,
h4 {
  font-family: "Metropolis", "Noto Sans TC", sans-serif;
}

h1,
h2,
h3,
h4,
p,
span {
  font-family: "Metropolis", "Noto Sans TC", sans-serif !important;
}

.brand-name h2,
.font-links h2 {
  font-family: "Noto Serif CJK TC", "Noto Serif TC", "Noto Sans TC", serif !important;
}

h1 {
  font-family: "Noto Sans TC", "Metropolis", sans-serif;
}

h4 {
  font-family: "Noto Sans TC", "Metropolis", sans-serif;
}

.shell {
  display: block;
}

.page-bg {
  background: var(--page-bg);
  min-height: 100vh;
  position: relative;
  inset: 0;
  overflow: visible;
}

body.dialog-open .page-bg {
  overflow: visible;
}

body {
  overflow-y: auto;
}

html.no-scroll,
body.home-page.no-scroll {
  overflow: visible;
  height: 100%;
  position: fixed;
  width: 100%;
  inset: 0;
  touch-action: none;
}

body.home-page.no-scroll .page-bg {
  height: 100%;
  overflow: hidden;
}

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3000;
  backdrop-filter: none;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--stroke);
  padding: 12px;
  width: 100%;
  font-family: "Noto Sans TC", "Metropolis", sans-serif;
}

@media (min-width: 1281px) {
  header {
    left: 260px;
    right: auto;
    width: calc(100dvw - 260px);
    padding: 8px 16px;
  }

  .brand-link {
    display: none;
  }

  .brand {
    gap: 0;
    flex: 0 0 auto;
  }

  .header-user-meta {
    display: grid;
    gap: 2px;
    margin-left: auto;
  }

  .header-actions {
    margin-left: 0;
  }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.brand-link {
  display: inline-flex;
  align-items: center;
}

.header-user-meta {
  display: none;
  text-align: right;
}

.header-user-name,
.header-user-role {
  margin: 0;
}

.header-user-name {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
}

.header-user-role {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.2;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: conic-gradient(from 120deg, #c07a2a, #f0c27a, #3f6b56, #c07a2a);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6), 0 10px 20px rgba(42, 34, 28, 0.25);
}

.brand h1,
.brand h3 {
  margin: 0;
  letter-spacing: 1px;
}

.brand-logo {
  height: 28px;
  width: auto;
  display: block;
}

.brand-text {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text);
  line-height: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.header-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

@media (min-width: 1281px) {
  .header-icon-btn {
    border: 1px solid rgba(42, 34, 28, 0.12);
  }

  .header-icon-btn:hover {
    background: rgba(42, 34, 28, 0.06);
  }
}

.header-icon-btn svg {
  width: 24px;
  height: 24px;
  stroke: var(--ink);
  stroke-width: 1.8;
  fill: none;
}

.header-icon-btn[aria-label="最新消息"] svg {
  transform: translateY(-2px);
}

.pill {
  border: 1px solid var(--stroke);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
}

.cta {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 400;
  font-size: 1rem;
  height: 48px;
  cursor: pointer;
  box-shadow: none;
}

.cta:disabled {
  background: var(--btn-disabled-bg);
  color: var(--btn-disabled-ink);
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.8;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 12px;
  background: #496F4B;
  color: #fff;
  font-size: 1rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  width: auto;
}

.btn:not(:disabled):hover {
  filter: brightness(0.96);
}

.btn.secondary {
  background: transparent;
  color: var(--btn-ghost-ink);
  border: 1px solid var(--cta-border-color);
}

.btn.secondary:hover {
  background: var(--hover-bg);
}

.inventory-btn:not(.primary):not(:disabled):hover,
.logout-btn:hover:not(:disabled),
.attendance-action-trigger:hover:not(:disabled),
.inventory-action-trigger:hover:not(:disabled) {
  background: var(--hover-bg);
  border-color: rgba(42, 34, 28, 0.32);
}

.btn:disabled {
  background: var(--btn-disabled-bg);
  color: var(--btn-disabled-ink);
  border-color: var(--btn-disabled-border);
  cursor: not-allowed;
  opacity: 0.8;
  pointer-events: none;
}

.font-links .btn {
  justify-self: start;
}

.menu-toggle {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: transparent;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}

.menu-toggle span {
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.shell.menu-open .menu-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.shell.menu-open .menu-toggle span {
  width: 20px;
}

.shell.menu-open .menu-toggle span:nth-child(2) {
  opacity: 0;
}

.shell.menu-open .menu-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.layout {
  position: relative;
  padding-top: var(--header-height, 120px);
}

body.pos-page .layout {
  padding-top: var(--header-height, 68px);
}

.side-menu {
  background: var(--panel-bg);
  border: none;
  border-right: 1px solid var(--stroke);
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 520px;
  height: calc(100dvh - var(--header-height, 120px) - 20px);
  margin-top: 0;
  font-family: "Noto Sans TC", "Metropolis", sans-serif;
  z-index: 30;
}

.side-menu-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--panel-bg);
}

.side-menu-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--field-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.side-menu-avatar svg {
  width: 20px;
  height: 20px;
  stroke: #6b7280;
  stroke-width: 1.8;
  fill: none;
}

.side-menu-profile-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.side-menu-footer {
  display: block;
  padding: 16px;
  height: auto;
}

.menu-meta-info {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.theme-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.theme-mode-btn {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.theme-mode-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
}

.theme-mode-btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(192, 122, 42, 0.12);
}

.logout-btn {
  border: 1px solid var(--btn-ghost-ink);
  background: transparent;
  color: var(--btn-ghost-ink);
  padding: 0.3rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  width: 100%;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.logout-btn:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.language-switcher {
  display: flex;
  justify-content: flex-start;
  margin-top: 0.6rem;
}

.language-switcher-options {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.language-switcher-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s ease;
}

.language-switcher-btn.is-active {
  color: var(--accent);
  font-weight: 700;
}

.language-switcher-divider {
  color: var(--border-strong);
  font-size: 0.8rem;
  line-height: 1;
}

.menu-group {
  display: block;
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.menu-details {
  display: grid;
  gap: 0;
  height: auto;
}

.menu-details summary {
  list-style: none;
  position: relative;
  padding-right: 36px;
}

.menu-details summary::-webkit-details-marker {
  display: none;
}

.menu-details summary::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 2px;
  background: var(--muted);
  transition: none;
}

.menu-details summary::before {
  content: "";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 14px;
  background: var(--muted);
  transition: none;
}

.menu-details[open] summary::before {
  opacity: 0;
}

.menu-sub {
  display: grid;
  gap: 0;
  padding-left: 0;
  height: auto;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-16px);
  background: var(--menu-sub-bg);
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: inset 0 1px 0 rgba(42, 34, 28, 0.03);
}

.menu-sub {
  transition: max-height 0.6s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.45s ease,
    transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.menu-details[open] .menu-sub {
  max-height: 600px;
  opacity: 1;
  transform: translateY(0);
}

@supports (-webkit-touch-callout: none) {
  header,
  .ai-tabs,
  .attendance-tabs,
  .canvas-loading {
    backdrop-filter: none !important;
  }

  .hero-visual::before,
  .hero-visual::after {
    filter: none;
  }
}

.menu-sub-item {
  color: var(--text-secondary);
  text-decoration: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.95rem;
  display: block;
}

.menu-sub-item a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  font-weight: 400;
  height: 48px;
}

.menu-sub-item a:hover {
  color: var(--text-primary);
}

.menu-status {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.menu-sub-item.active,
.menu-sub-item.active a {
  color: var(--accent);
}

.menu-sub-item.active a {
  background: var(--hover-bg);
}

.menu-item {
  padding: 0 16px;
  border-radius: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 400;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  height: 48px;
}

.menu-item:visited {
  color: var(--ink);
}

.menu-item:hover {
  background: var(--hover-bg);
}

.menu-item span {
  color: var(--text-secondary);
  font-size: 12px;
}

.menu-item.active {
  background: transparent;
  padding-left: 16px;
  padding-right: 16px;
  height: 48px;
}

.menu-item.active:not(summary) {
  background: var(--hover-bg);
  color: var(--accent);
}

.menu-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed rgba(42, 34, 28, 0.2);
  font-size: 12px;
  color: var(--muted);
}

.menu-user-info {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 0.9rem;
}

.menu-user-info p {
  margin: 0;
}

.menu-user-name {
  font-size: 1rem;
  font-weight: 500;
}

.menu-user-role {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.menu-user-time {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.menu-version {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.dashboard {
  display: block;
  margin-top: 0;
  padding: 0 2rem 2rem;
  padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  width: 100%;
  position: relative;
}

.pull-refresh-indicator {
  position: absolute;
  top: 0.5rem;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 180;
  pointer-events: none;
  opacity: 0;
  transform: translateY(calc(-100% + var(--pull-refresh-distance, 0px)));
  transition: opacity 160ms ease, transform 160ms ease;
}

.pull-refresh-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.94);
  color: var(--ink);
  box-shadow: 0 10px 28px rgba(42, 34, 28, 0.12);
  backdrop-filter: blur(10px);
}

.pull-refresh-spinner {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  border: 2px solid rgba(42, 34, 28, 0.18);
  border-top-color: var(--accent);
}

.pull-refresh-label {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

body.pull-refresh-active .pull-refresh-indicator {
  opacity: 1;
}

body.pull-refresh-loading .pull-refresh-indicator {
  opacity: 1;
  transform: translateY(0);
}

body.pull-refresh-loading .pull-refresh-spinner {
  animation: pull-refresh-spin 0.75s linear infinite;
}

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

.pos-page .dashboard {
  padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
}

.dashboard-home {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: calc(100dvh - var(--header-height, 68px));
  width: 100%;
  padding-top: 0;
  padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  padding-left: 2rem;
  padding-right: 2rem;
  margin-left: auto;
  margin-right: 0;
}

.dashboard-home > * {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.dashboard > * {
  margin-bottom: 64px;
}

.dashboard > *:last-child {
  margin-bottom: 0;
}

.ci-dashboard {
  display: block;
  margin-top: 0;
  padding: 0 2rem 2rem;
  padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  width: 100%;
}

.ci-dashboard > * {
  margin-bottom: 1rem;
}

.ci-dashboard > *:last-child {
  margin-bottom: 0;
}

.pos-page .dashboard,
.pos-page .ci-dashboard,
.pos-page .pos-toolbar,
.pos-page .pos-grid {
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

.ci-dashboard .hero-plain {
  margin-bottom: 1rem;
}

.ci-dashboard .tabs {
  margin-bottom: 1rem;
}

.ci-dashboard .tab-panels {
  margin-bottom: 1rem;
}

.ci-content {
  display: block;
  max-width: 900px;
  width: 100%;
}

.account-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--stroke);
  border-radius: 20px;
  padding: 0;
  width: auto;
  overflow: hidden;
}

.accounts-page .account-card {
  border-radius: 16px;
}

.profile-page .account-card {
  padding: 18px;
}

.profile-page .account-panel {
  padding: 0;
}

.account-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin-bottom: 1.5rem;
}

.account-tab {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0.25rem 0;
  font-family: "Metropolis", "Noto Sans TC", sans-serif !important;
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 900;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
}

.account-tab.is-active {
  color: var(--ink);
}

.account-tab + .account-tab {
  border-left: 1px solid rgba(42, 34, 28, 0.15);
  padding-left: 1rem;
  margin-left: 1rem;
}

.account-panels {
  display: grid;
}

.account-panel {
  display: none;
  gap: 1.5rem;
}

.account-panel.is-active {
  display: grid;
}

.account-form {
  display: grid;
  gap: 1rem;
}

.account-form label,
.account-form .pos-form-field {
  display: grid;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--ink);
}

.account-form input,
.account-form select {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
}

.account-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.account-table-header {
  display: none;
  justify-content: flex-start;
  margin-bottom: 1rem;
}

.account-table-header.is-active {
  display: flex;
}

.account-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: #fff;
}

.account-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  border: none;
}

.account-table th,
.account-table td {
  padding: 0.85rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(42, 34, 28, 0.12);
  white-space: nowrap;
}

.account-table tr:last-child td {
  border-bottom: none;
}

.account-table th {
  background: #faf7f2;
  color: var(--muted);
  font-weight: 600;
}

.account-table th + th {
  box-shadow: inset 1px 0 0 rgba(42, 34, 28, 0.08);
}

.account-row-skeleton td {
  white-space: normal;
}

.account-skeleton-line {
  display: block;
  width: 100%;
  height: 1rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #f1ece2 0%, #e8dfd2 50%, #f1ece2 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.account-skeleton-line.title {
  width: 70%;
}

.account-mobile-list,
.promotion-mobile-list {
  display: none;
}

.account-mobile-card-skeleton {
  display: grid;
  gap: 0.75rem;
}

.employee-accounts-page .account-card {
  background: #fff;
}

.schedule-dashboard {
  display: grid;
  gap: 1rem;
}

body.schedule-page .schedule-dashboard {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 2rem calc(6rem + env(safe-area-inset-bottom, 0px));
}

body.schedule-page .schedule-dashboard > * {
  margin-bottom: 0;
}

body.schedule-page .schedule-dashboard > *:last-child {
  margin-bottom: 0;
}

.schedule-hero-card,
.schedule-calendar-card,
.schedule-day-card,
.schedule-fixed-card,
.schedule-form-card {
  background: #fff;
  padding: 1rem;
}

.schedule-hero-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.schedule-hero-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  min-width: min(100%, 360px);
}

.schedule-hero-stat {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(42, 34, 28, 0.08);
}

.schedule-hero-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.schedule-hero-stat strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1rem;
}

.schedule-eyebrow {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.88rem;
  letter-spacing: 0.08em;
}

.schedule-day-card .schedule-eyebrow,
.schedule-fixed-card .schedule-eyebrow {
  letter-spacing: normal;
}

.schedule-title {
  margin: 0;
  font-size: clamp(1.7rem, 2vw, 2.4rem);
}

.schedule-subtitle,
.schedule-panel-head p {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

.schedule-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.9fr);
  gap: 1rem;
}

body.schedule-page .schedule-tabs-row {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 12px;
  height: auto;
  margin-bottom: 0;
  min-height: 0;
  overflow: visible;
}

.schedule-tab {
  border: none;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
}

body.schedule-page .schedule-panel {
  display: none;
  min-width: 0;
}

body.schedule-page .schedule-panel.is-active {
  display: grid;
  gap: 1rem;
  align-content: start;
  align-items: start;
}

body.schedule-page .schedule-page-tabs {
  display: flex;
  align-items: center;
  width: auto;
  margin-bottom: 0;
  overflow: visible;
}

@media (min-width: 1281px) {
  body.schedule-page .schedule-page-tabs .schedule-tab {
    padding-top: 0;
    padding-bottom: 0;
  }
}

.schedule-add-open-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  column-gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1.5rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  background: #fff;
  border-top: 1px solid var(--stroke);
  box-shadow: none;
  z-index: 1400;
}

.schedule-add-open {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 1.2rem;
}

.schedule-add-open-wrap > .schedule-add-open + .schedule-add-open {
  margin-left: 0.5rem;
}

.btn.schedule-add-event-btn {
  background: #c07a2a !important;
  color: #fff !important;
  border: none !important;
}

html[data-theme="dark"] .btn.schedule-add-event-btn {
  background: #c0742a !important;
  color: #fff !important;
  border: none !important;
}

body.dialog-open .schedule-add-open-wrap {
  display: none;
}

.schedule-create-dialog {
  position: fixed;
  inset: 0;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: none;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.schedule-create-dialog[open] {
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 2200;
  opacity: 1;
}

.schedule-create-dialog::backdrop {
  background: rgba(42, 34, 28, 0.45);
}

.schedule-create-inner {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, 92vw);
  height: auto;
  max-height: min(80vh, calc(100dvh - 32px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.schedule-create-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  margin: 0;
  padding: 0.75rem 1rem 0;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}

.schedule-create-header .dialog-close {
  align-self: start;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.schedule-create-tabs {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 0;
  background: transparent;
  border-bottom: 1px solid rgba(42, 34, 28, 0.12);
  width: 100%;
  flex: 0 0 auto;
  box-sizing: border-box;
}

.schedule-create-tab {
  flex: 1;
  text-align: center;
  margin: 0;
  padding: 1rem 0;
  border: none;
  border-radius: 0;
  font-size: 0.9rem;
  line-height: 1.3;
  font-weight: 900;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  position: relative;
}

.schedule-create-tab.is-active {
  color: #7a4a1e;
}

.schedule-create-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: #7a4a1e;
  border-radius: 2px;
}

.schedule-create-tabs .inventory-move-tab-divider {
  display: none;
}

.schedule-create-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  flex: 1 1 auto;
  width: 100%;
  box-sizing: border-box;
  padding: 1rem;
}

.schedule-create-panel {
  display: none;
  position: relative;
  z-index: 1;
}

.schedule-create-panel.is-active {
  display: block;
}

.schedule-create-inner > .account-dialog-actions {
  justify-content: flex-end;
  position: static;
  flex: 0 0 auto;
  margin: 0;
  padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
  background: inherit;
  border-top: 1px solid rgba(42, 34, 28, 0.08);
  box-sizing: border-box;
}

#schedule-event-dialog .account-dialog-header {
  margin-bottom: 0;
}

#schedule-event-dialog .account-dialog-actions {
  justify-content: flex-end;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  margin: 0;
  padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid rgba(42, 34, 28, 0.08);
}

.schedule-dialog-dropdown {
  width: 100%;
  display: flex;
}

.schedule-dialog-dropdown .dropdown-trigger {
  min-width: 100%;
  width: 100%;
}

.schedule-dialog-dropdown .dropdown-menu {
  left: 0;
  right: auto;
  min-width: 100%;
  width: 100%;
}

.schedule-weekday-field {
  display: grid;
  gap: 0.65rem;
}

.schedule-weekday-label {
  margin: 0;
  font-weight: 700;
  color: var(--ink);
}

.schedule-weekday-chips {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.55rem;
}

.schedule-weekday-chip {
  position: relative;
  display: block;
  cursor: pointer;
}

.schedule-weekday-chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.schedule-weekday-chip span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid rgba(42, 34, 28, 0.14);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.schedule-weekday-chip input:checked + span {
  border-color: rgba(145, 84, 17, 0.46);
  background: rgba(239, 196, 132, 0.18);
  color: #7a4a1e;
  box-shadow: 0 0 0 3px rgba(239, 196, 132, 0.16);
}

html[data-ui-language="en"] .schedule-weekday-label {
  display: none;
}

.schedule-side-column,
.schedule-admin-grid,
.schedule-calendar-card,
.schedule-form,
.schedule-fixed-list,
.schedule-day-list,
.schedule-manage-day-list {
  display: grid;
  gap: 1rem;
}

.schedule-event-datetime-group {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.schedule-event-datetime-group input {
  flex: 1;
  min-width: 0;
}

.schedule-event-datetime-group input[type="date"] {
  flex: 1.5;
}

.schedule-event-datetime-group input[type="time"] {
  flex: 1;
}

.schedule-calendar-card {
  padding: 1rem;
}

.schedule-side-column {
  align-content: start;
  padding: 0;
}

.schedule-fixed-list,
.schedule-day-list,
.schedule-manage-day-list {
  margin-top: 1rem;
}

.schedule-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.schedule-panel-head h2,
.schedule-calendar-heading h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--ink);
}

.schedule-day-card .schedule-panel-head {
  align-items: center;
}

.schedule-day-card .schedule-eyebrow {
  margin: 0;
}

.schedule-day-headline {
  margin: 0 0 0 auto;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
}

.schedule-day-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(239, 196, 132, 0.16);
  color: #915411;
  font-size: 0.84rem;
  font-weight: 700;
}

.schedule-calendar-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
}

.schedule-calendar-heading {
  text-align: center;
}

.schedule-month-nav {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
}

.schedule-calendar-heading p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.schedule-calendar-weekdays,
.schedule-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.65rem;
}

.schedule-calendar-weekdays span {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.schedule-calendar-weekdays span:first-child,
.schedule-calendar-weekdays span:last-child {
  color: #c83b3b;
}

.schedule-calendar-day {
  min-height: 118px;
  border: 1px solid rgba(42, 34, 28, 0.1);
  border-radius: 18px;
  padding: 0.8rem;
  background: #fff;
  color: var(--ink);
  text-align: left;
  display: grid;
  gap: 0.5rem;
  align-content: start;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  -webkit-text-fill-color: currentColor;
}

.schedule-calendar-day:hover {
  border-color: rgba(145, 84, 17, 0.22);
  box-shadow: 0 12px 24px rgba(42, 34, 28, 0.08);
  transform: translateY(-1px);
}

.schedule-calendar-day.is-outside {
  opacity: 0.42;
  cursor: default;
  pointer-events: none;
}

.schedule-calendar-day.is-today {
  border-color: rgba(145, 84, 17, 0.28);
}

.schedule-calendar-day.is-selected {
  border-color: rgba(145, 84, 17, 0.72);
  background: rgba(239, 196, 132, 0.22);
  box-shadow: 0 0 0 3px rgba(239, 196, 132, 0.28);
}

.schedule-calendar-day.is-selected .schedule-calendar-day-number {
  color: #7a4a1e;
  -webkit-text-fill-color: #7a4a1e;
}

.schedule-calendar-day-number {
  font-weight: 700;
  color: inherit;
  -webkit-text-fill-color: currentColor;
}

.schedule-calendar-day.has-event .schedule-calendar-day-number {
  color: #b42318;
  -webkit-text-fill-color: #b42318;
}

.schedule-calendar-day-body {
  display: grid;
  gap: 0.38rem;
}

.schedule-date-input {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: var(--card);
  font-size: 0.9375rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.18s ease;
  font-family: inherit;
  box-sizing: border-box;
  text-align: left;
  gap: 0.5rem;
}

.schedule-date-input-icon {
  display: none;
}

.schedule-date-picker-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--neutral-stroke);
  gap: 0.5rem;
}

.schedule-date-picker-nav {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--neutral-text-secondary);
  padding: 0;
}

.schedule-date-picker-nav:hover {
  color: var(--neutral-text-primary);
}

.schedule-date-picker-nav svg {
  width: 20px;
  height: 20px;
}

.schedule-date-picker-title {
  font-weight: 600;
  font-size: 0.9375rem;
  margin: 0;
  flex: 1;
  text-align: center;
  color: var(--neutral-text-primary);
}

.schedule-date-picker-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  padding: 1rem;
  min-height: 240px;
}

.schedule-date-picker-calendar .schedule-calendar-day {
  min-height: auto;
  aspect-ratio: 1;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.schedule-date-picker-selected {
  border-top: 1px solid var(--neutral-stroke);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--neutral-text-secondary);
}

.schedule-date-picker-modal:not([open]) {
  display: none !important;
}

.schedule-date-picker-modal[open] {
  display: grid;
  place-items: center;
}

.schedule-date-picker-wrapper {
  position: static !important;
  width: min(360px, calc(100vw - 24px)) !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  margin: 0 auto !important;
}

.schedule-date-picker-selected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.schedule-date-picker-selected-item {
  background: var(--neutral-bg-secondary);
  color: var(--neutral-text-primary);
  padding: 0.25rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
}

.schedule-date-selector {
  padding: 1rem;
  background: var(--page-bg);
  width: 100%;
  box-sizing: border-box;
}

.schedule-date-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--neutral-stroke);
}

.schedule-date-actions .btn {
  flex: 1;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

.schedule-date-selector-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}

.schedule-date-selector-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--neutral-text-primary);
}

.schedule-date-nav-prev,
.schedule-date-nav-next {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem 0.375rem;
  color: var(--neutral-text-secondary);
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.schedule-date-nav-prev:hover,
.schedule-date-nav-next:hover {
  color: var(--neutral-text-primary);
}

.schedule-date-selector-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 0.75rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--neutral-text-secondary);
}

.schedule-date-selector-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.schedule-date-day-label {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-width: 40px;
  border: 1px solid var(--neutral-stroke);
  border-radius: 0.375rem;
  background: var(--page-bg);
  cursor: pointer;
  font-size: 0.8125rem;
  padding: 0.25rem;
  color: var(--neutral-text-primary);
  transition: all 0.2s ease;
  position: relative;
  box-sizing: border-box;
}

.schedule-date-day-label:hover {
  border-color: var(--neutral-text-secondary);
  background: var(--neutral-bg-secondary);
}

.schedule-date-day-label.is-today {
  border-color: var(--primary);
  font-weight: 600;
}

.schedule-date-day {
  position: absolute;
  appearance: none;
  width: 0;
  height: 0;
  opacity: 0;
  margin: 0;
}

.schedule-date-day-text {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.schedule-date-day:checked + .schedule-date-day-text,
.schedule-date-day:checked ~ .schedule-date-day-text {
  background: var(--primary);
  color: white;
}

.schedule-date-day-label {
  position: relative;
}

.schedule-date-day:checked ~ .schedule-date-day-text {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.schedule-date-day-label:has(.schedule-date-day:checked) {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 600;
}

.schedule-selected-dates-display {
  min-height: 2rem;
  padding: 0.5rem;
  background: var(--neutral-bg-secondary);
  border-radius: 0.375rem;
  border: 1px solid var(--neutral-stroke);
}

.schedule-selected-dates-empty {
  color: var(--neutral-text-secondary);
  font-size: 0.875rem;
  margin: 0;
  padding: 0.5rem;
}

.schedule-selected-dates-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.schedule-selected-dates-list li {
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.schedule-date-clear {
  align-self: flex-start;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.schedule-calendar-day-skeleton,
.schedule-item-card-skeleton,
.schedule-skeleton-line,
.schedule-skeleton-pill,
.schedule-skeleton-tag,
.schedule-skeleton-btn,
.schedule-skeleton-dot {
  background: linear-gradient(
    100deg,
    rgba(229, 221, 209, 0.72) 20%,
    rgba(245, 239, 230, 0.96) 45%,
    rgba(229, 221, 209, 0.72) 70%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.schedule-calendar-day-skeleton {
  pointer-events: none;
  border-color: rgba(42, 34, 28, 0.08);
  box-shadow: none;
}

.schedule-skeleton-line,
.schedule-skeleton-pill,
.schedule-skeleton-tag,
.schedule-skeleton-btn {
  display: block;
  border-radius: 999px;
}

.schedule-skeleton-title-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
}

.schedule-skeleton-line-title {
  width: 140px;
  height: 1.5rem;
}

.schedule-skeleton-line-date {
  width: 180px;
  height: 1.1rem;
  margin-left: auto;
}

.schedule-item-card-skeleton {
  min-height: 124px;
}

.schedule-item-card-skeleton.has-actions {
  min-height: 152px;
}

.schedule-skeleton-line-day-number {
  width: 22px;
  height: 16px;
  border-radius: 8px;
}

.schedule-skeleton-stack {
  display: grid;
  gap: 0.55rem;
}

.schedule-skeleton-pill {
  width: 84px;
  height: 34px;
}

.schedule-skeleton-line-meta {
  width: 150px;
  height: 16px;
}

.schedule-skeleton-line-note {
  width: 70%;
  height: 16px;
}

.schedule-skeleton-tag {
  width: 88px;
  height: 34px;
}

.schedule-skeleton-btn {
  width: 82px;
  height: 40px;
}

.schedule-skeleton-dot {
  display: inline-flex;
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.schedule-calendar-chip,
.schedule-member-badge,
.schedule-mode-tag,
.schedule-source-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  padding: 0.26rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.schedule-calendar-chip-fixed,
.schedule-source-tag-fixed {
  background: #fff1dc;
  color: #9a5b00;
}

.schedule-calendar-chip-flexible,
.schedule-source-tag-manual {
  background: #e7f7ec;
  color: #1d6b3d;
}

.schedule-source-tag-leave {
  background: #ffe7ea;
  color: #b42318;
}

.schedule-calendar-chip-event,
.schedule-source-tag-event {
  background: #ffe7ea;
  color: #b42318;
}

.schedule-mode-tag-leave-type {
  background: #fff0f2;
  color: #9f1239;
}

.schedule-status-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  padding: 0.26rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.schedule-status-tag-submitted {
  background: #edf2f7;
  color: #364152;
}

.schedule-status-tag-approved {
  background: #e7f7ec;
  color: #1d6b3d;
}

.schedule-status-tag-rejected,
.schedule-status-tag-cancelled {
  background: #ffe7ea;
  color: #b42318;
}

.schedule-mode-tag-fixed {
  background: #edf2f7;
  color: #364152;
}

.schedule-mode-tag-flexible {
  background: #f5f0ff;
  color: #6240a3;
}

.schedule-member-badge {
  border: 1px solid transparent;
}

.schedule-member-badge-1 {
  background: #e8f2ff;
  border-color: #bfd8ff;
  color: #0b3b7a;
}

.schedule-member-badge-2 {
  background: #e9f8ee;
  border-color: #bfe7ca;
  color: #165c36;
}

.schedule-member-badge-3 {
  background: #fff3e6;
  border-color: #f2cfab;
  color: #8a4b00;
}

.schedule-member-badge-4 {
  background: #f8eeff;
  border-color: #dcc1f6;
  color: #6b2e8a;
}

.schedule-member-badge-5 {
  background: #fdecef;
  border-color: #f3bec8;
  color: #8a2235;
}

.schedule-member-badge-6 {
  background: #eaf7f7;
  border-color: #bae3e3;
  color: #0f5c61;
}

.schedule-member-badge-7 {
  background: #fff7d9;
  border-color: #f2de8a;
  color: #7a5a00;
}

.schedule-member-badge-8 {
  background: #eef1f5;
  border-color: #cfd6dd;
  color: #374151;
}

.schedule-calendar-more {
  color: var(--muted);
  font-size: 0.8rem;
}

.schedule-item-card {
  display: grid;
  gap: 0.55rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(42, 34, 28, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.schedule-item-card-leave {
  background: rgba(255, 247, 248, 0.92);
  border-color: rgba(180, 35, 24, 0.18);
}

.schedule-item-card-has-leave {
  border-color: rgba(180, 35, 24, 0.2);
}

.schedule-item-card-rule {
  background: rgba(255, 250, 243, 0.92);
}

.schedule-item-card-event {
  background: rgba(255, 247, 248, 0.92);
  border-color: rgba(180, 35, 24, 0.18);
}

.schedule-item-card-event:hover {
  border-color: rgba(180, 35, 24, 0.28);
}

.schedule-item-card:hover {
  border-color: rgba(145, 84, 17, 0.22);
  box-shadow: 0 12px 24px rgba(42, 34, 28, 0.08);
  transform: translateY(-1px);
}

.schedule-item-card-leave:hover,
.schedule-item-card-has-leave:hover {
  border-color: rgba(180, 35, 24, 0.28);
}

.schedule-item-main {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.schedule-item-main > div:first-child {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  min-width: auto;
}

.schedule-item-name,
.schedule-item-meta,
.schedule-item-note {
  margin: 0;
}

.schedule-item-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
}

.schedule-item-name .schedule-member-badge {
  font-size: 0.92rem;
}

.schedule-item-time {
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.schedule-item-meta,
.schedule-item-note {
  color: var(--muted);
  word-break: break-word;
}

.schedule-item-leave-note {
  color: #b42318;
  font-weight: 600;
}

.schedule-item-callout {
  display: grid;
  gap: 0.25rem;
  padding: 0.5rem 0.65rem;
  border-radius: 12px;
}

.schedule-item-callout-leave {
  background: rgba(255, 231, 234, 0.72);
  border: 1px solid rgba(180, 35, 24, 0.14);
}

.schedule-item-callout-range {
  background: rgba(255, 241, 220, 0.58);
  border: 1px solid rgba(154, 91, 0, 0.12);
}

.schedule-item-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.schedule-tag-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.schedule-item-actions .schedule-delete-btn {
  background: transparent !important;
  border: 1px solid rgba(220, 38, 38, 0.45) !important;
  color: #dc2626 !important;
  -webkit-text-fill-color: #dc2626 !important;
}

.schedule-item-actions .schedule-delete-btn:hover {
  background: rgba(220, 38, 38, 0.08) !important;
  border-color: #dc2626 !important;
  color: #dc2626 !important;
  -webkit-text-fill-color: #dc2626 !important;
}

.schedule-detail-body {
  display: grid;
  gap: 0.9rem;
  padding: 0;
  box-sizing: border-box;
}

.schedule-detail-form {
  display: grid;
  gap: 0.9rem;
  padding: 0 1rem;
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
}

.schedule-detail-form label {
  display: grid;
  gap: 0.4rem;
}

.schedule-detail-form textarea,
.schedule-detail-form input,
.schedule-detail-form select {
  width: 100%;
}

#schedule-detail-dialog .account-dialog-inner {
  position: relative;
}

#schedule-detail-dialog .account-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1rem 0;
}

#schedule-detail-dialog .account-dialog-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  flex: 1;
}

#schedule-detail-dialog .account-dialog-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

#schedule-detail-dialog .schedule-detail-edit,
#schedule-detail-dialog .schedule-detail-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

#schedule-detail-dialog .schedule-detail-edit svg,
#schedule-detail-dialog .schedule-detail-close svg {
  width: 22px;
  height: 22px;
}

#schedule-detail-dialog .schedule-detail-edit svg path,
#schedule-detail-dialog .schedule-detail-close svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#schedule-detail-dialog .schedule-detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.9rem 1rem 1rem;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
}

#schedule-detail-dialog .schedule-detail-delete {
  margin-right: auto;
  background: transparent;
  border: 1px solid rgba(220, 38, 38, 0.45);
  color: #dc2626;
}

#schedule-detail-dialog .schedule-detail-delete:hover {
  background: rgba(220, 38, 38, 0.08);
  border-color: #dc2626;
  color: #dc2626;
}

#schedule-detail-dialog .schedule-detail-delete svg {
  width: 16px;
  height: 16px;
}

#schedule-detail-dialog .schedule-detail-delete svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#schedule-detail-dialog .account-form.schedule-detail-form {
  padding: 0 1rem;
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
}

.schedule-detail-row {
  display: grid;
  gap: 0.2rem;
}

.schedule-detail-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.schedule-detail-value {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.5;
}

.schedule-admin-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.schedule-time-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.schedule-time-grid.is-hidden {
  display: none;
}

.schedule-member-alert {
  border: 1px solid rgba(145, 84, 17, 0.18);
  background: #fff6ea;
  color: #915411;
  padding: 0.85rem 1rem;
  border-radius: 14px;
}

.account-actions-cell {
  vertical-align: middle;
  text-align: right;
}

.account-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.account-toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.account-toolbar-filters {
  min-width: 0;
}

.account-action-menu {
  position: relative;
  display: inline-flex;
}

.account-action-trigger {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(42, 34, 28, 0.16);
  background: #fff;
  color: rgba(42, 34, 28, 0.78);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.account-action-trigger svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.account-action-trigger:hover:not(:disabled) {
  background: var(--hover-bg);
  border-color: rgba(42, 34, 28, 0.32);
}

.account-action-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 168px;
  padding: 0.35rem;
  border: 1px solid rgba(42, 34, 28, 0.12);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 32px rgba(42, 34, 28, 0.16);
  display: grid;
  gap: 0.2rem;
  z-index: 40;
}

.account-action-dropdown-menu[hidden] {
  display: none !important;
}

.account-menu-item {
  width: 100%;
  border: none;
  background: transparent;
  color: rgba(42, 34, 28, 0.82);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.account-menu-item:hover:not(:disabled) {
  background: rgba(42, 34, 28, 0.08);
}

.account-menu-item.danger {
  color: #dc2626;
}

.account-action-dropdown-menu .account-delete,
.account-action-dropdown-menu .account-toggle.danger,
.account-table .account-action-dropdown-menu .account-delete {
  background: transparent !important;
  border: none !important;
  color: #dc2626 !important;
  -webkit-text-fill-color: #dc2626 !important;
}

.account-menu-item.danger:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.08);
}

.account-search,
.account-sort {
  font-size: 16px;
  font-family: inherit;
  background: transparent;
}

.account-search-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 0.25rem 0.7rem;
  background: transparent;
  position: relative;
  min-width: 220px;
  height: 40px;
}

.account-search-icon {
  width: 18px;
  height: 18px;
  stroke: rgba(42, 34, 28, 0.7);
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-search {
  border: none;
  padding: 0.45rem 0.2rem;
  width: 100%;
}

.account-search:focus,
.account-sort:focus {
  outline: none;
}

.account-search::selection {
  background: rgba(239, 196, 132, 0.35);
}

.account-sort-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 0.25rem 0.7rem;
  background: #fff;
  position: relative;
  height: 40px;
}

.account-sort-wrap::after {
  content: none;
}

.account-sort-wrap:focus-within {
  border-color: rgba(42, 34, 28, 0.45);
  box-shadow: 0 0 0 3px rgba(239, 196, 132, 0.25);
}

.account-search-wrap:focus-within {
  border-color: rgba(42, 34, 28, 0.45);
  box-shadow: 0 0 0 3px rgba(239, 196, 132, 0.25);
}

.account-sort-icon {
  width: 18px;
  height: 18px;
  stroke: rgba(42, 34, 28, 0.75);
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-sort {
  border: none;
  background: transparent;
  padding: 0.45rem 0.2rem;
  font-size: 16px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.account-sort option {
  background: #fff;
  color: var(--ink);
}

.account-alert {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid rgba(42, 34, 28, 0.18);
  background: #fff6ea;
  color: #6b4b28;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  margin: 0 0 1rem;
  font-size: 0.95rem;
}

#account-alert-text {
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .account-alert {
    grid-template-columns: 1fr;
    justify-items: start;
  }
}

.account-alert.is-error {
  border-color: rgba(185, 28, 28, 0.4);
  background: #fff1f2;
  color: #991b1b;
}

.account-actions-locked {
  color: var(--muted);
  font-size: 0.85rem;
}

.account-actions {
  display: inline-flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
  align-items: center;
}

.account-table tr.is-disabled {
  color: #a39a8c;
  background: rgba(42, 34, 28, 0.04);
}

.account-table tr.is-disabled td {
  color: inherit;
}

.btn.danger {
  background: transparent;
  border: 1px solid rgba(220, 38, 38, 0.45);
  color: #dc2626;
}

.btn.danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.account-dialog {
  border: none;
  background: transparent;
  padding: 0;
  z-index: 9999;
}

.account-dialog::backdrop {
  background: rgba(42, 34, 28, 0.45);
  animation: dialog-backdrop 0.2s ease;
}

.account-dialog-inner {
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  padding: 0;
  max-width: 520px;
  width: min(90vw, 520px);
  max-height: calc(100dvh - 2rem);
  margin: 0;
  position: relative;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.account-dialog[open] {
  display: grid;
  place-items: center;
}

.account-dialog:not([open]) .account-dialog-inner {
  display: none !important;
}

.account-dialog[open] .account-dialog-inner {
  animation: dialog-pop 0.22s ease;
}

.account-dialog.is-closing .account-dialog-inner {
  animation: dialog-pop-out 0.18s ease forwards;
}

@keyframes dialog-pop {
  from {
    transform: scale(0.96);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes dialog-pop-out {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(0.96);
    opacity: 0;
  }
}

@keyframes dialog-backdrop {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.account-dialog-title {
  margin: 0;
  font-size: 1.2rem;
  color: var(--ink);
  padding: 0.75rem 1rem 0.5rem;
  font-weight: 700;
}

.account-dialog-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  background: inherit;
  padding: 0.9rem 1rem;
  border-top: 1px solid var(--stroke);
  flex-shrink: 0;
  border-radius: 0 0 16px 16px;
  overflow: hidden;
  box-sizing: border-box;
}

.account-dialog-actions .btn {
  flex: 0 0 auto;
}

@media (max-width: 1280px) {
  .account-dialog-actions .btn:not(.pos-actions-dropdown) {
    flex: 1 1 0;
    min-width: 0;
  }
}

#articles-dialog-import-json-btn {
  margin-right: auto;
}

/* Disabled button state in dialogs */
.account-dialog-actions .btn.cta:disabled {
  background: var(--btn-disabled-bg) !important;
  color: var(--btn-disabled-ink) !important;
  opacity: 0.6;
  cursor: not-allowed;
}

.account-dialog-body {
  font-size: 1rem;
  background: inherit;
  padding-top: 0;
  padding-right: 1rem;
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  padding-left: 1rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.account-dialog-header {
  background: inherit;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  flex-shrink: 0;
}

.account-dialog-inner .account-form {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}


#account-dialog .account-form,
#account-edit-dialog .account-form {
  flex: 1 1 auto;
}

#account-dialog .account-dialog-actions-fixed,
#account-edit-dialog .account-dialog-actions-fixed {
  margin: 0;
  padding: 0.9rem 1rem 1rem;
  border-top: 1px solid rgba(42, 34, 28, 0.08);
  background: inherit;
  flex: 0 0 auto;
}


/* Actions sit in normal flow right after the body instead of overlaying it as an
   absolutely-positioned bar — an overlay only avoids covering real content once the user
   has scrolled all the way down; at the initial scroll position it can still hide content
   that hasn't been scrolled past yet. In-flow avoids that entirely and needs no padding
   reserve to compensate. */
#home-tools-dialog .account-dialog-actions,
#home-quick-links-dialog .account-dialog-actions {
  justify-content: flex-end;
  position: static;
  margin: 0;
  padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(42, 34, 28, 0.08);
  background: inherit;
}

#home-tools-dialog .account-dialog-body,
#home-quick-links-dialog .account-dialog-body {
  padding-bottom: 1rem;
}

@media (max-width: 640px) {
  #account-dialog .account-dialog-actions-fixed,
  #account-edit-dialog .account-dialog-actions-fixed {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
  }
}

#logout-confirm-dialog .account-dialog-header {
  padding: 1rem 1rem 0;
}

#logout-confirm-dialog .account-dialog-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  flex: 1;
}

#logout-confirm-dialog .account-dialog-body {
  padding: 1rem;
}

/* Actions sit in normal flow right after the body/form instead of overlaying it as an
   absolutely-positioned bar — an overlay only avoids covering real content once the user
   has scrolled all the way down; at the initial scroll position it can still hide content
   that hasn't been scrolled past yet. In-flow avoids that entirely and needs no padding
   reserve to compensate. */
#logout-confirm-dialog .account-dialog-actions {
  position: static;
}

#logout-confirm-dialog p {
  margin: 0;
  color: var(--ink);
}

/* account-delete-dialog / profile-disconnect-dialog: .account-dialog-actions is nested
   inside .account-form; keep it in normal flow (not absolute) for the same reason. */
#account-delete-dialog .account-form,
#profile-disconnect-dialog .account-form {
  padding: 1rem;
}

#account-delete-dialog .account-dialog-actions,
#profile-disconnect-dialog .account-dialog-actions {
  position: static;
  margin: 0 -1rem -1rem;
}

#profile-edit-dialog.is-password #profile-edit-current-row,
#profile-edit-dialog.is-password #profile-edit-new-row {
  display: none;
}

#profile-edit-dialog.is-password .account-form {
  gap: 1rem;
}

#profile-edit-password-fields {
  gap: 1rem;
}

#profile-edit-password-fields:not([hidden]) {
  display: grid;
}

.account-dialog-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.profile-static {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.profile-value {
  font-size: 0.95rem;
  color: var(--ink);
}

.profile-lock {
  font-size: 0.8rem;
  color: var(--muted);
}

.profile-edit {
  padding: 0.2rem 0.4rem;
  min-width: auto;
  border: none;
  background: transparent;
}

.profile-edit .icon-edit {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-field {
  position: relative;
  width: 100%;
}

.password-field input {
  height: 40px;
  padding-right: 44px;
  width: 100%;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--muted);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.password-toggle .icon-eye-off {
  display: none;
}

.password-toggle.is-visible .icon-eye {
  display: none;
}

.password-toggle.is-visible .icon-eye-off {
  display: block;
}

.custom-date-picker-backdrop {
  position: fixed;
  inset: 0;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  z-index: 2398;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.custom-date-picker {
  position: fixed;
  top: 0;
  left: 0;
  width: min(320px, calc(100vw - 24px));
  border: 1px solid var(--stroke);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 0.9rem;
  z-index: 2399;
  opacity: 1;
}

.custom-date-picker.is-modal {
  width: min(360px, calc(100vw - 24px));
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%);
  opacity: 0;
}

.custom-date-picker-backdrop.is-modal {
  background: rgba(42, 34, 28, 0.32);
  display: block;
}

.custom-date-picker.is-modal.is-open {
  animation: dialog-pop 0.22s ease;
  opacity: 1;
}

.custom-date-picker.is-modal.is-closing {
  animation: dialog-pop-out 0.18s ease forwards;
}

.custom-date-picker-backdrop.is-modal.is-open {
  opacity: 1;
}

.custom-date-picker-backdrop.is-modal.is-closing {
  opacity: 0;
}

.custom-date-picker-header,
.custom-date-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.custom-date-picker-header {
  margin-bottom: 0.75rem;
}

.custom-date-picker-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.custom-date-picker-nav,
.custom-date-picker-action {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  min-height: 36px;
  padding: 0 0.75rem;
  cursor: pointer;
  font: inherit;
}

.custom-date-picker-nav {
  width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.custom-date-picker-weekdays,
.custom-date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.custom-date-picker-weekdays {
  margin-bottom: 0.4rem;
}

.custom-date-picker-weekdays span {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.custom-date-picker-weekdays span:first-child,
.custom-date-picker-weekdays span:last-child {
  color: #c83b3b;
}

.custom-date-picker-day {
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  min-height: 38px;
  cursor: pointer;
  font: inherit;
}

.custom-date-picker-day.is-outside {
  color: rgba(42, 34, 28, 0.38);
}

.custom-date-picker-day.is-today {
  border-color: rgba(192, 116, 42, 0.35);
}

.custom-date-picker-day.is-selected {
  background: #c0742a;
  color: #fff;
}

.custom-date-picker-day:hover,
.custom-date-picker-nav:hover,
.custom-date-picker-action:hover {
  background: rgba(42, 34, 28, 0.06);
}

.custom-date-picker-day.is-selected:hover {
  background: #c0742a;
}

.custom-date-picker-footer {
  margin-top: 0.75rem;
}

.custom-date-picker-footer .custom-date-picker-action {
  flex: 1 1 0;
}


.menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(42, 34, 28, 0.25);
  border: none;
  z-index: 20;
}

.hero {
  background: var(--card);
  border-radius: 28px;
  border: 1px solid var(--stroke);
  padding: 26px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
}

.hero.hero-assistant {
  grid-template-columns: 1fr;
  text-align: center;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 6.5rem 0;
  display: flex;
  flex-direction: column;
}

@media (max-width: 1280px) {
  .hero.hero-assistant {
    padding: 3.5rem 0;
  }
}

@media (max-width: 640px) {
  .hero.hero-assistant {
    padding: 3rem 0;
  }
}

.assistant-mode .hero {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.hero-assistant-inner {
  width: 100%;
  max-width: 720px;
  display: grid;
  gap: 1rem;
  justify-items: center;
  margin-left: auto;
  margin-right: auto;
}

.typing-text {
  font-weight: 500;
}

.assistant-orb {
  width: 64px;
  height: 64px;
  position: relative;
  border-radius: 999px;
  overflow: visible;
  opacity: 0;
  animation: assistant-firefly-float 3.4s ease-in-out infinite, assistant-orb-fade-in 0.5s ease forwards;
  isolation: isolate;
}

.assistant-firefly-core {
  position: absolute;
  inset: 0;
  display: none;
}

.assistant-firefly-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  margin-top: -3px;
  border-radius: 999px;
  background: radial-gradient(circle, #fff7c2 0%, #f0d68a 45%, rgba(240, 214, 138, 0) 70%);
  box-shadow: 0 0 12px rgba(237, 188, 96, 0.7);
  opacity: 0.95;
  --count: 100;
  --angle: calc(var(--i, 0) * (360deg / var(--count)));
  --start-r: 56px;
  --start-y: 0px;
  animation: assistant-firefly-dot 1s cubic-bezier(0.2, 0.9, 0.25, 1) 1 forwards;
}

.assistant-firefly-dot:nth-child(6n + 1) { --start-r: 96px; --start-y: -22px; }
.assistant-firefly-dot:nth-child(6n + 2) { --start-r: 86px; --start-y: 18px; }
.assistant-firefly-dot:nth-child(6n + 3) { --start-r: 92px; --start-y: -26px; }
.assistant-firefly-dot:nth-child(6n + 4) { --start-r: 80px; --start-y: 22px; }
.assistant-firefly-dot:nth-child(6n + 5) { --start-r: 94px; --start-y: 14px; }
.assistant-firefly-dot:nth-child(6n) { --start-r: 84px; --start-y: -18px; }

@keyframes assistant-orb-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes assistant-firefly-float {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-1.5px) rotate(90deg);
  }
  50% {
    transform: translateY(-3px) rotate(180deg);
  }
  75% {
    transform: translateY(-1.5px) rotate(270deg);
  }
  100% {
    transform: translateY(0) rotate(360deg);
  }
}

@keyframes assistant-firefly-dot {
  0% {
    opacity: 0;
    transform: rotate(var(--angle)) translateX(var(--start-r)) translateY(var(--start-y));
  }
  25% {
    opacity: 0.95;
  }
  100% {
    opacity: 1;
    transform: rotate(calc(var(--angle) + 72deg)) translateX(28px) translateY(0);
  }
}


.assistant-chat {
  width: 100%;
  max-width: 720px;
  display: grid;
  gap: 0.75rem;
  flex: 0 0 auto;
  height: auto;
  align-self: start;
}

.assistant-chat::before,
.assistant-chat::after {
  content: "";
  position: fixed;
  left: var(--assistant-chat-left, 50%);
  width: var(--assistant-chat-width, 720px);
  pointer-events: none;
  z-index: 2;
  opacity: 0;
}

.assistant-chat::before {
  top: var(--header-height, 68px);
  height: 2.5rem;
  background: #fff;
  left: 0;
  width: 100vw;
}

.assistant-chat::after {
  bottom: 0;
  height: 84px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 70%);
  left: 0;
  width: 100vw;
}

body.assistant-mode .assistant-chat::before,
body.assistant-mode .assistant-chat::after {
  opacity: 1;
}

.assistant-messages {
  display: none;
  gap: 0.75rem;
  height: auto;
  padding-bottom: 200px;
}

.assistant-mode .assistant-messages {
  display: grid;
}

.assistant-message {
  display: inline-flex;
  padding: 0.7rem 0.9rem;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 100%;
  text-align: left;
  word-break: break-word;
  height: auto;
  align-self: start;
}

.assistant-message.user {
  justify-self: end;
  background: #4b6f4b;
  color: #fff;
  border-top-right-radius: 6px;
}

.assistant-message.bot {
  justify-self: start;
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--ink);
  border-top-left-radius: 6px;
  padding: 0;
  text-align: left;
}

.assistant-input-wrap {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  margin-left: auto;
  margin-right: auto;
  border-radius: 20px;
  border: 1px solid var(--stroke);
  background: #fff;
  overflow: hidden;
}

.assistant-textarea-section {
  display: flex;
  flex-direction: column;
}

.assistant-input {
  width: 100%;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100px;
  padding: 1rem;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--stroke);
  background: transparent;
  resize: none;
}

.assistant-input::placeholder {
  color: #aaa39b;
}

.assistant-toolbar {
  position: relative;
  padding: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  border-top: 1px solid var(--stroke);
  background: var(--field-bg);
}

.assistant-attach {
  position: static;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.assistant-attach svg {
  width: 20px;
  height: 20px;
}

.assistant-toolbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex: 0 0 auto;
}

.assistant-enter-toggle {
  position: static;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  height: auto;
  z-index: 1;
}

.toggle-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.assistant-enter-toggle input {
  display: none;
}

.toggle-switch {
  width: 36px;
  height: 20px;
  background: #ddd;
  border-radius: 10px;
  position: relative;
  transition: background 200ms ease;
  display: block;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: left 200ms ease;
}

.assistant-enter-toggle input:checked + .toggle-switch {
  background: #4CAF50;
}

.assistant-enter-toggle input:checked + .toggle-switch::after {
  left: 18px;
}

html[data-theme="dark"] .toggle-switch {
  background: #444;
}

html[data-theme="dark"] .assistant-enter-toggle input:checked + .toggle-switch {
  background: #4CAF50;
}

html[data-theme="dark"] .toggle-label {
  color: #b8c0cb;
}

html[data-theme="dark"] .assistant-input-wrap {
  background: #2a2a2a;
  border-color: #404040;
}

html[data-theme="dark"] .assistant-textarea-section {
  background: #2a2a2a;
}

html[data-theme="dark"] .assistant-input-wrap .assistant-input {
  background: var(--field-bg);
  border-color: var(--field-border);
  color: var(--text-primary);
}

html[data-theme="dark"] .assistant-input-wrap .assistant-input::placeholder {
  color: var(--text-secondary);
}

html[data-theme="dark"] .assistant-toolbar {
  background: var(--field-bg);
  border-top-color: var(--stroke);
}

html[data-theme="dark"] .assistant-attach {
  background: #333;
  border-color: #404040;
  color: #e0e0e0;
}

html[data-theme="dark"] .assistant-attach:hover {
  background: #404040;
}

html[data-theme="dark"] .assistant-send {
  background: #404040;
  color: #999;
}

html[data-theme="dark"] .assistant-send.is-ready,
html[data-theme="dark"] .assistant-send.is-sending {
  background: #4b6f4b;
  color: #fff;
}


.assistant-send {
  position: static;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #e6e6e6;
  color: #9b9b9b;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: none;
}

.assistant-send.is-ready,
.assistant-send.is-sending {
  background: #4b6f4b;
  color: #fff;
}

.assistant-send svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
}

.assistant-send .icon-stop {
  display: none;
}

.assistant-send.is-sending {
  box-shadow: 0 10px 24px rgba(75, 111, 75, 0.25);
}

.assistant-send.is-sending .icon-send {
  display: none;
}

.assistant-send.is-sending .icon-stop {
  display: block;
}

.assistant-file-list {
  width: 100%;
  max-width: 720px;
  margin: 0.5rem auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.assistant-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid #d9d4ca;
  border-radius: 999px;
  background: #fff;
  font-size: 0.8rem;
  color: #3d3d3d;
}

.assistant-file-chip button {
  border: none;
  background: transparent;
  color: #8e8881;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
}

.assistant-message.bot.is-loading {
  padding: 0.25rem 0;
}

.assistant-message.bot.is-loading .assistant-skeleton {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(
    100deg,
    rgba(166, 166, 166, 0.8) 20%,
    rgba(210, 210, 210, 1) 45%,
    rgba(166, 166, 166, 0.8) 70%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

html[data-theme="dark"] .assistant-message.bot.is-loading .assistant-skeleton {
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0.14) 20%,
    rgba(255, 255, 255, 0.5) 45%,
    rgba(255, 255, 255, 0.14) 70%
  ) !important;
  background-size: 200% 100% !important;
  animation: skeleton-shimmer 1.2s ease-in-out infinite !important;
}

.assistant-message.bot.is-loading .assistant-skeleton + .assistant-skeleton {
  margin-top: 0.5rem;
}

html[data-theme="dark"] .assistant-message.user,
html[data-theme="dark"] body.assistant-mode .assistant-message.user {
  background: var(--accent-2) !important;
  color: #f3fbf5 !important;
  border-color: var(--accent-2) !important;
  -webkit-text-fill-color: currentColor !important;
}

.assistant-end {
  align-self: flex-start;
  justify-self: start;
  display: none;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: none;
  color: var(--accent);
  -webkit-text-fill-color: currentColor;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  position: fixed;
  top: calc(var(--header-height, 68px) + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 2rem));
  justify-content: flex-start;
  z-index: 6;
}

.assistant-end svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
}

.assistant-mode .assistant-end {
  display: inline-flex;
}

.assistant-mode .typing-text,
.assistant-mode .timeline,
.assistant-mode .assistant-orb {
  display: none;
}

.assistant-mode .hero-assistant-inner {
  gap: 1.25rem;
  min-height: 100%;
}

.assistant-mode .assistant-input-wrap {
  position: fixed;
  bottom: 1rem;
  left: 0;
  right: 0;
  padding: 0;
  z-index: 20;
  width: 100%;
  max-width: 736px;
  margin: 0 auto;
}

.assistant-mode .assistant-chat {
  margin-bottom: 0;
  margin-top: 0;
  padding-bottom: 0;
  flex: 1 1 auto;
  min-height: 0;
}

@media (min-width: 1281px) {
  .assistant-mode .assistant-chat {
    padding-bottom: 220px;
  }
}

body.assistant-mode .dashboard-home {
  min-height: calc(100dvh - var(--header-height, 120px) - 12px);
  padding-top: 0;
  padding-bottom: 0;
  justify-content: flex-start;
}

body.assistant-mode .home-quick-links {
  display: none !important;
}

body.assistant-mode .home-tools {
  display: none;
}

.assistant-copy {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0;
  padding: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  width: auto;
}

.assistant-copy-row {
  display: block;
  margin-top: 1rem;
}

.assistant-image-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.85rem;
}

.assistant-generated-image {
  margin-top: 0.85rem;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  background: #fff;
  padding: 0.75rem;
  display: grid;
  gap: 0.65rem;
}

.assistant-generated-image-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: #f5f2eb;
  border: 1px solid var(--stroke);
}

.assistant-generated-image-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.assistant-generated-image-meta {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
  word-break: break-word;
}

.assistant-generated-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.assistant-generated-image-action {
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
}

.assistant-generated-image-thumbs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.assistant-generated-image-thumb {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--stroke);
  background: #fff;
}

.assistant-generated-image-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 1 / 1;
}

.assistant-source-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.assistant-source-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: #fff;
  padding: 0.15rem 0.6rem;
  line-height: 1;
  font-size: 0.8rem;
  vertical-align: top;
}

.assistant-source-pill p {
  margin: 0;
  display: block;
  font-size: inherit;
  line-height: 1;
  color: var(--ink);
}

.assistant-table-wrap {
  margin-top: 0.75rem;
}

.assistant-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

.assistant-table th,
.assistant-table td {
  padding: 0.7rem 0.9rem;
  text-align: left;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--stroke);
}

.assistant-table tbody tr:last-child td {
  border-bottom: none;
}

.assistant-image-thumb {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--stroke);
  background: #fff;
}

.assistant-image-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 1 / 1;
}

.history-thumb.is-skeleton {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: linear-gradient(
    100deg,
    rgba(230, 226, 219, 0.7) 20%,
    rgba(255, 255, 255, 0.9) 45%,
    rgba(230, 226, 219, 0.7) 70%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 8px);
  background: rgba(33, 33, 33, 0.92);
  color: #fff;
  padding: 0.6rem 0.85rem;
  border-radius: 12px;
  font-size: 0.85rem;
  letter-spacing: 0.2px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  z-index: 2147483647;
  opacity: 0;
  width: auto;
  max-width: 90vw;
  text-align: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.assistant-copy:hover {
  text-decoration: underline;
}

.assistant-copy svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  display: block;
}


.hero.hero-plain {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
  gap: 0;
  grid-template-columns: 1fr;
}

.hero.hero-plain {
  padding-bottom: 16px;
}

.hero.hero-plain h1,
.hero.hero-plain h3 {
  margin-bottom: 0;
}

.hero h1,
.hero h3 {
  margin: 0 0 12px;
}

.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(63, 107, 86, 0.12);
  color: var(--accent-2);
  font-size: 12px;
}

.hero-visual {
  border-radius: 22px;
  background: linear-gradient(120deg, rgba(192, 122, 42, 0.25), rgba(63, 107, 86, 0.2));
  position: relative;
  overflow: hidden;
}

.hero-visual::before,
.hero-visual::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  opacity: 0.6;
  filter: blur(4px);
}

.hero-visual::before {
  width: 180px;
  height: 180px;
  background: #f5c27d;
  top: -40px;
  left: -30px;
}

.hero-visual::after {
  width: 220px;
  height: 220px;
  background: #4f7a61;
  bottom: -60px;
  right: -40px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}


.section-grid {
  display: block;
}

.section-grid > * {
  margin-bottom: 1rem;
}

.section-grid > *:last-child {
  margin-bottom: 0;
}

.section-card {
  background: rgba(255, 255, 255, 0.82);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid var(--stroke);
  display: grid;
  gap: 24px;
  min-height: 120px;
}

.section-title {
  display: grid;
  gap: 1rem;
}

.section-card h3 {
}

.section-card p {
  color: var(--muted);
  line-height: 1.5;
}

.mascot-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  align-items: start;
}

.mascot-gallery img {
  width: 100%;
  height: auto;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
  background: rgba(255, 255, 255, 0.6);
}

#section-character-spec {
  margin-top: 2rem;
  clear: both;
}

.brand-name {
  display: grid;
  gap: 1rem;
}

.mascot-spec {
  display: grid;
  gap: 12px;
  line-height: 1.6;
  background: #ffffff;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  padding: 16px;
}

.mascot-summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-direction: column;
}

.mascot-summary::-webkit-details-marker {
  display: none;
}

.mascot-summary::after {
  content: "▸";
  font-size: 0.9em;
  transition: transform 0.2s ease;
  position: absolute;
  right: 16px;
  top: 16px;
}

.mascot-spec[open] .mascot-summary::after {
  transform: rotate(90deg);
}

.mascot-summary h3 {
  margin: 0;
}

.mascot-summary p {
  margin: 0;
  color: var(--muted);
}

.mascot-spec {
  position: relative;
}

.mascot-body {
  display: grid;
  gap: 12px;
}

.mascot-spec hr {
  border: 0;
  border-top: 1px solid rgba(42, 34, 28, 0.15);
  margin: 4px 0;
}

.mascot-spec blockquote {
  margin: 0;
  padding: 8px 12px;
  border-left: 3px solid rgba(42, 34, 28, 0.25);
  background: rgba(255, 255, 255, 0.6);
}

.mascot-spec ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.mascot-spec p {
  color: var(--muted);
}

.brand-name-row {
  display: grid;
  gap: 16px;
}

.font-links {
  display: grid;
  gap: 8px;
}

.font-links > div {
  display: grid;
  gap: 8px;
}

.font-links .latin-sample {
  font-family: "Metropolis", sans-serif;
}

@media (min-width: 1281px) {
  .brand-name-row {
    grid-template-columns: 1fr 1fr;
  }

  .brand-name-row .brand-name + .brand-name {
    padding-left: 16px;
    border-left: 1px solid rgba(42, 34, 28, 0.2);
  }
}

.logo-gallery {
  display: grid;
  gap: 0.75rem;
}

.logo-row {
  display: grid;
  gap: 0.75rem;
}

.logo-mark {
  max-height: 100px;
  width: auto;
  height: 100px;
  display: block;
}

.logo-text {
  max-height: 80px;
  width: auto;
  height: 80px;
  display: block;
}

.color-block {
  display: grid;
  gap: 8px;
}

.color-bar {
  display: flex;
  width: 100%;
  height: 100px;
}

.color-bar .swatch {
  flex: 3;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 0.75rem;
  color: #fff;
}

.color-bar .swatch:nth-child(1) {
  background: #496F4B;
}

.color-bar .swatch:nth-child(2) {
  flex: 1;
  background: #994F3C;
}

.color-bar .swatch:nth-child(3) {
  flex: 1;
  background: #EFC484;
  color: #3D3D3D;
}

.color-bar .swatch:nth-child(3) p {
  color: #3D3D3D;
}

.color-bar .swatch.light {
  color: #fff;
}

.color-bar.foundation .swatch:nth-child(1) {
  background: #3D3D3D;
}

.color-bar.foundation .swatch:nth-child(2) {
  background: #DED8C9;
  color: #3D3D3D;
}

.color-bar.foundation .swatch:nth-child(2) p {
  color: #3D3D3D;
}

.color-bar.foundation .swatch:nth-child(3) {
  background: #87644E;
}

.color-bar.foundation .swatch:nth-child(3),
.color-bar.foundation .swatch:nth-child(3) p {
  color: #fff;
}

.color-bar.foundation .swatch {
  color: #fff;
}

.color-bar .swatch p {
  margin: 0;
  font-size: 1rem;
  color: #fff;
}

.color-bar .swatch.dark {
  color: #fff;
}

.usage-guidance {
  display: grid;
  gap: 8px;
}

@media (min-width: 1281px) {
  body.pos-page .layout {
    padding-top: 0;
  }

  .side-menu {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    height: 100dvh;
  }

  .dashboard {
    position: fixed;
    left: 260px;
    top: 0;
    bottom: 0;
    width: calc(100dvw - 260px);
    height: auto;
    overflow-y: auto;
  }

  body.pos-page .dashboard {
    top: 0;
    padding-top: var(--header-height, 68px);
    padding-bottom: calc(7rem + env(safe-area-inset-bottom, 0px));
    z-index: 29;
  }

  .assistant-mode .assistant-input-wrap {
    left: 260px;
    right: 0;
  }

  .logo-row {
    display: flex;
    gap: 16px;
    flex-wrap: nowrap;
    align-items: center;
  }

  .logo-row img + img {
    padding-left: 16px;
    border-left: 1px solid rgba(42, 34, 28, 0.2);
  }

  .brand-name-row {
    grid-template-columns: 1fr 1fr;
  }
}

.anchor-nav {
  position: fixed;
  top: 120px;
  right: 16px;
  width: 120px;
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid rgba(42, 34, 28, 0.15);
  border-radius: 12px;
  font-size: 0.75rem;
  line-height: 1.4;
}

.anchor-nav a {
  color: var(--muted);
  text-decoration: none;
}

.anchor-nav a:hover {
  color: var(--ink);
}

.empty-panel {
  border: 1px dashed rgba(42, 34, 28, 0.2);
  padding: 18px;
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.5);
}

.card {
  background: rgba(255, 255, 255, 0.82);
  border-radius: 20px;
  padding: 18px;
  border: 1px solid var(--stroke);
  display: grid;
  gap: 8px;
  min-height: 120px;
}

.card h3 {
  margin: 0;
}

.card p {
  margin: 0;
  color: var(--muted);
}

.canvas-panel {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  align-items: start;
}

.ai-tabs {
  display: none;
  gap: 0.5rem;
}

.ai-tab {
  border: none;
  background: transparent;
  color: var(--ink);
  border-radius: 0;
  padding: 1rem 0;
  font-size: 0.9rem;
  cursor: pointer;
  flex: 1;
  text-align: center;
  position: relative;
}

.ai-tab.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ai-tab.is-active {
  color: #7a4a1e;
  font-weight: 600;
}

.ai-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: #7a4a1e;
  border-radius: 2px;
}

.canvas-output {
  border: 1px solid var(--stroke);
  background: var(--panel-bg);
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
}



#canvas-output-slot {
  display: flex;
  min-height: 0;
}

#canvas-output-slot .canvas-output {
  width: 100%;
}

#canvas-host {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

#canvas-host.is-loading {
  min-height: 320px;
  background: linear-gradient(
    100deg,
    #e6e2db 20%,
    #ffffff 45%,
    #e6e2db 70%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

#canvas-host.is-loading canvas {
  opacity: 0;
}

.canvas-empty {
  position: absolute;
  inset: 0;
  display: block;
  text-align: center;
  padding: 2.5rem 2rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.92);
  transition: opacity 0.2s ease;
}

.canvas-empty-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(480px, 100%);
  transform: translate(-50%, -50%);
}

.canvas-empty h1 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  color: var(--ink);
  height: auto;
}

.canvas-empty p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  height: auto;
}

body.has-output .canvas-empty,
#canvas-host.is-loading .canvas-empty {
  opacity: 0;
  pointer-events: none;
}

.canvas-status {
  position: absolute;
  inset: auto 16px 16px 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.canvas-output canvas {
  width: auto;
  height: 100%;
  max-width: 100%;
  display: block;
  background: transparent;
}

#canvas-host canvas,
#dialog-canvas-host canvas {
  opacity: 0;
}

body.has-output #canvas-host canvas,
body.has-output #dialog-canvas-host canvas {
  opacity: 1;
}


.canvas-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.75);
  border-radius: 12px;
  backdrop-filter: blur(2px);
}

.output-settings {
  margin-top: 1rem;
  display: grid;
  gap: 0.5rem;
}

.output-options {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.output-option {
  border: 1px solid var(--stroke);
  background: transparent;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  font-size: 0.75rem;
  height: 48px;
}

.output-option.active {
  border-color: rgba(192, 122, 42, 0.4);
  color: var(--accent);
}

.canvas-dialog {
  border: none;
  padding: 0;
  background: transparent;
  width: min(92vw, 740px);
  z-index: 2000;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}

.canvas-dialog::backdrop {
  background: rgba(20, 16, 12, 0.5);
}

.canvas-dialog-inner {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
  max-height: 90vh;
  overflow: auto;
  margin-top: auto;
  width: 100%;
  position: relative;
}

.canvas-dialog[open] {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: transparent;
  border-radius: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  color: rgba(42, 34, 28, 0.7);
}

.output-actions {
  display: flex;
  justify-content: stretch;
}

.output-actions .btn {
  width: 100%;
  justify-content: center;
  height: 48px;
  font-size: 1rem;
  font-weight: 400;
}

.canvas-output-dialog .output-actions {
  justify-content: flex-end;
}

.canvas-output-dialog .output-actions .btn {
  width: auto;
  min-width: 120px;
}

.stop-button {
  display: none;
  background: #7a5c49;
}

.generate-actions {
  display: grid;
  gap: 0.75rem;
}

.view-output {
  display: none;
}

.output-actions .btn:disabled {
  cursor: not-allowed;
}

.canvas-input {
  display: grid;
  gap: 0.75rem;
}

.prompt-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  background: var(--panel-bg);
}

.ai-dashboard {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.5rem;
  padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
}

.ai-dashboard .canvas-panel {
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.ai-dashboard .canvas-output,
.ai-dashboard .canvas-input {
  height: 100%;
}

.output-top {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  position: relative;
  gap: 0.75rem;
}

.output-tags {
  position: static !important;
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.output-top.has-tags #canvas-host {
  margin-top: 0;
}

.output-tag {
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: rgba(205, 182, 149, 0.25);
  border: 1px solid rgba(205, 182, 149, 0.65);
  font-size: 0.75rem;
  color: var(--ink);
  letter-spacing: 0.3px;
}

.output-bottom {
  display: grid;
  gap: 0.75rem;
}

.audit-panel {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  background: rgba(255, 255, 255, 0.85);
  display: grid;
  gap: 0.5rem;
}

.audit-panel[hidden] {
  display: none !important;
}

.audit-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
}

.audit-header h4 {
  margin: 0;
}

.audit-status {
  font-size: 0.75rem;
  color: var(--muted);
}

.audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink);
  max-height: calc(1.5em * 4 + 0.4rem * 3);
  overflow-y: auto;
}

.audit-progress {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
  white-space: pre-line;
  position: relative;
  padding-right: 1.2rem;
}

.audit-panel img {
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.audit-progress::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  border: 2px solid rgba(42, 34, 28, 0.35);
  border-top-color: rgba(42, 34, 28, 0.7);
  animation: audit-spin 1s linear infinite;
}

@keyframes audit-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.audit-item.pass {
  color: #2f5f33;
}

.audit-item.fail {
  color: #9b2c2c;
}

.audit-item.warn {
  color: #8a6d1d;
}

/* 審核流程圖 */
.audit-flowchart {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem;
  border-radius: 0.5rem;
  background: var(--bg-secondary);
  margin-bottom: 1rem;
}

.audit-step {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: all 0.3s ease;
}

.audit-step.active {
  background: var(--brand-light);
  border-color: var(--brand);
}

.audit-step.completed {
  background: var(--success-light);
  border-color: var(--success);
}

.audit-step-icon {
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.audit-step.active .audit-step-icon {
  background: var(--brand);
  color: white;
}

.audit-step.completed .audit-step-icon {
  background: var(--success);
  color: white;
}

.audit-step-icon svg {
  width: 1.3rem;
  height: 1.3rem;
}

.audit-step-label {
  flex: 1;
}

.audit-step-label h5 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.audit-step-status {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.audit-step.active .audit-step-status {
  color: var(--brand);
  font-weight: 500;
}

.audit-step.completed .audit-step-status {
  color: var(--success);
  font-weight: 500;
}

.audit-connector {
  height: 1.5rem;
  padding: 0 2rem;
  display: flex;
  justify-content: center;
  color: var(--border);
}

.audit-connector svg {
  width: 0.15rem;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--cta-border-color);
  width: auto;
  white-space: nowrap;
}

.btn.ghost.profile-edit,
.btn.ghost.history-toggle {
  border: none;
}

.btn.ghost:hover:not(:disabled) {
  background: var(--hover-bg);
}

.btn.ghost.history-toggle {
  background: #DED8C9;
}

input:hover:not(:disabled):not([readonly]),
select:hover:not(:disabled),
textarea:hover:not(:disabled):not([readonly]),
.dropdown-trigger:hover:not(:disabled),
.account-search:hover,
.account-sort:hover,
.assistant-input:hover,
.inventory-input-row input:hover,
.dropdown-search:hover {
  border-color: rgba(42, 34, 28, 0.32);
  background: rgba(255, 255, 255, 0.92);
}

.text-btn {
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 0.95rem;
  font-family: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  width: auto;
  white-space: nowrap;
}

.text-btn:hover {
  color: var(--ink);
  text-decoration: underline;
}

.history-toggle {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 2px;
  border-radius: 12px 0 0 12px;
  padding: 12px 10px;
  z-index: 4;
  background: #DED8C9;
  transition: transform 0.25s ease;
}

.history-toggle:not(.assistant-history-toggle):not(.rag-qa-toggle) {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  padding: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

@media (min-width: 768px) {
  .history-toggle:not(.assistant-history-toggle):not(.rag-qa-toggle),
  .assistant-history-toggle {
    width: 42px;
    min-width: 42px;
    max-width: 42px;
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    padding: 10px;
  }
}

.history-toggle.is-open:not(.assistant-history-toggle):not(.rag-qa-toggle) {
  transform: translateX(calc(-1 * min(320px, 92vw))) translateY(-50%);
}

.assistant-history-toggle {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  letter-spacing: normal;
  border-radius: 12px 0 0 12px;
  padding: 7px;
  width: auto;
  min-width: 36px;
  max-width: 36px;
  height: auto;
  min-height: 36px;
  max-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  background: #3D3D3D;
  border-color: #3D3D3D;
  color: #fff;
  z-index: 22;
  transition: transform 0.25s ease;
}

.assistant-history-toggle svg {
  display: block;
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-toggle-icon {
  display: block;
  width: 22px;
  height: 22px;
  stroke: currentColor;
}

.history-toggle .history-toggle-icon-close {
  display: none;
}

.history-toggle.is-open .history-toggle-icon-open {
  display: none;
}

.history-toggle.is-open .history-toggle-icon-close {
  display: block;
}

.assistant-history-toggle .assistant-history-icon-close {
  display: none;
}

.assistant-history-toggle.is-open .assistant-history-icon-open {
  display: none;
}

.assistant-history-toggle.is-open .assistant-history-icon-close {
  display: block;
}

.assistant-history-toggle.is-open {
  transform: translateX(calc(-1 * min(320px, 92vw))) translateY(-50%);
}

@media (min-width: 1921px) {
  .assistant-history-toggle.is-open {
    transform: translateX(-420px) translateY(-50%);
  }
}

.output-history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row;
  gap: 0.5rem;
  height: 100%;
  justify-items: stretch;
  justify-content: start;
  align-content: start;
  grid-auto-rows: min-content;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.output-history-grid.is-empty {
  min-height: 100%;
  align-content: stretch;
}

.history-thumb {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 0;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  position: relative;
  width: 100%;
}

.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.assistant-history-grid {
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.assistant-history-item {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  background: #fff;
  display: grid;
  gap: 0.45rem;
  position: relative;
}

.assistant-history-question {
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}

.assistant-history-answer {
  color: rgba(42, 34, 28, 0.75);
  font-size: 0.9rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.assistant-history-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: #4b5563;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.assistant-history-item:hover .assistant-history-remove,
.assistant-history-item:focus-within .assistant-history-remove {
  opacity: 1;
  pointer-events: auto;
}

.assistant-history-remove:hover {
  background: #dc2626;
  color: #fff;
}

.assistant-history-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 1.5rem 0;
  text-align: center;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(42, 34, 28, 0.6);
  font-size: 0.9rem;
}

.pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 280px));
  justify-content: start;
  align-content: flex-start;
  gap: 1rem;
}

@media (min-width: 768px) and (max-width: 1280px) {
  .pos-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 280px));
  }
}

@media (min-width: 1281px) {
  .pos-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 280px));
  }
}

@media (min-width: 641px) and (max-width: 767px) {
  .pos-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 280px));
  }
}

.pos-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 640px) {
  .pos-toolbar {
    display: block;
  }

  .pos-toolbar > * + * {
    margin-top: 1rem;
  }

  .pos-page .pos-toolbar .account-search-wrap {
    display: flex;
    width: 100%;
    min-width: 0;
  }

  .pos-toolbar-actions {
    width: 100%;
  }

  .pos-toolbar-actions .btn {
    flex: 1;
    width: 100%;
  }
}

.pos-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: 420px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 0.55rem 0.8rem;
  background: #fff;
}

.pos-search input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 0.95rem;
  background: transparent;
  font-family: inherit;
}

.pos-search-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  color: rgba(42, 34, 28, 0.6);
}

.pos-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.pos-toolbar-actions .btn {
  height: 40px;
  padding: 0 1.1rem;
}

.pos-toolbar-actions .btn:not(.cta) {
  background: #c0742a;
  border-color: #c0742a;
  color: #fff;
}

.pos-edit-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-right: 0.35rem;
}

.pos-edit-icon-check {
  display: none;
}

body.pos-editing .pos-edit-icon-pencil {
  display: none;
}

body.pos-editing .pos-edit-icon-check {
  display: block;
}

.pill-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.6rem;
  margin: 0 0 1.25rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
}

.pos-skeleton-pill {
  width: 92px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(
    100deg,
    rgba(166, 166, 166, 0.24) 20%,
    rgba(210, 210, 210, 0.4) 45%,
    rgba(166, 166, 166, 0.24) 70%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  flex: 0 0 auto;
}

.pill-tab-shell {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.pill-tab {
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  flex: 0 0 auto;
}

.pill-tab-shell.is-editable .pill-tab {
  padding-right: 2.2rem;
}

.pill-tab-edit {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border: 0;
  padding: 0;
  background: transparent;
  color: currentColor;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  cursor: pointer;
}

.pill-tab-shell.is-editable:hover .pill-tab-edit,
.pill-tab-shell.is-editable .pill-tab-edit,
.pill-tab-shell.is-editable:focus-within .pill-tab-edit {
  opacity: 0.8;
  pointer-events: auto;
}

.pill-tab-edit:hover {
  opacity: 1;
}

.pill-tab-edit svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pill-tab.pill-tab-add {
  border-style: dashed;
  border-color: rgba(42, 34, 28, 0.28);
  background: rgba(42, 34, 28, 0.02);
  color: rgba(42, 34, 28, 0.65);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  line-height: 1;
  min-height: 36px;
  box-sizing: border-box;
  vertical-align: middle;
  text-align: center;
}

.pill-tab.pill-tab-add:hover {
  border-color: rgba(192, 116, 42, 0.42);
  color: #c0742a;
}

.pill-tab.pill-tab-add span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.pill-tab-add-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

#pos-category-dialog .account-dialog-inner {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
}

#pos-category-dialog .account-dialog-actions {
  justify-content: flex-end;
  position: static;
  padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--stroke);
  background: #fff;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

#pos-category-dialog .account-dialog-actions .btn {
  min-height: 46px;
}

#pos-category-dialog .toast {
  grid-row: 4;
}

#pos-dialog .account-dialog-actions {
  justify-content: flex-end;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--stroke);
  flex-shrink: 0;
}

#pos-category-dialog #pos-category-delete {
  margin-right: auto;
  background: transparent !important;
  color: var(--danger-accent) !important;
  -webkit-text-fill-color: var(--danger-accent) !important;
  border: 0 !important;
  padding: 0 !important;
  gap: 0.35rem;
  box-shadow: none !important;
}

#pos-category-dialog #pos-category-delete:hover {
  background: transparent !important;
}

#pos-category-dialog #pos-category-delete svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#pos-category-delete-dialog .account-dialog-actions {
  justify-content: flex-end;
  position: static;
  padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
}

#pos-delete-dialog .account-dialog-actions {
  position: static;
  margin: 0 -1rem -1rem;
}

#pos-category-delete-dialog .account-form,
#pos-delete-dialog .account-form {
  padding-left: 1rem;
  padding-right: 1rem;
  padding-top: 1rem;
}

.pill-tab.is-active {
  border-color: #c0742a;
  color: #c0742a;
}

.pos-category-dropdown {
  width: 100%;
  display: flex;
}

.pos-category-dropdown .dropdown-trigger {
  width: 100%;
  min-height: 56px;
  height: 56px;
  padding: 0 1.1rem;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: #fff;
  justify-content: space-between;
}

.pos-category-dropdown .dropdown-label {
  color: var(--ink);
}

.pos-category-dropdown .dropdown-menu {
  left: 0;
  right: auto;
  width: 100%;
  min-width: 100%;
}

.pos-sales-channel-dropdown {
  width: 100%;
  display: flex;
}

.pos-sales-channel-dropdown .dropdown-trigger {
  width: 100%;
  min-height: 56px;
  height: 56px;
  padding: 0 1.1rem;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: #fff;
  justify-content: space-between;
}

.pos-sales-channel-dropdown .dropdown-label {
  color: var(--ink);
}

.pos-sales-channel-dropdown .dropdown-menu {
  left: 0;
  right: auto;
  width: 100%;
  min-width: 100%;
}

.pos-sales-channel-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.pos-sales-channel-check {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--field-border);
  border-radius: 4px;
  flex: none;
  background: transparent;
}

.pos-sales-channel-item.is-active .pos-sales-channel-check {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 2px #fff;
}

.pos-card {
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 1.1rem 1.2rem;
  min-height: 220px;
  width: 100%;
  display: grid;
  gap: 0.5rem;
  position: relative;
}

@media (min-width: 641px) {
  .pos-card {
    max-width: 280px;
    justify-self: start;
  }
}

.pos-card.pos-card-skeleton {
  pointer-events: none;
}

.pos-card-skeleton-line,
.pos-card-skeleton-image,
.pos-card-skeleton-chip,
.pos-card-skeleton-btn,
.pos-card-skeleton-qty {
  background: linear-gradient(
    100deg,
    rgba(166, 166, 166, 0.24) 20%,
    rgba(210, 210, 210, 0.4) 45%,
    rgba(166, 166, 166, 0.24) 70%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.pos-card-skeleton-image {
  height: 132px;
  border-radius: 20px;
}

.pos-card-skeleton-line {
  height: 18px;
  border-radius: 999px;
}

.pos-card-skeleton-line.title {
  width: 58%;
  height: 22px;
}

.pos-card-skeleton-line.price {
  width: 42%;
}

.pos-card-skeleton-chip {
  width: 88px;
  height: 28px;
  border-radius: 999px;
}

.pos-card-skeleton-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}

.pos-card-skeleton-qty {
  flex: 1;
  height: 52px;
  border-radius: 16px;
}

.pos-card-skeleton-btn {
  width: 100px;
  height: 52px;
  border-radius: 16px;
}

.pos-card.is-hidden {
  display: none;
}

.pos-editing .pos-card {
  cursor: grab;
}

.pos-card.is-dragging {
  opacity: 0.6;
  border-style: dashed;
}

.pos-card-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  border: 1px solid rgba(185, 28, 28, 0.4);
  background: #fff;
  color: #9b2c2c;
  border-radius: 999px;
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.pos-editing .pos-card-delete {
  opacity: 1;
  pointer-events: auto;
}

.pos-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.pos-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.pos-info-card {
  display: grid;
  gap: 0.6rem;
  padding: 0 1rem 0.5rem;
  min-height: 0;
  align-content: start;
}

.pos-info-form {
  display: none;
}

#pos-info-image {
  width: 100%;
  max-width: 720px;
  height: min(28vh, 240px);
  overflow: hidden;
  border-radius: 12px;
  background: #f3f1ea;
  border: 1px dashed rgba(42, 34, 28, 0.2);
  display: grid;
  place-items: center;
  position: relative;
  justify-self: center;
  flex-shrink: 0;
}

.pos-info-form textarea {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  background: #fff;
  font-family: inherit;
  resize: vertical;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pos-rich-editor-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
  box-sizing: border-box;
}

.pos-rich-editor-label {
  font-weight: 600;
  color: var(--ink);
}

.pos-rich-editor {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.pos-rich-editor:hover {
  border-color: rgba(42, 34, 28, 0.32);
}

.pos-rich-editor:focus-within {
  border-color: #a0a0a0;
  outline: 2px solid rgba(138, 164, 255, 0.35);
  outline-offset: 0;
}

.pos-rich-editor-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  background: #f9f9f9;
  border: none;
  padding: 0.25rem 0.35rem;
  position: relative;
  z-index: 1;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.08);
  /* Isolate toolbar to prevent affecting other elements */
  contain: layout style paint;
  flex-shrink: 1;
  flex-grow: 1;
}

.pos-rich-editor-toolbar::-webkit-scrollbar {
  height: 8px;
}

.pos-rich-editor-toolbar::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 4px;
}

.pos-rich-editor-toolbar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}

.pos-rich-editor-toolbar::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.4);
}

/* 让下拉菜单始终能在工具栏外显示，不再改变overflow */

.pos-rich-editor-block-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  z-index: 100;
}

.pos-rich-editor-block-trigger {
  min-width: 100px;
  height: 36px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  padding: 0 0.6rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.pos-rich-editor-block-trigger:hover {
  background: transparent;
}

/* 區塊選項icon */
.pos-rich-editor-block-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: currentColor;
}

.pos-rich-editor-block-trigger:focus {
  outline: 2px solid rgba(79, 125, 88, 0.35);
  outline-offset: -2px;
}

.pos-rich-editor-block-trigger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pos-rich-editor-block-label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.pos-rich-editor-block-menu {
  right: auto;
  left: 0;
  min-width: 160px;
  z-index: 10000 !important;
}

.pos-rich-editor-block-menu .dropdown-item {
  color: #3D3D3D;
}

.pos-rich-editor-block-menu .dropdown-item:hover {
  background: rgba(192, 116, 42, 0.1);
}

.pos-rich-editor-block-menu .dropdown-item.is-active {
  color: #c0742a;
}

html[data-theme="dark"] .pos-rich-editor-block-menu .dropdown-item {
  color: var(--ink);
}

html[data-theme="dark"] .pos-rich-editor-block-menu .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .pos-rich-editor-block-menu .dropdown-item.is-active {
  color: #c0742a;
}

.pos-rich-editor-icon-btn,
.pos-rich-editor-text-btn,
.pos-rich-editor-toggle-icon {
  width: 32px;
  height: 32px;
  min-height: 32px;
  min-width: 32px;
  flex-shrink: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  margin: 0.25rem;
  font: inherit;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.pos-rich-editor-toggle-icon {
  padding: 0;
}

.pos-rich-editor-icon-btn {
  padding: 0;
}

.pos-rich-editor-text-btn {
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.3px;
}

/* H2/H3 字號區別 */
[data-rich-editor-action="block-h2"] {
  font-size: 0.95rem;
  font-weight: 600;
}

[data-rich-editor-action="block-h3"] {
  font-size: 0.75rem;
  font-weight: 400;
}

.pos-rich-editor-icon-btn svg,
.pos-rich-editor-toggle-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pos-rich-editor-icon-btn:hover,
.pos-rich-editor-toggle-icon:hover,
.pos-rich-editor-text-btn:hover {
  background: rgba(61, 61, 61, 0.05);
  border-color: var(--ink);
}

.pos-rich-editor-icon-btn:focus,
.pos-rich-editor-toggle-icon:focus,
.pos-rich-editor-text-btn:focus {
  outline: 2px solid rgba(79, 125, 88, 0.35);
  outline-offset: 2px;
}

/* B、I、U按钮的特殊样式 */
[data-rich-editor-action="bold"] {
  font-family: Georgia, serif;
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
}

[data-rich-editor-action="italic"] {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 1rem;
}

[data-rich-editor-action="underline"] {
  font-family: Georgia, serif;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  font-size: 0.95rem;
}

/* 條列列表圖標 - 圓點填滿 */
[data-rich-editor-action="block-ul"] svg circle {
  fill: currentColor;
  stroke: none;
}

.pos-rich-editor-icon-btn.is-active,
.pos-rich-editor-toggle-icon.is-active {
  background: rgba(73, 111, 75, 0.12);
  color: #27472c;
}

.pos-rich-editor-toggle-icon:disabled,
.pos-rich-editor-icon-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pos-rich-editor-divider {
  width: 1px;
  height: 24px;
  background: var(--stroke);
  margin: 0 0.25rem;
  flex-shrink: 0;
}

html[data-theme="dark"] .pos-rich-editor-icon-btn:hover,
html[data-theme="dark"] .pos-rich-editor-toggle-icon:hover,
html[data-theme="dark"] .pos-rich-editor-text-btn:hover {
  background: rgba(230, 235, 242, 0.1);
}

html[data-theme="dark"] .pos-rich-editor-toolbar {
  background: #2a2a2a;
  border-color: #404040;
}

html[data-theme="dark"] .pos-rich-editor-divider {
  background: var(--border-subtle);
}

/* Alignment button styles */
.pos-rich-editor-align-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 3px;
  padding: 4px 6px !important;
}

/* 字色按鈕樣式 */
.pos-rich-editor-color-btn {
  width: 28px;
  height: 28px;
  min-height: 28px;
  border: 2px solid var(--text-color);
  border-radius: 3px;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  margin: 0.25rem;
  font: inherit;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  position: relative;
}

.pos-rich-editor-color-btn::before {
  content: '';
  width: 18px;
  height: 18px;
  background: var(--text-color);
  border-radius: 2px;
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.pos-rich-editor-color-btn:hover {
  background: var(--text-color);
  opacity: 0.1;
}

.pos-rich-editor-color-btn:focus {
  outline: 2px solid rgba(79, 125, 88, 0.35);
  outline-offset: 2px;
}

/* 深色模式下的字色按鈕 */
html[data-theme="dark"] .pos-rich-editor-color-btn:hover {
  background: rgba(230, 235, 242, 0.1);
}

/* 深色模式下黑/白色按鈕改為白色 */
html[data-theme="dark"] .pos-rich-editor-color-btn[data-rich-editor-action="color-black"] {
  color: #ffffff !important;
}

.align-line {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

/* Left-aligned: lines grouped on the left */
.pos-rich-editor-align-btn[data-rich-editor-action="align-left"] .align-left-1 {
  width: 70%;
}

.pos-rich-editor-align-btn[data-rich-editor-action="align-left"] .align-left-2 {
  width: 90%;
}

.pos-rich-editor-align-btn[data-rich-editor-action="align-left"] .align-left-3 {
  width: 60%;
}

/* Center-aligned: lines grouped in the center */
.pos-rich-editor-align-btn[data-rich-editor-action="align-center"] .align-center-1 {
  width: 70%;
  margin-left: auto;
  margin-right: auto;
}

.pos-rich-editor-align-btn[data-rich-editor-action="align-center"] .align-center-2 {
  width: 85%;
  margin-left: auto;
  margin-right: auto;
}

.pos-rich-editor-align-btn[data-rich-editor-action="align-center"] .align-center-3 {
  width: 70%;
  margin-left: auto;
  margin-right: auto;
}

/* Right-aligned: lines grouped on the right */
.pos-rich-editor-align-btn[data-rich-editor-action="align-right"] .align-right-1 {
  width: 70%;
  margin-left: auto;
}

.pos-rich-editor-align-btn[data-rich-editor-action="align-right"] .align-right-2 {
  width: 85%;
  margin-left: auto;
}

.pos-rich-editor-align-btn[data-rich-editor-action="align-right"] .align-right-3 {
  width: 65%;
  margin-left: auto;
}

/* Justified: lines spread across with varying widths */
.pos-rich-editor-align-btn[data-rich-editor-action="align-justify"] .align-justify-1 {
  width: 90%;
}

.pos-rich-editor-align-btn[data-rich-editor-action="align-justify"] .align-justify-2 {
  width: 100%;
}

.pos-rich-editor-align-btn[data-rich-editor-action="align-justify"] .align-justify-3 {
  width: 95%;
}

.pos-rich-editor-body-wrap {
  position: relative;
  border: none;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.pos-rich-editor-body,
.pos-rich-editor-html {
  width: 100%;
  min-height: 160px;
  border: none;
  color: var(--ink);
  font: inherit;
  line-height: 1.6;
  transition: background-color 0.2s ease;
  box-sizing: border-box;
}

.pos-rich-editor-body {
  font-size: 1rem;
  overflow: auto;
  padding: 0.65rem 0.75rem;
  border-radius: 0;
  background: #fff;
}

.pos-rich-editor-html {
  font-size: 1rem;
  overflow: auto;
  resize: vertical;
  font-family: inherit;
  padding: 0;
  border: none;
  border-radius: 0;
  background: #fff;
}

.pos-rich-editor-body:hover {
  background: #fff;
}

.pos-rich-editor-html:hover {
  background: #fff;
}

.pos-rich-editor-body:focus {
  outline: none;
  background: #fff;
}

.pos-rich-editor-html:focus {
  outline: none;
  background: #fff;
}

/* HTML 模式下保持一致樣式 */
.is-html-mode .pos-rich-editor-body {
  background: #fff;
  pointer-events: none;
}

.is-html-mode .pos-rich-editor-body:hover {
  background: #fff;
}

.pos-rich-editor-body * {
  color: inherit;
}

.pos-rich-editor-body h1,
.pos-rich-editor-body h2,
.pos-rich-editor-body h3,
.pos-rich-editor-body h4,
.pos-rich-editor-body h5,
.pos-rich-editor-body h6,
.pos-rich-editor-body p,
.pos-rich-editor-body ul,
.pos-rich-editor-body ol,
.pos-rich-editor-body blockquote {
  margin: 0 0 0.5rem;
}

.pos-rich-editor-body h1 {
  font-size: 32px;
  line-height: 1.2;
  font-weight: 700;
}

.pos-rich-editor-body h2 {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
}

.pos-rich-editor-body h3 {
  font-size: 24px;
  line-height: 1.2;
  font-weight: 500;
}

.pos-rich-editor-body h4 {
  font-size: 20px;
  line-height: 1.4;
  font-weight: 500;
}

.pos-rich-editor-body h5 {
  font-size: 18px;
  line-height: 1.4;
  font-weight: 500;
}

.pos-rich-editor-body h6 {
  font-size: 16px;
  line-height: 1.4;
  font-weight: 500;
}

.pos-rich-editor-body p,
.pos-rich-editor-body ul,
.pos-rich-editor-body ol,
.pos-rich-editor-body li,
.pos-rich-editor-body blockquote {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
}

.pos-rich-editor-body ul,
.pos-rich-editor-body ol {
  padding-left: 1.25rem;
}

.pos-rich-editor-body img {
  max-width: 100%;
  height: auto;
  display: inline-block;
  margin: 0.5rem 0;
  border-radius: 12px;
}

.pos-rich-editor-body a {
  color: inherit;
  word-break: break-word;
  text-decoration: underline;
}

.pos-rich-editor-body:focus {
  outline: none;
  background: #fafafa;
}

.pos-rich-editor-body:empty::before {
  content: attr(data-placeholder);
  color: #999;
}

html[data-theme="dark"] .pos-rich-editor-body {
  background: #1a1a1a;
  color: #e0e0e0;
  border-color: #404040;
}

html[data-theme="dark"] .pos-rich-editor-html {
  background: #1a1a1a;
  color: #e0e0e0;
  border: none;
}

html[data-theme="dark"] .pos-rich-editor-body:hover {
  background: #333333;
}

html[data-theme="dark"] .pos-rich-editor-html:hover {
  background: #333333;
}

html[data-theme="dark"] .pos-rich-editor-body:focus {
  background: #2a2a2a;
}

html[data-theme="dark"] .pos-rich-editor-html:focus {
  background: #1e1e1e;
}

html[data-theme="dark"] .pos-rich-editor-body:empty::before {
  color: #666;
}

html[data-theme="dark"] .pos-rich-editor-body-wrap {
  border: none;
}

html[data-theme="dark"] .pos-rich-editor {
  border-color: rgba(255, 255, 255, 0.14);
}

html[data-theme="dark"] .pos-rich-editor:hover {
  border-color: rgba(255, 255, 255, 0.32);
}

html[data-theme="dark"] .pos-rich-editor:focus-within {
  border-color: #606060;
  outline: 2px solid rgba(138, 164, 255, 0.35);
  outline-offset: 0;
}

.pos-rich-editor-html {
  display: none;
  min-height: 180px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: none;
  border-radius: 0;
}

.pos-rich-editor.is-html-mode .pos-rich-editor-body {
  display: none;
}

.pos-rich-editor.is-html-mode .pos-rich-editor-html {
  display: block;
}

.pos-rich-editor-html:focus {
  outline: none;
  background: #fafafa;
}

.pos-info-editing .pos-info-card {
  display: none;
}

.pos-info-editing .pos-info-form {
  display: grid;
}

.pos-info-save {
  display: none;
}

.pos-info-editing .pos-info-save {
  display: inline-flex;
}

.pos-info-editing .pos-dialog-edit {
  display: none;
}

.pos-info-editing .pos-card-actions {
  display: none;
}

#pos-info-dialog .account-dialog-inner {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

@media (min-width: 641px) {
  #pos-info-dialog .account-dialog-inner {
    width: min(520px, 92vw);
    height: min(80vh, calc(100dvh - 120px));
    max-height: calc(100dvh - 120px);
  }
}

@media (min-width: 1281px) {
  #pos-info-dialog .account-dialog-inner {
    width: min(1200px, 92vw);
    max-width: 1200px;
  }

  #pos-info-dialog .account-form {
    display: grid;
    grid-template-columns: 40% 1fr;
    gap: 1.5rem;
    align-items: start;
    width: 100%;
    min-width: 0;
  }
}

#pos-info-dialog .account-form {
  flex: 1 1 auto;
  min-height: 0;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 1281px) {
  #pos-info-dialog .account-form {
    display: grid;
    grid-template-columns: 40% 1fr;
    gap: 1.5rem;
    align-items: start;
    width: 100%;
    min-width: 0;
    padding-bottom: calc(5.25rem + 1rem + env(safe-area-inset-bottom, 0px));
  }

  /* Constrain right column children to prevent overflow */
  #pos-info-dialog .pos-form-right > * {
    min-width: 0;
    max-width: 100%;
  }
}

#pos-info-dialog .account-dialog-actions {
  justify-content: flex-end;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  gap: 8px;
  padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid rgba(42, 34, 28, 0.12);
  justify-content: flex-end;
  display: flex;
}

#pos-info-dialog .account-dialog-actions .btn {
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
  min-height: 46px;
}

#pos-info-import-json-btn {
  margin-right: auto;
}

@media (min-width: 1281px) {
  #pos-info-dialog .account-dialog-actions .btn {
    flex: 0 0 auto;
    width: auto;
    padding: 0 1.2rem;
  }
}

.pos-info-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.9rem;
}

.pos-info-rich-text-wrap {
  display: grid;
  gap: 0.35rem;
}

.pos-info-section-title {
  margin: 0;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
}

.pos-info-product-info {
  white-space: normal;
  word-break: break-word;
}

.pos-info-product-info h1,
.pos-info-product-info h2,
.pos-info-product-info h3,
.pos-info-product-info h4,
.pos-info-product-info p,
.pos-info-product-info ul,
.pos-info-product-info ol,
.pos-info-product-info blockquote {
  margin: 0 0 0.5rem;
}

.pos-info-product-info ul,
.pos-info-product-info ol {
  padding-left: 1.25rem;
}

.pos-info-product-info img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

.pos-info-code {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(42, 34, 28, 0.65);
}

.pos-info-barcode {
  min-height: 98px;
  border: 1px solid rgba(42, 34, 28, 0.1);
  border-radius: 16px;
  background: #fff;
  padding: 0.85rem 0.95rem 0.7rem;
  display: grid;
  place-items: center;
}

.pos-info-barcode.is-empty {
  color: rgba(42, 34, 28, 0.45);
  font-size: 0.85rem;
  text-align: center;
}

.pos-info-barcode svg {
  width: 100%;
  max-width: 260px;
  height: auto;
  display: block;
  background: #fff;
}

.pos-info-barcode text {
  fill: #111827;
  font-family: "Arial", "Helvetica Neue", sans-serif;
  letter-spacing: 0;
}

.pos-dialog .account-dialog-actions {
  justify-content: flex-end;
  padding: 0.9rem 1rem;
}

.pos-payment-form {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
}

#pos-payment-dialog .account-dialog-actions {
  position: static;
}

.pos-payment-options {
  display: grid;
  gap: 0.75rem;
}

.pos-payment-option {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-align: left;
  padding: 0.9rem 1rem;
  cursor: pointer;
}

.pos-payment-option.is-selected {
  border-color: #496f4b;
  background: rgba(73, 111, 75, 0.08);
  color: #27472c;
}

.pos-payment-option:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #f5f5f5;
  border-color: #ccc;
  color: #999;
}

.pos-payment-badge {
  font-size: 0.75rem;
  margin-left: 0.5rem;
  color: #999;
}

#pos-dialog .account-dialog-inner {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

@media (min-width: 641px) {
  #pos-dialog .account-dialog-inner {
    width: min(520px, 92vw);
    height: min(80vh, calc(100dvh - 120px));
    max-height: calc(100dvh - 120px);
  }
}

@media (min-width: 1281px) {
  #pos-dialog .account-dialog-inner {
    width: min(1200px, 92vw);
    max-width: 1200px;
  }

  #pos-dialog .account-form {
    display: grid;
    grid-template-columns: 40% 1fr;
    gap: 1.5rem;
    align-items: start;
    width: 100%;
    min-width: 0;
    flex: none;
    min-height: 0;
    padding-bottom: calc(5.25rem + 1rem + env(safe-area-inset-bottom, 0px));
  }

  .pos-form-left {
    display: grid;
    gap: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    min-width: 0;
    max-height: 100%;
    scrollbar-gutter: stable;
  }

  .pos-form-right {
    display: grid;
    gap: 1rem;
    overflow-y: auto;
    overflow-x: visible;
    min-height: 0;
    min-width: 0;
    max-height: 100%;
    scrollbar-gutter: stable;
  }

  .pos-form-right > * {
    min-width: 0;
    max-width: 100%;
  }
}

#pos-dialog .account-form {
  flex: 1 1 auto;
  min-height: 0;
  padding-left: 1rem;
  padding-right: 1rem;
}

#pos-category-dialog .account-form {
  padding: 1rem;
}

@media (max-width: 1280px) {
  .pos-form-left,
  .pos-form-right {
    display: contents;
  }

  /* Constrain grid children to parent width in small/medium screens */
  .pos-form-right > * {
    min-width: 0;
    max-width: 100%;
  }

  /* 中小窗：隱藏"更多"文字，按鈕為正方形 */
  #pos-dialog .account-dialog-actions .pos-actions-dropdown button {
    width: 48px;
    height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #pos-dialog .account-dialog-actions .pos-actions-dropdown button .pos-more-text {
    display: none;
  }
}

#pos-dialog input,
#pos-dialog textarea,
#pos-dialog .dropdown {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#pos-dialog .dropdown-item {
  width: 100%;
  box-sizing: border-box;
  height: auto;
  padding: 8px 10px;
  min-height: auto;
  display: block;
}

#pos-dialog .account-dialog-actions .pos-actions-dropdown .dropdown-item {
  width: 100%;
  padding: 8px 10px;
  height: auto;
  min-height: auto;
  text-align: left;
  justify-content: flex-start;
}

#pos-dialog textarea {
  min-height: 56px;
  border-radius: 16px;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--stroke);
  resize: vertical;
}

#pos-dialog .pos-category-dropdown .dropdown-trigger,
#pos-info-dialog .pos-category-dropdown .dropdown-trigger,
#pos-dialog .pos-sales-channel-dropdown .dropdown-trigger,
#pos-info-dialog .pos-sales-channel-dropdown .dropdown-trigger {
  min-height: 40px;
  height: 40px;
  border-radius: 12px;
  padding: 0 0.9rem;
}

#pos-dialog .account-dialog-actions {
  justify-content: flex-end;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  gap: 8px;
  padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid rgba(42, 34, 28, 0.12);
  justify-content: flex-start;
  display: flex;
  flex-wrap: wrap;
  box-sizing: border-box;
}

@media (min-width: 1281px) {
  #pos-dialog .account-dialog-actions {
  justify-content: flex-end;
    justify-content: flex-start;
  }

  #pos-dialog .account-dialog-actions .btn {
    flex: 0 0 auto;
  }

  #pos-dialog .account-dialog-actions .pos-actions-dropdown {
    order: -1;
  }

  #pos-dialog .account-dialog-actions .btn.cta {
    margin-left: auto;
  }
}

@media (max-width: 1280px) {
  #pos-dialog .account-dialog-actions .btn:not(.pos-actions-dropdown) {
    flex: 1 1 0;
    min-width: 0;
  }
}

#pos-dialog .account-dialog-actions .btn {
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
  min-height: 46px;
}

@media (min-width: 1281px) {
  #pos-dialog .account-dialog-actions .btn {
    flex: 0 0 auto;
    width: auto;
    padding: 0 1.2rem;
  }
}

.pos-dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: rgba(42, 34, 28, 0.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.pos-dialog-edit {
  position: absolute;
  top: 10px;
  right: 48px;
  width: 32px;
  height: 32px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: rgba(42, 34, 28, 0.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.pos-dialog-edit svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pos-dialog-close svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pos-card-image {
  aspect-ratio: 3 / 2;
  height: auto;
  border-radius: 12px;
  background: #f3f1ea;
  border: 1px dashed rgba(42, 34, 28, 0.2);
  display: grid;
  place-items: center;
  color: rgba(42, 34, 28, 0.5);
  font-size: 0.9rem;
  overflow: hidden;
  position: relative;
}

.pos-card-image.has-image,
#pos-info-image.has-image {
  border-style: solid;
  border-color: transparent;
  background: #fff;
}

.pos-card-image img,
#pos-info-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
}

.pos-card-image img {
  object-fit: cover;
}

#pos-info-image img {
  object-fit: contain;
}

.pos-card-image-icon {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pos-card-title {
  margin: 0;
  font-size: 1.05rem;
}

.pos-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pos-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(42, 34, 28, 0.18);
  font-size: 0.75rem;
  color: rgba(42, 34, 28, 0.75);
  background: #fff9f0;
}

.pos-card-price {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
}

.pos-card-price.has-promotion {
  text-decoration: line-through;
  color: rgba(42, 34, 28, 0.45);
  font-weight: 400;
  font-size: 0.85em;
}

.pos-card-promo {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: -0.1rem 0 0;
}

.pos-card-promo-price {
  font-weight: 700;
  font-size: 1.05rem;
  color: #b91c1c;
}

.pos-card-promo-end {
  font-size: 0.75rem;
  color: rgba(42, 34, 28, 0.55);
}

.pos-stock-hint {
  margin: -0.15rem 0 0;
  font-size: 0.82rem;
  color: rgba(42, 34, 28, 0.58);
}

.pos-card.is-out-of-stock .pos-stock-hint {
  color: #b91c1c;
}

.pos-image-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.pos-image-error {
  display: block;
  min-height: 1.1em;
  margin-top: 0.2rem;
  font-size: 0.8rem;
  color: #b91c1c;
}

.pos-image-error:empty {
  display: block;
}

#pos-image-input,
#pos-info-image-input {
  display: none;
}

.pos-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 32px;
  border: 2px dashed rgba(42, 34, 28, 0.25);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fafafa;
  height: 200px;
  position: relative;
  overflow: hidden;
}

.pos-upload:hover {
  border-color: #1976d2;
  background: #f0f7ff;
}

.pos-upload.has-image {
  padding: 0;
  background: #fff;
  border-style: solid;
  border-color: transparent;
}

.pos-upload.has-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.pos-upload.has-image .pos-upload-icon,
.pos-upload.has-image .pos-upload-text {
  display: none;
}

.pos-upload-icon {
  font-size: 48px;
  color: #1976d2;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.pos-upload-text {
  font-size: 14px;
  color: var(--articles-text);
  font-weight: 500;
  text-align: center;
}

.pos-image-carousel {
  position: relative;
  aspect-ratio: 3 / 2;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(42, 34, 28, 0.15);
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.pos-image-carousel img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.pos-carousel-placeholder {
  font-size: 14px;
  color: rgba(42, 34, 28, 0.4);
  text-align: center;
}

.pos-image-controls {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.pos-upload-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  border: 2px dashed rgba(42, 34, 28, 0.2);
  background: #fafafa;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.pos-upload-button:hover {
  border-color: #1976d2;
  background: rgba(25, 118, 210, 0.05);
}

.pos-upload-button .pos-upload-icon {
  font-size: 24px;
  color: rgba(42, 34, 28, 0.6);
}

.pos-image-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.pos-image-gallery:empty {
  display: none;
  margin-bottom: 0;
}

.pos-image-gallery-item {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(42, 34, 28, 0.15);
  background: #fafafa;
  cursor: pointer;
  flex-shrink: 0;
}

.pos-image-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pos-image-gallery-item-cover {
  border-color: #1976d2;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.35);
}

.pos-image-gallery-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.pos-image-gallery-remove:hover {
  background: rgba(185, 28, 28, 0.85);
}

.pos-card-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.75rem;
}

.pos-qty {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 0.35rem;
  background: #fff;
  justify-self: start;
}

.pos-qty-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(42, 34, 28, 0.2);
  background: #f9f6ef;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1;
  font-weight: 700;
  font-family: inherit;
  -webkit-text-fill-color: currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  cursor: pointer;
}

.pos-qty-value {
  min-width: 18px;
  text-align: center;
  font-size: 0.9rem;
}

.pos-add {
  height: 36px;
  padding: 0 1rem;
  background: #c0742a;
  border-color: #c0742a;
  color: #fff;
}
.pos-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--stroke);
  z-index: 29;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  font-size: 1rem;
}

.footer-inner {
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  font-size: 1rem;
}

.pos-footer-source {
  margin-right: auto;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.pos-footer-count {
  color: #6f6659;
  font-weight: 600;
}

.pos-footer-value {
  font-weight: 700;
  color: var(--ink);
}

.pos-footer-cta {
  height: 40px;
  padding: 0 1.2rem;
}

@media (max-width: 640px) {
  .pos-footer-source {
    display: none;
  }

  .pos-footer:not(.attendance-footer) {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  .pos-footer:not(.attendance-footer) .pos-footer-cta {
    flex: 0 0 auto;
    margin-left: auto;
  }
}

.attendance-page .layout {
  padding-bottom: 72px;
}

.attendance-footer {
  justify-content: flex-end;
}

.attendance-clock-time {
  margin-right: auto;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.history-thumb-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: #4b5563;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.history-thumb:hover .history-thumb-remove,
.history-thumb:focus-within .history-thumb-remove {
  opacity: 1;
  pointer-events: auto;
}

.history-thumb-remove:hover {
  background: #dc2626;
  color: #fff;
}

.history-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 1.5rem 0;
  text-align: center;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(42, 34, 28, 0.6);
  font-size: 0.9rem;
}

.history-panel {
  position: fixed;
  top: var(--header-height, 68px);
  right: 0;
  bottom: 0;
  width: min(320px, 92vw);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  border-left: 1px solid var(--stroke);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 21;
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
  align-content: start;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.history-panel.open {
  transform: translateX(0);
}

.history-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0;
}

.history-panel-header h4 {
  margin: 0;
  line-height: 1;
}

.notification-panel {
  position: fixed;
  top: calc(var(--header-height, 68px) + 0.75rem);
  right: 1rem;
  width: min(420px, calc(100vw - 2rem));
  max-height: min(72vh, 760px);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(42, 34, 28, 0.1);
  border-radius: 20px;
  box-shadow: 0 24px 48px rgba(18, 16, 12, 0.16);
  backdrop-filter: blur(14px);
  z-index: 34;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px) scale(0.98);
  transition: opacity 180ms ease, transform 180ms ease;
  display: grid;
  grid-template-rows: auto 1fr;
}

.notification-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.notification-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(42, 34, 28, 0.08);
}

.notification-panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.notification-panel-header h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--ink);
}

.notification-panel-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(42, 34, 28, 0.12);
  background: transparent;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}

.notification-panel-close:hover {
  background: rgba(42, 34, 28, 0.06);
}

.notification-panel-close svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.notification-panel-body {
  padding: 0.75rem 1rem 1rem;
  overflow-y: auto;
  display: grid;
  gap: 1rem;
  align-content: start;
}

.notification-panel-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.notification-tab {
  min-width: 54px;
  height: 34px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0 0.9rem;
}

.notification-tab.is-active {
  background: rgba(192, 116, 42, 0.16);
  color: #c0742a;
}

.notification-section {
  display: grid;
  gap: 0.5rem;
}

.notification-section[hidden] {
  display: none !important;
}

.notification-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.notification-section h5 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink);
}

.notification-section-link {
  border: none;
  background: transparent;
  color: #4e7fd3;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.notification-section-list {
  display: grid;
  gap: 0.25rem;
}

.notification-item {
  width: 100%;
  border: none;
  border-radius: 16px;
  background: transparent;
  padding: 0.875rem 0.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  text-align: left;
  cursor: pointer;
}

.notification-item:hover {
  background: rgba(42, 34, 28, 0.05);
}

.notification-item-copy {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}

.notification-item-label {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 600;
}

.notification-item-title {
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.35;
}

.notification-item-summary,
.notification-item-time {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.notification-item-side {
  display: grid;
  justify-items: end;
  align-content: center;
  gap: 0.35rem;
}

.notification-item-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #356fd2;
}

.notification-item-time {
  white-space: nowrap;
  align-self: end;
}

.notification-empty {
  margin: 0;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
}

.notification-empty[hidden] {
  display: none !important;
}

@media (min-width: 1921px) {
  .btn.ghost.history-toggle:not(.rag-qa-toggle) {
    display: none;
  }

  .rag-qa-panel {
    width: 420px;
    transform: none;
    transition: none;
  }

  .history-panel {
    width: 420px;
    transform: none;
    transition: none;
  }

  .history-panel.open {
    transform: none;
  }

  .dashboard {
    left: 260px;
    right: 420px;
    width: auto;
  }

  .assistant-mode .assistant-input-wrap {
    left: 260px;
    right: 420px;
  }
}

@media (min-width: 1281px) {
}

@media (max-width: 1280px) {
  body.is-generating .generate-actions {
    grid-template-columns: 1fr 1fr;
  }

  body.is-generating .view-output {
    display: inline-flex;
  }

  body.has-output .view-output {
    display: inline-flex;
  }
}

@media (max-width: 640px) {
  .notification-panel {
    top: calc(var(--header-height, 68px) + 0.5rem);
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    max-height: calc(100dvh - var(--header-height, 68px) - 1.25rem);
    border-radius: 18px;
  }

  .notification-item {
    padding-inline: 0.5rem;
  }
}

@media (max-width: 640px) {
  .account-dialog {
    position: fixed;
    top: var(--header-height, 68px);
    right: 0;
    bottom: 0;
    left: 0;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    z-index: 2000;
    opacity: 1;
  }

  .account-dialog[open] {
    position: fixed !important;
    top: var(--header-height, 68px) !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    height: auto !important;
    width: 100% !important;
    margin: 0 !important;
    display: flex !important;
    align-items: flex-end !important;
    justify-content: flex-end !important;
  }

  .account-dialog-inner {
    border-radius: 18px 18px 0 0;
    height: auto;
    max-height: calc(100dvh - var(--header-height, 68px));
    width: 100% !important;
    max-width: none !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .account-dialog[open] .account-dialog-inner {
    animation: dialog-slide-up 0.28s ease;
  }

  .account-dialog.is-closing .account-dialog-inner {
    animation: dialog-slide-down 0.2s ease forwards;
  }

  @keyframes dialog-slide-up {
    from {
      transform: translateY(16px);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  @keyframes dialog-slide-down {
    from {
      transform: translateY(0);
      opacity: 1;
    }
    to {
      transform: translateY(16px);
      opacity: 0;
    }
  }
  .ai-dashboard .canvas-input {
    min-height: auto;
  }

  .ai-dashboard .prompt-card {
    min-height: auto;
  }

  .prompt-card-top {
    overflow: visible;
    flex: 0;
    min-height: auto;
  }

  .canvas-dialog {
    position: fixed;
    top: var(--header-height, 68px);
    right: 0;
    bottom: 0;
    left: 0;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    z-index: 2000;
  }

  .canvas-dialog[open] {
    position: fixed !important;
    top: var(--header-height, 68px) !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    height: calc(100dvh - var(--header-height, 68px)) !important;
    width: 100% !important;
    margin: 0 !important;
    display: flex !important;
    align-items: flex-end !important;
    justify-content: flex-end !important;
  }

  .canvas-dialog::backdrop {
    background: rgba(20, 16, 12, 0.5);
  }

  .canvas-dialog-inner {
    border-radius: 18px 18px 0 0;
    height: 100%;
    max-height: calc(100dvh - var(--header-height, 68px));
    align-self: end;
    width: 100% !important;
    max-width: none !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .prompt-dialog {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .prompt-dialog[open] {
    position: fixed;
    top: var(--header-height, 68px);
    right: 0;
    bottom: 0;
    left: 0;
    height: calc(100dvh - var(--header-height, 68px)) !important;
    max-height: none !important;
    display: flex;
    opacity: 1 !important;
    transform: none !important;
  }

  .prompt-dialog::backdrop {
    background: rgba(20, 16, 12, 0.35) !important;
  }

  .prompt-dialog-inner {
    border-radius: 18px 18px 0 0 !important;
    height: 100% !important;
    max-height: none !important;
    width: 100%;
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    margin: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .prompt-dialog[open].is-open .prompt-dialog-inner {
    animation: dialog-slide-up 0.28s ease;
  }

  .prompt-dialog.is-closing .prompt-dialog-inner {
    animation: dialog-slide-down 0.2s ease forwards;
  }

  .prompt-dialog-scroll {
    overflow-y: auto;
  }
}

@media (max-width: 1280px) {
  .canvas-dialog {
    position: fixed;
    top: var(--header-height, 68px);
    right: 0;
    bottom: 0;
    left: 0;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    z-index: 2000;
  }

  .canvas-dialog[open] {
    position: fixed !important;
    top: var(--header-height, 68px) !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    height: calc(100dvh - var(--header-height, 68px)) !important;
    width: 100% !important;
    margin: 0 !important;
    display: flex !important;
    align-items: flex-end !important;
    justify-content: flex-end !important;
  }

  .canvas-dialog-inner {
    border-radius: 18px 18px 0 0;
    height: 100%;
    max-height: calc(100dvh - var(--header-height, 68px));
    align-self: end;
    width: 100% !important;
    max-width: none !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .canvas-dialog::backdrop {
    background: rgba(20, 16, 12, 0.5);
  }
}

body.is-generating .output-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

body.is-generating .stop-button {
  display: inline-flex;
  width: 100%;
}

#dialog-output-slot {
  width: 100%;
}

.canvas-output-dialog {
  border: none;
  background: transparent;
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.canvas-output-dialog .output-top {
  flex: 1;
  min-height: 0;
}

.canvas-output-dialog .output-bottom {
  flex: 0 0 auto;
}

#dialog-output-slot .canvas-output,
#dialog-output-slot .output-top,
#dialog-output-slot #dialog-canvas-host,
#dialog-output-slot #dialog-canvas,
#dialog-output-slot .output-bottom {
  width: 100%;
  max-width: 100%;
}

#dialog-canvas-host {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

#dialog-canvas {
  width: 100%;
  height: auto;
  max-height: 100%;
  max-width: 100%;
  display: block;
  background: #fff;
}

.ai-dashboard .canvas-input {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ai-dashboard .prompt-card {
  flex: 1;
  min-height: 0;
}

.ai-dashboard .prompt-area {
  min-height: 128px;
  max-height: 220px;
  font-size: 16px;
  resize: none;
  overflow-y: auto;
  margin: 0;
  padding: 0.75rem 5rem 2.75rem 0.75rem;
  border-radius: 20px;
  background: var(--field-bg);
  color: var(--text-primary);
}

.prompt-card-top {
  display: grid;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.prompt-card-bottom {
  display: grid;
  gap: 0;
  position: relative;
  z-index: 2;
}

.prompt-cards {
  display: grid;
  gap: 0.75rem;
}

.prompt-mini-card {
  border: 1px solid var(--stroke);
  padding: 0.75rem;
  background: var(--panel-elevated);
  overflow: visible;
}

.prompt-card-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  position: relative;
  z-index: 3;
}

.prompt-card-header h4 {
  margin: 0;
  line-height: 1.1;
}

.prompt-card-header .info-button {
  margin-left: auto;
}

.tooltip-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  border: 1px solid var(--stroke);
  border-radius: 50%;
  color: var(--muted);
  cursor: default;
  position: relative;
  z-index: 4;
  align-self: center;
  margin-bottom: 0.35rem;
}

.tooltip-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  min-width: 220px;
  max-width: 260px;
  transform: translateY(-4px);
  background: rgba(42, 34, 28, 0.92);
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
}

.prompt-mini-card,
.theme-grid,
.theme-card {
  z-index: 1;
}

.tooltip-icon:hover::after {
  opacity: 1;
  transform: translateY(-8px);
}

.prompt-mini-card h4 {
  margin: 0 0 0.35rem;
}

.prompt-mini-card p {
  margin: 0;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
  overflow: visible;
}

.theme-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem;
  align-items: center;
  border: 1px solid var(--stroke);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.6);
  position: relative;
  min-height: 48px;
}

.theme-card input {
  margin: 0;
}

.theme-card input:checked + span {
  color: var(--accent);
  font-weight: 600;
}


.prompt-dialog {
  width: min(720px, 92vw);
  border: none;
  padding: 0;
  background: transparent;
  z-index: 30;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.prompt-dialog::backdrop {
  background: rgba(20, 16, 12, 0.35);
}

.prompt-dialog-inner {
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 0;
  display: grid;
  gap: 0;
  grid-template-rows: auto 1fr auto;
  max-height: 80vh;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

.prompt-dialog[open] {
  opacity: 0;
  transform: scale(0.96);
  height: 80vh;
}

.prompt-dialog[open].is-open {
  opacity: 1;
  transform: scale(1);
}

.prompt-tabs {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 4px;
  min-height: 0;
  flex-wrap: nowrap;
}

.prompt-tab {
  border: 1px solid var(--stroke);
  background: #fff;
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font-size: 0.9rem;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  height: fit-content;
}

.prompt-tab.prompt-tab-add {
  border: 1px dashed rgba(42, 34, 28, 0.35);
  background: #f7f2e8;
  color: rgba(42, 34, 28, 0.7);
}

.prompt-tab.active {
  border-color: rgba(192, 122, 42, 0.4);
  color: var(--accent);
}

.prompt-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #fff;
  padding: 0.75rem 1rem 0.5rem;
  z-index: 3;
  height: fit-content;
}

.prompt-dialog-more {
  border: 1px solid var(--stroke);
  background: #fff;
  font-size: 20px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  height: 48px;
  width: 48px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.prompt-dialog-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  background: #fff;
  border: 1px solid rgba(42, 34, 28, 0.12);
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(42, 34, 28, 0.12);
  padding: 6px;
  display: grid;
  gap: 0;
  z-index: 10;
  min-width: 120px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.prompt-dialog-menu.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.prompt-dialog-more-wrap {
  position: relative;
  display: inline-flex;
}

.prompt-dialog-menu-item {
  border: none;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.prompt-dialog-menu-item:hover {
  background: rgba(192, 116, 42, 0.1);
}

.prompt-dialog-menu-item[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
}

.prompt-dialog-title {
  display: grid;
  gap: 0.5rem;
  overflow: visible;
  clip-path: none;
}

.prompt-dialog-title h3 {
  color: var(--ink);
  font-weight: 700;
}

.prompt-dialog-close {
  align-self: start;
  width: 24px;
  height: 24px;
  border-radius: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  color: rgba(42, 34, 28, 0.7);
}

.prompt-dialog-close svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.prompt-dialog-scroll {
  overflow: auto;
  min-height: 0;
  padding: 0 1rem;
}

.prompt-dialog-body {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 0 0 1.25rem;
  align-self: start;
  min-height: 0;
}

.prompt-dialog-footer {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 0.75rem 1rem 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  z-index: 2;
  overflow: visible;
}

.prompt-dialog-edit {
  height: 48px;
  padding: 0 18px;
}

.prompt-dialog-save,
.prompt-dialog-cancel {
  height: 48px;
  padding: 0 18px;
  display: none;
}


.prompt-dialog.is-editing .prompt-dialog-edit {
  display: none;
}

.prompt-dialog.is-editing .prompt-dialog-save,
.prompt-dialog.is-editing .prompt-dialog-cancel {
  display: inline-flex;
}

.prompt-dialog-editor {
  width: 100%;
  min-height: 0;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.6;
  resize: none;
  margin: 0;
  overflow: auto;
  height: 100%;
  flex: 1;
}

.prompt-rename-dialog,
.prompt-delete-dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  width: min(360px, 90vw);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.prompt-rename-dialog[open],
.prompt-delete-dialog[open] {
  opacity: 1;
  transform: scale(1);
}

.prompt-rename-form,
.prompt-delete-form {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.prompt-rename-form h4,
.prompt-delete-form h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--ink);
  font-weight: 700;
}

.prompt-rename-form input {
  border: 1px solid #c0c0c0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.prompt-rename-actions,
.prompt-delete-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.prompt-rename-actions .btn {
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--ink);
}

.prompt-rename-actions .btn.cta {
  border: none;
  background: var(--accent);
  color: #fff;
}

.btn.danger {
  background: #dc2626;
  color: #fff;
  border: none;
}

.account-dialog .btn.danger {
  background: #dc2626;
  border: 1px solid #dc2626;
  color: #fff;
}

.account-dialog .btn.danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

#account-delete-dialog .btn.danger,
.account-table .account-delete {
  background: #c07a2a;
  border-color: #c07a2a;
  color: #fff;
}

#account-delete-dialog .btn.danger:hover,
.account-table .account-delete:hover {
  background: #a7661e;
  border-color: #a7661e;
  color: #fff;
}

.prompt-dialog.is-editing .prompt-dialog-scroll {
  flex: 1;
  overflow: hidden;
  padding-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.prompt-dialog-media {
  padding: 0;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.75rem;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  height: 150px !important;
  min-height: 150px;
  max-height: 150px;
  box-sizing: border-box;
  margin-bottom: 1rem;
  scroll-padding-left: 1rem;
  scroll-padding-right: 1rem;
}

.prompt-dialog-image-slot {
  --media-ratio: 1 / 1;
  aspect-ratio: var(--media-ratio);
  height: 100%;
  width: auto;
  flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(42, 34, 28, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.prompt-dialog-image-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.prompt-dialog-image-add {
  border: 1.5px dashed rgba(42, 34, 28, 0.35);
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.prompt-dialog-image-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(42, 34, 28, 0.2);
  background: rgba(255, 255, 255, 0.92);
  color: #3D3D3D;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.prompt-dialog-image-slot:hover .prompt-dialog-image-remove {
  opacity: 1;
  pointer-events: auto;
}

.prompt-dialog-image-input {
  display: none;
}

@media (max-width: 640px) {
  .canvas-dialog,
  .prompt-dialog,
  .prompt-rename-dialog,
  .prompt-delete-dialog {
    transform: translateY(16px);
  }

  .canvas-dialog[open],
  .prompt-dialog[open].is-open,
  .prompt-rename-dialog[open],
  .prompt-delete-dialog[open] {
    transform: translateY(0);
  }

  .prompt-rename-dialog,
  .prompt-delete-dialog {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 18px 18px 0 0;
  }

  .prompt-rename-dialog[open],
  .prompt-delete-dialog[open] {
    display: block;
  }

  .prompt-rename-form,
  .prompt-delete-form {
    padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
  }

  .prompt-dialog-body {
    align-self: stretch;
    padding-top: 0;
  }
}

.prompt-area {
  width: 100%;
  border: 1px solid var(--stroke);
  box-sizing: border-box;
  padding: 0.9rem 5rem 2.75rem 0.9rem;
  margin: 0;
  font-family: inherit;
  font-size: 16px;
  resize: vertical;
  overflow-y: auto;
  line-height: 1.5;
  scrollbar-gutter: stable;
  background: var(--field-bg);
  color: var(--text-primary);
}

.prompt-input-wrap {
  position: relative;
}

.prompt-area::placeholder {
  color: #aaa39b;
}

.prompt-area-image-add {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.prompt-area-image-add svg {
  width: 18px;
  height: 18px;
}

.prompt-input-wrap .prompt-select-wrap {
  position: absolute;
  left: 3.2rem;
  bottom: 0.75rem;
  z-index: 2;
}

.prompt-input-wrap .prompt-select-wrap .dropdown-trigger {
  min-height: 32px;
  height: 32px;
  border-radius: 999px;
  padding: 0 10px;
}

.prompt-generate-round {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: #4b6f4b;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.prompt-generate-round svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
}

.prompt-generate-round .icon-stop {
  display: none;
}

.prompt-generate-round.is-generating {
  background: #9ca3af;
}

html[data-theme="dark"] .prompt-generate-round {
  background: #5f8f78;
}

html[data-theme="dark"] .prompt-generate-round.is-generating {
  background: #6b7280;
}

.prompt-generate-round.is-generating .icon-send {
  display: none;
}

.prompt-generate-round.is-generating .icon-stop {
  display: block;
}

.prompt-area-upload-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.prompt-area-upload-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid #d9d4ca;
  border-radius: 999px;
  background: #fff;
  font-size: 0.8rem;
  color: #3d3d3d;
}

.prompt-area-upload-chip button {
  border: none;
  background: transparent;
  color: #8e8881;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
}

.prompt-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prompt-select {
  display: none;
}

.dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.dropdown select {
  display: none;
}

.dropdown-trigger {
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0;
  font: inherit;
  color: inherit;
  min-height: 40px;
  height: 40px;
}

.dropdown-label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.dropdown-caret {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(42, 34, 28, 0.55);
  border-bottom: 2px solid rgba(42, 34, 28, 0.55);
  transform: rotate(45deg);
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid rgba(42, 34, 28, 0.12);
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(42, 34, 28, 0.12);
  padding: 6px;
  min-width: 160px;
  max-height: min(280px, 40vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: none;
  z-index: 9999;
  gap: 6px;
}

.dropdown-menu.is-open {
  display: grid;
}

.account-dialog-actions .pos-actions-dropdown {
  position: relative;
  order: -1;
}

.account-dialog-actions .pos-actions-dropdown .dropdown-menu {
  position: fixed;
  z-index: 10000;
  top: 0;
  right: 0;
  min-width: 140px;
}

.account-dialog-actions .pos-actions-dropdown button svg {
  fill: currentColor;
  stroke: currentColor;
}

html[data-theme="dark"] .account-dialog-actions .pos-actions-dropdown button svg {
  color: var(--ink);
}

.dropdown-item {
  border: none;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  white-space: nowrap;
}

.dropdown-item:hover {
  background: rgba(192, 116, 42, 0.1);
}

.dropdown-item.is-active {
  color: #c0742a;
}

/* iOS Safari: prevent default blue text on clickable tabs/dropdowns */
.ai-tab,
.prompt-tab,
.dropdown-trigger,
.dropdown-item,
.home-tool-menu-item {
  color: #3D3D3D !important;
  -webkit-text-fill-color: #3D3D3D;
}

.ai-tab.is-active,
.prompt-tab.active,
.dropdown-item.is-active {
  color: #c0742a !important;
  -webkit-text-fill-color: #c0742a;
}

button,
[role="tab"],
[role="menuitem"] {
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.prompt-select-wrap .dropdown-trigger {
  border: 1px solid var(--stroke);
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
  background: var(--field-bg);
  color: var(--text-primary);
  border-radius: 8px;
  min-height: auto;
}

.prompt-select-wrap .dropdown-menu {
  top: auto;
  bottom: calc(100% + 6px);
}

.attendance-filter-all .attendance-filter-select-wrap {
  min-width: 0;
}

.attendance-filter-select-wrap .dropdown-trigger {
  border: 1px solid rgba(42, 34, 28, 0.18);
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  height: 40px;
  justify-content: space-between;
  min-width: 160px;
  width: 100%;
}

.attendance-filter-select-wrap .dropdown-menu {
  left: 0;
  right: auto;
  min-width: 100%;
}

.account-sort-dropdown .dropdown-trigger {
  font-size: 16px;
  padding: 0.45rem 0.2rem;
  width: 100%;
  justify-content: space-between;
  background: transparent !important;
}

.account-sort-dropdown {
  width: 100%;
}

.account-sort-dropdown .dropdown-menu {
  width: 100%;
  min-width: 100%;
  right: 0;
  left: 0;
}

.prompt-controls .btn {
  padding: 6px 10px;
  font-size: 0.9rem;
}

.text-button {
  background: transparent;
  border: none;
  padding: 0;
  color: #496F4B;
  font-size: 0.75rem;
  cursor: pointer;
  margin-left: auto;
}

.prompt-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.prompt-input {
  width: 100%;
  border: 1px solid var(--stroke);
  padding: 0.65rem 0.75rem;
  font-family: inherit;
  font-size: 0.75rem;
}

@media (max-width: 1280px) {
  .dashboard,
  .ci-dashboard,
  .ai-dashboard {
    padding: 1rem;
  }

  .ai-dashboard {
    padding: 4rem 1rem 1rem 1rem;
  }

  .attendance-dashboard {
    padding: 4rem 1rem 1rem 1rem;
  }

  .inventory-dashboard {
    padding: 4rem 1rem 1rem 1rem;
  }

  .rag-admin-dashboard {
    padding: 4rem 1rem 1rem 1rem;
  }


  .canvas-panel {
    grid-template-columns: 1fr;
  }

  .canvas-input,
  .canvas-output {
    width: 100%;
  }

  .ai-tabs {
    display: flex;
    position: fixed;
    top: var(--header-height, 68px);
    left: 0;
    right: 0;
    padding: 0;
    background: var(--panel-elevated);
    border-bottom: 1px solid var(--stroke);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: 5;
    gap: 0.5rem;
    margin: 0;
  }

  .attendance-tabs {
    display: flex;
    position: fixed;
    top: var(--header-height, 68px);
    left: 0;
    right: 0;
    padding: 0;
    background: rgba(248, 245, 240, 0.95);
    backdrop-filter: blur(6px);
    z-index: 5;
    gap: 0;
    margin: 0;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .attendance-tab {
    flex: 1 1 0;
    text-align: center;
    font-size: 0.9rem;
    padding: 1rem 0.9rem;
    font-weight: 900;
    position: relative;
    white-space: nowrap;
  }

  .attendance-tab.is-active {
    color: #7a4a1e;
  }

  .attendance-tab.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: #7a4a1e;
    border-radius: 2px;
  }

  .attendance-tab-divider {
    display: none;
    flex: 0 0 auto;
    width: 1px;
    height: 16px;
    background: rgba(42, 34, 28, 0.25);
  }

  .rag-drive-tabs {
    display: flex;
    position: fixed;
    top: var(--header-height, 68px);
    left: 0;
    right: 0;
    padding: 0;
    background: #f8f5f0;
    z-index: 95;
    gap: 0;
    margin: 0;
    align-items: center;
    border-bottom: 1px solid rgba(42, 34, 28, 0.12);
  }

  .rag-drive-controls {
    padding-top: 0;
  }

  .rag-drive-tabs .ai-tab {
    flex: 1;
    text-align: center;
    font-family: "Noto Sans TC", "Metropolis", sans-serif !important;
    font-size: 0.9rem;
    padding: 1rem 0;
    font-weight: 600;
    margin: 0;
    color: var(--ink);
    background: transparent;
    border-radius: 0;
    position: relative;
  }

  .rag-drive-tabs .ai-tab.is-active {
    color: var(--accent);
  }

  .rag-drive-tabs .ai-tab.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
  }

  .rag-drive-tab-divider {
    display: none;
    width: 1px;
    height: 20px;
    flex: 0 0 1px;
    background: rgba(42, 34, 28, 0.2);
  }

  .history-panel {
    z-index: 21;
  }

  .account-tabs {
    position: fixed;
    top: var(--header-height, 68px);
    left: 0;
    right: 0;
    padding: 0.65rem 1.5rem;
    background: rgba(248, 245, 240, 0.95);
    backdrop-filter: blur(6px);
    z-index: 5;
  }

  .account-card {
    width: 100%;
  }

  .account-tab {
    flex: 1;
    font-size: 0.9rem;
    padding: 0.4rem 0;
    position: relative;
  }

  .account-tab + .account-tab {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
  }

  .account-tab.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.2rem;
    height: 2px;
    background: #7a4a1e;
    border-radius: 2px;
  }

  .tab-panel {
    display: none;
  }

  .tab-panel.is-active {
    display: block;
  }

  #canvas-output-slot {
    display: none;
  }

  #canvas-output-slot.tab-panel.is-active {
    display: block;
  }

  .canvas-output {
    border: none;
    padding: 0;
    border-radius: 0;
    background: transparent !important;
  }

  .output-top,
  .output-top.has-tags,
  #canvas-host {
    height: 100%;
  }

  #canvas-host {
    background: var(--panel-bg);
  }

  .prompt-card {
    padding-bottom: 36px;
  }

  .canvas-empty {
    display: none;
  }

  .view-output {
    display: none !important;
  }

  body.ai-tab-output .prompt-card-bottom {
    display: none !important;
  }

  body.ai-tab-output .prompt-card-top,
  body.ai-tab-output .prompt-cards {
    display: none !important;
  }

  body.ai-tab-output .canvas-input {
    display: none !important;
  }

  .canvas-dialog,
  .prompt-dialog,
  .prompt-rename-dialog,
  .prompt-delete-dialog {
    height: calc(100vh - var(--header-height, 68px));
    max-height: calc(100vh - var(--header-height, 68px));
  }

  .canvas-dialog-inner,
  .prompt-dialog-inner {
    height: 100%;
    max-height: 100%;
  }

  .prompt-dialog-scroll {
    max-height: 100%;
  }

  #dialog-audit-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  #dialog-audit-list {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
  }

  .history-toggle {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
  }
}

@media (max-width: 640px) {
  .dashboard,
  .ci-dashboard,
  .ai-dashboard {
    padding: 1rem;
  }

  .prompt-card {
    padding-bottom: 36px;
  }

  .ai-dashboard {
    padding: 4rem 1rem 1rem 1rem;
  }

  .rag-admin-dashboard {
    padding: 4rem 1rem 1rem 1rem;
  }
}
.timeline {
  background: var(--card);
  border-radius: 24px;
  padding: 22px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  max-width: 900px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  pointer-events: none;
}

.home-tool-panel {
  box-shadow: none;
  pointer-events: auto;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.home-tool-panel.is-hidden {
  display: none;
}

.home-tool-card.is-hidden,
.home-tool-empty.is-hidden,
.home-tool-edit-btn.is-hidden,
.home-tool-add-btn.is-hidden {
  display: none;
}

.home-tools {
  border-radius: 24px;
  padding: 0;
  border: none;
  box-shadow: none;
  max-width: none;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
  align-self: stretch;
  display: grid;
  justify-items: center;
}

.home-quick-links {
  max-width: 900px;
  width: 100%;
  margin: 0 auto 1.5rem;
  display: grid;
  gap: 1rem;
  padding: 12px 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(42, 34, 28, 0.08);
  box-shadow: 0 16px 32px rgba(42, 34, 28, 0.08);
}

.home-quick-links-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.home-quick-links-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 400;
  color: var(--ink);
  -webkit-text-fill-color: currentColor;
}

.home-quick-links-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 1rem;
}

.home-quick-links-skeleton {
  grid-column: 1 / -1;
  height: 108px;
  border-radius: 12px;
  background: linear-gradient(
    90deg,
    rgba(233, 227, 217, 0.8) 0%,
    rgba(245, 240, 232, 0.95) 50%,
    rgba(233, 227, 217, 0.8) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.home-quick-links-edit {
  flex: 0 0 auto;
}

.home-quick-links-edit,
.home-tool-more {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(42, 34, 28, 0.12);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.home-quick-links-edit {
  position: relative;
  z-index: 1;
}

.home-quick-links-edit:hover,
.home-tool-more:hover {
  background: var(--hover-bg);
  border-color: rgba(42, 34, 28, 0.32);
  transform: none;
}

.home-quick-links-edit svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-quick-link-item {
  min-height: 108px;
  padding: 0.5rem 0.35rem;
  display: grid;
  place-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--ink);
  transition: transform 160ms ease;
}

.home-quick-link-item:hover {
  transform: translateY(-2px);
}

.home-quick-link-icon {
  width: 56px;
  height: 56px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(192, 116, 42, 0.18), rgba(96, 140, 114, 0.26));
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.home-quick-link-icon svg {
  width: 24px;
  height: 24px;
  display: block;
  stroke: currentColor;
}

.home-quick-link-label {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  -webkit-text-fill-color: currentColor;
  max-width: 100%;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  max-width: 900px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  justify-items: stretch;
  align-items: stretch;
  grid-auto-rows: 200px;
}

.home-tool-card--large {
  grid-row: span 2;
}

.home-tool-card--xlarge {
  grid-row: span 3;
}

@media (max-width: 960px) {
  .home-quick-links-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .home-quick-links {
    margin-bottom: 1.25rem;
    padding: 12px 16px;
  }

  .home-quick-links-head {
    gap: 0.75rem;
  }

  .home-quick-links-grid {
    gap: 0.75rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .home-quick-link-item {
    min-height: 96px;
  }

  .home-quick-link-icon {
    width: 50px;
    height: 50px;
    border-radius: 16px;
  }

  .home-quick-link-label {
    font-size: 0.85rem;
  }
}

.home-tools-grid.is-empty {
  display: flex;
  justify-content: center;
}

.home-tools-grid.is-loading {
  display: grid;
}

.home-tool-empty {
  border-radius: 18px;
  min-height: 240px;
  display: grid;
  place-items: center;
  gap: 0;
  color: rgba(42, 34, 28, 0.5);
  font-weight: 600;
  border: 1px dashed rgba(42, 34, 28, 0.28);
  width: 100%;
  justify-self: stretch;
  background: transparent;
  cursor: pointer;
  padding: 2rem;
  text-align: center;
}

.home-tool-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(42, 34, 28, 0.2);
  display: grid;
  place-items: center;
  font-size: 28px;
}

.home-tool-empty-text {
  font-size: 1rem;
}

.home-tool-card {
  background: #f4efe6;
  border: none;
  border-radius: 18px;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.75rem;
  padding: 12px 16px;
  width: 100%;
  justify-self: stretch;
}

.home-tool-loading-card {
  display: block;
  background: transparent;
  padding: 0;
  overflow: hidden;
}

.home-tools.is-editing .home-tool-card {
  cursor: grab;
}

.home-tools.is-editing .home-tool-card.is-dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.home-tools.is-editing .home-tool-card > * {
  pointer-events: none;
}

.home-tools.is-editing .home-tool-menu-wrap,
.home-tools.is-editing .home-tool-menu-wrap * {
  pointer-events: auto;
}

.home-tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  position: static;
  background: transparent;
  border: none;
  padding: 0;
  width: auto;
  z-index: auto;
}

.home-tool-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 400;
}

.home-tool-menu-wrap {
  position: relative;
  display: none;
}

.home-tool-more {
  font-size: 20px;
  line-height: 1;
  padding: 0;
}

.home-tools.is-editing .home-tool-menu-wrap {
  display: inline-flex;
}

.home-tool-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: #fff;
  border: 1px solid rgba(42, 34, 28, 0.12);
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(42, 34, 28, 0.12);
  padding: 6px;
  min-width: 120px;
  display: none;
  z-index: 5;
}

.home-tool-menu.is-open {
  display: grid;
}

.home-tool-menu-item {
  border: none;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
}

.home-tool-menu-item:hover {
  background: rgba(192, 116, 42, 0.1);
}

.home-tool-menu-item[data-tool-remove] {
  color: var(--danger-accent) !important;
  -webkit-text-fill-color: var(--danger-accent) !important;
}

.home-tool-menu-item[data-tool-remove]:hover {
  background: rgba(208, 122, 122, 0.12);
}

.home-tool-card .history-preview {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100px;
  grid-template-rows: 100px;
  justify-content: start;
  column-gap: 1rem;
  row-gap: 0;
  max-height: 100px;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
}

.home-tool-card .history-preview.is-empty {
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: none;
  min-height: 100px;
}

.home-tool-card .history-preview-item {
  overflow: hidden;
}

.home-tool-body {
  display: grid;
  gap: 0.6rem;
  min-height: 0;
}

.home-tool-list,
.home-tool-summary-list {
  display: grid;
  gap: 0.75rem;
  min-height: 0;
}

#home-tool-schedule .home-tool-list {
  display: flex;
  align-items: stretch;
  align-content: stretch;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 0.75rem;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

#home-tool-schedule.home-tool-card--large .home-tool-list,
#home-tool-schedule.home-tool-card--xlarge .home-tool-list {
  display: block;
  overflow: hidden;
}

#home-tool-schedule .home-tool-list-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
}

.home-tool-card-skeleton-fill {
  width: 100%;
  height: 100%;
  min-height: 120px;
  border-radius: 16px;
  background: linear-gradient(
    90deg,
    rgba(233, 227, 217, 0.8) 0%,
    rgba(245, 240, 232, 0.95) 50%,
    rgba(233, 227, 217, 0.8) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.home-tool-list-item.is-skeleton {
  align-items: flex-start;
}

.home-tool-skeleton-line.title {
  width: 62%;
}

.home-tool-skeleton-line.meta {
  width: 38%;
}

.home-tool-skeleton-line.value {
  width: 56px;
}

.home-tool-list-item,
.home-tool-summary-row {
  display: grid;
  gap: 0.2rem;
  height: auto;
  min-height: 0;
  align-self: start;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(42, 34, 28, 0.12);
}

#home-tool-schedule .home-tool-list-item,
#home-tool-leave .home-tool-list-item,
#home-tool-lodging .home-tool-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  height: auto;
}

.home-tool-schedule-tile {
  display: grid;
  align-content: start;
  flex: 0 0 132px;
  gap: 0.75rem;
  aspect-ratio: 1 / 1;
  min-height: 0;
  padding: 0.9rem;
  border: 1px solid rgba(42, 34, 28, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.home-tool-schedule-tile.is-today {
  border-color: rgba(196, 122, 36, 0.58);
  box-shadow: inset 0 0 0 1px rgba(196, 122, 36, 0.18);
}

.home-tool-schedule-tile.is-skeleton {
  align-content: start;
}

.home-tool-schedule-date {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
}

.home-tool-schedule-pill-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.45rem;
  align-content: start;
  min-height: 0;
  overflow: hidden;
}

.home-tool-schedule-pill {
  display: inline-flex;
  flex: 0 0 auto;
  width: auto;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-tool-schedule-pill.schedule-member-badge {
  width: auto;
  min-height: 0;
}

.home-tool-schedule-calendar {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.5rem;
  min-height: 0;
  height: 100%;
}

.home-tool-schedule-large-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 0.75rem;
  min-height: 0;
  height: 100%;
}

.home-tool-schedule-aside {
  min-width: 0;
  min-height: 0;
  display: block;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.home-tool-schedule-aside-list {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 0.45rem;
  overflow: visible;
}

.home-tool-schedule-aside-list.is-scrollable {
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.home-tool-schedule-aside-item {
  min-width: 0;
  display: grid;
  gap: 0.3rem;
  padding: 0.45rem;
  border: 1px solid rgba(42, 34, 28, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.home-tool-schedule-aside-item.is-today {
  border-color: rgba(196, 122, 36, 0.58);
  box-shadow: inset 0 0 0 1px rgba(196, 122, 36, 0.18);
}

.home-tool-schedule-aside-date {
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.home-tool-schedule-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.home-tool-schedule-weekday {
  min-width: 0;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(42, 34, 28, 0.66);
}

.home-tool-schedule-weekday.is-weekend {
  color: #c74a4a;
}

.home-tool-schedule-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
  min-height: 0;
  height: 100%;
  grid-auto-rows: minmax(0, 1fr);
}

.home-tool-schedule-calendar-cell {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.24rem;
  padding: 0.3rem;
  border: none;
  border-radius: 12px;
  background: transparent;
  overflow: hidden;
}

.home-tool-schedule-calendar-cell.is-empty {
  background: transparent;
  border-color: transparent;
}

.home-tool-schedule-calendar-cell.is-today {
  border-color: rgba(196, 122, 36, 0.58);
  box-shadow: inset 0 0 0 1px rgba(196, 122, 36, 0.18);
  border: 1px solid rgba(196, 122, 36, 0.58);
  background: rgba(255, 248, 238, 0.92);
}

.home-tool-schedule-calendar-cell.is-skeleton {
  padding-top: 0.55rem;
  align-content: start;
}

.home-tool-schedule-calendar-day {
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  justify-self: center;
}

.home-tool-schedule-calendar-cell.has-event .home-tool-schedule-calendar-day {
  color: #b42318;
}

.home-tool-schedule-event-chip {
  background: rgba(180, 35, 24, 0.12);
  color: #b42318;
  font-size: 0.6rem;
  padding: 0.05rem 0.28rem;
  border-radius: 99px;
  font-weight: 500;
  line-height: 1.4;
}


.home-tool-schedule-more-pill {
  background: rgba(42, 34, 28, 0.08);
  color: rgba(42, 34, 28, 0.72);
}

.home-tool-card--large .home-tool-schedule-pill-grid,
.home-tool-card--xlarge .home-tool-schedule-pill-grid {
  gap: 0.3rem;
}

.home-tool-card--large .home-tool-schedule-calendar-grid {
  gap: 0;
}

.home-tool-card--xlarge .home-tool-schedule-calendar-grid {
  gap: 0.35rem;
}

.home-tool-card--xlarge .home-tool-schedule-calendar-cell {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(42, 34, 28, 0.08);
}

.home-tool-card--large .home-tool-schedule-calendar-cell .home-tool-schedule-pill-grid,
.home-tool-card--xlarge .home-tool-schedule-calendar-cell .home-tool-schedule-pill-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  gap: 0.28rem;
}

.home-tool-card--large .home-tool-schedule-calendar-cell .home-tool-schedule-pill,
.home-tool-card--xlarge .home-tool-schedule-calendar-cell .home-tool-schedule-pill {
  min-height: 0;
  padding: 0.18rem 0.45rem;
  font-size: 0.72rem;
}

.home-tool-card--large .home-tool-schedule-aside-item .home-tool-schedule-pill,
.home-tool-card--xlarge .home-tool-schedule-aside-item .home-tool-schedule-pill {
  padding: 0.26rem 0.6rem;
  font-size: 0.76rem;
  border-radius: 999px;
  width: auto;
  min-width: auto;
  height: auto;
  min-height: auto;
}

.home-tool-card--large .home-tool-schedule-calendar-cell .home-tool-schedule-pill,
.home-tool-card--xlarge .home-tool-schedule-calendar-cell .home-tool-schedule-pill {
  width: 12px;
  min-width: 12px;
  height: 12px;
  min-height: 12px;
  padding: 0;
  border-radius: 999px;
  font-size: 0;
  line-height: 0;
  background: currentColor;
  border: 1px solid currentColor;
  opacity: 1;
  overflow: hidden;
  text-indent: -9999px;
  white-space: nowrap;
}

html[data-theme="dark"] .home-tool-card--large .home-tool-schedule-calendar-cell .schedule-member-badge-1,
html[data-theme="dark"] .home-tool-card--large .home-tool-schedule-calendar-cell .schedule-member-badge-2,
html[data-theme="dark"] .home-tool-card--large .home-tool-schedule-calendar-cell .schedule-member-badge-3,
html[data-theme="dark"] .home-tool-card--large .home-tool-schedule-calendar-cell .schedule-member-badge-4,
html[data-theme="dark"] .home-tool-card--large .home-tool-schedule-calendar-cell .schedule-member-badge-5,
html[data-theme="dark"] .home-tool-card--large .home-tool-schedule-calendar-cell .schedule-member-badge-6,
html[data-theme="dark"] .home-tool-card--large .home-tool-schedule-calendar-cell .schedule-member-badge-7,
html[data-theme="dark"] .home-tool-card--large .home-tool-schedule-calendar-cell .schedule-member-badge-8,
html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell .schedule-member-badge-1,
html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell .schedule-member-badge-2,
html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell .schedule-member-badge-3,
html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell .schedule-member-badge-4,
html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell .schedule-member-badge-5,
html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell .schedule-member-badge-6,
html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell .schedule-member-badge-7,
html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell .schedule-member-badge-8 {
  border-width: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .home-tool-card--large .home-tool-schedule-calendar-cell .schedule-member-badge-1,
html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell .schedule-member-badge-1 {
  background: #5da9ff;
  color: #5da9ff;
}

html[data-theme="dark"] .home-tool-card--large .home-tool-schedule-calendar-cell .schedule-member-badge-2,
html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell .schedule-member-badge-2 {
  background: #4fd18b;
  color: #4fd18b;
}

html[data-theme="dark"] .home-tool-card--large .home-tool-schedule-calendar-cell .schedule-member-badge-3,
html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell .schedule-member-badge-3 {
  background: #ffb454;
  color: #ffb454;
}

html[data-theme="dark"] .home-tool-card--large .home-tool-schedule-calendar-cell .schedule-member-badge-4,
html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell .schedule-member-badge-4 {
  background: #c68cff;
  color: #c68cff;
}

html[data-theme="dark"] .home-tool-card--large .home-tool-schedule-calendar-cell .schedule-member-badge-5,
html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell .schedule-member-badge-5 {
  background: #ff7f96;
  color: #ff7f96;
}

html[data-theme="dark"] .home-tool-card--large .home-tool-schedule-calendar-cell .schedule-member-badge-6,
html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell .schedule-member-badge-6 {
  background: #42d4d6;
  color: #42d4d6;
}

html[data-theme="dark"] .home-tool-card--large .home-tool-schedule-calendar-cell .schedule-member-badge-7,
html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell .schedule-member-badge-7 {
  background: #ffd84d;
  color: #ffd84d;
}

html[data-theme="dark"] .home-tool-card--large .home-tool-schedule-calendar-cell .schedule-member-badge-8,
html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell .schedule-member-badge-8 {
  background: #c7d2e0;
  color: #c7d2e0;
}

.home-tool-card--large .home-tool-schedule-calendar-cell .home-tool-schedule-more-pill,
.home-tool-card--xlarge .home-tool-schedule-calendar-cell .home-tool-schedule-more-pill {
  width: auto;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0 0.3rem;
  border-radius: 999px;
  font-size: 0.62rem;
  line-height: 18px;
}

@media (max-width: 640px) {
  .home-tool-schedule-large-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .home-tool-schedule-aside-list {
    grid-template-columns: 1fr;
  }

  .home-tool-card--large .home-tool-schedule-calendar-cell .home-tool-schedule-pill-grid,
  .home-tool-card--xlarge .home-tool-schedule-calendar-cell .home-tool-schedule-pill-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start;
    gap: 0.22rem;
  }

  .home-tool-card--large .home-tool-schedule-aside,
  .home-tool-card--xlarge .home-tool-schedule-aside {
    overflow: hidden;
    min-height: 0;
    height: auto;
  }

  .home-tool-card--large .home-tool-schedule-aside-list,
  .home-tool-card--xlarge .home-tool-schedule-aside-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    grid-template-columns: unset;
    gap: 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .home-tool-card--large .home-tool-schedule-aside-item,
  .home-tool-card--xlarge .home-tool-schedule-aside-item {
    display: grid;
    align-content: start;
    flex: 0 0 120px;
    gap: 0.75rem;
    aspect-ratio: 1 / 1;
    min-height: 0;
    padding: 0.9rem;
    border-radius: 14px;
  }

  .home-tool-card--large .home-tool-schedule-aside-date,
  .home-tool-card--xlarge .home-tool-schedule-aside-date {
    font-size: 0.95rem;
  }

  .home-tool-card--large .home-tool-schedule-aside-list .home-tool-schedule-pill,
  .home-tool-card--xlarge .home-tool-schedule-aside-list .home-tool-schedule-pill {
    width: auto;
    min-width: auto;
    height: auto;
    min-height: auto;
    padding: 0.26rem 0.6rem;
    border-radius: 999px;
    opacity: 1;
    overflow: visible;
    text-indent: 0;
    white-space: nowrap;
    font-size: 0.76rem;
    line-height: normal;
  }
}

.home-tool-list-item:last-child,
.home-tool-summary-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.home-tool-list-title,
.home-tool-summary-label {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
}

.home-tool-list-meta,
.home-tool-summary-value {
  color: rgba(42, 34, 28, 0.72);
  font-size: 0.95rem;
}

#home-tool-schedule .home-tool-list-title,
#home-tool-leave .home-tool-list-title,
#home-tool-lodging .home-tool-list-title {
  min-width: 0;
}

#home-tool-schedule .home-tool-list-meta,
#home-tool-leave .home-tool-list-meta,
#home-tool-lodging .home-tool-list-meta {
  text-align: right;
  justify-self: end;
  margin-left: auto;
  white-space: nowrap;
}

.home-tool-list-empty,
.home-tool-list-more {
  margin: 0;
  color: rgba(42, 34, 28, 0.58);
  font-size: 0.95rem;
}

#home-tool-inventory .home-tool-summary-list {
  display: flex;
  justify-content: space-between;
  gap: 0;
}

#home-tool-inventory .home-tool-summary-row {
  display: grid;
  align-content: center;
  gap: 0.35rem;
  width: 100%;
  height: 100%;
  padding-bottom: 0;
  border-bottom: none;
}

#home-tool-inventory .home-tool-summary-row.is-skeleton {
  align-content: center;
}

#home-tool-inventory .home-tool-summary-label,
#home-tool-inventory .home-tool-summary-value {
  height: auto;
}

.home-tool-punch {
  justify-self: start;
  height: 36px;
  padding: 0 1rem;
  width: 100%;
}

.home-tool-punch.is-off {
  background: #496F4B;
  color: #fff;
}

.home-tool-punch.is-on {
  background: #c0742a;
  color: #fff;
}

.home-tool-punch:disabled,
.home-tool-punch-in:disabled,
.home-tool-punch-out:disabled,
.attendance-footer .btn:disabled,
.attendance-footer .cta:disabled {
  background: var(--btn-disabled-bg) !important;
  color: var(--btn-disabled-ink) !important;
  border-color: var(--btn-disabled-border) !important;
}

.home-tool-punch-row {
  display: flex;
  gap: 0.75rem;
}

.home-tool-punch-in {
  background: #496F4B;
  color: #fff;
}

.home-tool-punch-out {
  background: #c0742a;
  color: #fff;
}

.home-tool-times {
  display: flex;
  justify-content: space-between;
  gap: 0;
  font-size: 0.9rem;
  color: rgba(42, 34, 28, 0.8);
}

.home-tool-time-row {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  width: 100%;
}

.home-tool-time-label {
  color: rgba(42, 34, 28, 0.6);
}

.home-tool-time-value {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
}

.home-tool-total {
  font-size: 0.9rem;
  color: rgba(42, 34, 28, 0.7);
  font-variant-numeric: tabular-nums;
}

.attendance-dashboard {
  padding-bottom: 10rem;
}

.inventory-dashboard {
  padding: 0 2rem 2rem;
  padding-bottom: calc(4rem + env(safe-area-inset-bottom, 0px));
}

.inventory-tabs-row,
.inventory-panel.is-active {
  background: transparent !important;
}

.inventory-table-sticky-wrap {
  border: 1px solid var(--stroke);
  border-radius: 16px;
  overflow: hidden;
  background: var(--card);
}

.attendance-card {
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 0;
  box-shadow: none;
  max-width: none;
  margin: 0;
  overflow: hidden;
}

.attendance-mobile-list {
  display: none;
}

.performance-mobile-list,
.rag-mobile-list {
  display: none;
}

.attendance-mobile-card {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: var(--card);
}

.attendance-mobile-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.rag-admin-page .attendance-mobile-card-head .rag-drive-more-wrap {
  margin-left: auto;
  flex: 0 0 auto;
}

.attendance-mobile-card-head h3,
.attendance-mobile-card-head p,
.attendance-mobile-card-note,
.attendance-mobile-card-meta p {
  margin: 0;
}

.attendance-mobile-card-head h3 {
  font-size: 1rem;
}

.attendance-mobile-card-head p,
.attendance-mobile-card-note,
.attendance-mobile-card-meta strong {
  color: var(--muted);
}

.attendance-mobile-card-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 0.9rem;
}

.attendance-mobile-card-meta p {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
}

.rag-mobile-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: flex-start;
}

.rag-mobile-card-select {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  min-height: 24px;
  margin-top: 0.1rem;
}

.rag-mobile-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.attendance-mobile-card-meta span {
  color: var(--ink);
  font-weight: 600;
  text-align: right;
}

.attendance-mobile-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.performance-skeleton-line {
  display: block;
  border-radius: 999px;
}

.performance-skeleton-line.kpi {
  width: 72px;
  height: 28px;
}

.performance-skeleton-line.table {
  width: 100%;
  height: 16px;
}

.performance-skeleton-menu {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: linear-gradient(90deg, rgba(224, 214, 196, 0.35), rgba(244, 238, 227, 0.9), rgba(224, 214, 196, 0.35));
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.performance-mobile-card-skeleton h3,
.performance-mobile-card-skeleton p,
.performance-mobile-card-skeleton strong,
.performance-mobile-card-skeleton span {
  color: transparent;
}

.attendance-mobile-empty {
  padding: 1rem 0;
}

.notification-skeleton-list {
  display: grid;
  gap: 0.9rem;
}

.notification-skeleton-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.notification-skeleton-copy,
.notification-skeleton-side {
  display: grid;
  gap: 0.45rem;
  align-content: start;
}

.notification-skeleton-copy {
  flex: 1 1 auto;
}

.notification-skeleton-side {
  flex: 0 0 56px;
  justify-items: end;
}

.notification-skeleton-line {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(224, 214, 196, 0.35), rgba(244, 238, 227, 0.9), rgba(224, 214, 196, 0.35));
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  height: 12px;
}

.notification-skeleton-line.label {
  width: 52px;
}

.notification-skeleton-line.title {
  width: 140px;
  height: 16px;
}

.notification-skeleton-line.summary {
  width: 100%;
}

.notification-skeleton-line.time {
  width: 40px;
}

.notification-skeleton-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(224, 214, 196, 0.35), rgba(244, 238, 227, 0.9), rgba(224, 214, 196, 0.35));
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.attendance-title {
  margin: 0 0 12px;
  font-size: 20px;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.attendance-tabs {
  display: flex;
  gap: 0.75rem;
  max-width: none;
  margin: 0 0 12px;
  align-items: center;
  flex-wrap: nowrap;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.attendance-tab {
  cursor: pointer;
  margin: 0;
  width: auto;
  flex: 0 0 auto;
  color: #3D3D3D;
  font-family: "Metropolis", "Noto Sans TC", sans-serif !important;
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 900;
}

.attendance-tab.is-active {
  color: #c0742a;
}

.attendance-tab-divider {
  width: 1px;
  height: 18px;
  background: rgba(42, 34, 28, 0.2);
}

.attendance-tabs {
  position: relative;
}

.attendance-tabs::before {
  content: none;
}

.attendance-panel {
  display: none;
}

.attendance-panel.is-active {
  display: block;
}

.attendance-filter-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 12px;
}

.attendance-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
  margin-bottom: 8px;
}

.attendance-filter-range {
  display: flex;
  gap: 1rem;
  flex-wrap: nowrap;
  align-items: center;
  width: auto;
  flex: 0 0 auto;
}

.attendance-filter-range.is-hidden {
  display: none;
}

.attendance-filter-range input {
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(42, 34, 28, 0.18);
  font-size: 1rem;
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .account-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .account-toolbar-filters {
    width: 100%;
  }

  .account-toolbar-filters .account-search-wrap,
  .account-toolbar-filters .account-sort-wrap,
  .account-toolbar-filters .account-sort-dropdown,
  .account-toolbar-filters .dropdown-trigger {
    width: 100%;
    min-width: 0;
  }

  .account-toolbar #account-add-button {
    width: 100%;
  }

  .attendance-filter-range {
    flex-direction: row;
    flex-wrap: nowrap;
    width: 100%;
    flex: 1 1 auto;
    gap: 8px;
  }

  .attendance-filter-range input {
    flex: 1;
    min-width: 0;
  }

  .attendance-filter-sep {
    align-self: center;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .attendance-filter {
    overflow-x: visible;
  }

  .attendance-dashboard {
    overflow-x: visible;
  }

  .attendance-page .attendance-table-wrap,
  .leave-page .attendance-table-wrap,
  .performance-page .attendance-table-wrap,
  .promotion-page .attendance-table-wrap,
  .employee-accounts-page .account-table-wrap,
  .rag-admin-page .devtest-table-wrap {
    display: block;
  }

  .attendance-page .attendance-card,
  .leave-page .leave-card,
  .performance-page .attendance-card,
  .promotion-page .attendance-card,
  .employee-accounts-page .account-card,
  .rag-admin-page .dashboard {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
  }

  .attendance-page .attendance-mobile-list,
  .leave-page .attendance-mobile-list,
  .performance-page .attendance-mobile-list,
  .promotion-page .attendance-mobile-list,
  .employee-accounts-page .attendance-mobile-list,
  .rag-admin-page .attendance-mobile-list {
    display: none;
  }

  .employee-accounts-page .attendance-mobile-list,
  .employee-accounts-page .attendance-mobile-card,
  .rag-admin-page .attendance-mobile-list,
  .rag-admin-page .attendance-mobile-card {
    overflow: visible;
  }

  .attendance-page .attendance-mobile-card-meta,
  .leave-page .attendance-mobile-card-meta,
  .performance-page .attendance-mobile-card-meta,
  .promotion-page .attendance-mobile-card-meta,
  .employee-accounts-page .attendance-mobile-card-meta,
  .rag-admin-page .attendance-mobile-card-meta {
    grid-template-columns: 1fr;
  }

  .attendance-page .attendance-mobile-card,
  .leave-page .attendance-mobile-card,
  .performance-page .attendance-mobile-card,
  .promotion-page .attendance-mobile-card,
  .employee-accounts-page .attendance-mobile-card,
  .rag-admin-page .attendance-mobile-card {
    border: none;
    border-radius: 0;
    padding: 1rem;
    background: transparent;
  }

  .employee-accounts-page .attendance-mobile-card {
    position: relative;
  }

  .attendance-page .attendance-mobile-card + .attendance-mobile-card,
  .leave-page .attendance-mobile-card + .attendance-mobile-card,
  .performance-page .attendance-mobile-card + .attendance-mobile-card,
  .promotion-page .attendance-mobile-card + .attendance-mobile-card,
  .employee-accounts-page .attendance-mobile-card + .attendance-mobile-card,
  .rag-admin-page .attendance-mobile-card + .attendance-mobile-card {
    border-top: 1px solid rgba(42, 34, 28, 0.12);
  }

  .attendance-page .attendance-mobile-empty,
  .leave-page .attendance-mobile-empty,
  .performance-page .attendance-mobile-empty,
  .promotion-page .attendance-mobile-empty,
  .employee-accounts-page .attendance-mobile-empty,
  .rag-admin-page .attendance-mobile-empty {
    padding: 1rem;
  }
}

.attendance-filter-sep {
  color: rgba(42, 34, 28, 0.7);
  font-size: 0.9rem;
}

.attendance-filter-all {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-right: auto;
}

.attendance-filter-all.is-hidden {
  display: none;
}

.attendance-filter-all .dropdown-search {
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(42, 34, 28, 0.18);
  font-size: 1rem;
  width: 100%;
}

.dropdown-list {
  display: grid;
  gap: 0;
  max-height: 220px;
  overflow-y: auto;
}

.attendance-filter-quick {
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  overflow: visible;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

/* Removed account-form-field styles - using simple inline layout */

/* Orders page dropdown styling */
.orders-page .account-form-field {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 0 1 auto;
}

.orders-page .account-form-field span {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}

.orders-page .account-form-field input,
.orders-page .account-form-field .dropdown {
  flex: 0 1 auto;
}

.orders-page .account-form-field input {
  border: 1px solid rgba(42, 34, 28, 0.18);
  border-radius: 12px;
  padding: 0 12px;
  height: 40px;
  font-size: 1rem;
  font-family: inherit;
}

.orders-page .dropdown {
  position: relative;
}

.orders-page .dropdown-trigger {
  width: auto;
  min-width: 180px;
  max-width: 180px;
  border: 1px solid rgba(42, 34, 28, 0.18);
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
}

#search-order-id {
  width: auto;
  min-width: 180px;
  max-width: 180px;
}

.orders-page .dropdown-menu {
  position: absolute !important;
  top: calc(100% + 6px) !important;
  left: 0 !important;
  right: auto !important;
  bottom: auto !important;
  min-width: 180px !important;
  background: #fff !important;
  border: 1px solid rgba(42, 34, 28, 0.12) !important;
  border-radius: 10px !important;
  padding: 6px !important;
  display: none !important;
  z-index: 100 !important;
  box-shadow: 0 12px 24px rgba(42, 34, 28, 0.12) !important;
  grid-auto-flow: row !important;
}

.orders-page .dropdown-menu.is-open {
  display: grid !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.orders-page .dropdown-item {
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  min-height: 32px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.orders-page .dropdown-item:hover {
  background: rgba(42, 34, 28, 0.06);
}

.orders-page .dropdown-item.is-active {
  background: rgba(42, 34, 28, 0.12);
}

.attendance-filter-quick .dropdown .dropdown-trigger {
  display: flex !important;
  pointer-events: auto !important;
}

.attendance-filter-quick .dropdown .dropdown-menu.is-open {
  display: grid !important;
}

html[data-theme="dark"] .attendance-filter-quick .account-form-field input {
  border-color: rgba(255, 255, 255, 0.18);
  background: var(--field-bg);
  color: var(--ink);
}

html[data-theme="dark"] .attendance-filter-quick .dropdown .dropdown-trigger {
  border-color: rgba(255, 255, 255, 0.18) !important;
  background: var(--field-bg) !important;
  color: var(--ink) !important;
}

.attendance-filter-btn {
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  flex: 0 0 auto;
}

.attendance-filter-btn.is-active {
  border-color: #c0742a;
  color: #c0742a;
}

.attendance-filter-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-end;
}

.attendance-filter-total {
  font-size: 0.95rem;
  color: rgba(42, 34, 28, 0.75);
  white-space: nowrap;
}

.attendance-export-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.attendance-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: #fff;
}

.employee-accounts-page .account-card,
.employee-accounts-page .account-panel,
.employee-accounts-page .account-table-wrap {
  overflow: visible;
}

.attendance-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.attendance-table th,
.attendance-table td {
  padding: 0.85rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(42, 34, 28, 0.12);
  font-size: 0.95rem;
}

.attendance-table th {
  background: #faf7f2;
  color: rgba(42, 34, 28, 0.7);
  font-weight: 600;
}

.attendance-table th + th {
  box-shadow: inset 1px 0 0 rgba(42, 34, 28, 0.08);
}

.attendance-table th:nth-last-child(2),
.attendance-table td:nth-last-child(2) {
  min-width: 148px;
  white-space: nowrap;
}

.attendance-table th:last-child,
.attendance-table td:last-child {
  width: 1%;
  min-width: 0;
  white-space: nowrap;
}

.attendance-empty {
  text-align: center;
  color: rgba(42, 34, 28, 0.5);
  padding: 24px 0;
}

html[data-theme="dark"] .attendance-empty {
  color: #9aa5b1;
}

.attendance-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
}

.attendance-action-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.attendance-action-trigger {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(42, 34, 28, 0.16);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-sizing: border-box;
}

.attendance-action-trigger svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.attendance-action-dropdown {
  position: fixed;
  width: 168px;
  padding: 0.35rem;
  border: 1px solid rgba(42, 34, 28, 0.12);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 32px rgba(42, 34, 28, 0.16);
  box-sizing: border-box;
  display: none;
  z-index: 1200;
}

.attendance-action-dropdown.is-open {
  display: grid;
  gap: 0.2rem;
}

.attendance-action-dropdown .btn {
  width: 100%;
  justify-content: flex-start;
  border: none !important;
  background: transparent;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}

.attendance-action-dropdown .attendance-edit:hover {
  background: rgba(42, 34, 28, 0.08);
}

.attendance-action-dropdown .attendance-delete:hover {
  background: rgba(220, 38, 38, 0.08);
}

.attendance-delete {
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.58) !important;
  background: transparent;
  gap: 0.35rem;
}

.attendance-edit {
  color: rgba(42, 34, 28, 0.82);
  border: 1px solid rgba(42, 34, 28, 0.3) !important;
  background: transparent;
  gap: 0.35rem;
}

.attendance-edit:hover {
  background: rgba(42, 34, 28, 0.08);
}

.attendance-delete:hover {
  background: rgba(220, 38, 38, 0.08);
}

.attendance-edit .rag-action-icon,
.attendance-delete .rag-action-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

html[data-theme="dark"] .attendance-action-trigger {
  background: #2a2f38;
  border-color: var(--stroke);
  color: var(--ink);
}

html[data-theme="dark"] .attendance-action-dropdown {
  background: #242a33;
  border-color: var(--stroke);
  color: var(--ink);
}

html[data-theme="dark"] .attendance-action-dropdown .btn {
  color: var(--ink);
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .attendance-action-dropdown .btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .attendance-action-dropdown .attendance-delete {
  color: #f28b82;
}

html[data-theme="dark"] .attendance-action-dropdown .attendance-delete:hover {
  background: rgba(242, 139, 130, 0.12);
}

html[data-theme="dark"] .performance-action-trigger {
  background: #242a33;
  border-color: var(--stroke);
  color: var(--ink);
}

html[data-theme="dark"] .performance-action-trigger:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.28);
}

html[data-theme="dark"] .performance-action-dropdown {
  background: #242a33;
  border-color: var(--stroke);
  color: var(--ink);
}

html[data-theme="dark"] .performance-action-dropdown .btn {
  color: var(--ink);
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .performance-action-dropdown .btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .performance-action-dropdown .performance-delete {
  color: #f28b82 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .performance-action-dropdown .performance-delete:hover {
  background: rgba(242, 139, 130, 0.12);
}

html[data-theme="dark"] #performance-action-delete,
html[data-theme="dark"] #performance-action-delete:not(:disabled) {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #f28b82 !important;
  -webkit-text-fill-color: #f28b82 !important;
  filter: none !important;
}

html[data-theme="dark"] #performance-action-delete:hover:not(:disabled) {
  background: rgba(242, 139, 130, 0.12) !important;
  border: none !important;
  box-shadow: none !important;
  color: #f28b82 !important;
  -webkit-text-fill-color: #f28b82 !important;
  filter: none !important;
}

.attendance-makeup-error {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--danger-accent);
}

.leave-dashboard {
  padding: 0 2rem 2rem;
}

.performance-dashboard {
  padding: 0 2rem 2rem;
}

@media (min-width: 1281px) {
  .dashboard {
    padding-top: 5rem;
  }

  .dashboard-home {
  }

  .ci-dashboard,
  .inventory-dashboard,
  .leave-dashboard,
  .performance-dashboard,
  .lodging-dashboard {
    padding-top: 5rem;
  }

  body.pos-page .dashboard,
  body.lodging-page .dashboard {
    padding-top: 5rem;
  }

  body.schedule-page .schedule-dashboard {
    padding-top: 5rem;
    padding-left: 2rem;
    padding-right: 2rem;
    padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 1280px) {
  .performance-dashboard {
    padding: 1rem;
  }
}

.performance-toolbar {
  display: grid;
  gap: 1rem;
  margin-bottom: 12px;
}

.performance-page .performance-dashboard,
.performance-page .performance-toolbar,
.performance-page .attendance-filter.performance-filter {
  max-width: 100%;
  min-width: 0;
  overflow-x: visible;
}

.leave-page .attendance-filter.leave-filter {
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.performance-page .attendance-card,
.performance-page .attendance-table-wrap {
  max-width: 100%;
}

.performance-filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
}

.performance-table {
  min-width: 1360px;
}

.performance-table th,
.performance-table td {
  white-space: nowrap;
}

.performance-table th:last-child,
.performance-table td:last-child {
  width: 1%;
  min-width: 0;
  white-space: nowrap;
}

.performance-qty {
  font-variant-numeric: tabular-nums;
}

.performance-action-column {
  text-align: left;
  vertical-align: middle;
}

.performance-action-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.performance-action-trigger {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(42, 34, 28, 0.16);
  background: #fff;
  color: rgba(42, 34, 28, 0.78);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-sizing: border-box;
}

.performance-action-trigger svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.performance-action-trigger:hover:not(:disabled) {
  background: var(--hover-bg);
  border-color: rgba(42, 34, 28, 0.32);
}

.performance-action-dropdown {
  position: fixed;
  width: 168px;
  padding: 0.35rem;
  border: 1px solid rgba(42, 34, 28, 0.12);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 32px rgba(42, 34, 28, 0.16);
  box-sizing: border-box;
  display: none;
  z-index: 1200;
}

.performance-action-dropdown.is-open {
  display: grid;
  gap: 0.2rem;
}

.performance-action-dropdown .btn {
  width: 100%;
  justify-content: flex-start;
  border: none !important;
  background: transparent !important;
  color: rgba(42, 34, 28, 0.82);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  box-shadow: none !important;
}

.performance-action-dropdown .btn:hover:not(:disabled) {
  background: rgba(42, 34, 28, 0.08);
}

.performance-delete {
  color: #dc2626 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.performance-action-dropdown .performance-delete:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.08) !important;
}

#performance-action-delete,
#performance-action-delete:not(:disabled) {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #dc2626 !important;
  -webkit-text-fill-color: #dc2626 !important;
}

#performance-action-delete:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.08) !important;
  border: none !important;
  box-shadow: none !important;
  color: #dc2626 !important;
  -webkit-text-fill-color: #dc2626 !important;
}

.leave-toolbar {
  display: grid;
  gap: 1rem;
  margin-bottom: 12px;
}

.leave-panel {
  display: none;
}

.leave-panel.is-active {
  display: block;
}

.leave-summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.leave-summary-card {
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  display: grid;
  gap: 0.35rem;
}

.leave-summary-label {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(42, 34, 28, 0.62);
}

.leave-summary-value {
  margin: 0;
  font-size: 1rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.leave-table {
  min-width: 1080px;
}

.leave-table th {
  background: #faf7f2;
  color: var(--muted);
}

.leave-table th,
.leave-table td {
  white-space: nowrap;
}

.leave-note-cell {
  max-width: 240px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.leave-status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.82rem;
  border: 1px solid rgba(42, 34, 28, 0.22);
  color: rgba(42, 34, 28, 0.75);
  background: rgba(42, 34, 28, 0.06);
}

.leave-status-pill.is-submitted {
  color: #8a6d1d;
  border-color: rgba(138, 109, 29, 0.5);
  background: rgba(205, 162, 48, 0.12);
}

.leave-status-pill.is-cancelled {
  color: #8b5d5d;
  border-color: rgba(139, 93, 93, 0.45);
  background: rgba(139, 93, 93, 0.1);
}

.leave-status-pill.is-approved {
  color: #1c6b42;
  border-color: rgba(28, 107, 66, 0.42);
  background: rgba(28, 107, 66, 0.1);
}

.leave-status-pill.is-rejected {
  color: #8f2f2f;
  border-color: rgba(143, 47, 47, 0.42);
  background: rgba(143, 47, 47, 0.1);
}

.leave-actions {
  white-space: nowrap;
  vertical-align: middle;
}

.leave-actions .btn + .btn {
  margin-left: 0.45rem;
}

.leave-cancel {
  color: #111111;
  border: 1px solid rgba(17, 17, 17, 0.5) !important;
  background: transparent;
  gap: 0.35rem;
}

.leave-cancel:hover {
  color: #111111;
  background: rgba(17, 17, 17, 0.08);
  border-color: rgba(17, 17, 17, 0.5) !important;
}

.leave-approve {
  color: #1c6b42;
  border: 1px solid rgba(28, 107, 66, 0.5) !important;
  background: transparent;
  gap: 0.35rem;
}

.leave-approve:hover {
  color: #1c6b42;
  background: rgba(28, 107, 66, 0.1);
  border-color: rgba(28, 107, 66, 0.5) !important;
}

.leave-reject {
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.5) !important;
  background: transparent;
  gap: 0.35rem;
}

.leave-reject:hover {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.5) !important;
}

.leave-apply-inner {
  max-width: 560px;
}

.leave-apply-form {
  gap: 0.9rem;
  padding: 1rem;
}

.leave-apply-inner > .account-dialog-actions {
  position: static;
}

.leave-mode-group {
  border: 1px solid rgba(42, 34, 28, 0.14);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  margin: 0;
  display: grid;
  gap: 0.45rem;
}

.leave-mode-group legend {
  padding: 0 0.2rem;
  font-size: 0.9rem;
  color: rgba(42, 34, 28, 0.72);
}

.leave-mode-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
}

.leave-time-fields {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: 1fr;
}

.leave-time-fields.is-hidden {
  display: none;
}

.leave-type-dropdown {
  width: 100%;
  min-width: 0;
}

.leave-type-dropdown .dropdown-menu {
  width: 100%;
  min-width: 100%;
  left: 0;
  right: 0;
}

.account-role-dropdown .dropdown-menu {
  top: auto;
  bottom: calc(100% + 6px);
}

#account-dialog .dropdown.account-role-dropdown .dropdown-menu,
#account-edit-dialog .dropdown.account-role-dropdown .dropdown-menu,
#schedule-create-dialog .dropdown.account-role-dropdown .dropdown-menu {
  top: calc(100% + 6px) !important;
  bottom: auto !important;
  left: 0;
  right: 0;
  width: 100%;
  min-width: 100%;
  z-index: 20;
  max-height: min(280px, 40vh);
  overflow-y: auto;
}

#schedule-create-dialog .dropdown.account-role-dropdown .dropdown-menu {
  max-height: min(220px, calc(100dvh - 320px));
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.account-permissions-group {
  margin: 0;
  border: 1px solid rgba(42, 34, 28, 0.12);
  border-radius: 14px;
  padding: 0.9rem;
  display: grid;
  gap: 0.8rem;
}

.account-permissions-group legend {
  padding: 0 0.25rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: rgba(42, 34, 28, 0.78);
}

.account-permissions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.account-permission-chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid rgba(42, 34, 28, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: rgba(42, 34, 28, 0.84);
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  padding: 0.75rem;
}

.account-permission-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.account-permission-chip:has(input:checked) {
  border-color: rgba(196, 122, 36, 0.7);
  background: rgba(247, 226, 192, 0.56);
  color: #9b5d17;
}

.account-permission-chip:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.8;
}

.account-capabilities-group {
  margin-top: -0.2rem;
}

html[data-theme="dark"] .account-permissions-group {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(18, 22, 29, 0.35);
}

html[data-theme="dark"] .account-permissions-group legend {
  color: rgba(226, 232, 240, 0.82);
}

html[data-theme="dark"] .account-permission-chip {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(34, 40, 49, 0.92);
  color: #e7edf6;
}

html[data-theme="dark"] .account-permission-chip:has(input:checked) {
  border-color: rgba(214, 152, 74, 0.7);
  background: rgba(214, 152, 74, 0.18);
  color: #f3c98e;
}

.leave-apply-form textarea {
  width: 100%;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
  resize: vertical;
}

.leave-apply-hint {
  margin: 0;
  font-size: 0.86rem;
  color: rgba(42, 34, 28, 0.65);
  line-height: 1.5;
}

.leave-footer-note {
  margin: 0.85rem 0 0;
  line-height: 1.6;
  color: rgba(42, 34, 28, 0.78);
}

.leave-footer-note > p {
  margin: 0;
}

.leave-footer-note-list {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.leave-footer-note-list li + li {
  margin-top: 0.2rem;
}

#worklog-dialog .account-form {
  padding: 1rem 1.25rem 4.5rem;
}

.worklog-form-hint {
  margin: 0;
}

.worklog-content-cell {
  white-space: pre-wrap;
  max-width: 420px;
}

.worklog-actions-cell {
  text-align: right;
}

.worklog-mobile-card .attendance-mobile-card-head {
  align-items: flex-start;
}

@media (min-width: 641px) {
  .leave-summary-card {
    max-width: 320px;
  }

  .leave-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .leave-toolbar #leave-apply-button {
    justify-self: end;
    width: auto;
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  .performance-page .performance-dashboard,
  .performance-page .performance-toolbar,
  .performance-page .attendance-filter.performance-filter {
    overflow-x: visible;
  }

  .performance-page .attendance-card {
    width: 100%;
    max-width: 100%;
  }

  .performance-page .attendance-table-wrap {
    width: 100%;
    max-width: 100%;
  }

  .leave-dashboard {
    padding: 1rem;
  }

  .leave-summary-grid {
    display: block;
  }

  .leave-summary-card + .leave-summary-card {
    margin-top: 0.75rem;
  }

  .leave-time-fields {
    grid-template-columns: 1fr;
  }
}

.home-tool-actions {
  margin: 1.5rem auto 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.home-tool-edit-btn,
.home-tool-add-btn {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.75rem 1rem;
  line-height: 1;
  box-sizing: border-box;
}

.home-tool-edit-btn.is-active {
  background: rgba(192, 116, 42, 0.14);
  border-color: rgba(192, 116, 42, 0.48);
  color: var(--accent);
}

.add-icon,
.home-tool-add-icon {
  font-size: 18px;
  display: inline-flex;
  align-items: center;
}

.home-tool-edit-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  flex: 0 0 auto;
}

.home-tool-edit-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-tool-edit-icon-check {
  display: none;
}

.home-tool-edit-btn.is-active .home-tool-edit-icon-pencil {
  display: none;
}

.home-tool-edit-btn.is-active .home-tool-edit-icon-check {
  display: block;
}

.home-tools-options {
  display: grid;
  gap: 0.75rem;
}

.home-tools-empty {
  margin: 0;
  color: rgba(42, 34, 28, 0.6);
  font-size: 0.95rem;
}

.home-tool-option {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 18px;
  padding: 0.6rem 0.35rem;
  display: grid;
  place-items: center;
  gap: 0.75rem;
  min-height: 108px;
  color: var(--ink);
  text-align: center;
  font: inherit;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.home-tool-option:hover {
  transform: translateY(-1px);
}

#home-tools-dialog .home-tools-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#home-tools-dialog .home-tool-option {
  min-height: 108px;
  padding: 0.6rem 0.35rem;
}

#home-quick-links-dialog .home-tools-options {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#home-quick-links-dialog .home-tool-option {
  min-height: 108px;
  padding: 0.6rem 0.35rem;
}

.home-tool-option.is-selected {
  border-color: #c0742a;
  background: rgba(192, 116, 42, 0.14);
}

@media (max-width: 960px) {
  #home-tools-dialog .home-tools-options,
  #home-quick-links-dialog .home-tools-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  #home-tools-dialog .home-tools-options,
  #home-quick-links-dialog .home-tools-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

html[data-theme="dark"] .home-tool-option {
  background: transparent;
  border-color: transparent;
  color: var(--text-primary);
}

html[data-theme="dark"] .home-tool-option:hover {
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .home-tool-option.is-selected {
  border-color: #c0742a;
  background: rgba(192, 116, 42, 0.2);
  color: var(--text-primary);
}

html[data-theme="dark"] #home-tools-dialog .account-dialog-actions,
html[data-theme="dark"] #home-quick-links-dialog .account-dialog-actions {
  justify-content: flex-end;
  border-top-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] #account-dialog .account-dialog-actions-fixed,
html[data-theme="dark"] #account-edit-dialog .account-dialog-actions-fixed {
  background: #242a33;
  border-top-color: rgba(255, 255, 255, 0.08);
}

.account-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.pos-dialog-header-copy {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding: 0.75rem 1rem 0.5rem;
}

.pos-dialog-header-copy .account-dialog-title {
  padding: 0;
}

.pos-dialog-eyebrow {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(42, 34, 28, 0.62);
  letter-spacing: 0.02em;
}

.dialog-close {
  border: none;
  background: transparent;
  padding: 4px;
  cursor: pointer;
}

.dialog-close svg,
.prompt-dialog-close svg,
.pos-dialog-close svg,
.rag-qa-minimize svg {
  pointer-events: none;
}

.dialog-close svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.timeline h3 {
  margin: 0 0 16px;
  font-size: 18px;
}

.timeline-subtitle {
  margin: -8px 0 16px;
  color: rgba(42, 34, 28, 0.6);
  font-size: 14px;
}

.history-preview {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 0;
}

@media (max-width: 1200px) {
  .history-preview {
    justify-content: space-between;
  }
}

@media (max-width: 900px) {
  .history-preview {
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  .history-preview {
    justify-content: stretch;
  }
}

@media (max-width: 640px) {
  .home-tool-card .history-preview {
    row-gap: 1rem;
    column-gap: 1rem;
  }
}

.history-preview-item {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(42, 34, 28, 0.12);
  background: #f0ede6;
  aspect-ratio: 1 / 1;
  max-width: 100px;
  max-height: 100px;
  position: relative;
  flex: 0 0 calc((100% - 3rem) / 4);
}

@media (max-width: 1200px) {
  .history-preview-item {
    flex: 0 0 calc((100% - 2rem) / 3);
  }
}

@media (max-width: 900px) {
  .history-preview-item {
    flex: 0 0 calc((100% - 1rem) / 2);
  }
}

@media (max-width: 640px) {
  .history-preview-item {
    flex: 0 0 100%;
    max-width: none;
  }
}

@media (max-width: 1280px) {
  .attendance-dashboard {
    padding: 4rem 1rem 1rem 1rem;
  }

  .leave-dashboard {
    padding: 1rem;
  }

  .attendance-tabs {
    position: fixed;
    top: var(--header-height, 68px);
    left: 0;
    right: 0;
    padding: 0;
    margin: 0;
    gap: 0;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
    background: rgba(248, 245, 240, 0.95);
    backdrop-filter: blur(6px);
    z-index: 5;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .attendance-tab {
    flex: 1 1 0;
    width: auto;
    text-align: center;
    font-size: 0.9rem;
    padding: 1rem 0.9rem;
    font-weight: 900;
    color: var(--ink);
    position: relative;
    white-space: nowrap;
  }

  .attendance-tab.is-active {
    color: #7a4a1e;
  }

  .attendance-tab.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: #7a4a1e;
    border-radius: 2px;
  }

  .attendance-tab-divider {
    display: none;
    flex: 0 0 auto;
    width: 1px;
    height: 16px;
    background: rgba(42, 34, 28, 0.25);
  }

  .attendance-filter {
    align-items: center;
  }

  .attendance-filter-all {
    margin-right: auto;
  }

  .attendance-filter-quick {
    width: auto;
    flex: 0 1 auto;
    min-width: 0;
  }

  .attendance-filter-range {
    width: auto;
    flex-wrap: nowrap;
    flex: 0 0 auto;
  }

  .attendance-filter-range:not(.is-hidden) {
    display: flex;
  }

  .orders-page .dropdown-trigger {
    width: auto;
    min-width: 180px;
    max-width: 180px;
  }

  #search-order-id {
    width: auto;
    min-width: 180px;
    max-width: 180px;
  }

}

@media (max-width: 640px) {
  .attendance-filter {
    align-items: center;
  }

  .attendance-filter-all {
    margin-right: auto;
  }

  .attendance-filter-quick {
    width: auto;
    flex: 0 1 auto;
    min-width: 0;
  }

  .attendance-filter-range {
    width: 100%;
    flex-wrap: nowrap;
    flex: 1 1 auto;
  }

  .attendance-filter-range:not(.is-hidden) {
    display: flex;
  }

  .account-form-field > span:first-child {
    display: none !important;
  }

  .orders-page .dropdown-trigger {
    width: auto;
    min-width: 180px;
    max-width: 180px;
  }

  #search-order-id {
    width: auto;
    min-width: 180px;
    max-width: 180px;
  }
}

.history-preview-item.is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    #e6e2db 20%,
    #ffffff 45%,
    #e6e2db 70%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.history-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.history-thumb {
  position: relative;
}

.history-thumb.is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    100deg,
    #e6e2db 20%,
    #ffffff 45%,
    #e6e2db 70%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  z-index: 0;
}

.history-thumb.is-loading img {
  opacity: 0;
}

.history-preview-empty,
.home-tool-list-empty {
  margin: 0;
  font-size: 14px;
  color: rgba(42, 34, 28, 0.6);
  width: 100%;
  min-height: 100px;
  display: grid;
  place-items: center;
  text-align: center;
}

.home-tool-card .history-preview .history-preview-empty {
  width: 100%;
  min-height: 100px;
}

input,
textarea,
select {
  font-size: 16px;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select {
  height: 40px;
}

/* Unified input/textarea/select focus border color */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus-visible,
textarea:focus-visible,
select:focus-visible {
  border-color: #a0a0a0;
  outline: 2px solid rgba(138, 164, 255, 0.35);
  outline-offset: 0;
}

html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus-visible,
html[data-theme="dark"] textarea:focus-visible,
html[data-theme="dark"] select:focus-visible {
  border-color: #606060;
  outline: 2px solid rgba(138, 164, 255, 0.35);
  outline-offset: 0;
}

@media (max-width: 980px) {
  .ai-dashboard .canvas-output,
  .ai-dashboard .canvas-input {
    height: auto;
  }

  .ai-dashboard .prompt-card {
    overflow: visible;
  }

  .prompt-card-top,
  .prompt-cards {
    overflow: visible;
    flex: 0 0 auto;
  }

  .prompt-card-bottom {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    background: #fff;
    padding: 0.5rem 1rem;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--stroke);
    border-radius: 0;
  }

  .ai-dashboard .prompt-card {
    background: transparent;
    padding: 0;
    border: none;
    padding-bottom: 280px;
  }
}

.timeline-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed rgba(42, 34, 28, 0.15);
  font-size: 14px;
}

.timeline-item:last-child {
  border-bottom: none;
}

.status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(192, 122, 42, 0.16);
  color: var(--accent);
}

@keyframes rise {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  50% {
    background-position: 0 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.login-page .page-bg {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
}

.login-shell {
  width: 100%;
  display: flex;
  justify-content: center;
}

.login-card {
  width: min(420px, 92vw);
  background: #ffffff;
  border-radius: 24px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  padding: 32px;
  display: grid;
  gap: 12px;
}

.login-brand {
  font-size: 1.2rem;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--muted);
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
}

.login-error {
  background: #f6e2db;
  color: #7b2f1f;
  border: 1px solid rgba(123, 47, 31, 0.2);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form * {
  min-width: 0;
}

.login-form label {
  font-size: 0.85rem;
  color: var(--muted);
}

.login-form input {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
}

.login-form input:focus {
  outline: 2px solid rgba(63, 107, 86, 0.3);
  border-color: rgba(63, 107, 86, 0.6);
}

.login-submit {
  width: 100%;
  padding: 12px 16px;
  margin-top: 4px;
}

.login-forgot {
  margin-top: 0.75rem;
}

@media (max-width: 1280px) {
  html.menu-open,
  body.menu-open {
    overflow: hidden;
    height: 100%;
  }

  body.menu-open .page-bg {
    overflow: hidden;
  }

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

  .hero {
    grid-template-columns: 1fr;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .side-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    width: min(360px, 72vw);
    height: 100dvh;
    border-radius: 0;
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
    z-index: 40;
    overflow: hidden;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  .shell.menu-open .side-menu {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .shell.menu-open .menu-overlay {
    display: block;
  }

  .shell.menu-open .layout,
  .shell.menu-open header {
    pointer-events: none;
  }

  .shell.menu-open .side-menu,
  .shell.menu-open .menu-overlay {
    pointer-events: auto;
  }

  .side-menu {
    min-height: auto;
  }
}

@media (max-width: 1024px) {
  .footer-inner {
    padding: 0;
  }
}

@media (min-width: 1024px) {
  .home-tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-tool-card--large {
    grid-column: span 2;
    grid-row: span 1;
  }

  .home-tool-card--xlarge {
    grid-column: span 2;
    grid-row: span 2;
  }
}

.devtest-dashboard {
  display: block;
}

.devtest-page .content {
  background: #fff;
}

.devtest-dashboard > * {
  margin-bottom: 1rem;
}

.devtest-dashboard > *:last-child {
  margin-bottom: 0;
}

.devtest-infobar {
  align-items: center;
  background: #e6f0ff;
  border: 1px solid #b9d2ff;
  border-radius: 16px;
  color: #2a2a2c;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 12px 16px;
}

.devtest-infobar-content {
  align-items: center;
  display: flex;
  gap: 8px;
}

.devtest-infobar-icon {
  align-items: center;
  border: 1px solid #2a2a2c;
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: 700;
  height: 20px;
  justify-content: center;
  line-height: 1;
  width: 20px;
}

.devtest-infobar-cta {
  white-space: nowrap;
}

.devtest-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  height: auto;
  margin: 0 0 1rem;
  padding: 0;
}

.devtest-manual {
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: #fff;
  padding: 1rem;
}

.devtest-manual-head {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.devtest-manual-title {
  margin: 0;
  font-size: 1rem;
  color: var(--ink);
}

.devtest-manual-hint {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
}

.devtest-manual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.devtest-manual-card {
  border: 1px solid rgba(42, 34, 28, 0.08);
  border-radius: 14px;
  background: #faf7f2;
  padding: 0.95rem 1rem;
}

.devtest-manual-card h4 {
  margin: 0 0 0.6rem;
  font-size: 0.96rem;
  color: var(--ink);
}

.devtest-manual-pages {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--muted);
}

.devtest-manual-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--ink);
  line-height: 1.65;
}

.devtest-manual-list li + li {
  margin-top: 0.25rem;
}


.devtest-actions {
  display: inline-flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.devtest-base {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  height: auto;
}


.devtest-table-wrap {
  border: 1px solid var(--stroke);
  border-radius: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  background: #fff;
  position: relative;
  z-index: 1;
}

.rag-admin-page .attendance-table-wrap,
.rag-admin-page .account-panel,
.rag-admin-page .account-card {
  overflow: visible;
}

.rag-admin-page .devtest-table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
}

.devtest-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.devtest-table th,
.devtest-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(42, 34, 28, 0.08);
  text-align: left;
  white-space: nowrap;
}

.devtest-table th {
  font-weight: 600;
  color: var(--muted);
  background: #faf7f2;
}

.devtest-table th .devtest-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  padding: 0;
  cursor: pointer;
}

.devtest-sort-icon {
  width: 16px;
  height: 16px;
  position: relative;
  display: inline-block;
}

.devtest-sort-icon::before,
.devtest-sort-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

.devtest-sort-icon::before {
  top: 1px;
  border-bottom: 6px solid rgba(42, 34, 28, 0.35);
}

.devtest-sort-icon::after {
  bottom: 1px;
  border-top: 6px solid rgba(42, 34, 28, 0.35);
}

.devtest-sort.is-active.asc .devtest-sort-icon::before {
  border-bottom-color: #c0742a;
}

.devtest-sort.is-active.desc .devtest-sort-icon::after {
  border-top-color: #c0742a;
}

.devtest-table tr:last-child td {
  border-bottom: none;
}

.devtest-status {
  font-weight: 600;
  color: var(--muted);
}

.devtest-status.is-running {
  color: #8b5a2b;
}

.devtest-status.is-passed {
  color: #3f6b56;
}

.devtest-status.is-failed {
  color: #b91c1c;
}

.devtest-export-row.is-hidden {
  display: none;
}

.devtest-results {
  font-size: 0.9rem;
  color: var(--muted);
}

.devtest-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(42, 34, 28, 0.15);
  font-size: 0.95rem;
}

.devtest-detail-row:last-child {
  border-bottom: none;
}

.devtest-detail-row.is-hidden {
  display: none;
}

.rag-admin-dashboard {
  display: block;
}

body.rag-admin-page .dashboard {
  right: 0;
}

.rag-admin-dashboard > * {
  margin-bottom: 1rem;
}

.rag-admin-dashboard > *:last-child {
  margin-bottom: 0;
}

.rag-qa-mask {
  display: none;
}

.rag-qa-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: min(520px, calc(100vw - 2.5rem));
  height: min(640px, calc(100vh - var(--header-height, 68px) - 2rem));
  max-height: calc(100vh - var(--header-height, 68px) - 2rem);
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  box-shadow: 0 24px 48px rgba(42, 34, 28, 0.2);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  z-index: 40;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  pointer-events: none;
  transition: opacity 180ms ease, transform 220ms ease;
}

.rag-qa-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.rag-qa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0.95rem;
  border-bottom: 1px solid rgba(42, 34, 28, 0.12);
}

.rag-qa-title {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1 1 auto;
}

.rag-qa-title h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--ink);
  font-weight: 600;
}

.rag-qa-history-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: min(320px, 100%);
}

.rag-qa-history-trigger {
  min-width: 0;
  max-width: 100%;
  height: 36px;
  border: 1px solid rgba(42, 34, 28, 0.16);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 0 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.rag-qa-history-trigger:hover {
  background: rgba(42, 34, 28, 0.05);
}

.rag-qa-history-trigger svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.rag-qa-history-trigger-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 600;
}

.rag-qa-history-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 5;
  min-width: 280px;
  max-width: min(360px, calc(100vw - 2rem));
  max-height: min(360px, 50vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border: 1px solid rgba(42, 34, 28, 0.12);
  border-radius: 14px;
  box-shadow: 0 16px 32px rgba(42, 34, 28, 0.16);
  padding: 0.4rem;
  display: grid;
  gap: 0.2rem;
}

.rag-qa-history-menu[hidden] {
  display: none !important;
}

.rag-qa-history-item {
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 10px;
  color: var(--ink);
  padding: 0.6rem 0.7rem;
  text-align: left;
  display: grid;
  gap: 0.2rem;
  cursor: pointer;
}

.rag-qa-history-item:hover {
  background: rgba(42, 34, 28, 0.05);
}

.rag-qa-history-item.is-active {
  background: rgba(193, 128, 34, 0.12);
  color: #9c6014;
}

.rag-qa-history-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rag-qa-history-item-preview {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rag-qa-history-empty {
  padding: 0.8rem 0.7rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.rag-qa-header-ring {
  width: 14px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  color: #3d3d3d;
  display: inline-block;
  position: relative;
  flex: 0 0 auto;
}

.rag-qa-header-ring::after {
  content: "";
  position: absolute;
  width: 3px;
  height: 3px;
  right: 1px;
  top: 1px;
  border-radius: 999px;
  background: currentColor;
}

.rag-qa-minimize {
  border: none;
  background: transparent;
  padding: 4px;
  border-radius: 6px;
  color: #3d3d3d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.rag-qa-minimize:hover {
  background: rgba(42, 34, 28, 0.08);
}

.rag-qa-minimize svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rag-qa-toggle {
  -webkit-tap-highlight-color: transparent;
  /* Reset .history-toggle base styles */
  position: static;
  top: auto;
  right: auto;
  transform: none;
  writing-mode: horizontal-tb;
  text-orientation: auto;
  letter-spacing: normal;
  border-radius: 10px;
  padding: 0;
  z-index: auto;
  background: transparent;
  transition: background 0.15s ease;
}

.rag-qa-toggle-header {
  display: inline-flex;
}

.rag-qa-toggle-header.is-open {
  background: rgba(42, 34, 28, 0.08);
}

.rag-qa-toggle .rag-qa-fab-ring {
  width: 18px;
  height: 18px;
  border: 3px solid #edbc60;
  border-radius: 999px;
  display: block;
  flex: 0 0 auto;
  box-shadow: 0 0 6px rgba(237, 188, 96, 0.8), 0 0 14px rgba(237, 188, 96, 0.4), inset 0 0 5px rgba(237, 188, 96, 0.5);
}

.rag-qa-toggle-orb {
  display: none !important;
}

.rag-qa-toggle-orb .assistant-orb {
  pointer-events: none;
}

.rag-qa-toggle-orb.is-open {
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
}

@media (min-width: 641px) {
  .attendance-page .rag-qa-toggle-orb {
    bottom: 5rem;
  }
}

@media (min-width: 641px) and (max-width: 1280px) {
  .inventory-page .rag-qa-toggle-orb {
    bottom: 5rem;
  }
}

.rag-qa-messages {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0.95rem;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 0;
  height: 100%;
}

.rag-qa-empty {
  margin: 0;
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  padding: 0 0.75rem;
}

.rag-qa-empty .assistant-orb {
  align-self: center;
  margin-bottom: 1.25rem;
}

.rag-qa-empty-title {
  margin: 0 0 0.75rem 0;
  color: #3D3D3D;
  font-weight: 400;
}

.rag-qa-empty-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.65;
  color: #6d6258;
}

.rag-qa-message {
  margin: 0;
  max-width: 92%;
  border-radius: 12px;
  padding: 0.55rem 0.68rem;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.rag-qa-message.user {
  align-self: flex-end;
  background: #f1ece2;
  color: var(--ink);
}

.rag-qa-message.bot {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  color: var(--ink);
}

.rag-qa-message.bot.is-loading {
  padding: 0.25rem 0;
  min-height: 36px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rag-qa-message.bot.is-loading .rag-qa-skeleton {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(
    100deg,
    rgba(166, 166, 166, 0.8) 20%,
    rgba(210, 210, 210, 1) 45%,
    rgba(166, 166, 166, 0.8) 70%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

html[data-theme="dark"] .rag-qa-message.bot.is-loading .rag-qa-skeleton {
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0.14) 20%,
    rgba(255, 255, 255, 0.5) 45%,
    rgba(255, 255, 255, 0.14) 70%
  );
}

.rag-qa-input-wrap {
  display: flex;
  flex-direction: column;
  margin: 12px;
  border: 1px solid rgba(42, 34, 28, 0.12);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.rag-qa-textarea-section {
  padding: 0;
}

#rag-qa-input {
  width: 100%;
  border: none;
  min-height: 100px;
  padding: 0.75rem;
  font-size: 16px;
  line-height: 1.5;
  resize: none;
  background: #fff;
}

.rag-qa-toolbar {
  position: relative;
  padding: 12px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.75rem;
  border-top: 1px solid rgba(42, 34, 28, 0.12);
}

.rag-qa-attach {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(42, 34, 28, 0.24);
  background: transparent;
  color: #9b9b9b;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.rag-qa-attach svg {
  width: 18px;
  height: 18px;
  display: block;
}

.rag-qa-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.rag-qa-selection-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.rag-qa-send {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #e6e6e6;
  color: #9b9b9b;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.rag-qa-send {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: #ede7dc;
  color: #6d6258;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: none;
}

.rag-qa-send.is-ready,
.rag-qa-send.is-sending {
  background: #3d3d3d;
  color: #fff;
}

.rag-qa-send svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
}

.rag-qa-selection-pill {
  position: absolute;
  left: 1.45rem;
  bottom: 1.65rem;
  font-size: 0.75rem;
  line-height: 1;
  background: rgba(95, 143, 120, 0.1);
  color: #4a7a63;
  border: 1px solid rgba(95, 143, 120, 0.3);
  border-radius: 999px;
  padding: 0.22rem 0.6rem 0.22rem 0.45rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: default;
}
.rag-qa-selection-pill[hidden] {
  display: none !important;
}

.btn[hidden],
.cta[hidden] {
  display: none !important;
}

.rag-qa-selection-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: inherit;
  line-height: 1;
  flex: 0 0 auto;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.rag-qa-selection-clear svg {
  pointer-events: none;
  display: block;
}

html[data-theme="dark"] .rag-qa-selection-pill {
  background: rgba(95, 143, 120, 0.15);
  color: #7fbfa3;
  border-color: rgba(95, 143, 120, 0.35);
}

@media (max-width: 980px) {
  .rag-qa-panel {
    right: 12px;
    bottom: 12px;
    width: min(520px, calc(100vw - 1.5rem));
    height: min(70vh, 580px);
    max-height: calc(100vh - var(--header-height, 68px) - 1rem);
  }
}

@media (max-width: 640px) {
  .rag-qa-title h4 {
    display: none;
  }

  .rag-qa-history-dropdown {
    max-width: min(220px, 100%);
  }

  .rag-qa-history-menu {
    min-width: min(260px, calc(100vw - 2rem));
  }

  .rag-qa-mask {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 31;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body:has(.rag-qa-panel.open) .rag-qa-mask {
    opacity: 1;
    pointer-events: auto;
  }

  .rag-qa-panel {
    left: 0;
    right: 0;
    bottom: 0;
    top: var(--header-height, 68px);
    width: 100vw;
    height: auto;
    max-height: none;
    border-radius: 16px 16px 0 0;
    opacity: 1;
    z-index: 32;
    transform: translateY(100%);
    transition: transform 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }

  .rag-qa-panel.open {
    transform: translateY(0);
  }
}

html[data-theme="dark"] .rag-qa-panel {
  background: #1d222a;
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 26px 52px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .rag-qa-header,
html[data-theme="dark"] .rag-qa-input-wrap {
  border-color: rgba(255, 255, 255, 0.12);
  background: #1d222a;
}

html[data-theme="dark"] .rag-qa-title h4 {
  color: var(--text-primary);
}

html[data-theme="dark"] .rag-qa-history-trigger {
  background: #20262f;
  color: #e6ebf2;
  border-color: rgba(255, 255, 255, 0.14);
}

html[data-theme="dark"] .rag-qa-history-trigger:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .rag-qa-history-menu {
  background: #20262f;
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.32);
}

html[data-theme="dark"] .rag-qa-history-item {
  color: #e6ebf2;
}

html[data-theme="dark"] .rag-qa-history-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .rag-qa-history-item.is-active {
  background: rgba(193, 128, 34, 0.18);
  color: #f0c27b;
}

html[data-theme="dark"] .rag-qa-history-item-preview,
html[data-theme="dark"] .rag-qa-history-empty {
  color: var(--text-secondary);
}

html[data-theme="dark"] .rag-qa-header-ring {
  color: #dbe2ec;
}

html[data-theme="dark"] .rag-qa-minimize {
  color: #dbe2ec;
}

html[data-theme="dark"] .rag-qa-minimize:hover {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .rag-qa-empty-title {
  color: var(--text-primary);
}

html[data-theme="dark"] .rag-qa-empty-text {
  color: var(--text-secondary);
}

html[data-theme="dark"] .rag-qa-message.user {
  background: #2b3240;
  color: #e6ebf2;
}

html[data-theme="dark"] .rag-qa-message.bot {
  background: none;
  border: none;
  color: #e6ebf2;
}

html[data-theme="dark"] #rag-qa-input {
  background: #20262f;
  color: #e6ebf2;
  border-color: rgba(255, 255, 255, 0.16);
}

/* .rag-qa-toggle is transparent; the orb handles its own visuals */

.holdings-grid {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

.holdings-grid:not(:empty),
.holdings-grid.has-items,
.holdings-grid.has-holdings,
.holdings-grid[data-has-holdings="true"] {
  margin-bottom: 8rem !important;
  padding-bottom: calc(8rem + env(safe-area-inset-bottom, 0px)) !important;
  scroll-padding-bottom: calc(8rem + env(safe-area-inset-bottom, 0px)) !important;
}

.holdings-panel .holdings-grid:not(:empty),
.holdings-panel .holdings-grid.has-items,
.holdings-panel .holdings-grid.has-holdings,
.holdings-panel .holdings-grid[data-has-holdings="true"] {
  padding-bottom: calc(10rem + env(safe-area-inset-bottom, 0px)) !important;
  scroll-padding-bottom: calc(10rem + env(safe-area-inset-bottom, 0px)) !important;
}

.holdings-panel .holdings-grid .holdings-table-card {
  padding-bottom: calc(10rem + env(safe-area-inset-bottom, 0px)) !important;
  scroll-padding-bottom: calc(10rem + env(safe-area-inset-bottom, 0px)) !important;
}

.holdings-panel .holdings-grid .holdings-table-card .table-wrap,
.holdings-panel .holdings-grid .holdings-table-card .holdings-table-wrap,
.holdings-panel .holdings-grid .holdings-table-card .table-responsive {
  padding-bottom: calc(10rem + env(safe-area-inset-bottom, 0px)) !important;
  scroll-padding-bottom: calc(10rem + env(safe-area-inset-bottom, 0px)) !important;
}

.rag-admin-header {
  display: block;
  position: relative;
  z-index: 2;
  overflow: visible;
}

.rag-admin-search {
  min-width: 0;
  width: 100%;
  max-width: 320px;
  grid-area: search;
}

.rag-drive-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas:
    "tabs tabs tabs"
    "meta meta meta"
    "search type upload";
  align-items: center;
  column-gap: 1rem;
  row-gap: 0.75rem;
  width: 100%;
  overflow: visible;
  position: relative;
  z-index: 20;
}

.rag-drive-controls > * {
  flex-shrink: 0;
}

.rag-type-filter {
  grid-area: type;
  width: 140px;
  position: relative;
  z-index: 50;
}

.rag-type-filter .dropdown-trigger {
  border: 1px solid rgba(42, 34, 28, 0.18);
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  min-height: 40px;
  height: 40px;
  justify-content: space-between;
  width: 100%;
}

.rag-type-filter .dropdown-menu {
  width: 100%;
}

.rag-drive-tabs {
  grid-area: tabs;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.rag-drive-tabs .ai-tab {
  cursor: pointer;
  margin: 0;
  padding: 0;
  flex: none;
  font-family: "Noto Sans TC", "Metropolis", sans-serif !important;
  font-size: 1.5rem;
  color: #3D3D3D;
  font-weight: 900;
}

.rag-drive-tabs .ai-tab.is-active {
  color: #c0742a;
}

.rag-drive-tabs .ai-tab.is-active::after {
  content: none;
}

.rag-drive-tab-divider {
  width: 1px;
  height: 18px;
  background: rgba(42, 34, 28, 0.2);
}

.rag-folder-meta {
  display: inline-flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  grid-area: meta;
}

.rag-drive-controls[data-scope="shared"] .rag-folder-meta {
  display: none !important;
}

.rag-folder-title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  max-width: 280px;
  min-width: 0;
}

.rag-folder-title svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--muted);
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rag-folder-title-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rag-breadcrumb-link {
  border: none;
  background: transparent;
  padding: 0;
  color: var(--muted);
  font-family: "Noto Sans TC", "Metropolis", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rag-breadcrumb-link:hover {
  color: #3D3D3D;
}

.rag-folder-meta .text-btn,
.rag-folder-meta .text-btn:focus-visible,
.rag-folder-meta .text-btn:active {
  color: var(--muted);
}

.rag-folder-meta .text-btn:hover {
  color: #3D3D3D;
}

.rag-folder-title svg,
.rag-folder-title:hover svg {
  color: var(--muted);
}

.rag-breadcrumb-sep {
  color: var(--muted);
}

.rag-drive-more-wrap {
  position: relative;
}

.rag-drive-more-trigger {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}

.rag-drive-more-trigger svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.rag-drive-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: grid;
  gap: 4px;
  z-index: 8;
}

.rag-drive-more-menu[hidden] {
  display: none !important;
}

.rag-drive-more-item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--ink);
}

.rag-drive-more-item-danger {
  color: #dc2626;
  -webkit-text-fill-color: #dc2626;
}

.rag-drive-more-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.rag-drive-more-item-danger:hover {
  background: rgba(220, 38, 38, 0.08);
}

.btn.secondary.rag-open-upload-inline {
  grid-area: upload;
  width: auto !important;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #c0742a;
  color: #fff;
  border: 1px solid #c0742a;
}

.btn.secondary.rag-open-upload-inline:hover {
  background: #a8601f;
  border-color: #a8601f;
  color: #fff;
}

.rag-open-upload-inline svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rag-check-col {
  width: 44px;
  text-align: center;
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
}

.rag-check-col input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.rag-admin-table thead .rag-check-col {
  background: #faf7f2;
  z-index: 4;
}

.rag-google-empty {
  border: 1px dashed var(--stroke);
  border-radius: 14px;
  background: #fff;
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
  justify-items: center;
  text-align: center;
}

.rag-google-empty h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--ink);
}

.rag-google-empty p {
  margin: 0;
  color: var(--muted);
}

.rag-drive-controls[hidden],
#rag-open-upload[hidden],
.rag-google-empty[hidden],
.rag-admin-dashboard .devtest-table-wrap[hidden] {
  display: none !important;
}

.google-g-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1;
  background: conic-gradient(
    #4285f4 0deg 90deg,
    #34a853 90deg 180deg,
    #fbbc05 180deg 270deg,
    #ea4335 270deg 360deg
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.profile-google-bind {
  gap: 0.5rem;
  flex-wrap: wrap;
}

.profile-google-bind [hidden] {
  display: none !important;
}

.rag-admin-upload {
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: #fff;
  padding: 1rem;
}

.rag-admin-upload .account-form {
  display: grid;
  gap: 1rem;
}

.rag-upload-drop {
  border: 2px dashed rgba(42, 34, 28, 0.25);
  border-radius: 8px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(42, 34, 28, 0.7);
  cursor: pointer;
  text-align: center;
  position: relative;
  transition: all 0.2s ease;
  background: #fafafa;
}

.rag-upload-drop:hover {
  border-color: #1976d2;
  background: #f0f7ff;
}

.rag-upload-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.rag-upload-icon {
  font-size: 48px;
  color: #1976d2;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.rag-upload-text {
  font-size: 14px;
  color: var(--articles-text);
  font-weight: 500;
}

.rag-upload-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.rag-admin-table .rag-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
  align-items: center;
}

.rag-admin-table .rag-actions .btn {
  width: auto;
  min-width: 0;
  flex: 0 0 auto;
  gap: 0.35rem;
}

.rag-action-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rag-admin-table .rag-delete-drive,
.rag-admin-table .rag-remove {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.5);
}

.rag-admin-table .rag-delete-drive:hover,
.rag-admin-table .rag-remove:hover {
  background: rgba(220, 38, 38, 0.08);
}

.rag-name-main {
  font-weight: 400;
  line-height: 1.3;
}

.rag-name-link {
  border: none;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}

.rag-name-link:hover {
  color: #87644E;
  text-decoration: underline;
}

.rag-name-meta {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.rag-type-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.rag-type-icon {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}

.rag-type-icon::before {
  content: "檔";
}

.rag-type-folder {
  background: #87644E;
}
.rag-type-folder::before {
  content: "夾";
}

.rag-type-pdf {
  background: #dc2626;
}
.rag-type-pdf::before {
  content: "PDF";
  font-size: 8px;
}

.rag-type-ppt {
  background: #f59e0b;
}
.rag-type-ppt::before {
  content: "PPT";
  font-size: 8px;
}

.rag-type-doc {
  background: #2563eb;
}
.rag-type-doc::before {
  content: "DOC";
  font-size: 8px;
}

.rag-type-sheet {
  background: #16a34a;
}
.rag-type-sheet::before {
  content: "XLS";
  font-size: 8px;
}

.rag-type-image {
  background: #e11d48;
}
.rag-type-image::before {
  content: "圖";
}

.rag-type-video {
  background: #7c3aed;
}
.rag-type-video::before {
  content: "影";
}

.rag-type-file {
  background: #6b7280;
}

.rag-admin-table {
  min-width: 860px;
}

.rag-share-item {
  display: flex;
  width: 100%;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
}

.account-form label.rag-share-item {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
}

.rag-share-item input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

.rag-share-item-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rag-share-dropdown .dropdown-menu {
  left: 0;
  right: auto;
  width: 100%;
  max-height: 240px;
  overflow-y: auto;
}

.rag-share-dropdown .dropdown-trigger {
  border: 1px solid rgba(42, 34, 28, 0.18);
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  min-width: 240px;
  height: 40px;
  justify-content: space-between;
  width: 100%;
}

.rag-share-drive-role-dropdown {
  width: 100%;
}

.rag-share-drive-email-dropdown {
  width: 100%;
}

.rag-share-drive-email-dropdown .dropdown-trigger,
.rag-share-drive-role-dropdown .dropdown-trigger {
  border: 1px solid rgba(42, 34, 28, 0.18);
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  min-height: 40px;
  height: 40px;
  justify-content: space-between;
  width: 100%;
}

.rag-share-drive-email-dropdown .dropdown-menu,
.rag-share-drive-role-dropdown .dropdown-menu {
  width: 100%;
}

.rag-share-drive-email-dropdown .dropdown-menu {
  max-height: 260px;
  overflow: hidden;
}

.rag-share-drive-email-dropdown .dropdown-search {
  width: calc(100% - 1rem);
  height: 40px;
  margin: 0.5rem;
  border-radius: 12px;
  border: 1px solid rgba(42, 34, 28, 0.18);
  padding: 0 12px;
  font: inherit;
}

.rag-share-drive-email-dropdown .dropdown-list {
  max-height: 180px;
  overflow-y: auto;
}

.rag-admin-table .btn {
  white-space: nowrap;
}

.rag-preview-dialog .account-dialog-body {
  padding-top: 0.5rem;
  padding-right: 1rem;
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  padding-left: 1rem;
  display: grid;
  gap: 0.75rem;
}

.rag-preview-dialog .account-dialog-actions,
.rag-upload-dialog .account-dialog-actions,
.rag-share-drive-dialog .account-dialog-actions {
  justify-content: flex-end;
  padding: 0.9rem 1rem;
  justify-content: flex-end;
}

#rag-upload {
  background: #496f4b;
  border-color: #496f4b;
  color: #fff;
}

#rag-upload:hover {
  background: #3f6b56;
  border-color: #3f6b56;
  color: #fff;
}

.rag-delete-dialog .account-dialog-body {
  padding-top: 0.5rem;
  padding-right: 1rem;
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  padding-left: 1rem;
}

.rag-delete-dialog .account-dialog-actions {
  justify-content: flex-end;
  padding: 0.9rem 1rem;
}

.attendance-delete-dialog .account-dialog-body {
  padding-top: 0.5rem;
  padding-right: 1rem;
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  padding-left: 1rem;
}

.attendance-delete-dialog .account-dialog-actions {
  justify-content: flex-end;
  padding: 0.9rem 1rem;
}

#schedule-delete-dialog .account-dialog-body {
  padding-top: 0.5rem;
  padding-right: 1rem;
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  padding-left: 1rem;
  margin-bottom: 1rem;
}

#schedule-delete-dialog .account-dialog-actions {
  justify-content: flex-end;
  padding: 0.9rem 1rem;
}

.performance-delete-dialog[open] {
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  display: grid;
  place-items: center;
}

.performance-delete-dialog .account-dialog-inner {
  width: min(420px, calc(100vw - 32px));
}

.performance-delete-dialog .account-dialog-body {
  padding-top: 0.5rem;
  padding-right: 1rem;
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  padding-left: 1rem;
}

.performance-delete-dialog .account-dialog-actions {
  justify-content: flex-end;
  padding: 0.9rem 1rem;
}

.rag-folder-dialog .account-dialog-body {
  padding-top: 0.5rem;
  padding-right: 1rem;
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  padding-left: 1rem;
  display: grid;
  gap: 0.75rem;
}

.rag-folder-dialog .account-dialog-actions {
  justify-content: flex-end;
  padding: 0.9rem 1rem;
}

.rag-folder-search {
  width: 100%;
}

.rag-folder-list {
  display: grid;
  gap: 0.5rem;
  max-height: 320px;
  overflow-y: auto;
}

.rag-folder-list-item {
  width: 100%;
  border: 1px solid rgba(42, 34, 28, 0.16);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  font-size: 0.75rem;
  line-height: 1.4;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.rag-folder-list-item.is-selected {
  border-color: #87644E;
  background: rgba(135, 100, 78, 0.08);
}

.rag-folder-list-empty {
  color: var(--muted);
  padding: 0.5rem 0.25rem;
}

.rag-preview-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.rag-preview-note {
  color: #a06a2a;
}

.rag-preview-content {
  background: #f8f8f8;
  border-radius: 12px;
  padding: 0.75rem;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
}

#devtest-detail-dialog .account-dialog-body {
  padding-top: 0.5rem;
  padding-right: 1rem;
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  padding-left: 1rem;
  display: grid;
  gap: 0.75rem;
}

#devtest-detail-dialog .account-dialog-actions {
  justify-content: flex-end;
  padding: 0.9rem 1rem;
  margin-top: 0.5rem;
}

@media (max-width: 768px) {
  .devtest-infobar {
    align-items: flex-start;
    flex-direction: column;
  }

  .rag-admin-header {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .rag-drive-controls {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "tabs tabs"
      "meta meta"
      "search type"
      "upload upload";
  }

  .rag-drive-tabs {
    position: fixed;
    top: var(--header-height, 68px);
    left: 0;
    right: 0;
    z-index: 90;
  }

  .rag-folder-meta {
    justify-content: space-between;
  }

  .rag-admin-search {
    min-width: 0;
    max-width: none;
  }

  .rag-open-upload-inline {
    justify-self: stretch;
    width: 100% !important;
    justify-content: center;
  }

  .rag-folder-title {
    max-width: 180px;
  }

  .devtest-header {
    flex-direction: column;
    align-items: stretch;
  }

  .devtest-actions {
    justify-content: flex-start;
  }
}

@media (min-width: 769px) {
  .rag-folder-title {
    font-size: 24px;
    line-height: 1.2;
  }

  .rag-folder-title svg {
    width: 24px;
    height: 24px;
  }
}

/* Keep rag tabs in attendance-style for medium/small viewports. */
@media (max-width: 1280px) {
  .rag-drive-tabs {
    display: flex;
    position: fixed;
    top: var(--header-height, 68px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 0;
    gap: 0;
    align-items: center;
    background: #f8f5f0;
    z-index: 90;
    border-bottom: 1px solid rgba(42, 34, 28, 0.12);
  }

  .rag-drive-tabs .ai-tab {
    flex: 1;
    margin: 0;
    padding: 1rem 0;
    text-align: center;
    font-family: "Noto Sans TC", "Metropolis", sans-serif !important;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink);
    background: transparent;
    border-radius: 0;
    position: relative;
  }

  .rag-drive-tabs .ai-tab.is-active {
    color: var(--accent);
  }

  .rag-drive-tabs .ai-tab.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
  }

  .rag-drive-tab-divider {
    display: none;
    width: 1px;
    height: 20px;
    flex: 0 0 1px;
    background: rgba(42, 34, 28, 0.2);
  }
}

/* Dark theme patch: strengthen component-level coverage to avoid light remnants. */
html[data-theme="dark"] .menu-sub {
  background: #171a1f;
  border-top-color: rgba(255, 255, 255, 0.1);
  border-bottom-color: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

html[data-theme="dark"] .menu-item,
html[data-theme="dark"] .menu-sub-item,
html[data-theme="dark"] .menu-sub-item a,
html[data-theme="dark"] .menu-status,
html[data-theme="dark"] .menu-user-name,
html[data-theme="dark"] .menu-user-role,
html[data-theme="dark"] .menu-user-time,
html[data-theme="dark"] .menu-version {
  color: #d9dde4;
}

html[data-theme="dark"] .menu-sub-item,
html[data-theme="dark"] .menu-item,
html[data-theme="dark"] .side-menu-profile {
  border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .menu-item:hover,
html[data-theme="dark"] .menu-sub-item a:hover,
html[data-theme="dark"] .menu-item.active:not(summary),
html[data-theme="dark"] .menu-sub-item.active a {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .side-menu-avatar {
  background: #262b33;
  border-color: rgba(255, 255, 255, 0.18);
}

html[data-theme="dark"] .side-menu-avatar svg {
  stroke: #c2c9d4;
}

html[data-theme="dark"] .hero,
html[data-theme="dark"] .home-quick-link-card,
html[data-theme="dark"] .home-tool-card,
html[data-theme="dark"] .home-tool-empty,
html[data-theme="dark"] .history-preview,
html[data-theme="dark"] .history-preview-item,
html[data-theme="dark"] .attendance-panel,
html[data-theme="dark"] .inventory-panel,
html[data-theme="dark"] .inventory-kpi,
html[data-theme="dark"] .inventory-table-wrap,
html[data-theme="dark"] .rag-table-wrap,
html[data-theme="dark"] .attendance-table-wrap,
html[data-theme="dark"] .devtest-table-wrap,
html[data-theme="dark"] .account-table-wrap {
  background: #1d222a;
  color: #e6ebf2;
  border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .attendance-card,
html[data-theme="dark"] .leave-card {
  background: #1d222a;
  border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .attendance-mobile-card-head p,
html[data-theme="dark"] .attendance-mobile-card-note,
html[data-theme="dark"] .attendance-mobile-card-meta strong {
  color: var(--text-secondary);
}

html[data-theme="dark"] .attendance-mobile-card-meta span,
html[data-theme="dark"] .attendance-mobile-card-head h3 {
  color: var(--text-primary);
}

html[data-theme="dark"] .attendance-page .attendance-mobile-list,
html[data-theme="dark"] .leave-page .attendance-mobile-list,
html[data-theme="dark"] .performance-page .attendance-mobile-list,
html[data-theme="dark"] .promotion-page .attendance-mobile-list,
html[data-theme="dark"] .employee-accounts-page .attendance-mobile-list,
html[data-theme="dark"] .rag-admin-page .attendance-mobile-list {
  background: #1d222a;
  border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .employee-accounts-page .attendance-mobile-list,
html[data-theme="dark"] .employee-accounts-page .attendance-mobile-card {
  overflow: visible;
}

html[data-theme="dark"] .attendance-page .attendance-mobile-card + .attendance-mobile-card,
html[data-theme="dark"] .leave-page .attendance-mobile-card + .attendance-mobile-card,
html[data-theme="dark"] .performance-page .attendance-mobile-card + .attendance-mobile-card,
html[data-theme="dark"] .promotion-page .attendance-mobile-card + .attendance-mobile-card,
html[data-theme="dark"] .employee-accounts-page .attendance-mobile-card + .attendance-mobile-card,
html[data-theme="dark"] .rag-admin-page .attendance-mobile-card + .attendance-mobile-card {
  border-top-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .home-tool-header,
html[data-theme="dark"] .card-head,
html[data-theme="dark"] .inventory-panel-header {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .home-quick-link-icon {
  background: linear-gradient(135deg, rgba(207, 160, 98, 0.18), rgba(93, 123, 198, 0.26));
  color: #f2d4a7;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .account-table,
html[data-theme="dark"] .assistant-table,
html[data-theme="dark"] .rag-table,
html[data-theme="dark"] .inventory-table,
html[data-theme="dark"] .attendance-table,
html[data-theme="dark"] .devtest-table {
  color: #e6ebf2;
}

html[data-theme="dark"] .account-table th,
html[data-theme="dark"] .assistant-table th,
html[data-theme="dark"] .rag-table th,
html[data-theme="dark"] .inventory-table th,
html[data-theme="dark"] .attendance-table th,
html[data-theme="dark"] .devtest-table th {
  background: #242a33;
  color: #dbe2ec;
  border-color: rgba(255, 255, 255, 0.14);
}

html[data-theme="dark"] .account-table td,
html[data-theme="dark"] .assistant-table td,
html[data-theme="dark"] .rag-table td,
html[data-theme="dark"] .inventory-table td,
html[data-theme="dark"] .attendance-table td,
html[data-theme="dark"] .devtest-table td {
  color: #e6ebf2;
  border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .schedule-hero-card,
html[data-theme="dark"] .schedule-calendar-card,
html[data-theme="dark"] .schedule-day-card,
html[data-theme="dark"] .schedule-fixed-card,
html[data-theme="dark"] .schedule-form-card,
html[data-theme="dark"] .schedule-calendar-day,
html[data-theme="dark"] .schedule-item-card {
  background: #111417;
  border-color: #2a3138;
}

html[data-theme="dark"] .schedule-member-badge-1 {
  background: #183654;
  border-color: #27517a;
  color: #d8e9ff;
}

html[data-theme="dark"] .schedule-member-badge-2 {
  background: #173b2a;
  border-color: #2a6a4a;
  color: #d8f7e4;
}

html[data-theme="dark"] .schedule-member-badge-3 {
  background: #4a3016;
  border-color: #7c5025;
  color: #ffe4c2;
}

html[data-theme="dark"] .schedule-member-badge-4 {
  background: #432650;
  border-color: #71418a;
  color: #f0dcff;
}

html[data-theme="dark"] .schedule-member-badge-5 {
  background: #4c2230;
  border-color: #874359;
  color: #ffd9e1;
}

html[data-theme="dark"] .schedule-member-badge-6 {
  background: #153f42;
  border-color: #2b7075;
  color: #d9f9fb;
}

html[data-theme="dark"] .schedule-member-badge-7 {
  background: #4b3b14;
  border-color: #816821;
  color: #ffefb8;
}

html[data-theme="dark"] .schedule-member-badge-8 {
  background: #2c3440;
  border-color: #475364;
  color: #ebf0f6;
}

html[data-theme="dark"] .schedule-calendar-day-skeleton,
html[data-theme="dark"] .schedule-item-card-skeleton,
html[data-theme="dark"] .schedule-skeleton-line,
html[data-theme="dark"] .schedule-skeleton-pill,
html[data-theme="dark"] .schedule-skeleton-tag,
html[data-theme="dark"] .schedule-skeleton-btn,
html[data-theme="dark"] .schedule-skeleton-dot {
  background: linear-gradient(
    100deg,
    rgba(58, 67, 80, 0.72) 20%,
    rgba(86, 97, 112, 0.95) 45%,
    rgba(58, 67, 80, 0.72) 70%
  );
  background-size: 200% 100%;
}

html[data-theme="dark"] .schedule-subtitle,
html[data-theme="dark"] .schedule-eyebrow,
html[data-theme="dark"] .schedule-panel-head p,
html[data-theme="dark"] .schedule-calendar-heading p,
html[data-theme="dark"] .schedule-item-meta,
html[data-theme="dark"] .schedule-item-note,
html[data-theme="dark"] .schedule-calendar-more,
html[data-theme="dark"] .schedule-hero-stat span,
html[data-theme="dark"] .schedule-calendar-weekdays span {
  color: #9aa5b1;
}

html[data-theme="dark"] .schedule-calendar-weekdays span:first-child,
html[data-theme="dark"] .schedule-calendar-weekdays span:last-child {
  color: #ff8b8b;
}

html[data-theme="dark"] .schedule-hero-stat {
  background: rgba(18, 23, 29, 0.92);
  border-color: #2a3138;
}

html[data-theme="dark"] .schedule-source-tag-leave {
  background: rgba(125, 32, 45, 0.28);
  color: #ffb4bc;
}

html[data-theme="dark"] .schedule-mode-tag-leave-type {
  background: rgba(125, 32, 45, 0.22);
  color: #ffd4da;
}

html[data-theme="dark"] .schedule-status-tag-submitted {
  background: rgba(67, 76, 88, 0.72);
  color: #e2e8f0;
}

html[data-theme="dark"] .schedule-status-tag-approved {
  background: rgba(29, 107, 61, 0.28);
  color: #b8efcb;
}

html[data-theme="dark"] .schedule-status-tag-rejected,
html[data-theme="dark"] .schedule-status-tag-cancelled {
  background: rgba(125, 32, 45, 0.28);
  color: #ffb4bc;
}

html[data-theme="dark"] .schedule-item-leave-note {
  color: #ff9aa5;
}

html[data-theme="dark"] .schedule-item-card-leave {
  background: rgba(47, 23, 27, 0.48);
  border-color: rgba(208, 122, 122, 0.22);
}

html[data-theme="dark"] .schedule-item-card-has-leave {
  border-color: rgba(208, 122, 122, 0.28);
}

html[data-theme="dark"] .schedule-item-card-rule {
  background: rgba(63, 45, 22, 0.34);
}

html[data-theme="dark"] .schedule-item-card-event {
  background: rgba(47, 23, 27, 0.48);
  border-color: rgba(208, 122, 122, 0.22);
}

html[data-theme="dark"] .schedule-item-card-event:hover {
  border-color: rgba(208, 122, 122, 0.38);
}

html[data-theme="dark"] .schedule-calendar-chip-event,
html[data-theme="dark"] .schedule-source-tag-event {
  background: rgba(180, 35, 24, 0.3);
  color: #ff9aa5;
}

html[data-theme="dark"] .schedule-item-card-leave:hover,
html[data-theme="dark"] .schedule-item-card-has-leave:hover {
  border-color: rgba(208, 122, 122, 0.38);
}

html[data-theme="dark"] .schedule-item-callout-leave {
  background: rgba(125, 32, 45, 0.16);
  border-color: rgba(208, 122, 122, 0.2);
}

html[data-theme="dark"] .schedule-item-callout-range {
  background: rgba(118, 84, 23, 0.2);
  border-color: rgba(207, 160, 98, 0.18);
}

html[data-theme="dark"] .schedule-calendar-day.is-selected {
  border-color: rgba(239, 196, 132, 0.72);
  background: rgba(145, 84, 17, 0.22);
  box-shadow: 0 0 0 3px rgba(239, 196, 132, 0.22);
}

html[data-theme="dark"] .schedule-calendar-day.is-selected .schedule-calendar-day-number {
  color: #f2d4a7;
  -webkit-text-fill-color: #f2d4a7;
}

html[data-theme="dark"] .schedule-calendar-day.has-event .schedule-calendar-day-number {
  color: #ff9aa5;
  -webkit-text-fill-color: #ff9aa5;
}

html[data-theme="dark"] .schedule-member-alert {
  background: rgba(84, 54, 20, 0.26);
  border-color: rgba(239, 196, 132, 0.18);
  color: #f2d4a7;
}

html[data-theme="dark"] .schedule-create-inner {
  background: #1f242b;
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .schedule-create-header {
  background: #1f242b;
}

html[data-theme="dark"] .schedule-create-tabs {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .schedule-add-open-wrap {
  background: var(--panel-elevated);
  border-top-color: var(--stroke);
}

html[data-theme="dark"] .schedule-create-tab {
  color: #e6ebf2;
}

html[data-theme="dark"] .schedule-create-tab.is-active {
  color: #cfa062;
}

html[data-theme="dark"] .schedule-create-tab.is-active::after {
  background: #cfa062;
}

html[data-theme="dark"] .schedule-create-inner > .account-dialog-actions,
html[data-theme="dark"] #schedule-event-dialog .account-dialog-actions {
  justify-content: flex-end;
  background: #1f242c;
  border-top-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] #schedule-detail-dialog .schedule-detail-actions {
  background: #1f242c;
}

html[data-theme="dark"] .schedule-weekday-label {
  color: #e6ebf2;
}

html[data-theme="dark"] .schedule-weekday-chip span {
  background: #111417;
  border-color: #2a3138;
  color: #dbe2ec;
}

html[data-theme="dark"] .schedule-weekday-chip input:checked + span {
  background: rgba(192, 116, 42, 0.18);
  border-color: rgba(192, 116, 42, 0.56);
  color: #f2d4a7;
  box-shadow: 0 0 0 3px rgba(192, 116, 42, 0.12);
}

html[data-theme="dark"] .schedule-item-actions .schedule-delete-btn,
html[data-theme="dark"] #schedule-detail-dialog .schedule-detail-delete {
  border-color: rgba(208, 122, 122, 0.5) !important;
  color: var(--danger-accent) !important;
  -webkit-text-fill-color: var(--danger-accent) !important;
}

html[data-theme="dark"] .schedule-item-actions .schedule-delete-btn:hover,
html[data-theme="dark"] #schedule-detail-dialog .schedule-detail-delete:hover {
  background: rgba(208, 122, 122, 0.18) !important;
  border-color: rgba(208, 122, 122, 0.5) !important;
  color: var(--danger-accent) !important;
  -webkit-text-fill-color: var(--danger-accent) !important;
}

html[data-theme="dark"] .devtest-infobar {
  background: #1f2a3c;
  border-color: rgba(146, 177, 228, 0.55);
  color: #dce7fb;
}

html[data-theme="dark"] .devtest-manual {
  background: #1d222a;
  border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .devtest-manual-card {
  background: #242a33;
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .devtest-infobar-icon {
  border-color: #dce7fb;
  color: #dce7fb;
}

html[data-theme="dark"] .table-empty,
html[data-theme="dark"] .rag-admin-empty,
html[data-theme="dark"] .inventory-empty {
  color: #aeb6c3;
}

html[data-theme="dark"] .account-search,
html[data-theme="dark"] .account-sort,
html[data-theme="dark"] .dropdown-trigger,
html[data-theme="dark"] .rag-share-dropdown .dropdown-trigger,
html[data-theme="dark"] .rag-share-drive-email-dropdown .dropdown-trigger,
html[data-theme="dark"] .rag-share-drive-role-dropdown .dropdown-trigger,
html[data-theme="dark"] .rag-share-drive-email-dropdown .dropdown-search,
html[data-theme="dark"] .rag-folder-list-item,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #1f242c;
  color: #e6ebf2;
  border-color: rgba(255, 255, 255, 0.18);
}

html[data-theme="dark"] .account-search-wrap,
html[data-theme="dark"] .account-sort-wrap {
  background: #1f242c;
  border-color: rgba(255, 255, 255, 0.18);
}

html[data-theme="dark"] .account-action-trigger,
html[data-theme="dark"] .account-action-dropdown-menu {
  background: #242a33;
  border-color: rgba(255, 255, 255, 0.14);
  color: #e6ebf2;
}

html[data-theme="dark"] .account-menu-item {
  color: #dde4ee;
}

html[data-theme="dark"] .account-menu-item:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .account-action-dropdown-menu .account-delete,
html[data-theme="dark"] .account-action-dropdown-menu .account-toggle.danger,
html[data-theme="dark"] .account-table .account-action-dropdown-menu .account-delete {
  color: var(--danger-accent) !important;
  -webkit-text-fill-color: var(--danger-accent) !important;
  background: transparent !important;
  border-color: transparent !important;
}

html[data-theme="dark"] .account-action-dropdown-menu .account-delete:hover:not(:disabled) {
  background: rgba(208, 122, 122, 0.12) !important;
}

html[data-theme="dark"] .account-search,
html[data-theme="dark"] .account-search-wrap {
  background: transparent !important;
}

html[data-theme="dark"] .account-search-wrap:focus-within,
html[data-theme="dark"] .account-sort-wrap:focus-within {
  border-color: #c0742a;
  box-shadow: 0 0 0 3px rgba(192, 116, 42, 0.28);
}

html[data-theme="dark"] .account-search-icon,
html[data-theme="dark"] .account-sort-icon {
  stroke: #c9d1dc;
}

html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .rag-drive-more-menu,
html[data-theme="dark"] .home-tool-menu,
html[data-theme="dark"] .prompt-dialog-menu,
html[data-theme="dark"] .rag-folder-dialog-list {
  background: #1c2129;
  border-color: rgba(255, 255, 255, 0.15);
}

html[data-theme="dark"] .dropdown-item,
html[data-theme="dark"] .rag-drive-more-item,
html[data-theme="dark"] .home-tool-menu-item,
html[data-theme="dark"] .prompt-dialog-menu-item {
  color: #dde4ee;
}

html[data-theme="dark"] .dropdown-item.is-active,
html[data-theme="dark"] .rag-drive-more-item.is-active,
html[data-theme="dark"] .prompt-dialog-menu-item.is-active {
  color: #c0742a !important;
  -webkit-text-fill-color: #c0742a !important;
  background: rgba(192, 116, 42, 0.14);
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .rag-drive-more-item:hover,
html[data-theme="dark"] .home-tool-menu-item:hover,
html[data-theme="dark"] .prompt-dialog-menu-item:hover,
html[data-theme="dark"] .rag-folder-list-item:hover,
html[data-theme="dark"] .rag-folder-list-item.is-selected {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .rag-drive-more-item-danger {
  color: var(--danger-accent) !important;
  -webkit-text-fill-color: var(--danger-accent) !important;
}

html[data-theme="dark"] .rag-drive-more-item-danger:hover {
  background: rgba(208, 122, 122, 0.16);
}

html[data-theme="dark"] .home-tool-menu-item[data-tool-remove] {
  color: var(--danger-accent) !important;
  -webkit-text-fill-color: var(--danger-accent) !important;
}

html[data-theme="dark"] .home-tool-menu-item[data-tool-remove]:hover {
  background: rgba(208, 122, 122, 0.16);
}

html[data-theme="dark"] .rag-drive-tabs {
  background: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

@media (max-width: 1280px) {
  html[data-theme="dark"] .rag-drive-tabs {
    background: #171a1f;
    border-bottom-color: rgba(255, 255, 255, 0.14);
  }
}

html[data-theme="dark"] .rag-drive-tabs .ai-tab {
  background: transparent !important;
  color: #c9d1dc !important;
  -webkit-text-fill-color: #c9d1dc !important;
}

html[data-theme="dark"] .rag-drive-tabs .ai-tab.is-active {
  color: #c0742a !important;
  -webkit-text-fill-color: #c0742a !important;
}

html[data-theme="dark"] .rag-drive-tabs .ai-tab.is-active::after {
  background: #c0742a;
}

html[data-theme="dark"] .rag-drive-tabs .ai-tab[aria-selected="true"] {
  color: #c0742a !important;
  -webkit-text-fill-color: #c0742a !important;
}

html[data-theme="dark"] .rag-drive-tab-divider {
  background: rgba(255, 255, 255, 0.26);
}

html[data-theme="dark"] .header-icon-btn {
  border-color: rgba(255, 255, 255, 0.18);
}

html[data-theme="dark"] .header-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .hero.hero-assistant {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .home-quick-links {
  background: rgba(29, 34, 42, 0.94);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .home-quick-links-edit {
  background: rgba(17, 21, 27, 0.82);
  border-color: rgba(255, 255, 255, 0.12);
  color: #e6ebf2;
}

html[data-theme="dark"] .home-quick-links-edit:hover,
html[data-theme="dark"] .home-tool-more:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  transform: none;
}

html[data-theme="dark"] .home-quick-links-skeleton {
  background: linear-gradient(
    90deg,
    rgba(49, 56, 68, 0.9) 0%,
    rgba(61, 69, 82, 0.98) 50%,
    rgba(49, 56, 68, 0.9) 100%
  );
  background-size: 200% 100%;
}

html[data-theme="dark"] .notification-panel {
  background: rgba(29, 34, 42, 0.98);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 28px 56px rgba(0, 0, 0, 0.42);
}

html[data-theme="dark"] .notification-panel-header {
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .notification-panel-header h4,
html[data-theme="dark"] .notification-section h5,
html[data-theme="dark"] .notification-item-title,
html[data-theme="dark"] .notification-panel-close {
  color: #eef2f7;
}

html[data-theme="dark"] .notification-item-summary,
html[data-theme="dark"] .notification-item-time,
html[data-theme="dark"] .notification-empty {
  color: #b8c1cf;
}

html[data-theme="dark"] .notification-skeleton-line,
html[data-theme="dark"] .notification-skeleton-dot,
html[data-theme="dark"] .performance-skeleton-menu {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06));
  background-size: 200% 100%;
}

html[data-theme="dark"] .notification-panel-close {
  border-color: rgba(255, 255, 255, 0.14);
}

html[data-theme="dark"] .notification-panel-close:hover,
html[data-theme="dark"] .notification-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .notification-item-label {
  color: #e0a667;
}

html[data-theme="dark"] .notification-tab {
  color: #b8c1cf;
}

html[data-theme="dark"] .notification-tab.is-active {
  background: rgba(224, 166, 103, 0.18);
  color: #e0a667;
}

html[data-theme="dark"] .notification-section-link {
  color: #81aef5;
}

.hero.hero-assistant {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

/* Dark-mode hardening: patch remaining light surfaces and low-contrast text. */
html[data-theme="dark"] .ai-tab,
html[data-theme="dark"] .prompt-tab,
html[data-theme="dark"] .dropdown-trigger,
html[data-theme="dark"] .dropdown-item,
html[data-theme="dark"] .home-tool-menu-item {
  color: #e6ebf2 !important;
  -webkit-text-fill-color: #e6ebf2 !important;
}

html[data-theme="dark"] .attendance-tab,
html[data-theme="dark"] .inventory-tab {
  color: #e6ebf2 !important;
  -webkit-text-fill-color: #e6ebf2 !important;
}

html[data-theme="dark"] .attendance-tabs {
  background: rgba(18, 21, 27, 0.95) !important;
  border-bottom-color: rgba(255, 255, 255, 0.14) !important;
}

html[data-theme="dark"] .attendance-tab.is-active,
html[data-theme="dark"] .inventory-tab.is-active {
  color: #c0742a !important;
  -webkit-text-fill-color: #c0742a !important;
}

html[data-theme="dark"] .attendance-tabs .attendance-tab.is-active::after {
  background: #c0742a !important;
}

html[data-theme="dark"] .attendance-filter-btn.is-active {
  color: #c0742a !important;
  -webkit-text-fill-color: #c0742a !important;
  border-color: #c0742a !important;
  background: rgba(192, 116, 42, 0.16) !important;
}

html[data-theme="dark"] .attendance-filter-total {
  color: rgba(236, 236, 236, 0.9) !important;
  -webkit-text-fill-color: rgba(236, 236, 236, 0.9) !important;
}

html[data-theme="dark"] .attendance-filter-sep {
  color: rgba(219, 226, 236, 0.82) !important;
  -webkit-text-fill-color: rgba(219, 226, 236, 0.82) !important;
}

html[data-theme="dark"] .leave-summary-card {
  background: #1d222a;
  border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .leave-summary-label {
  color: rgba(219, 226, 236, 0.72);
}

html[data-theme="dark"] .leave-summary-value {
  color: #e6ebf2;
}

html[data-theme="dark"] .attendance-table th + th,
html[data-theme="dark"] .account-table th + th {
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .account-skeleton-line {
  background: linear-gradient(90deg, #2a3138 0%, #323a44 50%, #2a3138 100%);
  background-size: 200% 100%;
}

html[data-theme="dark"] .leave-status-pill {
  color: #dbe2ec;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .leave-table th {
  background: #242a33;
  color: #dbe2ec;
}

html[data-theme="dark"] .leave-status-pill.is-submitted {
  color: #f0ce6a;
  border-color: rgba(240, 206, 106, 0.55);
  background: rgba(240, 206, 106, 0.16);
}

html[data-theme="dark"] .leave-status-pill.is-cancelled {
  color: #e0b4b4;
  border-color: rgba(224, 180, 180, 0.5);
  background: rgba(224, 180, 180, 0.14);
}

html[data-theme="dark"] .leave-status-pill.is-approved {
  color: #8dd8b1;
  border-color: rgba(141, 216, 177, 0.45);
  background: rgba(141, 216, 177, 0.14);
}

html[data-theme="dark"] .leave-status-pill.is-rejected {
  color: #f1b0b0;
  border-color: rgba(241, 176, 176, 0.45);
  background: rgba(241, 176, 176, 0.14);
}

html[data-theme="dark"] .leave-approve {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.5) !important;
  background: transparent;
}

html[data-theme="dark"] .leave-approve:hover {
  color: #86efac;
  background: rgba(74, 222, 128, 0.18);
  border-color: rgba(74, 222, 128, 0.5) !important;
}

html[data-theme="dark"] .leave-cancel {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.5) !important;
  background: transparent !important;
}

html[data-theme="dark"] .leave-cancel:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
}

html[data-theme="dark"] .leave-reject {
  color: var(--danger-accent);
  border-color: rgba(208, 122, 122, 0.5) !important;
  background: transparent !important;
}

html[data-theme="dark"] .leave-reject:hover {
  color: var(--danger-accent);
  background: rgba(208, 122, 122, 0.16) !important;
  border-color: rgba(208, 122, 122, 0.5) !important;
}

html[data-theme="dark"] .leave-mode-group {
  border-color: rgba(255, 255, 255, 0.14);
}

html[data-theme="dark"] .leave-mode-group legend,
html[data-theme="dark"] .leave-apply-hint {
  color: #b8c0cb;
}

html[data-theme="dark"] .leave-footer-note {
  color: rgba(219, 226, 236, 0.86);
}

html[data-theme="dark"] .attendance-tab-divider {
  background: rgba(255, 255, 255, 0.35) !important;
}

html[data-theme="dark"] body.assistant-mode .assistant-chat::before {
  background: var(--page-bg);
}

html[data-theme="dark"] body.assistant-mode .assistant-chat::after {
  background: linear-gradient(to bottom, rgba(22, 22, 22, 0), var(--page-bg) 70%);
}

html[data-theme="dark"] .assistant-input,
html[data-theme="dark"] .assistant-source-pill,
html[data-theme="dark"] .assistant-table,
html[data-theme="dark"] .assistant-image-thumb,
html[data-theme="dark"] .assistant-generated-image,
html[data-theme="dark"] .assistant-generated-image-thumb,
html[data-theme="dark"] .history-thumb,
html[data-theme="dark"] .assistant-history-item,
html[data-theme="dark"] .assistant-file-chip {
  background: var(--panel-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

html[data-theme="dark"] .assistant-history-answer,
html[data-theme="dark"] .assistant-history-empty,
html[data-theme="dark"] .history-empty,
html[data-theme="dark"] .history-preview-empty {
  color: var(--text-secondary);
}

html[data-theme="dark"] .assistant-generated-image-preview,
html[data-theme="dark"] .assistant-generated-image-action {
  background: var(--panel-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

html[data-theme="dark"] .assistant-history-remove,
html[data-theme="dark"] .history-thumb-remove {
  background: rgba(18, 22, 30, 0.9);
  color: #dbe2ec;
}

html[data-theme="dark"] .prompt-dialog-header,
html[data-theme="dark"] .prompt-dialog-footer,
html[data-theme="dark"] .prompt-dialog-inner,
html[data-theme="dark"] .prompt-tab,
html[data-theme="dark"] .prompt-dialog-more {
  background: var(--panel-elevated);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

html[data-theme="dark"] .prompt-area::placeholder {
  color: #8f99a8;
}

html[data-theme="dark"] .prompt-input-wrap .prompt-select-wrap .dropdown-trigger {
  border-color: var(--field-border);
}

html[data-theme="dark"] .prompt-tab.prompt-tab-add {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-secondary);
}

html[data-theme="dark"] .prompt-dialog-image-slot {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .prompt-dialog-image-add {
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.45);
}

html[data-theme="dark"] .prompt-dialog-image-remove {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(30, 30, 30, 0.9);
  color: #dbe2ec;
}

html[data-theme="dark"] .prompt-dialog-menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .section-card,
html[data-theme="dark"] .card,
html[data-theme="dark"] .mascot-spec,
html[data-theme="dark"] .anchor-nav,
html[data-theme="dark"] .empty-panel {
  background: var(--panel-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

html[data-theme="dark"] .mascot-spec hr {
  border-top-color: var(--border-soft);
}

html[data-theme="dark"] .mascot-spec blockquote {
  background: rgba(255, 255, 255, 0.05);
  border-left-color: rgba(255, 255, 255, 0.2);
}

html[data-theme="dark"] .canvas-empty,
html[data-theme="dark"] .canvas-status,
html[data-theme="dark"] .canvas-loading,
html[data-theme="dark"] .audit-panel {
  background: var(--panel-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

html[data-theme="dark"] .canvas-output {
  background: var(--panel-bg) !important;
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

html[data-theme="dark"] .canvas-output-dialog {
  background: transparent !important;
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

html[data-theme="dark"] .prompt-card {
  background: var(--panel-bg);
}

html[data-theme="dark"] #canvas-host.is-loading {
  background: linear-gradient(
    100deg,
    #20252d 20%,
    #2a313b 45%,
    #20252d 70%
  );
}

html[data-theme="dark"] .canvas-empty p,
html[data-theme="dark"] .audit-status,
html[data-theme="dark"] .audit-progress {
  color: var(--text-secondary);
}

html[data-theme="dark"] .audit-item.pass {
  color: #6abf72;
}

html[data-theme="dark"] .audit-item.fail {
  color: #f28b82;
}

html[data-theme="dark"] .audit-item.warn {
  color: #fdd663;
}

html[data-theme="dark"] .rag-check-col,
html[data-theme="dark"] .rag-admin-table thead .rag-check-col {
  background: var(--table-row-bg);
}

html[data-theme="dark"] .rag-admin-table thead .rag-check-col {
  background: var(--table-head-bg);
}

html[data-theme="dark"] .rag-google-empty {
  background: var(--panel-elevated);
  border-color: var(--border-subtle);
}

html[data-theme="dark"] .inventory-kpi,
html[data-theme="dark"] .inventory-kpi h4,
html[data-theme="dark"] .inventory-kpi p,
html[data-theme="dark"] .inventory-panel h3,
html[data-theme="dark"] .inventory-panel p {
  color: var(--text-primary);
}

html[data-theme="dark"] .inventory-kpi p,
html[data-theme="dark"] .inventory-panel p {
  color: var(--text-secondary);
}

html[data-theme="dark"] .pos-search,
html[data-theme="dark"] .pos-card,
html[data-theme="dark"] .pos-card-image,
html[data-theme="dark"] .pos-tag,
html[data-theme="dark"] .pos-qty,
html[data-theme="dark"] .pos-footer,
html[data-theme="dark"] .attendance-footer,
html[data-theme="dark"] #pos-info-dialog .account-dialog-actions,
html[data-theme="dark"] #pos-dialog .account-dialog-actions,
html[data-theme="dark"] #pos-category-dialog .account-dialog-actions {
  background: var(--panel-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

html[data-theme="dark"] .pos-qty,
html[data-theme="dark"] .pos-footer,
html[data-theme="dark"] .attendance-footer,
html[data-theme="dark"] #pos-info-dialog .account-dialog-actions,
html[data-theme="dark"] #pos-dialog .account-dialog-actions {
  justify-content: flex-end;
}

html[data-theme="dark"] .pos-rich-editor-block-trigger,
html[data-theme="dark"] .pos-rich-editor-icon-btn,
html[data-theme="dark"] .pos-rich-editor-toggle-icon {
  background: transparent;
  color: var(--text-primary);
  border: none;
}

html[data-theme="dark"] .pos-rich-editor-body {
  background: #2a2a2a;
  color: var(--ink);
  border: none;
}

html[data-theme="dark"] .pos-rich-editor-html {
  background: #1e1e1e;
  color: var(--ink);
  border: none;
}

html[data-theme="dark"] .pos-rich-editor-body:hover {
  background: #333333;
}

html[data-theme="dark"] .pos-rich-editor-html:hover {
  background: #333333;
}

html[data-theme="dark"] .pos-rich-editor-body:focus {
  background: #2a2a2a;
}

html[data-theme="dark"] .pos-rich-editor-html:focus {
  background: #1e1e1e;
}

html[data-theme="dark"] .pos-rich-editor-body:empty::before {
  color: rgba(226, 232, 240, 0.38);
}

html[data-theme="dark"] .pos-rich-editor-toggle-icon.is-active {
  border-color: #5fa86f;
  background: rgba(95, 168, 111, 0.25);
  color: #7dd3a0;
}

html[data-theme="dark"] #pos-info-image {
  background: var(--panel-elevated);
  border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] #pos-info-image .pos-card-image-icon,
html[data-theme="dark"] .pos-card-image .pos-card-image-icon {
  color: var(--text-secondary);
}

html[data-theme="dark"] #pos-info-dialog .account-dialog-title {
  background: var(--panel);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

html[data-theme="dark"] .pos-dialog-eyebrow {
  color: rgba(226, 232, 240, 0.72);
}

html[data-theme="dark"] .pos-info-barcode {
  background: #fff;
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .pos-info-barcode.is-empty {
  background: var(--panel-elevated);
}

html[data-theme="dark"] #pos-info-dialog .pos-card-title,
html[data-theme="dark"] #pos-info-dialog .pos-card-price,
html[data-theme="dark"] #pos-info-dialog .pos-info-desc {
  color: var(--text-primary);
}

html[data-theme="dark"] .pos-info-section-title,
html[data-theme="dark"] .pos-info-product-info,
html[data-theme="dark"] .pos-info-code {
  color: var(--text-primary);
}

html[data-theme="dark"] .pos-info-product-info img {
  border: 1px solid rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] #pos-info-dialog .pos-info-code,
html[data-theme="dark"] #pos-info-dialog .pos-info-barcode.is-empty {
  color: var(--text-secondary);
}

html[data-theme="dark"] .pos-stock-hint {
  color: var(--text-secondary);
}

html[data-theme="dark"] .pos-card.is-out-of-stock .pos-stock-hint {
  color: #f1b0b0;
}

html[data-theme="dark"] .pos-card-price.has-promotion {
  color: var(--text-secondary);
}

html[data-theme="dark"] .pos-card-promo-price {
  color: #f1b0b0;
}

html[data-theme="dark"] .pos-card-promo-end {
  color: var(--text-secondary);
}

html[data-theme="dark"] .pos-info-barcode svg,
html[data-theme="dark"] .pos-info-barcode rect,
html[data-theme="dark"] .pos-info-barcode text {
  color-scheme: light;
}

html[data-theme="dark"] .pos-payment-option {
  background: var(--field-bg);
  border-color: var(--field-border);
  color: var(--text-primary);
}

html[data-theme="dark"] .pos-payment-option.is-selected {
  border-color: #5d8a71;
  background: rgba(93, 138, 113, 0.16);
  color: #d7eadc;
}

html[data-theme="dark"] .pos-payment-option:disabled {
  opacity: 0.6;
  background: #333;
  border-color: #555;
  color: #888;
}

html[data-theme="dark"] .pos-qty-btn {
  background: var(--field-bg);
  border-color: var(--field-border);
  color: var(--text-primary);
}

html[data-theme="dark"] .pos-qty-value {
  color: var(--text-primary);
}

html[data-theme="dark"] .pos-search-icon,
html[data-theme="dark"] .pos-tag,
html[data-theme="dark"] .pos-image-hint,
html[data-theme="dark"] .pos-image-error,
html[data-theme="dark"] .pos-upload {
  color: var(--text-secondary);
}

html[data-theme="dark"] .pos-image-error {
  color: #fca5a5;
}

html[data-theme="dark"] .home-tool-body,
html[data-theme="dark"] .home-tool-body p,
html[data-theme="dark"] .home-tool-times,
html[data-theme="dark"] .home-tool-time-label,
html[data-theme="dark"] .home-tool-time-value,
html[data-theme="dark"] .home-tool-total,
html[data-theme="dark"] .home-tool-list-title,
html[data-theme="dark"] .home-tool-summary-label,
html[data-theme="dark"] .home-tools-empty {
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary) !important;
}

html[data-theme="dark"] .home-tool-time-label {
  color: var(--text-secondary) !important;
  -webkit-text-fill-color: var(--text-secondary) !important;
}

html[data-theme="dark"] .home-tool-list-item,
html[data-theme="dark"] .home-tool-summary-row {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .home-tool-schedule-tile {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(35, 40, 49, 0.92);
}

html[data-theme="dark"] .home-tool-schedule-tile.is-today {
  border-color: rgba(237, 175, 91, 0.72);
  box-shadow: inset 0 0 0 1px rgba(237, 175, 91, 0.24);
}

html[data-theme="dark"] .home-tool-schedule-weekday {
  color: rgba(226, 232, 240, 0.72);
}

html[data-theme="dark"] .home-tool-schedule-weekday.is-weekend {
  color: #ee7676;
}

html[data-theme="dark"] .home-tool-schedule-calendar-cell {
  border: none;
  background: transparent;
}

html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.07);
}

html[data-theme="dark"] .home-tool-schedule-calendar-cell.is-empty {
  background: transparent;
  border-color: transparent;
}

html[data-theme="dark"] .home-tool-schedule-calendar-cell.is-today {
  border-color: rgba(237, 175, 91, 0.72);
  box-shadow: inset 0 0 0 1px rgba(237, 175, 91, 0.24);
  border: 1px solid rgba(237, 175, 91, 0.72);
  background: rgba(62, 45, 28, 0.92);
}

html[data-theme="dark"] .home-tool-schedule-calendar-day {
  color: var(--text-primary);
}

html[data-theme="dark"] .home-tool-schedule-calendar-cell.has-event .home-tool-schedule-calendar-day {
  color: #ff9aa5;
}

html[data-theme="dark"] .home-tool-card--large .home-tool-schedule-calendar-cell.has-event .home-tool-schedule-calendar-day,
html[data-theme="dark"] .home-tool-card--xlarge .home-tool-schedule-calendar-cell.has-event .home-tool-schedule-calendar-day {
  color: #ff9aa5 !important;
  -webkit-text-fill-color: #ff9aa5 !important;
}

html[data-theme="dark"] .home-tool-schedule-event-chip {
  background: rgba(255, 154, 165, 0.15);
  color: #ff9aa5;
}

html[data-theme="dark"] .home-tool-schedule-more-pill {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

html[data-theme="dark"] .home-tool-schedule-aside-title {
  color: rgba(226, 232, 240, 0.72);
}

html[data-theme="dark"] .home-tool-schedule-aside-item {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(35, 40, 49, 0.92);
}

html[data-theme="dark"] .home-tool-schedule-aside-item.is-today {
  border-color: rgba(237, 175, 91, 0.72);
  box-shadow: inset 0 0 0 1px rgba(237, 175, 91, 0.24);
}

html[data-theme="dark"] .home-tool-schedule-aside-date {
  color: var(--text-primary);
}

html[data-theme="dark"] .home-tool-card-skeleton-fill {
  background: linear-gradient(
    90deg,
    rgba(49, 56, 68, 0.9) 0%,
    rgba(61, 69, 82, 0.98) 50%,
    rgba(49, 56, 68, 0.9) 100%
  );
  background-size: 200% 100%;
}

html[data-theme="dark"] .performance-mobile-card-skeleton h3,
html[data-theme="dark"] .performance-mobile-card-skeleton p,
html[data-theme="dark"] .performance-mobile-card-skeleton strong,
html[data-theme="dark"] .performance-mobile-card-skeleton span {
  color: transparent;
}

html[data-theme="dark"] .home-tool-list-meta,
html[data-theme="dark"] .home-tool-summary-value,
html[data-theme="dark"] .home-tool-list-empty,
html[data-theme="dark"] .home-tool-list-more {
  color: var(--text-secondary) !important;
  -webkit-text-fill-color: var(--text-secondary) !important;
}

html[data-theme="dark"] .pos-card-delete {
  background: rgba(18, 22, 30, 0.95);
}

html[data-theme="dark"] .inventory-table-wrap table,
html[data-theme="dark"] .inventory-table-wrap th,
html[data-theme="dark"] .inventory-table-wrap td,
html[data-theme="dark"] .devtest-table-wrap table,
html[data-theme="dark"] .devtest-table-wrap th,
html[data-theme="dark"] .devtest-table-wrap td,
html[data-theme="dark"] .account-table-wrap th,
html[data-theme="dark"] .account-table-wrap td {
  color: var(--text-primary);
}

html[data-theme="dark"] .history-toggle:not(.assistant-history-toggle):not(.rag-qa-toggle) {
  background: #2a313b;
  border-color: rgba(255, 255, 255, 0.16);
  color: #e6ebf2;
}

html[data-theme="dark"] .history-toggle:not(.assistant-history-toggle):not(.rag-qa-toggle):hover {
  background: #323a46;
}

html[data-theme="dark"] .history-toggle-icon,
html[data-theme="dark"] .history-toggle svg {
  color: #e6ebf2;
  stroke: currentColor;
}

html[data-theme="dark"] .home-tool-more,
html[data-theme="dark"] .prompt-dialog-close,
html[data-theme="dark"] .dialog-close,
html[data-theme="dark"] .pos-dialog-close,
html[data-theme="dark"] .pos-dialog-edit {
  color: #dbe2ec;
}

html[data-theme="dark"] .home-tool-more {
  background: rgba(17, 21, 27, 0.82);
  border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .home-tool-edit-btn.is-active {
  background: rgba(192, 116, 42, 0.16);
  border-color: rgba(192, 116, 42, 0.52);
  color: #f0c187;
}

html[data-theme="dark"] .home-tool-more:hover,
html[data-theme="dark"] .prompt-dialog-close:hover,
html[data-theme="dark"] .dialog-close:hover,
html[data-theme="dark"] .pos-dialog-close:hover,
html[data-theme="dark"] .pos-dialog-edit:hover {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .dialog-close svg {
  stroke: #dbe2ec;
}

html[data-theme="dark"] .custom-date-picker {
  background: #20252d;
  border-color: var(--border-subtle);
}

html[data-theme="dark"] .custom-date-picker-backdrop.is-modal {
  background: rgba(10, 14, 20, 0.52);
}

html[data-theme="dark"] .custom-date-picker-title,
html[data-theme="dark"] .custom-date-picker-day {
  color: var(--text-primary);
}

html[data-theme="dark"] .custom-date-picker-weekdays span,
html[data-theme="dark"] .custom-date-picker-day.is-outside {
  color: var(--text-secondary);
}

html[data-theme="dark"] .custom-date-picker-weekdays span:first-child,
html[data-theme="dark"] .custom-date-picker-weekdays span:last-child {
  color: #ff8b8b;
}

html[data-theme="dark"] .custom-date-picker-nav,
html[data-theme="dark"] .custom-date-picker-action {
  background: #2a313b;
  border-color: var(--field-border);
  color: var(--text-primary);
}

html[data-theme="dark"] .custom-date-picker-day:hover,
html[data-theme="dark"] .custom-date-picker-nav:hover,
html[data-theme="dark"] .custom-date-picker-action:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .custom-date-picker-day.is-selected,
html[data-theme="dark"] .custom-date-picker-day.is-selected:hover {
  background: #c0742a;
  color: #fff;
}

html[data-theme="dark"] .dropdown-caret,
html[data-theme="dark"] .dropdown-trigger .dropdown-caret,
html[data-theme="dark"] .rag-share-dropdown .dropdown-caret,
html[data-theme="dark"] .rag-share-drive-email-dropdown .dropdown-caret,
html[data-theme="dark"] .rag-share-drive-role-dropdown .dropdown-caret {
  border-right-color: #e6ebf2 !important;
  border-bottom-color: #e6ebf2 !important;
}

/* Keep original accent semantics in dark mode (orange/red should not become grayscale). */
html[data-theme="dark"] .cta:not(:disabled):not(.articles-add-open):not(.articles-ai-mode-open),
html[data-theme="dark"] .inventory-btn.primary:not(:disabled),
html[data-theme="dark"] .inventory-move-open:not(:disabled),
html[data-theme="dark"] .btn.secondary.rag-open-upload-inline:not(:disabled),
html[data-theme="dark"] .prompt-rename-actions .btn.cta:not(:disabled):not(.articles-add-open):not(.articles-ai-mode-open),
html[data-theme="dark"] .pos-toolbar-actions .btn:not(.cta):not(:disabled) {
  background: #c0742a !important;
  border-color: #c0742a !important;
  color: #fff !important;
}

html[data-theme="dark"] .btn.secondary.rag-open-upload-inline:hover,
html[data-theme="dark"] #rag-upload:not(:disabled):hover {
  background: #a8601f !important;
  border-color: #a8601f !important;
}

html[data-theme="dark"] .rag-upload-drop {
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.45);
}

html[data-theme="dark"] .rag-upload-icon {
  border-color: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.55);
}

html[data-theme="dark"] .btn.danger,
html[data-theme="dark"] .account-dialog .btn.danger {
  background: var(--danger-accent) !important;
  border-color: var(--danger-accent) !important;
  color: #fff !important;
}

html[data-theme="dark"] .btn.danger:hover,
html[data-theme="dark"] .account-dialog .btn.danger:hover {
  background: #c26e6e !important;
  border-color: #c26e6e !important;
}

html[data-theme="dark"] #account-delete-dialog .btn.danger,
html[data-theme="dark"] .account-table .account-delete {
  background: #b8742c !important;
  border-color: #b8742c !important;
}

html[data-theme="dark"] #account-delete-dialog .btn.danger:hover,
html[data-theme="dark"] .account-table .account-delete:hover {
  background: #d28b40 !important;
  border-color: #d28b40 !important;
}

html[data-theme="dark"] .account-table .account-action-dropdown-menu .account-delete:hover,
html[data-theme="dark"] .account-table .account-action-dropdown-menu .account-toggle.danger:hover {
  background: rgba(208, 122, 122, 0.12) !important;
  border-color: transparent !important;
}

html[data-theme="dark"] .rag-admin-table .rag-delete-drive,
html[data-theme="dark"] .rag-admin-table .rag-remove {
  color: var(--danger-accent) !important;
  border-color: rgba(208, 122, 122, 0.5) !important;
}

html[data-theme="dark"] .rag-admin-table .rag-delete-drive:hover,
html[data-theme="dark"] .rag-admin-table .rag-remove:hover {
  background: rgba(208, 122, 122, 0.18) !important;
}

html[data-theme="dark"] .assistant-history-remove:hover,
html[data-theme="dark"] .history-thumb-remove:hover {
  background: var(--danger-accent) !important;
  color: #fff !important;
}

html[data-theme="dark"] .pos-card-delete {
  color: var(--danger-accent) !important;
  border-color: rgba(208, 122, 122, 0.5) !important;
}

html[data-theme="dark"] .pos-card-delete:hover {
  background: rgba(208, 122, 122, 0.16) !important;
}

html[data-theme="dark"] .devtest-status.is-failed {
  color: var(--danger-accent) !important;
}

html[data-theme="dark"] .home-tool-punch.is-on:not(:disabled) {
  background: #c0742a !important;
  border-color: #c0742a !important;
  color: #fff !important;
}

/* Adapt green semantic actions for dark mode (keep green, improve contrast). */
html[data-theme="dark"] .btn:not(.secondary):not(.danger):not(.cta):not(.ghost):not(.home-tool-punch):not(.attendance-delete):not(.attendance-edit):not(.leave-cancel):not(.leave-approve):not(.leave-reject):not(.schedule-add-event-btn):not(.articles-ai-mode-open):not(:disabled),
html[data-theme="dark"] .home-tool-punch-in:not(:disabled),
html[data-theme="dark"] .home-tool-punch.is-off:not(:disabled),
html[data-theme="dark"] .btn.cta:not(:disabled):not(.articles-ai-mode-open):not(.articles-add-open),
html[data-theme="dark"] #rag-upload:not(:disabled),
html[data-theme="dark"] .assistant-send.is-ready,
html[data-theme="dark"] .assistant-send.is-sending,
html[data-theme="dark"] .rag-qa-send.is-ready,
html[data-theme="dark"] .rag-qa-send.is-sending {
  background: #5f8f78 !important;
  border-color: #5f8f78 !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .attendance-action-dropdown .btn:not(:disabled),
html[data-theme="dark"] .performance-action-dropdown .btn:not(:disabled),
html[data-theme="dark"] .inventory-page .inventory-action-dropdown .inventory-btn.small:not(:disabled) {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  color: var(--ink) !important;
  -webkit-text-fill-color: currentColor !important;
}

html[data-theme="dark"] .inventory-page .inventory-action-dropdown .inventory-btn.small.danger:not(:disabled) {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  color: #f28b82 !important;
  -webkit-text-fill-color: #f28b82 !important;
}

html[data-theme="dark"] .inventory-page .inventory-action-dropdown .inventory-btn.small.danger:hover:not(:disabled) {
  background: rgba(242, 139, 130, 0.12) !important;
  border-color: transparent !important;
  box-shadow: none !important;
  color: #f28b82 !important;
  -webkit-text-fill-color: #f28b82 !important;
}

.performance-action-dropdown .performance-delete:not(:disabled) {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  color: #dc2626 !important;
  -webkit-text-fill-color: #dc2626 !important;
}

.performance-action-dropdown .performance-delete:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.08) !important;
  border-color: transparent !important;
  box-shadow: none !important;
  color: #dc2626 !important;
  -webkit-text-fill-color: #dc2626 !important;
}

html[data-theme="dark"] .performance-action-dropdown .performance-delete:not(:disabled) {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  color: #f28b82 !important;
  -webkit-text-fill-color: #f28b82 !important;
}

html[data-theme="dark"] .performance-action-dropdown .performance-delete:hover:not(:disabled) {
  background: rgba(242, 139, 130, 0.12) !important;
  border-color: transparent !important;
  box-shadow: none !important;
  color: #f28b82 !important;
  -webkit-text-fill-color: #f28b82 !important;
}

html[data-theme="dark"] #pos-edit-button {
  background: #c0742a !important;
  border-color: #c0742a !important;
  color: #fff !important;
}

html[data-theme="dark"] #pos-add-button,
html[data-theme="dark"] #pos-next-button,
html[data-theme="dark"] #stop-button {
  background: #5f8f78 !important;
  border-color: #5f8f78 !important;
  color: #fff !important;
}

html[data-theme="dark"] .attendance-delete {
  color: var(--danger-accent) !important;
  border: 1px solid rgba(208, 122, 122, 0.68) !important;
  background: transparent !important;
}

html[data-theme="dark"] .attendance-delete:hover {
  background: rgba(208, 122, 122, 0.16) !important;
}

html[data-theme="dark"] .attendance-edit {
  color: #d6deeb !important;
  border: 1px solid rgba(214, 222, 235, 0.42) !important;
  background: transparent !important;
}

html[data-theme="dark"] .attendance-edit:hover {
  background: rgba(214, 222, 235, 0.12) !important;
}

html[data-theme="dark"] .home-tool-punch-out:not(:disabled) {
  background: #c0742a !important;
  border-color: #c0742a !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .home-tool-punch-out.is-off:not(:disabled),
html[data-theme="dark"] .home-tool-punch-out.is-on:not(:disabled) {
  background: #c0742a !important;
  border-color: #c0742a !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .assistant-send:not(.is-ready):not(.is-sending),
html[data-theme="dark"] .assistant-send:disabled,
html[data-theme="dark"] .rag-qa-send:not(.is-ready):not(.is-sending),
html[data-theme="dark"] .rag-qa-send:disabled {
  background: #343943 !important;
  color: #9ea7b4 !important;
}

html[data-theme="dark"] .rag-qa-attach {
  border-color: rgba(255, 255, 255, 0.24);
  color: #9ea7b4;
}

html[data-theme="dark"] .rag-qa-attach:hover {
  border-color: rgba(255, 255, 255, 0.36);
  color: #c5cdd8;
}

.rag-qa-file-list {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 1rem 0;
  margin: 0;
}

.rag-qa-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid #d9d4ca;
  border-radius: 999px;
  background: #fff;
  font-size: 0.8rem;
  color: #3d3d3d;
}

.rag-qa-file-chip button {
  border: none;
  background: transparent;
  color: #8e8881;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
  margin: 0;
}

html[data-theme="dark"] .rag-qa-file-chip {
  border-color: #404040;
  background: #2a2a2a;
  color: #e0e0e0;
}

html[data-theme="dark"] .rag-qa-file-chip button {
  color: #9ea7b4;
}

.btn:disabled,
.cta:disabled {
  background: var(--btn-disabled-bg) !important;
  color: var(--btn-disabled-ink) !important;
  border-color: var(--btn-disabled-border) !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
  opacity: 1 !important;
}

html[data-theme="dark"] .btn:disabled,
html[data-theme="dark"] .cta:disabled,
html[data-theme="dark"] #export-button:disabled,
html[data-theme="dark"] #stop-button:disabled {
  background: var(--btn-disabled-bg) !important;
  color: var(--btn-disabled-ink) !important;
  border-color: var(--btn-disabled-border) !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
  opacity: 1 !important;
}

/* Ensure disabled buttons in dialogs show gray in dark mode */
html[data-theme="dark"] .account-dialog-actions .btn.cta:disabled {
  background: #4a4a4a !important;
  color: #808080 !important;
  opacity: 0.6 !important;
}

html[data-theme="dark"] .assistant-attach,
html[data-theme="dark"] .prompt-area-image-add {
  background: var(--field-bg) !important;
  border-color: var(--field-border) !important;
  color: var(--text-primary) !important;
}

html[data-theme="dark"] .prompt-area-upload-chip {
  background: var(--field-bg) !important;
  border-color: var(--field-border) !important;
  color: var(--text-primary) !important;
}

html[data-theme="dark"] .prompt-area-upload-chip button {
  color: rgba(230, 235, 242, 0.78) !important;
}

/* AI drawing page dark-mode hardening */
html[data-theme="dark"] .ai-dashboard .ai-tabs {
  background: var(--panel-elevated) !important;
  border-bottom-color: rgba(255, 255, 255, 0.14) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html[data-theme="dark"] .ai-dashboard .ai-tab {
  background: transparent !important;
  color: #dbe2ec !important;
  -webkit-text-fill-color: #dbe2ec !important;
}

html[data-theme="dark"] .ai-dashboard .ai-tab.is-active,
html[data-theme="dark"] .ai-dashboard .ai-tab[aria-selected="true"] {
  color: #c0742a !important;
  -webkit-text-fill-color: #c0742a !important;
}

html[data-theme="dark"] .ai-dashboard .ai-tab.is-active::after,
html[data-theme="dark"] .ai-dashboard .ai-tab[aria-selected="true"]::after {
  background: #c0742a !important;
}

html[data-theme="dark"] .ai-dashboard .prompt-mini-card {
  background: var(--panel-elevated) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

html[data-theme="dark"] .ai-dashboard .theme-card {
  background: #1f242c !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
}

html[data-theme="dark"] .ai-dashboard .theme-card input:checked + span {
  color: #c0742a !important;
}

html[data-theme="dark"] .ai-dashboard .prompt-card-bottom {
  background: transparent !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

@media (max-width: 980px) {
  html[data-theme="dark"] .ai-dashboard .prompt-card-bottom {
    background: #161616 !important;
    border-top-color: rgba(255, 255, 255, 0.14) !important;
  }
}

html[data-theme="dark"] .text-button,
html[data-theme="dark"] .text-btn {
  color: #a4e8af !important;
  -webkit-text-fill-color: #a4e8af !important;
}

html[data-theme="dark"] .text-button:hover,
html[data-theme="dark"] .text-btn:hover {
  color: #bcf1c5 !important;
  -webkit-text-fill-color: #bcf1c5 !important;
}

html[data-theme="dark"] .assistant-history-toggle {
  background: #2a313b !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color: #e6ebf2 !important;
}

html[data-theme="dark"] .assistant-history-toggle:hover {
  background: #323a46 !important;
}

/* Inventory page: keep tabs row and active panel transparent in all themes. */
.inventory-tabs-row,
.inventory-panel.is-active,
html[data-theme="dark"] .inventory-tabs-row,
html[data-theme="dark"] .inventory-panel.is-active {
  background: transparent !important;
}

/* Dark mode: active tab orange override (counters !important from base dark rule) */
html[data-theme="dark"] .ai-tab.is-active,
html[data-theme="dark"] .ai-tab[aria-selected="true"] {
  color: #c0742a !important;
  -webkit-text-fill-color: #c0742a !important;
}

html[data-theme="dark"] .ai-tab.is-active::after,
html[data-theme="dark"] .ai-tab[aria-selected="true"]::after {
  background: #c0742a !important;
}

html[data-theme="dark"] .prompt-tab.active {
  color: #c0742a !important;
  -webkit-text-fill-color: #c0742a !important;
  border-color: rgba(192, 116, 42, 0.5) !important;
}

html[data-theme="dark"] .pill-tab.is-active {
  color: #c0742a !important;
  -webkit-text-fill-color: #c0742a !important;
  border-color: #c0742a !important;
}

html[data-theme="dark"] .pill-tab.pill-tab-add {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.65);
}

html[data-theme="dark"] .pill-tab-edit {
  color: inherit;
}

html[data-theme="dark"] .pos-skeleton-pill,
html[data-theme="dark"] .pos-card-skeleton-line,
html[data-theme="dark"] .pos-card-skeleton-image,
html[data-theme="dark"] .pos-card-skeleton-chip,
html[data-theme="dark"] .pos-card-skeleton-btn,
html[data-theme="dark"] .pos-card-skeleton-qty {
  background: linear-gradient(
    100deg,
    rgba(58, 67, 80, 0.72) 20%,
    rgba(86, 97, 112, 0.95) 45%,
    rgba(58, 67, 80, 0.72) 70%
  );
  background-size: 200% 100%;
}

html[data-theme="dark"] .pos-category-dropdown .dropdown-trigger,
html[data-theme="dark"] .pos-sales-channel-dropdown .dropdown-trigger {
  background: var(--field-bg);
  border-color: var(--field-border);
}

html[data-theme="dark"] .pos-sales-channel-item.is-active .pos-sales-channel-check {
  box-shadow: inset 0 0 0 2px var(--field-bg);
}

html[data-theme="dark"] #pos-category-dialog #pos-category-delete {
  color: #f1b0b0 !important;
  -webkit-text-fill-color: #f1b0b0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #pos-category-dialog #pos-category-delete:hover {
  background: transparent !important;
}

html[data-theme="dark"] #pos-category-save:not(:disabled) {
  background: var(--accent-2) !important;
  border-color: var(--accent-2) !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

html[data-theme="dark"] #pos-category-save:not(:disabled):hover {
  background: #4f7c67 !important;
  border-color: #4f7c67 !important;
}

html[data-theme="dark"] #pos-save-button:not(:disabled),
html[data-theme="dark"] #pos-info-save:not(:disabled),
html[data-theme="dark"] #attendance-makeup-save:not(:disabled),
html[data-theme="dark"] #profile-edit-save:not(:disabled),
html[data-theme="dark"] #account-edit-save:not(:disabled),
html[data-theme="dark"] #inventory-edit-confirm:not(:disabled),
html[data-theme="dark"] .prompt-dialog-save:not(:disabled) {
  background: var(--accent-2) !important;
  border-color: var(--accent-2) !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

html[data-theme="dark"] #pos-save-button:not(:disabled):hover,
html[data-theme="dark"] #pos-info-save:not(:disabled):hover,
html[data-theme="dark"] #attendance-makeup-save:not(:disabled):hover,
html[data-theme="dark"] #profile-edit-save:not(:disabled):hover,
html[data-theme="dark"] #account-edit-save:not(:disabled):hover,
html[data-theme="dark"] #inventory-edit-confirm:not(:disabled):hover,
html[data-theme="dark"] .prompt-dialog-save:not(:disabled):hover {
  background: #4f7c67 !important;
  border-color: #4f7c67 !important;
}

html[data-theme="dark"] #rag-upload:not(:disabled) {
  background: var(--accent-2) !important;
  border-color: var(--accent-2) !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

html[data-theme="dark"] #rag-upload:not(:disabled):hover {
  background: #3f6b56 !important;
  border-color: #3f6b56 !important;
}

html[data-theme="dark"] .account-tab.is-active {
  color: #c0742a !important;
  -webkit-text-fill-color: #c0742a !important;
}

html[data-theme="dark"] .inventory-move-tab.is-active {
  color: #c0742a !important;
  -webkit-text-fill-color: #c0742a !important;
}

/* Small screen: simple confirm dialogs — centered, 1rem margin, all-round radius, pop animation */
@media (max-width: 640px) {
  .account-dialog.dialog-confirm {
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: none !important;
    padding: 0 1rem !important;
    border-radius: 0 !important;
  }

  .account-dialog.dialog-confirm[open] {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .account-dialog.dialog-confirm .account-dialog-inner {
    border-radius: 16px !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    max-height: 90dvh !important;
  }

  .account-dialog.dialog-confirm[open] .account-dialog-inner {
    animation: dialog-pop 0.22s ease !important;
  }

  .account-dialog.dialog-confirm.is-closing .account-dialog-inner {
    animation: dialog-pop-out 0.18s ease forwards !important;
  }

  .prompt-delete-dialog {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 1rem !important;
    right: 1rem !important;
    width: auto !important;
    max-width: none !important;
    margin: auto !important;
    height: fit-content !important;
    border-radius: 16px !important;
    transform: scale(0.96) !important;
    opacity: 0 !important;
  }

  .prompt-delete-dialog[open] {
    display: block !important;
    transform: scale(1) !important;
    opacity: 1 !important;
  }
}

/* iOS Safari: remove blue tap highlight and focus ring on tabs */
.ai-tab,
.pill-tab,
.prompt-tab,
.account-tab,
.attendance-tab,
.inventory-move-tab {
  -webkit-tap-highlight-color: transparent;
}

.ai-tab:focus:not(:focus-visible),
.pill-tab:focus:not(:focus-visible),
.prompt-tab:focus:not(:focus-visible),
.account-tab:focus:not(:focus-visible),
.attendance-tab:focus:not(:focus-visible),
.inventory-move-tab:focus:not(:focus-visible) {
  outline: none;
}

/* Dark mode skeleton shimmer */
html[data-theme="dark"] #canvas-host.is-loading {
  background: linear-gradient(
    100deg,
    #2e2b28 20%,
    #3e3a36 45%,
    #2e2b28 70%
  );
  background-size: 200% 100%;
}

html[data-theme="dark"] .history-thumb.is-skeleton {
  background: linear-gradient(
    100deg,
    #2e2b28 20%,
    #3e3a36 45%,
    #2e2b28 70%
  );
  background-size: 200% 100%;
}

html[data-theme="dark"] .history-preview-item.is-loading::before {
  background: linear-gradient(
    100deg,
    #2e2b28 20%,
    #3e3a36 45%,
    #2e2b28 70%
  );
  background-size: 200% 100%;
}

html[data-theme="dark"] .history-thumb.is-loading::before {
  background: linear-gradient(
    100deg,
    #2e2b28 20%,
    #3e3a36 45%,
    #2e2b28 70%
  );
  background-size: 200% 100%;
}

.social-marketing-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 1rem;
  align-items: stretch;
  min-height: calc(100dvh - var(--header-height, 68px) - 3rem);
  overflow: visible;
}

.social-marketing-dashboard > * {
  margin-bottom: 0 !important;
}

.social-marketing-card,
.social-marketing-output-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: auto;
  min-height: 0;
  overflow: visible;
}

.social-marketing-card {
  padding: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
}

.social-marketing-form-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.2rem 1.2rem 0;
}

.social-marketing-output-card {
  overflow: hidden;
  padding: 1.2rem;
  padding-bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.social-marketing-head h2,
.social-marketing-output-head h3 {
  margin: 0;
}

.social-marketing-head p,
.social-marketing-output-head p {
  margin: 0.45rem 0 0;
  color: var(--muted);
}

.social-marketing-inline {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.social-marketing-inline label,
.social-marketing-fields label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--ink);
}

.social-marketing-inline input,
.social-marketing-fields input,
.social-marketing-fields select,
.social-marketing-fields textarea {
  width: 100%;
  border: 1px solid #c0c0c0;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.social-marketing-fields {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.75rem;
  overflow: visible;
}

.social-marketing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.sm-block {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.6);
}

.sm-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.55rem;
}

.sm-block-head h4 {
  margin: 0;
  font-size: 0.95rem;
}

.sm-rows {
  display: grid;
  gap: 0.55rem;
}

.sm-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.45rem;
}

.sm-row .sm-remove-row {
  white-space: nowrap;
}

.social-marketing-fields textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}

.sm-add-dialog-form {
  margin-top: 0.5rem;
}

.sm-add-dialog-form label {
  display: grid;
  gap: 0.35rem;
}

.sm-add-dialog .account-dialog-actions {
  justify-content: flex-end;
  padding: 0.9rem 1rem;
}

.sm-add-dialog-form .dropdown.sm-dialog-dropdown {
  width: 100%;
  display: flex;
}

.sm-dialog-dropdown .dropdown-trigger {
  width: 100%;
  justify-content: space-between;
  min-height: 42px;
  height: 42px;
  border: 1px solid #c0c0c0;
  border-radius: 10px;
  padding: 0 0.75rem;
  background: #fff;
}

.sm-dialog-dropdown .dropdown-menu {
  left: 0;
  right: auto;
  min-width: 100%;
}

.sm-dialog-dropdown.sm-dropdown-up .dropdown-menu {
  top: auto;
  bottom: calc(100% + 6px);
}

.social-marketing-actions {
  margin-top: 0;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.65rem;
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 0.9rem 1.2rem calc(1rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--stroke);
  background: var(--panel-bg);
}

.social-marketing-readable {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.sm-summary-card,
.sm-post-card {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: #fff;
  padding: 0.85rem 0.9rem;
}

.sm-summary-card p,
.sm-post-card p {
  margin: 0.35rem 0;
  line-height: 1.5;
}

.sm-post-card h4,
.sm-post-card h5 {
  margin: 0 0 0.4rem;
}

.sm-platform-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.sm-empty {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .social-marketing-dashboard {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .social-marketing-card,
  .social-marketing-output-card {
    height: auto;
    overflow: visible;
    display: flex;
  }

  .social-marketing-form-main {
    overflow: visible;
    padding-bottom: 0;
  }

  .social-marketing-card {
    grid-template-rows: none;
  }

  .social-marketing-actions {
    position: static;
  }

  .social-marketing-fields,
  .social-marketing-readable {
    overflow: visible;
  }
}

@media (max-width: 720px) {
  .social-marketing-inline {
    grid-template-columns: 1fr;
  }

  .social-marketing-grid {
    grid-template-columns: 1fr;
  }

  .sm-row {
    grid-template-columns: 1fr;
  }

  .sm-platform-row {
    grid-template-columns: 1fr;
  }
}

html[data-theme="dark"] .social-marketing-inline input,
html[data-theme="dark"] .social-marketing-fields input,
html[data-theme="dark"] .social-marketing-fields select,
html[data-theme="dark"] .social-marketing-fields textarea {
  background: #111417;
  border-color: #404040;
  color: #edf2f6;
}

body.customer-service-page .customer-service-dashboard {
  display: flex;
  flex-direction: column;
}

.customer-service-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  border-radius: 0;
}

.customer-service-add-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  width: 100%;
  padding: 0.75rem 1.5rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  background: #fff;
  border-top: 1px solid var(--stroke);
  box-shadow: none;
  z-index: 20;
}

.customer-service-add-trigger {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

body.customer-service-dialog-open .customer-service-add-wrap {
  display: none;
}

.customer-service-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0;
  border: none;
  box-shadow: none;
}

.customer-service-tabs {
  margin: 0;
  margin-bottom: 0;
  gap: 0.75rem;
}

.customer-service-tab {
  min-width: 5.5rem;
}

.customer-service-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.customer-service-card-head h3 {
  margin: 0;
}

.customer-service-card-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.customer-service-source {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(200, 173, 112, 0.12);
  color: #8f6b2e;
  font-size: 0.92rem;
  font-weight: 700;
}

.customer-service-channel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.customer-service-channel {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel-soft);
}

.customer-service-preview-card {
  gap: 1rem;
}

.customer-service-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.customer-service-preview-head > div {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 0.4rem;
}

.customer-service-channel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.customer-service-channel-head h4,
.customer-service-section-head h4 {
  margin: 0;
}

.customer-service-channel > p {
  margin: 0;
  color: var(--muted);
}

.customer-service-channel-meta {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.customer-service-channel-meta li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.95rem;
}

.customer-service-channel-meta span {
  color: var(--muted);
}

.customer-service-channel-meta strong {
  color: var(--ink);
  font-weight: 700;
  text-align: right;
  word-break: break-all;
}

.customer-service-preview-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.customer-service-preview-enabled {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.36rem 0.72rem;
  border-radius: 999px;
  background: rgba(148, 156, 168, 0.14);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.customer-service-preview-enabled.is-enabled {
  background: rgba(94, 143, 109, 0.14);
  color: #2d6b43;
}

.customer-service-preview-connection {
  color: var(--muted);
  font-size: 0.92rem;
}

.customer-service-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.5rem;
  padding: 0.36rem 0.7rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  background: rgba(160, 160, 160, 0.16);
  color: var(--muted);
}

.customer-service-status-pill.is-ready {
  background: rgba(200, 173, 112, 0.14);
  color: #8f6b2e;
}

.customer-service-status-pill.is-connected {
  background: rgba(94, 143, 109, 0.18);
  color: #2d6b43;
}

.customer-service-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.customer-service-form .dropdown {
  width: 100%;
}

.customer-service-form .dropdown-trigger {
  width: 100%;
  justify-content: space-between;
  min-height: 48px;
}

.customer-service-form .dropdown-menu {
  max-height: min(280px, 40vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.customer-service-edit-trigger {
  flex: 0 0 auto;
}

.customer-service-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.customer-service-channel-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.customer-service-panel-actions {
  display: flex;
  justify-content: flex-end;
}

.customer-service-empty {
  padding: 1rem 1.1rem;
  border: 1px dashed var(--line);
  border-radius: 20px;
  color: var(--muted);
  text-align: center;
  background: var(--panel-soft);
}

.customer-service-panel[hidden] {
  display: none !important;
}

.customer-service-section {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 24px;
}

.customer-service-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1rem;
}

.customer-service-form-span-2 {
  grid-column: span 2;
}

.customer-service-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
}

.customer-service-edit-inner {
  width: min(720px, calc(100vw - 2rem));
  max-height: min(84vh, calc(100dvh - 2rem));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.customer-service-edit-dialog .account-dialog-header {
  flex: 0 0 auto;
}

.customer-service-edit-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
}

.customer-service-edit-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.customer-service-edit-panel[hidden] {
  display: none !important;
}

.customer-service-textarea {
  width: 100%;
  min-height: 108px;
  padding: 0.85rem 0.95rem;
  border-radius: 18px;
  resize: vertical;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: none;
}

#customer-service-edit-dialog .customer-service-form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
#customer-service-edit-dialog .customer-service-form-grid .dropdown-trigger {
  min-height: 48px;
}

#customer-service-edit-dialog .customer-service-form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="range"]) {
  width: 100%;
  padding: 0.75rem 0.95rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  box-shadow: none;
}

#customer-service-edit-dialog .customer-service-form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):hover:not(:disabled):not([readonly]) {
  border-color: #a0a0a0;
}

#customer-service-edit-dialog .customer-service-form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus-visible {
  outline: 2px solid rgba(138, 164, 255, 0.35);
  outline-offset: 0;
  border-color: #a0a0a0;
}

.customer-service-textarea:hover:not(:disabled):not([readonly]) {
  border-color: #a0a0a0;
}

.customer-service-textarea:focus-visible {
  outline: 2px solid rgba(138, 164, 255, 0.35);
  outline-offset: 0;
  border-color: #a0a0a0;
}

#customer-service-edit-dialog .account-dialog-actions-fixed {
  flex: 0 0 auto;
  background: inherit;
  border-top: 1px solid rgba(42, 34, 28, 0.08);
  padding: 0.9rem 1rem;
}

#customer-service-edit-dialog .account-dialog-actions-fixed .btn {
  flex: 0 0 auto;
}

html[data-theme="dark"] .customer-service-textarea {
  background: #20262f;
  border-color: #404040;
  color: #edf2f6;
}

html[data-theme="dark"] #customer-service-edit-dialog .customer-service-form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="range"]) {
  background: #20262f;
  border-color: #404040;
  color: #edf2f6;
}

html[data-theme="dark"] #customer-service-edit-dialog .customer-service-form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):hover:not(:disabled):not([readonly]) {
  border-color: #606060;
}

html[data-theme="dark"] #customer-service-edit-dialog .customer-service-form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus-visible {
  border-color: #606060;
  outline-color: rgba(138, 164, 255, 0.35);
}

html[data-theme="dark"] .customer-service-textarea:hover:not(:disabled):not([readonly]) {
  border-color: #606060;
}

html[data-theme="dark"] .customer-service-textarea:focus-visible {
  border-color: #606060;
  outline-color: rgba(138, 164, 255, 0.35);
}

html[data-theme="dark"] #customer-service-edit-dialog .account-dialog-actions-fixed {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.customer-service-textarea::placeholder {
  color: var(--muted);
}

html[data-theme="dark"] .customer-service-textarea::placeholder {
  color: #9aa4b1;
}

#customer-service-edit-dialog .dropdown.account-role-dropdown .dropdown-menu {
  top: calc(100% + 6px) !important;
  bottom: auto !important;
  left: 0;
  right: 0;
  width: 100%;
  min-width: 100%;
  z-index: 20;
  max-height: min(280px, 40vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1280px) {
  .customer-service-channel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .customer-service-channel-grid,
  .customer-service-channel-list,
  .customer-service-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .customer-service-form-span-2 {
    grid-column: auto;
  }

  .customer-service-card-head,
  .customer-service-actions,
  .customer-service-preview-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .customer-service-edit-trigger {
    width: 100%;
  }

  .customer-service-panel-actions .btn {
    width: 100%;
  }

  #customer-service-edit-dialog .account-dialog-actions-fixed {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    padding: 0.9rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    background: inherit;
    border-top: 1px solid rgba(42, 34, 28, 0.08);
    border-radius: 0;
  }

  html[data-theme="dark"] #customer-service-edit-dialog .account-dialog-actions-fixed {
    border-top-color: rgba(255, 255, 255, 0.08);
  }
}

html[data-theme="dark"] .customer-service-channel {
  background: rgba(255, 255, 255, 0.02);
}

html[data-theme="dark"] .customer-service-empty {
  background: rgba(255, 255, 255, 0.02);
}

html[data-theme="dark"] .customer-service-source {
  background: rgba(200, 173, 112, 0.16);
  color: #d4b47c;
}

html[data-theme="dark"] .customer-service-status-pill.is-ready {
  color: #d4b47c;
}

html[data-theme="dark"] .customer-service-status-pill.is-connected {
  background: rgba(94, 143, 109, 0.24);
  color: #9dc8aa;
}

html[data-theme="dark"] .customer-service-preview-enabled {
  background: rgba(255, 255, 255, 0.06);
  color: #b8c2cf;
}

html[data-theme="dark"] .customer-service-preview-enabled.is-enabled {
  background: rgba(94, 143, 109, 0.24);
  color: #9dc8aa;
}

html[data-theme="dark"] .sm-block {
  background: #12171d;
  border-color: #2a3138;
}

html[data-theme="dark"] .sm-dialog-dropdown .dropdown-trigger {
  background: #111417;
  border-color: #2a3138;
  color: #edf2f6;
}

html[data-theme="dark"] .sm-summary-card,
html[data-theme="dark"] .sm-post-card {
  background: #111417;
  border-color: #2a3138;
}

@media (max-width: 1280px) {
  .dashboard-has-tabs {
    padding-top: 4rem !important;
  }

  body.schedule-page .schedule-dashboard {
    padding: 4rem 1rem calc(6rem + env(safe-area-inset-bottom, 0px));
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  body.schedule-page .schedule-add-open-wrap {
    z-index: 20;
  }

  .shell.menu-open .schedule-add-open-wrap,
  body:has(.rag-qa-panel.open) .schedule-add-open-wrap {
    display: none;
  }
}

@media (max-width: 960px) {
  .schedule-main-grid,
  .schedule-admin-grid {
    grid-template-columns: 1fr;
  }

  .schedule-hero-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .schedule-hero-meta,
  .schedule-time-grid {
    grid-template-columns: 1fr;
  }

  .schedule-calendar-toolbar {
    grid-template-columns: auto 1fr auto;
    align-items: center;
  }

  .schedule-calendar-heading {
    text-align: center;
  }

  .schedule-manage-toolbar {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .devtest-manual-grid {
    grid-template-columns: 1fr;
  }

  .schedule-create-dialog:not([open]),
  #schedule-detail-dialog:not([open]) {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }

  .schedule-create-dialog {
    position: fixed !important;
    top: var(--header-height, 68px) !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    display: none;
  }

  .schedule-create-dialog[open],
  #schedule-detail-dialog[open] {
    position: fixed !important;
    top: var(--header-height, 68px) !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    height: auto !important;
    width: 100% !important;
    margin: 0 !important;
    display: flex !important;
    align-items: flex-end !important;
    justify-content: flex-end !important;
  }

  .schedule-create-inner,
  #schedule-detail-dialog .account-dialog-inner {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    max-height: calc(100dvh - var(--header-height, 68px)) !important;
    margin: 0 !important;
    border-radius: 18px 18px 0 0 !important;
  }

  .schedule-create-body,
  .schedule-detail-body {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .schedule-create-body {
    overflow: hidden;
    flex: 1 1 auto;
    min-height: 0;
    padding: 12px 16px 16px;
  }

  .schedule-create-body .schedule-create-panel {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
  }

  .schedule-create-dialog[open] .schedule-create-inner,
  #schedule-detail-dialog[open] .account-dialog-inner {
    animation: dialog-slide-up 0.28s ease;
  }

  .schedule-create-dialog.is-closing .schedule-create-inner,
  #schedule-detail-dialog.is-closing .account-dialog-inner {
    animation: dialog-slide-down 0.2s ease forwards;
  }

  #schedule-detail-dialog .schedule-detail-actions {
    position: sticky;
    bottom: 0;
    background: var(--panel-bg);
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  }

  .schedule-create-dialog[open] .schedule-create-inner > .account-dialog-actions {
    justify-content: flex-end;
    position: static;
    flex: 0 0 auto;
    margin: 0;
    padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
    background: inherit;
    border-top: 1px solid rgba(42, 34, 28, 0.08);
  }

  html[data-theme="dark"] .schedule-create-dialog[open] .schedule-create-inner > .account-dialog-actions {
  justify-content: flex-end;
    border-top-color: rgba(255, 255, 255, 0.08);
  }

  .schedule-calendar-card {
    border: none;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  .schedule-day-card,
  .schedule-fixed-card {
    border: none;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  .schedule-add-open-wrap {
    justify-content: stretch;
    padding: 0.75rem 1.5rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
    display: flex;
    gap: 0.5rem;
    column-gap: 0.5rem;
  }

  .schedule-add-open {
    flex: 1;
    pointer-events: auto;
  }

  .schedule-add-open-wrap > .schedule-add-open + .schedule-add-open {
    margin-left: 0.5rem;
  }

  .schedule-cta-group {
    width: 100%;
  }

  .schedule-calendar-weekdays,
  .schedule-calendar-grid {
    gap: 0.45rem;
  }

  .schedule-calendar-grid,
  .schedule-calendar-day {
    touch-action: pan-y;
  }

  .schedule-calendar-day {
    min-height: 60px;
    padding: 0.45rem;
    border-radius: 14px;
  }

  .schedule-calendar-day-body {
    min-width: 0;
    gap: 0.3rem;
  }

  .schedule-calendar-day-body .schedule-member-badge,
  .schedule-calendar-day-body .schedule-calendar-chip {
    display: inline-flex;
    width: 12px;
    height: 12px;
    min-width: 12px;
    padding: 0;
    border-radius: 999px;
    background: currentColor;
    border: 1px solid currentColor;
    opacity: 1;
    overflow: hidden;
    text-indent: -9999px;
    white-space: nowrap;
    justify-self: start;
  }

  .schedule-item-main,
  .schedule-panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .schedule-day-card .schedule-panel-head {
    flex-direction: row;
    align-items: center;
  }

  html[data-theme="dark"] .schedule-calendar-day-body .schedule-member-badge-1,
  html[data-theme="dark"] .schedule-calendar-day-body .schedule-member-badge-2,
  html[data-theme="dark"] .schedule-calendar-day-body .schedule-member-badge-3,
  html[data-theme="dark"] .schedule-calendar-day-body .schedule-member-badge-4,
  html[data-theme="dark"] .schedule-calendar-day-body .schedule-member-badge-5,
  html[data-theme="dark"] .schedule-calendar-day-body .schedule-member-badge-6,
  html[data-theme="dark"] .schedule-calendar-day-body .schedule-member-badge-7,
  html[data-theme="dark"] .schedule-calendar-day-body .schedule-member-badge-8 {
    border-width: 0;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
  }

  html[data-theme="dark"] .schedule-calendar-day-body .schedule-member-badge-1 {
    background: #5da9ff;
    color: #5da9ff;
  }

  html[data-theme="dark"] .schedule-calendar-day-body .schedule-member-badge-2 {
    background: #4fd18b;
    color: #4fd18b;
  }

  html[data-theme="dark"] .schedule-calendar-day-body .schedule-member-badge-3 {
    background: #ffb454;
    color: #ffb454;
  }

  html[data-theme="dark"] .schedule-calendar-day-body .schedule-member-badge-4 {
    background: #c68cff;
    color: #c68cff;
  }

  html[data-theme="dark"] .schedule-calendar-day-body .schedule-member-badge-5 {
    background: #ff7f96;
    color: #ff7f96;
  }

  html[data-theme="dark"] .schedule-calendar-day-body .schedule-member-badge-6 {
    background: #42d4d6;
    color: #42d4d6;
  }

  html[data-theme="dark"] .schedule-calendar-day-body .schedule-member-badge-7 {
    background: #ffd84d;
    color: #ffd84d;
  }

  html[data-theme="dark"] .schedule-calendar-day-body .schedule-member-badge-8 {
    background: #c7d2e0;
    color: #c7d2e0;
  }
}

@media (min-width: 1536px) {
  body.pos-page .dashboard,
  body.articles-page .dashboard {
    left: 260px;
    right: 0;
    width: auto;
    max-width: none;
    padding-bottom: 5rem;
  }

  body.social-marketing-page .dashboard,
  body.inventory-page .dashboard,
  body.attendance-page .dashboard,
  body.schedule-page .dashboard,
  body.leave-page .dashboard,
  body.profile-page .dashboard,
  body.employee-accounts-page .dashboard,
  body.devtest-page .dashboard {
    left: 260px;
    right: 0;
    width: auto;
    max-width: none;
  }

  body.pos-page .dashboard {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 260px;
    right: 0;
    width: auto;
    max-width: none;
  }
}

html[data-theme="dark"] .performance-action-dropdown #performance-action-delete:not(:disabled) {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #f28b82 !important;
  -webkit-text-fill-color: #f28b82 !important;
}

html[data-theme="dark"] .performance-action-dropdown #performance-action-delete:hover:not(:disabled) {
  background: rgba(242, 139, 130, 0.12) !important;
  border: none !important;
  box-shadow: none !important;
  color: #f28b82 !important;
  -webkit-text-fill-color: #f28b82 !important;
}

html[data-theme="dark"] #pos-save-button:not(:disabled),
html[data-theme="dark"] #pos-info-save:not(:disabled),
html[data-theme="dark"] #pos-category-save:not(:disabled),
html[data-theme="dark"] #attendance-makeup-save:not(:disabled),
html[data-theme="dark"] #profile-edit-save:not(:disabled),
html[data-theme="dark"] #account-edit-save:not(:disabled),
html[data-theme="dark"] #inventory-edit-confirm:not(:disabled),
html[data-theme="dark"] #promotion-save-button:not(:disabled),
html[data-theme="dark"] .prompt-dialog-save:not(:disabled) {
  background: var(--accent-2) !important;
  border-color: var(--accent-2) !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

html[data-theme="dark"] #pos-save-button:not(:disabled):hover,
html[data-theme="dark"] #pos-info-save:not(:disabled):hover,
html[data-theme="dark"] #pos-category-save:not(:disabled):hover,
html[data-theme="dark"] #attendance-makeup-save:not(:disabled):hover,
html[data-theme="dark"] #profile-edit-save:not(:disabled):hover,
html[data-theme="dark"] #account-edit-save:not(:disabled):hover,
html[data-theme="dark"] #inventory-edit-confirm:not(:disabled):hover,
html[data-theme="dark"] #promotion-save-button:not(:disabled):hover,
html[data-theme="dark"] .prompt-dialog-save:not(:disabled):hover {
  background: #4f7c67 !important;
  border-color: #4f7c67 !important;
}

/* ==================== ARTICLES PAGE STYLES ==================== */

body.articles-page .dashboard {
  padding-bottom: 5rem;
}

body.articles-page {
  --articles-bg: #f5f5f5;
  --articles-border: #e0e0e0;
  --articles-text: #333;
  --articles-muted: #666;
}

html[data-theme="dark"] body.articles-page {
  --articles-bg: #1e1e1e;
  --articles-border: #333;
  --articles-text: #e0e0e0;
  --articles-muted: #999;
}

.articles-header {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.articles-header-left {
  min-width: 0;
}

.articles-title {
  display: none;
}

.articles-subtitle {
  display: none;
}

.articles-header-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
}

.articles-search {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  font-size: 0.95rem;
  background: white;
  max-width: 280px;
  flex-shrink: 0;
  font-family: inherit;
}

.articles-search:hover:not(:disabled) {
  border-color: rgba(42, 34, 28, 0.32);
  background: rgba(255, 255, 255, 0.92);
}

.articles-search::placeholder {
  color: var(--muted);
}

#articles-create-btn {
  width: auto;
  white-space: nowrap;
}

html[data-theme="dark"] .articles-search {
  background: #222;
  border-color: var(--stroke);
  color: var(--ink);
}

html[data-theme="dark"] .articles-search:hover:not(:disabled) {
  background: #252b34;
  border-color: rgba(255, 255, 255, 0.28);
}

html[data-theme="dark"] .articles-search::placeholder {
  color: #9ca3af;
}

.articles-filters {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  margin-bottom: 24px;
  align-items: flex-start;
}

.articles-filters-controls {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.articles-header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.articles-add-open-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1.5rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  background: #fff;
  border-top: 1px solid var(--stroke);
  box-shadow: none;
  z-index: 10;
}

body.articles-dialog-open {
  overflow: hidden;
}

body.articles-dialog-open .articles-add-open-wrap {
  display: none;
}

.articles-add-open,
.articles-ai-mode-open {
  flex: 0 0 auto;
  min-width: 0;
  height: 40px;
  padding: 0 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #ffffff;
  border: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

/* Small window - articles-add-open-wrap buttons full width */
@media (max-width: 767px) {
  .articles-add-open-wrap .articles-add-open,
  .articles-add-open-wrap .articles-ai-mode-open {
    flex: 1;
  }
}

/* 新增文章按鈕 - 標準綠色 */
.articles-add-open {
  background: #3f6b56;
}

.articles-add-open:hover:not(:disabled) {
  filter: brightness(1.08);
}

.articles-add-open:active:not(:disabled) {
  filter: brightness(0.95);
}

/* AI自動模式按鈕 - 藍紫色 */
.articles-ai-mode-open {
  background: linear-gradient(135deg, #5B69D9 0%, #9B6BA8 100%);
}

.articles-ai-mode-open:hover:not(:disabled) {
  filter: brightness(1.08);
}

.articles-ai-mode-open:active:not(:disabled) {
  filter: brightness(0.95);
}

.add-icon {
  font-size: 1.2rem;
  font-weight: 300;
}

@media (max-width: 640px) {
  .articles-dialog .account-dialog-inner {
    max-height: calc(100dvh - var(--header-height, 68px)) !important;
    overflow: hidden !important;
  }

  .articles-dialog .account-form {
    padding: 1rem 1rem calc(1rem + 5.5rem + env(safe-area-inset-bottom, 0px)) 1rem;
    overflow-y: auto;
    flex: 1 1 auto;
  }

  .articles-dialog .account-dialog-header {
    flex: 0 0 auto;
    position: relative;
    z-index: 10;
  }
}

.filter-group {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.filter-group label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  flex-shrink: 0;
}

.articles-topic-filter,
.articles-status-filter {
  max-width: 280px;
}

.articles-topic-filter .dropdown-trigger,
.articles-status-filter .dropdown-trigger {
  min-width: 150px;
}

.filter-group .pos-category-dropdown .dropdown-trigger {
  min-height: 40px;
  height: 40px;
  padding: 0 0.75rem;
  border-radius: 10px;
  font-size: 0.95rem;
  border: 1px solid var(--stroke);
  transition: border-color 0.2s;
}

.filter-group .pos-category-dropdown .dropdown-trigger[aria-expanded="true"] {
  border-color: var(--accent);
}

/* Responsive: Small screens */
@media (max-width: 640px) {
  .articles-filters {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .articles-topic-filter,
  .articles-status-filter {
    width: 100%;
  }

  .articles-search {
    width: 100%;
    max-width: none;
  }

  .filter-group .pos-category-dropdown .dropdown-trigger {
    width: 100%;
  }
}

.articles-featured-wrapper {
  width: fit-content;
}

.account-form textarea {
  width: 100%;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
  resize: vertical;
}

.articles-featured-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: var(--ink);
}

.articles-featured-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.articles-featured-label span {
  flex-shrink: 0;
}

html[data-theme="dark"] .account-form textarea {
  background: #222;
  border-color: var(--stroke);
  color: var(--ink);
}

html[data-theme="dark"] .account-form textarea:hover:not(:disabled):not([readonly]) {
  background: #252b34;
  border-color: rgba(255, 255, 255, 0.28);
}

html[data-theme="dark"] .account-form textarea::placeholder {
  color: #9ca3af;
}

.articles-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.articles-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  color: var(--articles-muted);
  font-size: 14px;
}

/* Article Card */
.articles-card {
  background: white;
  border: 1px solid var(--articles-border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  cursor: pointer;
}

html[data-theme="dark"] .articles-card {
  background: #2a2a2a;
  border-color: #3a3a3a;
}

.articles-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.articles-card-image {
  width: 100%;
  height: 160px;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

html[data-theme="dark"] .articles-card-image {
  background: #1a1a1a;
}

.articles-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.articles-card-image-icon {
  width: 48px;
  height: 48px;
  color: #ccc;
  fill: currentColor;
  stroke: none;
}

.articles-card-content {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.articles-card-topic {
  font-size: 11px;
  font-weight: 600;
  color: #1976d2;
  text-transform: uppercase;
  margin-bottom: 8px;
}

html[data-theme="dark"] .articles-card-topic {
  color: #64b5f6;
}

.articles-card-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--articles-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.articles-card-excerpt {
  font-size: 13px;
  color: var(--articles-muted);
  margin: 0 0 12px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.articles-card-meta {
  font-size: 12px;
  color: var(--articles-muted);
  margin-bottom: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--articles-border);
}

.articles-card-status {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-right: 8px;
  margin-bottom: 8px;
  border: 1px solid;
}

.articles-card-status.draft {
  color: rgba(42, 34, 28, 0.75);
  border-color: rgba(42, 34, 28, 0.22);
  background: rgba(42, 34, 28, 0.06);
}

html[data-theme="dark"] .articles-card-status.draft {
  color: #dbe2ec;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
}

.articles-card-status.review {
  color: #1c6b42;
  border-color: rgba(28, 107, 66, 0.42);
  background: rgba(28, 107, 66, 0.1);
}

html[data-theme="dark"] .articles-card-status.review {
  color: #8dd8b1;
  border-color: rgba(141, 216, 177, 0.45);
  background: rgba(141, 216, 177, 0.14);
}

.articles-card-status.published {
  color: #1c6b42;
  border-color: rgba(28, 107, 66, 0.42);
  background: rgba(28, 107, 66, 0.1);
}

html[data-theme="dark"] .articles-card-status.published {
  color: #8dd8b1;
  border-color: rgba(141, 216, 177, 0.45);
  background: rgba(141, 216, 177, 0.14);
}

.articles-card-status.archived {
  color: rgba(42, 34, 28, 0.75);
  border-color: rgba(42, 34, 28, 0.22);
  background: rgba(42, 34, 28, 0.06);
}

html[data-theme="dark"] .articles-card-status.archived {
  color: #dbe2ec;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
}

.articles-approved-by {
  font-size: 12px;
  color: #666;
  margin-left: 12px;
}

html[data-theme="dark"] .articles-approved-by {
  color: #999;
}

.articles-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--articles-border);
}

.articles-card-action-btn {
  flex: 1;
  height: 36px;
  padding: 0 1rem;
  font-size: 14px;
  border: 1px solid var(--articles-border);
  background: transparent;
  color: var(--articles-text);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.articles-card-action-btn:hover {
  background: var(--articles-border);
}

html[data-theme="dark"] .articles-card-action-btn:hover {
  background: #3a3a3a;
}

.articles-card-action-btn.cta {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.articles-card-action-btn.cta:hover {
  background: #b3681d;
  border-color: #b3681d;
}

.articles-card-action-btn.danger {
  color: #d32f2f;
  border-color: #d32f2f;
}

.articles-card-action-btn.danger:hover {
  background: rgba(211, 47, 47, 0.1);
}

html[data-theme="dark"] .articles-card-action-btn.danger {
  color: #ef5350;
  border-color: #ef5350;
}

html[data-theme="dark"] .articles-card-action-btn.danger:hover {
  background: rgba(239, 83, 80, 0.15);
}

/* AI-Generated Articles Styles */
.articles-card-ai-generated {
  border-left: 4px solid var(--accent);
}

html[data-theme="dark"] .articles-card-ai-generated {
  border-left-color: var(--accent);
}

.articles-ai-badge {
  display: inline-block;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 8px;
  font-weight: 500;
}

.articles-ai-badge-approved {
  color: #2e7d32;
  background: rgba(46, 125, 50, 0.1);
  border: 1px solid rgba(46, 125, 50, 0.3);
}

html[data-theme="dark"] .articles-ai-badge-approved {
  color: #66bb6a;
  background: rgba(102, 187, 106, 0.15);
  border-color: rgba(102, 187, 106, 0.3);
}

.articles-ai-badge-rejected {
  color: #c62828;
  background: rgba(198, 40, 40, 0.1);
  border: 1px solid rgba(198, 40, 40, 0.3);
}

html[data-theme="dark"] .articles-ai-badge-rejected {
  color: #ef5350;
  background: rgba(239, 83, 80, 0.15);
  border-color: rgba(239, 83, 80, 0.3);
}

.articles-ai-badge-pending {
  color: #f57c00;
  background: rgba(245, 124, 0, 0.1);
  border: 1px solid rgba(245, 124, 0, 0.3);
}

html[data-theme="dark"] .articles-ai-badge-pending {
  color: #ffb74d;
  background: rgba(255, 183, 77, 0.15);
  border-color: rgba(255, 183, 77, 0.3);
}

.articles-ai-feedback {
  background: rgba(211, 47, 47, 0.05);
  border-left: 3px solid #d32f2f;
  padding: 8px 12px;
  margin-top: 8px;
  border-radius: 4px;
  font-size: 13px;
  color: #555;
}

html[data-theme="dark"] .articles-ai-feedback {
  background: rgba(239, 83, 80, 0.1);
  border-left-color: #ef5350;
  color: #ccc;
}

.articles-ai-feedback p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Dialog Styles */
.articles-dialog {
  max-width: 1200px;
}

.articles-dialog .dropdown {
  position: relative;
}

/* .articles-dialog .dropdown-menu rules removed z-index - no longer needed */


.articles-dialog .account-dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - var(--header-height, 68px) - 2rem);
  width: min(90vw, 1200px);
  max-width: 1200px;
  overflow: hidden;
}

@media (max-width: 1280px) {
  .articles-form-left,
  .articles-form-right {
    display: contents;
  }

  /* Constrain grid children to parent width in small/medium screens */
  .articles-form-right > * {
    min-width: 0;
    max-width: 100%;
  }
}

.articles-dialog .account-dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
}

.articles-dialog .account-form {
  padding: 0;
}

@media (min-width: 1281px) {
  /* 雙欄版面下，左右欄各自獨立捲動（例如封面/標題較短的左欄，右欄的內文編輯器
     較長時可以各自捲，不會因為右欄很長就把左欄一起捲走），所以捲動容器不是
     account-dialog-body 本身，而是下面兩個欄位各自。
     這裡改用 flex（而不是 grid + height:100%）撐出欄位高度：grid 子項的
     height:100% 沒辦法可靠地順著巢狀的 body -> account-form -> 欄位 一路撐下去
     （量測結果欄位仍撐到跟內容一樣高，完全沒有被裁切/捲動），
     flex row 容器預設 align-items:stretch 讓子項自動撐滿容器高度，
     是這個檔案本來就在用、比較不會出錯的做法（跟 account-dialog-inner 本身的
     header/body/actions 直式排版同一套邏輯）。
     這條規則要放在上面 account-dialog-body 的無條件規則「之後」，選擇器優先權
     一樣時才會照原始碼順序蓋過去。 */
  .articles-dialog .account-dialog-body {
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .articles-dialog:not(.articles-ai-workflow-dialog) .account-form {
    display: flex;
    flex-direction: row;
    flex: 1 1 auto;
    min-height: 0;
    gap: 1.5rem;
    width: 100%;
    min-width: 0;
  }

  .articles-form-left {
    flex: 0 0 40%;
    display: grid;
    align-content: start;
    gap: 1rem;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .articles-form-right {
    flex: 1 1 0;
    display: grid;
    align-content: start;
    gap: 1rem;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* Constrain grid children to parent width */
  .articles-form-right > * {
    min-width: 0;
    max-width: 100%;
  }
}

.articles-dialog .account-dialog-actions {
  position: static;
  justify-content: flex-end;
  flex: 0 0 auto;
  margin: 0;
  padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
  background: inherit;
  border-top: 1px solid rgba(42, 34, 28, 0.08);
  box-sizing: border-box;
}

.articles-dialog .account-dialog-header {
  flex: 0 0 auto;
  margin-bottom: 0 !important;
  padding: 1rem 1rem 0;
}

.articles-dialog .account-dialog-header {
  overflow: visible !important;
}

.articles-dialog-header-copy {
  padding-bottom: 0;
  border-bottom: none !important;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  flex: 1;
  min-width: 0;
}

.articles-dialog .account-dialog-title {
  padding: 0 !important;
  margin: 0;
  flex-shrink: 0;
}

.articles-dialog .pos-category-dropdown .dropdown-trigger {
  min-height: auto;
  height: auto;
  padding: 0.7rem 0.9rem;
  min-width: 150px;
}

.articles-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  border: 2px dashed rgba(42, 34, 28, 0.25);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fafafa;
  width: 100%;
  aspect-ratio: 16 / 9;
  position: relative;
  z-index: 0;
  overflow: hidden;
}

.articles-upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  height: auto;
  flex-grow: 0;
  flex-shrink: 0;
  margin-top: auto;
  margin-bottom: auto;
}

html[data-theme="dark"] .articles-upload {
  background: #1a1a1a;
  border-color: rgba(255, 255, 255, 0.15);
}

.articles-upload[data-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.articles-upload:hover:not([data-disabled="true"]) {
  border-color: #1976d2;
  background: #f0f7ff;
}

html[data-theme="dark"] .articles-upload:hover:not([data-disabled="true"]) {
  background: #0f3a5c;
}

.articles-upload-icon {
  font-size: 48px;
  color: #1976d2;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  margin: 0;
}

.articles-upload-text {
  font-size: 14px;
  color: var(--articles-text);
  font-weight: 500;
  margin: 0;
  margin-top: -4px;
  text-align: center;
}

/* Image preview inside upload box */
.articles-upload img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 6px !important;
  display: block !important;
}

.articles-image-hint {
  font-size: 12px;
  color: var(--articles-muted);
  display: block;
  margin-top: 8px;
}

.articles-image-error {
  color: #d32f2f;
  font-size: 12px;
  margin-top: 4px;
  display: block;
  min-height: 1.5em;
}

.articles-slug-hint {
  font-size: 12px;
  color: var(--articles-muted);
  display: block;
  margin-top: 4px;
}

.articles-rich-editor-field {
  margin-top: 16px;
}

.articles-rich-editor-label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--articles-text);
}

.articles-rich-editor {
  border: 1px solid #c0c0c0;
  border-radius: 4px;
  background: white;
  overflow: hidden;
}

html[data-theme="dark"] .articles-rich-editor {
  background: #2a2a2a;
  border-color: #404040;
}

.articles-rich-editor-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: #f5f5f5;
  border-bottom: 1px solid #c0c0c0;
  flex-wrap: wrap;
}

html[data-theme="dark"] .articles-rich-editor-toolbar {
  background: #1a1a1a;
}

.articles-rich-editor-block-trigger,
.articles-rich-editor-icon-btn,
.articles-rich-editor-toggle-icon {
  padding: 6px 10px;
  background: white;
  border: 1px solid #c0c0c0;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

html[data-theme="dark"] .articles-rich-editor-block-trigger,
html[data-theme="dark"] .articles-rich-editor-icon-btn,
html[data-theme="dark"] .articles-rich-editor-toggle-icon {
  background: #2a2a2a;
  border-color: #404040;
  color: #e0e0e0;
}

.articles-rich-editor-block-trigger:hover,
.articles-rich-editor-icon-btn:hover,
.articles-rich-editor-toggle-icon:hover {
  background: #f0f0f0;
}

html[data-theme="dark"] .articles-rich-editor-block-trigger:hover,
html[data-theme="dark"] .articles-rich-editor-icon-btn:hover,
html[data-theme="dark"] .articles-rich-editor-toggle-icon:hover {
  background: #3a3a3a;
}

.articles-rich-editor-icon-btn svg {
  width: 16px;
  height: 16px;
}

.articles-rich-editor-body-wrap {
  position: relative;
  display: flex;
  min-height: 300px;
}

.articles-rich-editor-body {
  flex: 1;
  padding: 16px;
  min-height: 300px;
  outline: none;
  word-break: break-word;
  overflow-y: auto;
  color: var(--ink);
  background: #fff;
  border: 1px solid #c0c0c0;
  border-radius: 4px;
  transition: border-color 0.2s ease;
}

.articles-rich-editor-body:hover {
  border-color: #a0a0a0;
}

.articles-rich-editor-body:focus {
  border-color: #a0a0a0;
  outline: 2px solid rgba(138, 164, 255, 0.35);
  outline-offset: 2px;
}

.articles-rich-editor-body[contenteditable]:empty:before {
  content: attr(data-placeholder);
  color: var(--articles-muted);
  opacity: 0.5;
}

.articles-rich-editor-html {
  display: none;
  flex: 1;
  padding: 16px;
  min-height: 300px;
  border: 1px solid #c0c0c0;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  resize: none;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.2s ease;
}

.articles-rich-editor-html:hover {
  border-color: #a0a0a0;
}

.articles-rich-editor-html:focus {
  border-color: #a0a0a0;
  outline: 2px solid rgba(138, 164, 255, 0.35);
  outline-offset: 2px;
}

html[data-theme="dark"] .articles-rich-editor-body,
html[data-theme="dark"] .articles-rich-editor-html {
  background: #222;
  border-color: #404040;
  color: var(--ink);
}

html[data-theme="dark"] .articles-rich-editor-body:hover,
html[data-theme="dark"] .articles-rich-editor-html:hover {
  border-color: #606060;
}

html[data-theme="dark"] .articles-rich-editor-body:focus,
html[data-theme="dark"] .articles-rich-editor-html:focus {
  border-color: #606060;
  outline-color: rgba(138, 164, 255, 0.35);
}

.articles-rich-editor-html.visible {
  display: block;
}

.articles-related-select {
  padding: 12px;
  border: 1px solid var(--articles-border);
  border-radius: 4px;
  background: white;
  max-height: 250px;
  overflow-y: auto;
}

html[data-theme="dark"] .articles-related-select {
  background: #2a2a2a;
  border-color: #3a3a3a;
}

.articles-related-hint {
  margin: 0;
  font-size: 12px;
  color: var(--articles-muted);
  padding: 0;
}

.articles-related-select .articles-related-item input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.articles-related-select .articles-related-item:has(input[type="checkbox"]:disabled) {
  opacity: 0.6;
  cursor: not-allowed;
}

.articles-related-select .articles-related-item {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 14px;
  color: var(--articles-text);
  border-bottom: 1px solid var(--articles-border);
  cursor: pointer;
}

.articles-related-select .articles-related-item:last-child {
  border-bottom: none;
}

.articles-related-select .articles-related-item input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 0;
  flex-shrink: 0;
}

.articles-related-select .articles-related-item span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.articles-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  padding: 8px 0;
}

/* Preview Dialog */
.articles-dialog.articles-preview-dialog .account-dialog-inner {
  max-width: 1200px;
  width: min(90vw, 1200px);
}

.articles-preview-content {
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  width: 100%;
  box-sizing: border-box;
}

.articles-preview-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 24px;
  width: 100%;
  box-sizing: border-box;
}

html[data-theme="dark"] .articles-preview-card {
  background: #2a2a2a;
}

.articles-preview-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0 !important;
  margin: 0;
}

html[data-theme="dark"] .articles-preview-image {
  background: #1a1a1a;
}

.articles-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.articles-preview-image-icon {
  width: 64px;
  height: 64px;
  color: #ccc;
  fill: currentColor;
  stroke: none;
}

.articles-preview-card > * {
  padding: 0 24px;
}

.articles-preview-card > :first-child {
  padding-top: 24px;
}

.articles-preview-card > :last-child {
  padding-bottom: 24px;
}

.articles-preview-title {
  font-size: 24px;
  font-weight: 600;
  margin: 16px 0 8px 0;
  color: var(--articles-text);
}

.articles-preview-excerpt {
  font-size: 14px;
  color: var(--articles-muted);
  margin: 0 0 12px 0;
}

.articles-preview-meta {
  font-size: 12px;
  color: var(--articles-muted);
  margin: 0;
}

.articles-preview-body {
  padding: 0;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.articles-preview-lead {
  font-size: 15px;
  font-weight: 500;
  color: var(--articles-text);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--articles-border);
}

.articles-preview-html {
  color: var(--articles-text);
  line-height: 1.6;
  margin-bottom: 24px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.articles-preview-html h1 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  margin: 24px 0 12px 0;
  color: var(--articles-text);
}

.articles-preview-html h2 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  margin: 24px 0 12px 0;
  color: var(--articles-text);
}

.articles-preview-html h3 {
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
  margin: 16px 0 8px 0;
  color: var(--articles-text);
}

.articles-preview-html h4 {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.4;
  margin: 14px 0 8px 0;
  color: var(--articles-text);
}

.articles-preview-html h5 {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
  margin: 14px 0 8px 0;
  color: var(--articles-text);
}

.articles-preview-html h6 {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  margin: 14px 0 8px 0;
  color: var(--articles-text);
}

.articles-preview-html p {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
}

.articles-preview-html ul,
.articles-preview-html ol {
  margin: 0 0 12px 20px;
  padding: 0;
}

.articles-preview-html li {
  margin-bottom: 6px;
  font-size: 16px;
}

.articles-preview-html img {
  max-width: 100%;
  height: auto;
  margin: 16px 0;
  border-radius: 4px;
}

.articles-preview-html table {
  max-width: 100%;
  width: 100%;
  overflow-x: auto;
  display: block;
}

.articles-preview-html code {
  max-width: 100%;
  overflow-x: auto;
  display: inline-block;
  word-break: break-word;
}

.articles-preview-related {
  margin-top: 32px;
}

.articles-preview-section {
  margin-bottom: 32px;
}

.articles-preview-section h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 16px 0;
  color: var(--articles-text);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--articles-border);
}

.articles-preview-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px 0;
  color: var(--articles-text);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--articles-border);
}

.articles-preview-seo-item {
  margin-bottom: 12px;
}

.articles-preview-seo-item p {
  margin: 0;
  font-size: 13px;
  color: var(--articles-text);
}

.articles-preview-seo-item strong {
  color: var(--articles-text);
}

.articles-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.articles-related-card {
  background: var(--articles-bg);
  border: 1px solid var(--articles-border);
  border-radius: 4px;
  padding: 12px;
  font-size: 13px;
  color: var(--articles-text);
  text-decoration: none;
  transition: all 0.2s ease;
}

.articles-related-card:hover {
  background: var(--articles-border);
  text-decoration: underline;
}

.articles-preview-status {
  margin: 8px 0 0 0;
  font-size: 12px;
  color: var(--articles-muted);
}


#articles-approve-button {
  background: #496F4B !important;
  color: #fff !important;
}

#articles-approve-button:hover:not(:disabled) {
  background: #2d4a2d !important;
}

#articles-approve-button:disabled {
  background: var(--btn-disabled-bg) !important;
  color: var(--btn-disabled-ink) !important;
}

html[data-theme="dark"] #articles-approve-button {
  background: #5f8f78 !important;
  color: #fff !important;
}

html[data-theme="dark"] #articles-approve-button:not(:disabled):hover,
html[data-theme="dark"] #articles-submit-button:not(:disabled):hover {
  background: #1c6b42 !important;
  border-color: #1c6b42 !important;
}

/* ==================== Public Academy Pages ==================== */
.academy-page {
  margin: 0;
  background: linear-gradient(180deg, #fbf7ef 0%, #f8f3e9 100%);
  color: var(--ink);
  font-family: "Metropolis", "Noto Sans TC", sans-serif;
}

.academy-shell {
  min-height: 100vh;
}

.academy-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  background: rgba(251, 247, 239, 0.88);
  border-bottom: 1px solid rgba(61, 61, 61, 0.08);
}

.academy-header-inner,
.academy-main {
  width: min(1180px, calc(100vw - 48px));
  margin: 0 auto;
}

.academy-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 0;
}

.academy-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.academy-brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(192, 122, 42, 0.18), rgba(63, 107, 86, 0.18));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.academy-brand-name {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.academy-brand-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.academy-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.academy-nav a,
.academy-topic-chip {
  text-decoration: none;
}

.academy-nav a {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(61, 61, 61, 0.08);
  transition: 0.2s ease;
}

.academy-nav a:hover {
  color: var(--ink);
  border-color: rgba(192, 122, 42, 0.28);
  background: rgba(255, 255, 255, 0.8);
}

.academy-main {
  padding: 40px 0 72px;
}

.academy-hero {
  margin-bottom: 42px;
}

.academy-hero-eyebrow,
.academy-section-eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.academy-hero h1,
.academy-section h2 {
  margin: 0;
  font-family: "Metropolis", "Noto Sans TC", sans-serif;
}

.academy-hero h1 {
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.05;
  letter-spacing: 0.02em;
}

.academy-hero-copy {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 18px;
}

.academy-search-form {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

.academy-search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid rgba(61, 61, 61, 0.12);
  border-radius: 999px;
  padding: 15px 20px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
}

.academy-search-button {
  border: none;
  border-radius: 999px;
  padding: 0 24px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.academy-topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.academy-topic-chip {
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid rgba(61, 61, 61, 0.1);
  background: rgba(255, 255, 255, 0.68);
  color: var(--text-secondary);
  transition: 0.2s ease;
}

.academy-topic-chip:hover,
.academy-topic-chip.is-active {
  background: rgba(192, 122, 42, 0.12);
  color: var(--ink);
  border-color: rgba(192, 122, 42, 0.32);
}

.academy-section {
  margin-top: 42px;
}

.academy-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.academy-section h2 {
  font-size: 28px;
  line-height: 1.2;
}

.academy-topic-head {
  align-items: start;
}

.academy-topic-head h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.academy-topic-description {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--text-secondary);
  line-height: 1.75;
}

.academy-section-count {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.academy-topic-section + .academy-topic-section {
  margin-top: 42px;
}

.academy-topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.academy-topic-card {
  display: block;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(61, 61, 61, 0.1);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 30px rgba(42, 34, 28, 0.08);
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.academy-topic-card:hover {
  transform: translateY(-2px);
  border-color: rgba(192, 122, 42, 0.22);
  box-shadow: 0 18px 36px rgba(42, 34, 28, 0.12);
}

.academy-topic-card-media {
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, rgba(192, 122, 42, 0.12), rgba(63, 107, 86, 0.14));
  overflow: hidden;
}

.academy-topic-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.academy-topic-card-body {
  padding: 18px 18px 20px;
}

.academy-topic-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 12px;
}

.academy-topic-card h4 {
  margin: 0;
  font-size: 19px;
  line-height: 1.4;
}

.academy-topic-card p {
  margin: 10px 0 0;
  color: var(--text-secondary);
  line-height: 1.7;
}

.academy-topic-card-cta {
  display: inline-flex;
  margin-top: 16px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.academy-card-grid,
.academy-related-articles-grid,
.academy-product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.academy-article-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.academy-card,
.academy-related-article-card,
.academy-product-card {
  display: block;
  border: 1px solid rgba(61, 61, 61, 0.1);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 16px 40px rgba(42, 34, 28, 0.08);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
}

.academy-article-row {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 0;
  padding: 18px 0;
  border: 0;
  border-bottom: 1px solid rgba(61, 61, 61, 0.1);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.academy-article-row:hover {
  transform: translateX(4px);
  border-color: rgba(192, 122, 42, 0.26);
}

.academy-article-row .academy-card-media {
  aspect-ratio: 16 / 10;
  border-radius: 20px;
  overflow: hidden;
}

.academy-article-row .academy-card-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 0 8px 24px;
}

.academy-row-cta {
  margin-top: 18px;
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.academy-card-media,
.academy-product-media {
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, rgba(192, 122, 42, 0.12), rgba(63, 107, 86, 0.14));
  overflow: hidden;
}

.academy-card-media img,
.academy-product-media img,
.academy-article-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.academy-card-body,
.academy-product-body {
  padding: 20px;
}

.academy-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.academy-card h3,
.academy-product-body h3,
.academy-related-article-card h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
}

.academy-card p,
.academy-product-body p,
.academy-related-article-card p {
  margin: 12px 0 0;
  color: var(--text-secondary);
  line-height: 1.7;
}

.academy-article-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 32px;
  align-items: center;
}

.academy-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  font-size: 14px;
  color: var(--text-secondary);
}

.academy-breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}

.academy-breadcrumb a:hover {
  color: var(--ink);
}

.academy-breadcrumb-sep {
  color: rgba(61, 61, 61, 0.3);
}

.academy-article-lead {
  margin: 20px 0 0;
  font-size: 18px;
  line-height: 1.85;
  color: var(--text-secondary);
}

.academy-article-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
  color: var(--text-secondary);
  font-size: 14px;
}

.academy-article-cover {
  margin: 0;
  border-radius: 28px;
  overflow: hidden;
  min-height: 340px;
  background: linear-gradient(135deg, rgba(192, 122, 42, 0.14), rgba(63, 107, 86, 0.16));
  box-shadow: 0 20px 45px rgba(42, 34, 28, 0.12);
}

.academy-article-cover-fallback {
  min-height: 340px;
}

.academy-article-content-section {
  margin-top: 54px;
}

.academy-article-content {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  line-height: 1.9;
  font-size: 17px;
  color: var(--ink);
}

.academy-article-content h1,
.academy-article-content h2,
.academy-article-content h3,
.academy-article-content h4,
.academy-article-content h5,
.academy-article-content h6 {
  margin: 1.4em 0 0.65em;
}

.academy-article-content h1 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
}

.academy-article-content h2 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.academy-article-content h3 {
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
}

.academy-article-content h4 {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.4;
}

.academy-article-content h5 {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
}

.academy-article-content h6 {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
}

.academy-article-content p {
  margin: 0 0 1em;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
}

.academy-article-content ul,
.academy-article-content ol {
  padding-left: 1.4em;
  margin: 0 0 1em;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
}

.academy-article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 18px;
}

.academy-product-card {
  pointer-events: none;
}

.academy-product-category {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.academy-product-price {
  font-weight: 700;
  color: var(--ink);
}

.academy-related-article-card {
  padding: 22px;
}

.academy-related-article-topic {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(192, 122, 42, 0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.academy-empty-state {
  padding: 28px;
  border: 1px dashed rgba(61, 61, 61, 0.14);
  border-radius: 24px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.55);
}

@media (max-width: 1080px) {
  .academy-header-inner,
  .academy-main {
    width: min(100vw - 36px, 1180px);
  }

  .academy-article-hero,
  .academy-card-grid,
  .academy-related-articles-grid,
  .academy-product-grid,
  .academy-topic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .academy-header-inner {
    flex-direction: column;
    align-items: start;
  }

  .academy-nav {
    width: 100%;
  }

  .academy-search-form {
    flex-direction: column;
  }

  .academy-card-grid,
  .academy-related-articles-grid,
  .academy-product-grid,
  .academy-topic-grid,
  .academy-article-hero,
  .academy-article-row {
    grid-template-columns: 1fr;
  }

  .academy-topic-card-body {
    padding: 16px 16px 18px;
  }

  .academy-article-content {
    padding: 22px 18px;
  }
}

html[data-theme="dark"] .articles-dialog .account-dialog-actions {
  justify-content: flex-end;
  background: #1f242c;
  border-top-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .articles-dialog .account-form {
  background: inherit;
}

html[data-theme="dark"] .articles-add-open-wrap {
  background: var(--panel-elevated);
  border-top-color: var(--stroke);
}

html[data-theme="dark"] .customer-service-add-wrap {
  background: var(--panel-elevated);
  border-top-color: var(--stroke);
}

html[data-theme="dark"] .pos-upload {
  background: #1a1a1a;
  border-color: rgba(255, 255, 255, 0.15);
}

html[data-theme="dark"] .pos-upload:hover {
  border-color: #1976d2;
  background: #0f3a5c;
}

html[data-theme="dark"] .pos-upload-text {
  color: var(--articles-text);
}

html[data-theme="dark"] .pos-image-carousel {
  background: #1a1a1a;
  border-color: rgba(255, 255, 255, 0.15);
}

html[data-theme="dark"] .pos-carousel-placeholder {
  color: rgba(255, 255, 255, 0.4);
}

html[data-theme="dark"] .pos-upload-button {
  background: #1a1a1a;
  border-color: rgba(255, 255, 255, 0.15);
}

html[data-theme="dark"] .pos-upload-button:hover {
  border-color: #1976d2;
  background: rgba(25, 118, 210, 0.1);
}

html[data-theme="dark"] .pos-upload-button .pos-upload-icon {
  color: rgba(255, 255, 255, 0.6);
}

html[data-theme="dark"] .pos-image-gallery-item {
  background: #1a1a1a;
  border-color: rgba(255, 255, 255, 0.15);
}

html[data-theme="dark"] .rag-upload-drop {
  background: #1a1a1a;
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--articles-text);
}

html[data-theme="dark"] .rag-upload-drop:hover {
  border-color: #1976d2;
  background: #0f3a5c;
}

html[data-theme="dark"] .rag-upload-text {
  color: var(--articles-text);
}

/* Article dialog button colors */
#articles-save-button {
  background: #c0742a !important;
  color: #fff !important;
}

#articles-save-button:hover:not(:disabled) {
  background: #a8601f !important;
}

#articles-save-button:disabled {
  background: var(--btn-disabled-bg) !important;
  color: var(--btn-disabled-ink) !important;
}

#articles-submit-button {
  background: #496F4B !important;
  color: #fff !important;
}

#articles-submit-button:hover:not(:disabled) {
  background: #2d4a2d !important;
}

#articles-submit-button:disabled {
  background: var(--btn-disabled-bg) !important;
  color: var(--btn-disabled-ink) !important;
}

#articles-publish-button {
  background: #496F4B !important;
  color: #fff !important;
}

#articles-publish-button:hover:not(:disabled) {
  background: #2d4a2d !important;
}

#articles-publish-button:disabled {
  background: var(--btn-disabled-bg) !important;
  color: var(--btn-disabled-ink) !important;
}

html[data-theme="dark"] #articles-save-button {
  background: #c0742a !important;
  color: #fff !important;
}

html[data-theme="dark"] #articles-save-button:hover:not(:disabled) {
  background: #a8601f !important;
  color: #fff !important;
}

html[data-theme="dark"] #articles-save-button:disabled {
  background: var(--btn-disabled-bg) !important;
  color: var(--btn-disabled-ink) !important;
}

html[data-theme="dark"] #articles-submit-button {
  background: #5f8f78 !important;
  color: #fff !important;
}

html[data-theme="dark"] #articles-submit-button:hover:not(:disabled) {
  background: #4a7363 !important;
  color: #fff !important;
}

html[data-theme="dark"] #articles-submit-button:disabled {
  background: var(--btn-disabled-bg) !important;
  color: var(--btn-disabled-ink) !important;
}

html[data-theme="dark"] #articles-publish-button {
  background: #5f8f78 !important;
  color: #fff !important;
}

html[data-theme="dark"] #articles-publish-button:not(:disabled):hover {
  background: #1c6b42 !important;
  border-color: #1c6b42 !important;
}

html[data-theme="dark"] #articles-publish-button:disabled {
  background: var(--btn-disabled-bg) !important;
  color: var(--btn-disabled-ink) !important;
}

/* Hide articles lead input - merged with excerpt */
#articles-lead-input,
[id="articles-lead-input"] {
  display: none !important;
}

label:has(#articles-lead-input) {
  display: none !important;
}

/* Articles Review Flowchart Styles */
.articles-review-flowchart {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--divider-color, #e0e0e0);
}

.articles-review-flowchart h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary, #212121);
}

.articles-review-steps {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.articles-review-step {
  flex: 1;
  min-width: 200px;
  padding: 16px;
  background: var(--surface, #f5f5f5);
  border-radius: 8px;
  border: 1px solid var(--divider-color, #e0e0e0);
  position: relative;
}

.articles-review-step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.articles-review-step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary, #1976d2);
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.articles-review-step-number.passed {
  background: #4caf50;
}

.articles-review-step-number.failed {
  background: #d32f2f;
}

.articles-review-step-number.pending {
  background: #ff9800;
}

.articles-review-step-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary, #212121);
}

.articles-review-step-status {
  font-size: 13px;
  color: #666;
  padding: 8px 0;
}

.articles-review-step-status.passed {
  color: #4caf50;
  font-weight: 500;
}

.articles-review-step-status.failed {
  color: #d32f2f;
  font-weight: 500;
}

.articles-review-step-status.approved {
  color: #4caf50;
  font-weight: 500;
}

.articles-review-step-status.rejected {
  color: #d32f2f;
  font-weight: 500;
}

.articles-review-step-issues {
  margin-top: 8px;
  padding: 8px;
  background: rgba(211, 47, 47, 0.1);
  border-radius: 4px;
}

.articles-review-step-arrow {
  position: absolute;
  right: -20px;
  top: 20px;
  font-size: 20px;
  color: #bbb;
  font-weight: bold;
}

@media (max-width: 600px) {
  .articles-review-steps {
    flex-direction: column;
  }

  .articles-review-step-arrow {
    display: none;
  }
}

/* Dark mode styles for articles review steps */
html[data-theme="dark"] .articles-review-step {
  background: #2a2a2a;
  border-color: #444;
}

html[data-theme="dark"] .articles-review-step-title {
  color: #e0e0e0;
}

html[data-theme="dark"] .articles-review-step-status {
  color: #b0b0b0;
}

html[data-theme="dark"] .articles-review-step-arrow {
  color: #666;
}

html[data-theme="dark"] .articles-review-step-issues {
  background: rgba(211, 47, 47, 0.2);
  color: #ff6b6b;
}

/* AI Workflow Dialog Styles */
.articles-workflow-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid rgba(42, 34, 28, 0.15);
  padding: 0.75rem 1.5rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(42, 34, 28, 0.02);
}

.articles-workflow-tab-btn {
  flex: 0 0 auto;
  padding: 0.75rem 1.25rem;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  position: relative;
  margin-right: 0;
  border-radius: 8px 8px 0 0;
}

.articles-workflow-tab-btn:hover {
  background: rgba(42, 34, 28, 0.08);
  color: #ffffff;
}

.articles-workflow-tab-btn.active {
  background: #ff9800;
  color: #ffffff;
  border-bottom-color: #ff9800;
  z-index: 10;
}

.articles-workflow-form {
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  min-height: 300px;
  max-height: none;
}

.articles-workflow-tab-panel {
  display: none;
  gap: 1rem;
}

.articles-workflow-tab-panel.active {
  display: grid;
  gap: 1rem;
  width: 100%;
}

.articles-workflow-tab-panel.slide-in-left {
  animation: slideInLeft 0.3s ease-out;
}

.articles-workflow-tab-panel.slide-in-right {
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.articles-workflow-tab-panel label {
  display: flex;
  flex-direction: column;
}

.articles-workflow-tab-panel label > span:first-child {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.articles-workflow-tab-panel input[type="text"],
.articles-workflow-tab-panel input[type="time"],
.articles-workflow-tab-panel input[type="date"] {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  transition: border-color 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.articles-workflow-tab-panel textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  resize: vertical;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.articles-workflow-tab-panel input[type="text"]:focus,
.articles-workflow-tab-panel input[type="time"]:focus,
.articles-workflow-tab-panel input[type="date"]:focus,
.articles-workflow-tab-panel textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(192, 122, 42, 0.1);
}

.articles-workflow-step-hint {
  background: var(--panel-bg);
  padding: 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 1rem;
}

.articles-workflow-step-hint p {
  margin: 0;
}

.articles-workflow-result-panel {
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: 4px;
  padding: 1rem;
  min-height: 100px;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.6;
  overflow-y: auto;
  max-height: 300px;
}

.articles-workflow-result-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.articles-workflow-result-content p {
  margin: 0;
  word-break: break-word;
  white-space: pre-wrap;
}

.articles-workflow-loading {
  color: var(--muted);
  text-align: center;
  padding: 2rem 1rem;
}

.articles-workflow-generate-btn,
.articles-workflow-review-btn {
  margin-top: 1rem;
}

/* 多URL網頁爬蟲輸入控制 */
.web-urls-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.web-urls-label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.web-urls-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.web-url-item {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.web-url-input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--field-border);
  border-radius: 4px;
  font-size: 0.95rem;
  background: var(--field-bg);
  color: var(--ink);
}

.web-url-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.web-url-remove-btn {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--field-border);
  border-radius: 4px;
  background: var(--field-bg);
  color: #d32f2f;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s ease;
}

.web-url-remove-btn:hover {
  background: #ffebee;
  border-color: #d32f2f;
}

.articles-workflow-add-btn {
  align-self: flex-start;
  padding: 0.5rem 1rem;
  border: 1px solid var(--field-border);
  border-radius: 4px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.articles-workflow-add-btn:hover {
  background: #0052a3;
  border-color: #0052a3;
}

.articles-workflow-add-btn:active {
  transform: scale(0.98);
}

.articles-workflow-decision-label {
  display: flex;
  flex-direction: column;
}

.articles-workflow-decision-label select {
  padding: 0.75rem;
  border: 1px solid var(--field-border);
  border-radius: 4px;
  background: var(--field-bg);
  color: var(--ink);
  font-size: 0.95rem;
}

.articles-workflow-human-review {
  display: flex;
  flex-direction: column;
}

.articles-workflow-human-review p {
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: var(--ink);
}

html[data-theme="dark"] .articles-add-open-wrap {
  background: var(--bg);
}

html[data-theme="dark"] .articles-workflow-tab-btn {
  color: #ffffff;
}

/* Data Source Configuration Styles (新增) */

.articles-workflow-data-sources {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 0.5rem 0 1.5rem 0;
}

.articles-workflow-source-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--panel-bg);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.articles-workflow-source-btn:hover {
  border-color: var(--accent);
  background: rgba(192, 122, 42, 0.08);
}

.articles-workflow-source-btn input[type="checkbox"] {
  cursor: pointer;
}

.articles-workflow-source-btn input[type="checkbox"]:checked + span {
  color: var(--accent);
  font-weight: 600;
}

.source-config {
  background: var(--panel-bg);
  padding: 1rem;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.source-config label {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.75rem;
}

.source-config label > span {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

/* Checkbox labels: horizontal layout */
.source-config label:has(input[type="checkbox"]) {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.source-config label:has(input[type="checkbox"]) > span {
  margin-bottom: 0;
  font-size: 0.95rem;
  color: var(--ink);
}

.source-config input[type="checkbox"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.source-config input[type="text"],
.source-config input[type="url"],
.source-config input[type="number"],
.source-config select {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  background: var(--field-bg);
  color: var(--ink);
  font-size: 0.9rem;
  font-family: inherit;
}

.source-config input:focus,
.source-config select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(192, 122, 42, 0.1);
}

.source-config small {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.source-preview {
  margin: 1.5rem 0;
  background: var(--panel-bg);
  border-radius: 8px;
}

.preview-label {
  margin: 0 0 1rem 0;
  color: var(--ink);
  font-size: 0.95rem;
}

.source-preview-items {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.source-preview-item {
  background: var(--panel-bg);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 1rem;
}

.source-preview-item h4 {
  margin: 0 0 0.5rem 0;
  color: var(--ink);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.source-count {
  margin: 0 0 0.75rem 0;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}

.source-items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.source-items li {
  padding: 0.5rem;
  background: var(--field-bg);
  border-radius: 6px;
  font-size: 0.85rem;
}

.source-items strong {
  display: block;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.source-item-content {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0.25rem 0 0 0;
  line-height: 1.4;
}

html[data-theme="dark"] .articles-workflow-tab-btn:hover {
  color: #ffffff;
}

html[data-theme="dark"] .articles-workflow-step-hint {
  background: rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .articles-workflow-result-panel {
  background: var(--field-bg);
  border-color: var(--field-border);
}

/* Workflow Schedule/Time Styles */
.articles-workflow-time-group {
  margin-bottom: 1.5rem;
}

.articles-workflow-time-group input[type="time"],
.articles-workflow-time-inputs input[type="time"] {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.articles-workflow-time-group input[type="time"]:focus,
.articles-workflow-time-inputs input[type="time"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(192, 122, 42, 0.1);
}

.articles-workflow-time-inputs {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.articles-workflow-time-inputs input[type="time"] {
  flex: 1;
}

.articles-workflow-weekday-selector,
.articles-workflow-monthly-selector,
.articles-workflow-once-selector {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--panel-bg);
  border-radius: 4px;
}

.articles-workflow-weekday-selector label:first-child,
.articles-workflow-monthly-selector label:first-child,
.articles-workflow-once-selector label:first-child {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--ink);
}

.articles-workflow-weekdays {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 0.75rem;
}

.articles-workflow-weekday-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  border: 1px solid var(--field-border);
  border-radius: 4px;
  background: var(--field-bg);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.articles-workflow-weekday-btn:hover {
  border-color: var(--accent);
  background: var(--field-bg);
}

.articles-workflow-weekday-btn input[type="radio"],
.articles-workflow-weekday-btn input[type="checkbox"] {
  margin-right: 0.5rem;
  cursor: pointer;
  accent-color: var(--accent);
}

.articles-workflow-weekday-btn input[type="radio"]:checked + span,
.articles-workflow-weekday-btn input[type="checkbox"]:checked + span {
  color: var(--accent);
  font-weight: 600;
}

.articles-workflow-schedule-summary {
  padding: 1rem;
  background: rgba(192, 122, 42, 0.1);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  margin-bottom: 1.5rem;
}

.articles-workflow-schedule-text {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* AI Workflow Dialog */
.articles-ai-workflow-dialog .account-dialog-inner {
  max-width: 580px;
  width: min(90vw, 580px);
  overflow: hidden;
  height: 700px;
  max-height: calc(100dvh - 2rem);
  display: flex;
  flex-direction: column;
}

.articles-ai-workflow-dialog .articles-workflow-tabs {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
  border-bottom: 1px solid var(--stroke);
}

.articles-ai-workflow-dialog .articles-workflow-form {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  min-height: 450px;
  flex: 1 1 auto;
  /* Allow dropdown menu to overflow the bottom */
  clip-path: inset(0 0 -500px 0);
}

/* Strong text styling to match label styling */
.articles-ai-workflow-dialog strong,
.articles-preview-dialog strong {
  font-weight: 600;
  color: var(--ink);
}

/* Dropdown menu positioning in AI workflow dialog */
.articles-ai-workflow-dialog .dropdown {
  position: relative;
  overflow: visible !important;
  clip-path: none !important;
}

/* Lower z-index of dropdown triggers to be below dropdown menus */
.articles-ai-workflow-dialog .dropdown-toggle,
.articles-ai-workflow-dialog [role="button"].dropdown-toggle,
.articles-ai-workflow-dialog button.dropdown-toggle {
  position: relative;
}

.articles-ai-workflow-dialog .dropdown-trigger {
  position: relative;
}

.articles-ai-workflow-dialog .dropdown-menu {
  position: absolute;
  top: calc(100% + 6px) !important;
  bottom: auto !important;
  right: 0;
  left: auto !important;
  display: none;
}

/* Show dropdown menu when is-open class is applied */
.articles-ai-workflow-dialog .dropdown-menu.is-open {
  display: grid !important;
}

/* All dropdown menus have sufficient z-index */
.articles-ai-workflow-dialog .articles-workflow-tab-panel.active .dropdown {
  position: relative;
}

.articles-ai-workflow-dialog .articles-workflow-tab-panel.active .dropdown-menu {
  top: calc(100% + 6px) !important;
  bottom: auto !important;
}

/* Dark mode styles for form inputs */
html[data-theme="dark"] .articles-workflow-tab-panel input[type="text"],
html[data-theme="dark"] .articles-workflow-tab-panel input[type="time"],
html[data-theme="dark"] .articles-workflow-tab-panel input[type="date"],
html[data-theme="dark"] .articles-workflow-tab-panel textarea,
html[data-theme="dark"] .articles-workflow-time-group input[type="time"],
html[data-theme="dark"] .articles-workflow-time-inputs input[type="time"] {
  background: #1f242c;
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--ink);
}

html[data-theme="dark"] .articles-workflow-tab-panel input[type="text"]:hover:not(:disabled),
html[data-theme="dark"] .articles-workflow-tab-panel input[type="time"]:hover:not(:disabled),
html[data-theme="dark"] .articles-workflow-tab-panel input[type="date"]:hover:not(:disabled),
html[data-theme="dark"] .articles-workflow-tab-panel textarea:hover:not(:disabled),
html[data-theme="dark"] .articles-workflow-time-group input[type="time"]:hover:not(:disabled),
html[data-theme="dark"] .articles-workflow-time-inputs input[type="time"]:hover:not(:disabled) {
  background: #252b34;
  border-color: #606060;
}

html[data-theme="dark"] .articles-workflow-weekday-selector,
html[data-theme="dark"] .articles-workflow-monthly-selector,
html[data-theme="dark"] .articles-workflow-once-selector {
  background: rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .articles-workflow-schedule-summary {
  background: rgba(209, 145, 63, 0.1);
}

/* AI Generation Fields Styles */
.articles-workflow-generation-fields {
  margin-bottom: 1.5rem;
}

.articles-workflow-field {
  margin-bottom: 1.5rem;
}

.articles-workflow-field label {
  display: flex;
  flex-direction: column;
}

.articles-workflow-field > label > span:first-child {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.articles-workflow-field input[type="text"],
.articles-workflow-field textarea {
  padding: 0.75rem;
  border: 1px solid var(--field-border);
  border-radius: 4px;
  background: var(--field-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
}

.articles-workflow-field textarea {
  resize: vertical;
}

.articles-workflow-cover-preview {
  width: 100%;
  height: 200px;
  border: 2px dashed var(--field-border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--field-bg);
  color: var(--muted);
  font-size: 0.9rem;
  overflow: hidden;
}

.articles-workflow-cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.articles-workflow-content-preview {
  padding: 1rem;
  border: 1px solid var(--field-border);
  border-radius: 4px;
  background: var(--field-bg);
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.6;
  max-height: 300px;
  overflow-y: auto;
}

.articles-workflow-loading {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

html[data-theme="dark"] .articles-workflow-field input[type="text"],
html[data-theme="dark"] .articles-workflow-field textarea {
  background: var(--field-bg);
  border-color: var(--field-border);
  color: var(--ink);
}

/* ============================================
   AI 工作流對話框 - 響應式高度修復
   ============================================ */

/* 桌面版本：固定高度 */
@media (min-width: 641px) {
  .articles-ai-workflow-dialog .account-dialog-inner {
    height: 700px;
  }
}

/* 平板版本：自適應高度 */
@media (max-width: 640px) and (min-height: 800px) {
  .articles-ai-workflow-dialog .account-dialog-inner {
    height: 650px;
  }
}

/* 小屏幕版本：最大化可用空間 */
@media (max-width: 640px) and (max-height: 799px) {
  .articles-ai-workflow-dialog .account-dialog-inner {
    height: auto;
    min-height: 550px;
    max-height: calc(100dvh - 3rem);
  }
}

/* 視覺風格複選框樣式 */
.articles-workflow-visual-styles-group {
  margin: 0.75rem 0;
}

.visual-styles-checkboxes {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.visual-style-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--field-border);
  border-radius: 4px;
  background: var(--field-bg);
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1 1 calc(50% - 0.375rem);
  min-width: 200px;
}

.visual-style-checkbox:hover {
  background: var(--bg-secondary);
  border-color: var(--brand);
}

.visual-style-checkbox input[type="checkbox"] {
  margin-top: 0.25rem;
  cursor: pointer;
  accent-color: var(--brand);
}

.visual-style-checkbox input[type="checkbox"]:checked {
  accent-color: var(--brand);
}

.visual-style-checkbox-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.visual-style-checkbox-label {
  font-weight: 600;
  color: var(--ink);
  font-size: 0.95rem;
  user-select: none;
}

.visual-style-checkbox-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* AI 繪圖提示語編輯區域 */
.articles-workflow-tab-panel #articles-workflow-thumbnail-prompt {
  padding: 0.75rem;
  border: 1px solid var(--field-border);
  border-radius: 4px;
  background: var(--field-bg);
  color: var(--ink);
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
}

.articles-workflow-tab-panel #articles-workflow-thumbnail-prompt:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb, 0), 0.1);
}

.articles-workflow-tab-panel #articles-workflow-thumbnail-prompt::placeholder {
  color: var(--text-secondary);
}

/* 提示語參考資訊區域 */
.articles-workflow-prompt-reference {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--field-border);
  border-radius: 4px;
  background: var(--bg-secondary);
}

.reference-label {
  margin: 0 0 0.75rem 0;
  font-weight: 600;
  color: var(--ink);
  font-size: 0.9rem;
}

.prompt-reference-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.prompt-reference-item {
  padding: 0.75rem;
  border-left: 3px solid var(--brand);
  background: var(--field-bg);
  border-radius: 2px;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.prompt-reference-item-image {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--field-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.prompt-reference-item-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.prompt-reference-item-content {
  flex: 1;
  min-width: 0;
}

.prompt-reference-item-title {
  font-weight: 600;
  color: var(--brand);
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.prompt-reference-item-text {
  color: var(--ink);
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'Monaco', 'Courier New', monospace;
}

/* 深色模式 */
html[data-theme="dark"] .visual-style-checkbox {
  border-color: #606060;
  background: #252b34;
}

html[data-theme="dark"] .visual-style-checkbox:hover {
  background: #2f3642;
  border-color: var(--brand);
}

html[data-theme="dark"] .articles-workflow-tab-panel #articles-workflow-thumbnail-prompt {
  background: #252b34;
  border-color: #606060;
  color: #e0e0e0;
}

html[data-theme="dark"] .articles-workflow-tab-panel #articles-workflow-thumbnail-prompt:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb, 255), 0.1);
}

html[data-theme="dark"] .articles-workflow-prompt-reference {
  background: #252b34;
  border-color: #606060;
}

html[data-theme="dark"] .prompt-reference-item {
  background: #1a1f28;
  border-left-color: var(--brand);
}

html[data-theme="dark"] .prompt-reference-item-image {
  background: #252b34;
  border: 1px solid #606060;
}

html[data-theme="dark"] .prompt-reference-item-text {
  color: #b0b0b0;
}

/* Articles Workflow History Dropdown */
.articles-workflow-history-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 0.75rem;
}

.articles-workflow-history-trigger {
  height: 36px;
  border: 1px solid rgba(42, 34, 28, 0.16);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 0 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.articles-workflow-history-trigger:hover {
  background: rgba(42, 34, 28, 0.05);
}

.articles-workflow-history-trigger svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.articles-workflow-history-trigger-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.articles-workflow-history-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 15;
  min-width: 280px;
  max-width: min(360px, calc(100vw - 2rem));
  max-height: min(360px, 50vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border: 1px solid rgba(42, 34, 28, 0.12);
  border-radius: 14px;
  box-shadow: 0 16px 32px rgba(42, 34, 28, 0.16);
  padding: 0.4rem;
  display: grid;
  gap: 0.2rem;
}

.articles-workflow-history-menu[hidden] {
  display: none !important;
}

.articles-workflow-history-item-container {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
}

.articles-workflow-history-item {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 10px 0 0 10px;
  color: var(--ink);
  padding: 0.6rem 0.7rem;
  text-align: left;
  display: grid;
  gap: 0.2rem;
  cursor: pointer;
}

.articles-workflow-history-item:hover {
  background: rgba(42, 34, 28, 0.05);
}

.articles-workflow-history-item.is-active {
  background: rgba(193, 128, 34, 0.12);
  color: #9c6014;
}

.articles-workflow-history-delete-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 0.6rem 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 10px 10px 0;
  width: 2.2rem;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.articles-workflow-history-delete-btn:hover {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.articles-workflow-history-delete-btn svg {
  width: 1.2rem;
  height: 1.2rem;
}

.articles-workflow-history-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.articles-workflow-history-item-preview {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.articles-workflow-history-empty {
  padding: 0.8rem 0.7rem;
  color: var(--muted);
  font-size: 0.85rem;
}

html[data-theme="dark"] .articles-workflow-history-trigger {
  background: #2a3240;
  border-color: #606060;
  color: #e6ebf2;
}

html[data-theme="dark"] .articles-workflow-history-trigger:hover {
  background: #323d4a;
}

html[data-theme="dark"] .articles-workflow-history-menu {
  background: #1f2530;
  border-color: #606060;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .articles-workflow-history-item {
  color: #e6ebf2;
}

html[data-theme="dark"] .articles-workflow-history-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .articles-workflow-history-item.is-active {
  background: rgba(193, 128, 34, 0.2);
  color: #f5d180;
}

html[data-theme="dark"] .articles-workflow-history-item-preview,
html[data-theme="dark"] .articles-workflow-history-empty {
  color: var(--text-secondary);
}

html[data-theme="dark"] .articles-workflow-history-delete-btn {
  color: #999;
}

html[data-theme="dark"] .articles-workflow-history-delete-btn:hover {
  background: rgba(220, 53, 69, 0.2);
  color: #ff6b6b;
}

/* AI Model Selection Dropdown - Full Width */
.articles-model-select-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.articles-model-select-trigger {
  width: 100% !important;
  padding: 0.7rem 0.9rem !important;
  border: 1px solid var(--stroke) !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: var(--ink) !important;
  font-family: inherit !important;
  font-size: 16px !important;
  transition: border-color 0.2s ease, background-color 0.2s ease !important;
  box-sizing: border-box !important;
  text-align: left !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  cursor: pointer !important;
  position: relative !important;
}

.articles-model-select-trigger:hover:not(:disabled) {
  border-color: var(--accent) !important;
  background: #fafafa !important;
}

.articles-model-select-trigger:focus {
  outline: none !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(192, 122, 42, 0.1) !important;
}

.articles-model-select-wrap .dropdown-menu {
  width: 100% !important;
  min-width: auto !important;
  max-width: none !important;
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  right: 0 !important;
  margin-top: 4px !important;
  background: #fff !important;
  border: 1px solid var(--stroke) !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
  z-index: 1000 !important;
  display: none !important;
  flex-direction: column !important;
  box-sizing: border-box !important;
}

.articles-model-select-wrap .dropdown-menu.is-open {
  display: flex !important;
}

.articles-model-select-wrap .dropdown-menu button {
  width: 100% !important;
  padding: 0.7rem 0.9rem !important;
  border: none !important;
  background: transparent !important;
  color: var(--ink) !important;
  font-family: inherit !important;
  font-size: 16px !important;
  text-align: left !important;
  cursor: pointer !important;
  transition: background-color 0.2s ease !important;
  box-sizing: border-box !important;
}

.articles-model-select-wrap .dropdown-menu button:first-child {
  border-radius: 9px 9px 0 0 !important;
}

.articles-model-select-wrap .dropdown-menu button:last-child {
  border-radius: 0 0 9px 9px !important;
}

.articles-model-select-wrap .dropdown-menu:not(.is-open) button:not(:last-child) {
  border-bottom: 1px solid var(--stroke) !important;
}

.articles-model-select-wrap .dropdown-menu button:hover {
  background-color: rgba(192, 122, 42, 0.08) !important;
}

.articles-model-select-wrap .dropdown-menu button[aria-selected="true"] {
  background-color: rgba(192, 122, 42, 0.15) !important;
  color: var(--accent) !important;
  font-weight: 600 !important;
}

/* Dark mode for articles model select dropdown */
html[data-theme="dark"] .articles-model-select-trigger {
  background: #2a3240 !important;
  border-color: #606060 !important;
  color: #e6ebf2 !important;
}

html[data-theme="dark"] .articles-model-select-trigger:hover:not(:disabled) {
  background: #323d4a !important;
  border-color: #606060 !important;
}

html[data-theme="dark"] .articles-model-select-wrap .dropdown-menu {
  background: #1f2530 !important;
  border-color: #606060 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

html[data-theme="dark"] .articles-model-select-wrap .dropdown-menu button {
  color: #e6ebf2 !important;
  border-bottom-color: #606060 !important;
}

html[data-theme="dark"] .articles-model-select-wrap .dropdown-menu button:hover {
  background-color: rgba(192, 122, 42, 0.1) !important;
}

html[data-theme="dark"] .articles-model-select-wrap .dropdown-menu button[aria-selected="true"] {
  background-color: rgba(192, 122, 42, 0.2) !important;
  color: #f5d180 !important;
}

/* AI 編輯助手面板 */
.articles-ai-panel {
  padding: 16px;
  margin: 16px 0;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background-color: var(--card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.ai-panel-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.ai-panel-refresh {
  padding: 6px 12px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  background-color: transparent;
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-panel-refresh:hover {
  background-color: var(--hover-bg);
  border-color: var(--border-soft);
}

.ai-panel-refresh:active {
  background-color: rgba(192, 122, 42, 0.1);
}

/* 評分區域 */
.ai-panel-scores {
  display: flex;
  gap: 16px;
  padding: 12px 0;
}

.score-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.score-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.score-bar {
  height: 8px;
  border-radius: 4px;
  background-color: var(--bg-2);
  overflow: hidden;
}

.score-fill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #8bc34a);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.score-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

/* 建議和標簽區域 */
.ai-suggestions-wrapper,
.ai-tags-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-section-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.ai-suggestions,
.ai-tags {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-suggestion-item {
  padding: 8px 12px;
  border-radius: 6px;
  background-color: var(--bg);
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
}

.ai-tag {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  margin-right: 8px;
  margin-bottom: 8px;
  background-color: var(--bg-2);
  color: var(--ink);
  word-break: break-word;
}

.ai-tag-category {
  background-color: rgba(192, 122, 42, 0.15);
  color: var(--accent);
}

.ai-tag-product {
  background-color: rgba(63, 107, 86, 0.15);
  color: var(--accent-2);
}

.ai-tag-topic {
  background-color: rgba(66, 133, 244, 0.15);
  color: #4285f4;
}

.ai-empty-state {
  margin: 0;
  padding: 12px 8px;
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  text-align: center;
}

/* 動作按鈕 */
.ai-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.ai-action-btn {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  background-color: var(--bg);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-action-btn:hover {
  background-color: rgba(192, 122, 42, 0.1);
  border-color: var(--accent);
}

.ai-action-btn:active {
  transform: scale(0.98);
}

/* 加載指示 */
.ai-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background-color: var(--bg);
  border-radius: 6px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--bg-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* 深色主題 */
html[data-theme="dark"] .ai-panel-refresh {
  border-color: #606060;
  color: #e6ebf2;
}

html[data-theme="dark"] .ai-panel-refresh:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .ai-panel-refresh:active {
  background-color: rgba(192, 122, 42, 0.15);
}

html[data-theme="dark"] .score-bar {
  background-color: #3a3a3a;
}

html[data-theme="dark"] .ai-suggestion-item {
  background-color: #2a2a2a;
  color: #e6ebf2;
}

html[data-theme="dark"] .ai-tag {
  background-color: #3a3a3a;
  color: #e6ebf2;
}

html[data-theme="dark"] .ai-tag-category {
  background-color: rgba(192, 122, 42, 0.2);
  color: #f5d180;
}

html[data-theme="dark"] .ai-tag-product {
  background-color: rgba(95, 143, 120, 0.2);
  color: #7fccac;
}

html[data-theme="dark"] .ai-tag-topic {
  background-color: rgba(66, 133, 244, 0.2);
  color: #8ab4f8;
}

html[data-theme="dark"] .ai-action-btn {
  background-color: #2a2a2a;
  border-color: #606060;
  color: #e6ebf2;
}

html[data-theme="dark"] .ai-action-btn:hover {
  background-color: rgba(192, 122, 42, 0.15);
  border-color: #f5d180;
}

html[data-theme="dark"] .ai-loading {
  background-color: #2a2a2a;
  color: #f5d180;
}

html[data-theme="dark"] .spinner {
  border-color: #404040;
  border-top-color: #f5d180;
}

/* Article List Display */
.articles-list {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.article-item {
  border: 1px solid #e7d9c5;
  border-radius: 8px;
  padding: 16px;
  background: #fafaf8;
  transition: all 0.3s ease;
}

.article-item:hover {
  border-color: #c07a2a;
  box-shadow: 0 2px 8px rgba(192, 122, 42, 0.1);
}

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

.article-item-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #3d3d3d;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-item-status {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-draft {
  background-color: #fff3cd;
  color: #856404;
}

.status-published {
  background-color: #d4edda;
  color: #155724;
}

.status-archived {
  background-color: #e2e3e5;
  color: #383d41;
}

.status-review {
  background-color: #cfe2ff;
  color: #084298;
}

.article-item-description {
  margin: 8px 0;
  font-size: 14px;
  color: #6c5f52;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-item-meta {
  display: flex;
  gap: 12px;
  margin: 8px 0;
  flex-wrap: wrap;
  font-size: 13px;
  color: #999;
}

.article-category,
.article-quality,
.article-date {
  display: inline-block;
}

.article-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid #ddd;
  background: white;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small:hover {
  border-color: #c07a2a;
  color: #c07a2a;
}

.btn-small.btn-primary {
  background-color: #c07a2a;
  color: white;
  border-color: #c07a2a;
}

.btn-small.btn-primary:hover {
  background-color: #a06824;
}

/* AI Review Status Display */
.article-ai-review {
  margin-top: 12px;
  padding: 12px;
  border-radius: 6px;
  border-left: 4px solid;
  background-color: #f9f9f9;
}

.article-ai-review.review-passed {
  border-left-color: #28a745;
  background-color: #f0f8f5;
}

.article-ai-review.review-failed {
  border-left-color: #dc3545;
  background-color: #fdf5f5;
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
}

.review-status {
  font-size: 14px;
}

.review-score {
  font-size: 13px;
  color: #666;
}

.review-summary {
  margin: 8px 0;
  font-size: 13px;
  color: #666;
}

.review-issues {
  margin-top: 8px;
  font-size: 13px;
}

.issues-group {
  margin: 8px 0;
}

.issues-group h5 {
  margin: 6px 0 4px 0;
  font-size: 12px;
  font-weight: 600;
}

.issues-group.critical h5 {
  color: #d32f2f;
}

.issues-group.warning h5 {
  color: #f57c00;
}

.issues-group.info h5 {
  color: #1976d2;
}

.issues-group ul {
  margin: 4px 0 0 16px;
  padding: 0;
  list-style: none;
}

.issues-group li {
  margin: 4px 0;
  line-height: 1.4;
  color: #666;
}

.issue-location {
  font-weight: 600;
  color: #3d3d3d;
}

.issues-group small {
  display: block;
  margin-top: 2px;
  color: #999;
  font-style: italic;
}

.articles-empty {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 16px;
}

/* Dark Mode */
html[data-theme="dark"] .article-item {
  background-color: #2a2a2a;
  border-color: #404040;
}

html[data-theme="dark"] .article-item:hover {
  border-color: #f5d180;
  box-shadow: 0 2px 8px rgba(245, 209, 128, 0.1);
}

html[data-theme="dark"] .article-item-title {
  color: #e6ebf2;
}

html[data-theme="dark"] .article-item-description {
  color: #b0a399;
}

html[data-theme="dark"] .article-item-meta {
  color: #666;
}

html[data-theme="dark"] .btn-small {
  background: #3a3a3a;
  color: #b0a399;
  border-color: #404040;
}

html[data-theme="dark"] .btn-small:hover {
  border-color: #f5d180;
  color: #f5d180;
}

html[data-theme="dark"] .btn-small.btn-primary {
  background-color: #c07a2a;
  color: white;
}

html[data-theme="dark"] .btn-small.btn-primary:hover {
  background-color: #d4915f;
}

html[data-theme="dark"] .article-ai-review {
  background-color: #3a3a3a;
}

html[data-theme="dark"] .article-ai-review.review-passed {
  background-color: #1a3a2a;
  border-left-color: #4caf50;
}

html[data-theme="dark"] .article-ai-review.review-failed {
  background-color: #3a1a1a;
  border-left-color: #e74c3c;
}

html[data-theme="dark"] .review-header,
html[data-theme="dark"] .review-summary,
html[data-theme="dark"] .issues-group li {
  color: #b0a399;
}

html[data-theme="dark"] .issue-location {
  color: #e6ebf2;
}

html[data-theme="dark"] .issues-group small {
  color: #666;
}

/* Word file import button styles */
.articles-add-open-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Dialog button style */
.articles-dialog-import-word {
  padding: 4px 8px;
  font-size: 12px;
  background: #4a90e2;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.articles-dialog-import-word:hover:not(:disabled) {
  background: #3b7bc8;
  color: white;
  filter: brightness(1.05);
}

.articles-dialog-import-word:active:not(:disabled) {
  background: #2d5fa0;
}

html[data-theme="dark"] .articles-dialog-import-word {
  background: #5a9ff5;
  color: white;
}

html[data-theme="dark"] .articles-dialog-import-word:hover:not(:disabled) {
  background: #4a8fe5;
  color: white;
}

/* ==================== 雙語編輯器樣式 ==================== */

/* 語言標籤 */
.language-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.tab-btn {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: #496f4b;
  border-bottom-color: #496f4b;
}

/* 語言內容容器 */
.language-content {
  display: none;
}

.language-content.active {
  display: block;
  animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 英文輸入字段樣式 */
#articles-title-en-input,
#articles-excerpt-en-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  background: var(--bg-color);
  color: var(--text-primary);
}

#articles-title-en-input {
  font-size: 16px;
  font-weight: 600;
  min-height: 44px;
}

#articles-excerpt-en-input {
  min-height: 80px;
}

#articles-title-en-input:focus,
#articles-excerpt-en-input:focus {
  outline: none;
  border-color: #496f4b;
  box-shadow: 0 0 0 3px rgba(73, 111, 75, 0.1);
}

/* 輔助按鈕 */
.helper-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.btn-helper {
  padding: 6px 12px;
  background: var(--bg-secondary, rgba(0,0,0,0.05));
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-helper:hover {
  background: #496f4b;
  color: white;
  border-color: #496f4b;
  transform: translateY(-1px);
}

.btn-helper:active {
  transform: translateY(0);
}

/* 響應式設計 */
@media (max-width: 768px) {
  .language-tabs {
    margin-bottom: 12px;
  }

  .tab-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .helper-buttons {
    margin-top: 8px;
  }

  .btn-helper {
    padding: 5px 10px;
    font-size: 11px;
  }
}

/* ==================== 全局雙語編輯器樣式 ==================== */

/* 全局語言切換按鈕 */
.articles-global-language-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary, rgba(0,0,0,0.05));
  padding: 4px;
  border-radius: 6px;
}

.global-tab-btn {
  padding: 6px 14px;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.global-tab-btn:hover {
  background: rgba(0,0,0,0.08);
  color: var(--text-primary);
}

.global-tab-btn.active {
  background: white;
  color: #496f4b;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 深色模式 - 語言切換按鈕 */
html[data-theme="dark"] .global-tab-btn {
  color: var(--text-secondary);
}

html[data-theme="dark"] .global-tab-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

html[data-theme="dark"] .global-tab-btn.active {
  background: #2d3748;
  color: #7bc97f;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* 表單標籤（中英文切換） */
.form-label-zh,
.form-label-en {
  display: inline;
}

/* 語言內容包裝器 */
.language-content-wrapper {
  position: relative;
}

.language-content-wrapper .language-content {
  display: none;
}

.language-content-wrapper .language-content.active {
  display: block;
  animation: fadeIn 0.2s ease-in;
}

/* 英文輸入框樣式（與中文完全相同） */
#articles-title-en-input,
#articles-excerpt-en-input,
#articles-seo-title-en-input,
#articles-seo-desc-en-input {
  width: 100%;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  box-sizing: border-box;
}

#articles-title-en-input {
  font-size: 16px;
  font-weight: 600;
  min-height: 44px;
}

#articles-excerpt-en-input,
#articles-seo-desc-en-input {
  min-height: 80px;
  resize: none;
}

#articles-title-en-input:focus,
#articles-excerpt-en-input:focus,
#articles-seo-title-en-input:focus,
#articles-seo-desc-en-input:focus {
  outline: none;
  border-color: var(--stroke);
  box-shadow: 0 0 0 3px rgba(79, 125, 88, 0.1);
}

/* 複製按鈕緊湊版 */
.btn-helper[title] {
  padding: 8px 12px;
  font-size: 13px;
  min-width: 40px;
  height: 40px;
}


/* ==================== 文章輸入框寬度調整 ==================== */

#articles-title-input,
#articles-title-en-input,
#articles-seo-title-input,
#articles-seo-title-en-input {
  width: 100% !important;
  box-sizing: border-box;
}


/* ==================== 隱藏取消按鈕 ==================== */

.articles-dialog-cancel {
  display: none !important;
}


/* ==================== 深色模式輸入框適配 ==================== */

html[data-theme="dark"] #articles-title-en-input,
html[data-theme="dark"] #articles-excerpt-en-input,
html[data-theme="dark"] #articles-seo-title-en-input,
html[data-theme="dark"] #articles-seo-desc-en-input {
  background: #1f2937;
  color: #f3f4f6;
  border-color: #374151;
}

html[data-theme="dark"] #articles-title-en-input:focus,
html[data-theme="dark"] #articles-excerpt-en-input:focus,
html[data-theme="dark"] #articles-seo-title-en-input:focus,
html[data-theme="dark"] #articles-seo-desc-en-input:focus {
  background: #111827;
  border-color: #4b5563;
  box-shadow: 0 0 0 3px rgba(79, 125, 88, 0.2);
}

/* Order Detail Dialog Styles */
.order-detail-dialog {
  border: none;
  background: transparent;
  padding: 0;
}

.order-detail-dialog::backdrop {
  background: rgba(42, 34, 28, 0.45);
  animation: dialog-backdrop 0.2s ease;
}

.order-detail-dialog-inner {
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  padding: 0;
  max-width: 520px;
  width: min(90vw, 520px);
  max-height: calc(100dvh - 2rem);
  margin: 0;
  position: relative;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.order-detail-dialog[open] {
  display: grid;
  place-items: center;
}

.order-detail-dialog:not([open]) .order-detail-dialog-inner {
  display: none !important;
}

.order-detail-dialog[open] .order-detail-dialog-inner {
  animation: dialog-pop 0.22s ease;
}

.order-detail-dialog.is-closing .order-detail-dialog-inner {
  animation: dialog-pop-out 0.18s ease forwards;
}

.order-detail-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem 0.5rem;
  background: #fff;
  flex-shrink: 0;
}

.order-detail-dialog-header h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--ink);
  padding: 0;
  font-weight: 700;
  flex: 1;
}

.order-detail-dialog-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  transition: color 0.15s ease;
}

.order-detail-dialog-close:hover {
  color: var(--ink);
}

.order-detail-dialog-body {
  flex: 1;
  padding: 0;
  min-height: 0;
  overflow-y: auto;
  color: var(--ink);
}

.order-detail-dialog-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  background: inherit;
  padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--stroke);
  flex-shrink: 0;
  border-radius: 0 0 16px 16px;
  overflow: hidden;
}

.order-detail-dialog-actions .btn {
  flex: 0 0 auto;
}

/* Dark mode styles for order detail dialog */
html[data-theme="dark"] .order-detail-dialog-inner {
  background: #242424;
  border-color: rgba(255, 255, 255, 0.14);
}

html[data-theme="dark"] .order-detail-dialog-header {
  background: #242424;
}

html[data-theme="dark"] .order-detail-dialog-header h3 {
  color: #ececec;
}

html[data-theme="dark"] .order-detail-dialog-close {
  color: #b5b5b5;
}

html[data-theme="dark"] .order-detail-dialog-close:hover {
  color: #ececec;
}

html[data-theme="dark"] .order-detail-dialog-body {
  color: #ececec;
}

html[data-theme="dark"] .order-detail-dialog-actions {
  border-top-color: rgba(255, 255, 255, 0.14);
  background: inherit;
}

/* Order detail content wrapper */
.order-detail-content {
  padding: 0 1rem;
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Responsive layout for order detail info */
.order-detail-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.order-detail-label {
  color: #000;
}

html[data-theme="dark"] .order-detail-label {
  color: #fff;
}

.order-detail-value {
  margin-top: 0.5rem;
  color: var(--ink);
}

/* Order detail table */
.order-detail-table {
  width: 100%;
  border-collapse: collapse;
}

.order-detail-table-head {
  border-bottom: 2px solid rgba(42, 34, 28, 0.12);
}

html[data-theme="dark"] .order-detail-table-head {
  border-bottom-color: rgba(255, 255, 255, 0.14);
}

.order-detail-th {
  padding: 0.5rem 0;
  color: rgba(42, 34, 28, 0.5);
  font-size: 0.9rem;
  text-align: left;
}

html[data-theme="dark"] .order-detail-th {
  color: rgba(255, 255, 255, 0.5);
}

.order-detail-th-qty {
  text-align: center;
}

.order-detail-th-price {
  text-align: right;
}

.order-detail-td-name {
  text-align: left;
}

.order-detail-td-qty {
  text-align: center;
}

.order-detail-td-price {
  text-align: right;
}

/* Order detail hint */
.order-detail-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

@media (max-width: 576px) {
  .order-detail-dialog-inner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    max-height: 85vh;
    border-radius: 16px 16px 0 0;
    transform: translate(0, 0) !important;
  }

  .order-detail-dialog[open] .order-detail-dialog-inner {
    animation: dialog-slide-up 0.28s ease;
  }

  .order-detail-dialog.is-closing .order-detail-dialog-inner {
    animation: dialog-slide-down 0.2s ease forwards;
  }

  .order-detail-info-grid {
    grid-template-columns: 1fr;
  }

  .order-detail-content {
    padding-bottom: calc(3rem + env(safe-area-inset-bottom, 0px));
  }
}

