:root {
  --bg: #eef4f8;
  --panel: rgba(255, 255, 255, 0.68);
  --panel-soft: rgba(255, 255, 255, 0.46);
  --ink: #1d2733;
  --text: #1d2733;
  --muted: #637385;
  --line: rgba(127, 154, 174, 0.28);
  --primary: #087f78;
  --primary-dark: #075f5a;
  --primary-soft: rgba(20, 210, 198, 0.16);
  --cyan: #16c7c7;
  --amber: #d68c20;
  --warning: #b45309;
  --warning-soft: rgba(255, 214, 140, 0.26);
  --success: #147a3f;
  --success-soft: rgba(95, 220, 143, 0.18);
  --danger: #b42318;
  --danger-soft: rgba(255, 140, 129, 0.2);
  --glass: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-soft: rgba(255, 255, 255, 0.34);
  --glass-line: rgba(255, 255, 255, 0.72);
  --glass-inner: inset 0 1px 0 rgba(255, 255, 255, 0.76), inset 0 -1px 0 rgba(255, 255, 255, 0.2);
  --shadow: 0 18px 46px rgba(32, 47, 68, 0.14);
  --shadow-glass: 0 18px 50px rgba(31, 48, 68, 0.16), 0 1px 0 rgba(255, 255, 255, 0.72) inset;
  --banner-text: #f8fbff;
  --banner-muted: #b8c7d0;
  --sidebar-width: 236px;
  --sidebar-collapsed-width: 76px;
  --topbar-height: 190px;
  --sidebar-top: var(--topbar-height);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.theme-dark {
  --bg: #071016;
  --panel: rgba(11, 24, 32, 0.68);
  --panel-soft: rgba(17, 37, 48, 0.5);
  --ink: #edf6f7;
  --text: #edf6f7;
  --muted: #9cb2bd;
  --line: rgba(133, 171, 188, 0.24);
  --primary: #12b8aa;
  --primary-dark: #84f3ea;
  --primary-soft: rgba(18, 184, 170, 0.18);
  --cyan: #20dfe5;
  --amber: #f2bd67;
  --warning: #f0b45d;
  --warning-soft: rgba(240, 180, 93, 0.16);
  --success: #54d88a;
  --success-soft: rgba(84, 216, 138, 0.15);
  --danger: #ff8c81;
  --danger-soft: rgba(255, 140, 129, 0.16);
  --glass: rgba(10, 22, 30, 0.62);
  --glass-strong: rgba(13, 29, 39, 0.82);
  --glass-soft: rgba(255, 255, 255, 0.07);
  --glass-line: rgba(255, 255, 255, 0.13);
  --glass-inner: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -1px 0 rgba(255, 255, 255, 0.05);
  --shadow: 0 22px 62px rgba(0, 0, 0, 0.38);
  --shadow-glass: 0 22px 60px rgba(0, 0, 0, 0.36), 0 1px 0 rgba(255, 255, 255, 0.1) inset;
  --banner-text: #f8fbff;
  --banner-muted: #9fb5bf;
}

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

@keyframes appSlideIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes topbarReveal {
  from {
    opacity: 0;
    transform: translateY(-10px);
    filter: saturate(0.85);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: saturate(1);
  }
}

@keyframes themeMenuIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes techGridDrift {
  from {
    background-position: 0 0, 0 0, 0 0;
  }
  to {
    background-position: 72px 0, 0 72px, 0 0;
  }
}

@keyframes softPulse {
  0%, 100% {
    opacity: 0.72;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes backdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dragLineGlow {
  from {
    opacity: 0.78;
    filter: brightness(0.95);
  }
  to {
    opacity: 1;
    filter: brightness(1.18);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans TC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background-color 0.22s ease, color 0.22s ease;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

body:not(.authenticated) .topbar,
body:not(.authenticated) .tabs,
body:not(.authenticated) main,
body:not(.authenticated) dialog {
  display: none;
}

[hidden] {
  display: none !important;
}

body.authenticated .login-screen {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(6, 17, 24, 0.96) 0%, rgba(7, 29, 34, 0.78) 48%, rgba(7, 29, 34, 0.3) 100%),
    url("/assets/studio-tech-banner.png") center / cover no-repeat,
    #061118;
}

.login-panel {
  width: min(430px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid rgba(195, 236, 235, 0.24);
  border-radius: 8px;
  background: rgba(7, 20, 27, 0.78);
  color: var(--banner-text);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(16px);
  animation: modalIn 360ms var(--ease-out) both;
}

.login-panel h1 {
  font-size: 1.7rem;
}

.login-panel label span {
  color: #c5d7dd;
}

.login-panel input {
  border-color: rgba(195, 236, 235, 0.22);
  background: rgba(255, 255, 255, 0.92);
}

.password-control {
  position: relative;
}

.password-control input {
  width: 100%;
  padding-right: 44px;
}

[data-ascii-input] {
  ime-mode: disabled;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 34px;
  height: 34px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: transparent;
  color: #49626b;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s var(--ease-out);
}

.password-toggle:hover {
  background: rgba(15, 118, 110, 0.1);
  color: var(--primary);
  transform: translateY(-50%) scale(1.04);
}

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

.login-mark {
  width: 66px;
  height: 66px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  user-select: none;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.check-row span {
  color: #c5d7dd;
  font-size: 0.9rem;
  font-weight: 800;
}

.admin-only[hidden],
.super-admin-only[hidden] {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 190px;
  padding: 34px 40px;
  background:
    linear-gradient(90deg, rgba(6, 17, 24, 0.95) 0%, rgba(7, 29, 34, 0.84) 42%, rgba(7, 29, 34, 0.28) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
    url("/assets/studio-tech-banner.png") center / cover no-repeat;
  border-bottom: 1px solid rgba(22, 199, 199, 0.22);
  color: var(--banner-text);
  position: relative;
  z-index: 40;
  overflow: visible;
  box-shadow: 0 18px 54px rgba(10, 22, 31, 0.18);
  animation: topbarReveal 420ms var(--ease-out) both;
}

.app-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(22, 199, 199, 0.12) 1px, transparent 1px) 0 0 / 72px 72px,
    linear-gradient(0deg, rgba(22, 199, 199, 0.08) 1px, transparent 1px) 0 0 / 72px 72px,
    linear-gradient(180deg, transparent 0%, rgba(5, 13, 20, 0.35) 100%);
  opacity: 0.52;
  pointer-events: none;
  animation: techGridDrift 18s linear infinite;
}

.app-banner::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--amber) 48%, transparent 86%);
  opacity: 0.95;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 0 0 min(420px, 38vw);
  min-width: 320px;
  position: relative;
  z-index: 2;
}

.brand-home {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, filter 0.16s ease;
}

.brand-home:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.brand-home:focus-visible {
  outline: 3px solid rgba(22, 199, 199, 0.35);
  outline-offset: 8px;
  border-radius: 10px;
}

.brand-mark {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  position: relative;
  background:
    radial-gradient(circle at 50% 50%, rgba(22, 199, 199, 0.22) 0 22%, transparent 23%),
    conic-gradient(from 18deg, rgba(22, 199, 199, 0.12), rgba(214, 140, 32, 0.2), rgba(255, 255, 255, 0.08), rgba(22, 199, 199, 0.12)),
    rgba(5, 18, 24, 0.86);
  color: #ffffff;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    inset 0 0 34px rgba(22, 199, 199, 0.14);
  border: 1px solid rgba(195, 236, 235, 0.26);
  overflow: hidden;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.brand-mark::before {
  width: 52px;
  height: 52px;
  border: 1px solid rgba(195, 236, 235, 0.28);
  animation: softPulse 3.8s ease-in-out infinite;
}

.brand-mark::after {
  width: 31px;
  height: 31px;
  border: 1px solid rgba(214, 140, 32, 0.42);
}

.brand-mark svg {
  position: absolute;
  width: 58px;
  height: 58px;
  color: rgba(255, 255, 255, 0.13);
}

.brand-mark span {
  position: relative;
  z-index: 1;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.brand-copy h1 {
  max-width: 9em;
  font-size: clamp(1.72rem, 2.15vw, 2rem);
}

.banner-caption {
  margin: 2px 0 0;
  color: var(--banner-muted);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.banner-meta {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  position: relative;
  z-index: 2;
}

.banner-action {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid rgba(195, 236, 235, 0.23);
  border-radius: 8px;
  background: rgba(8, 26, 34, 0.62);
  color: #e6f4f4;
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 26px rgba(0, 0, 0, 0.16);
  transition: transform 0.18s var(--ease-out), border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.banner-action {
  cursor: pointer;
}

.banner-action:hover {
  transform: translateY(-1px);
  border-color: rgba(22, 199, 199, 0.42);
  background: rgba(10, 42, 50, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 16px 28px rgba(0, 0, 0, 0.2);
}

.banner-action.active {
  border-color: rgba(22, 199, 199, 0.55);
  background: rgba(13, 72, 76, 0.82);
  box-shadow: 0 0 0 3px rgba(22, 199, 199, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.theme-picker-shell {
  position: relative;
  display: inline-flex;
}

.banner-action.theme-picker {
  border-color: rgba(242, 189, 103, 0.34);
}

.banner-action.theme-picker svg {
  color: var(--amber);
}

.theme-picker[aria-expanded="true"] {
  border-color: rgba(242, 189, 103, 0.72);
  background: rgba(28, 46, 42, 0.86);
  box-shadow: 0 0 0 3px rgba(242, 189, 103, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.theme-picker-caret {
  width: 15px;
  height: 15px;
  opacity: 0.74;
  transition: transform 0.18s var(--ease-out);
}

/* 自動刷新指示器：低調的倒數秒數 + 手動刷新按鈕 */
.banner-action.refresh-indicator {
  min-height: 30px;
  padding: 0 10px;
  gap: 5px;
  border-color: rgba(195, 236, 235, 0.14);
  background: rgba(8, 26, 34, 0.4);
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(230, 244, 244, 0.5);
  box-shadow: none;
}

.banner-action.refresh-indicator:hover {
  transform: none;
  border-color: rgba(22, 199, 199, 0.32);
  background: rgba(10, 42, 50, 0.55);
  color: rgba(230, 244, 244, 0.8);
  box-shadow: none;
}

.banner-action.refresh-indicator svg {
  width: 13px;
  height: 13px;
  opacity: 0.6;
  transition: transform 0.35s var(--ease-out);
}

.banner-action.refresh-indicator:hover svg {
  opacity: 0.9;
}

.banner-action.refresh-indicator.refreshing svg {
  animation: refresh-spin 0.8s linear infinite;
}

.banner-action.refresh-indicator.refreshing {
  color: rgba(230, 244, 244, 0.75);
  border-color: rgba(22, 199, 199, 0.3);
}

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

.theme-picker[aria-expanded="true"] .theme-picker-caret {
  transform: rotate(180deg);
}

.theme-picker-menu {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 80;
  min-width: 156px;
  padding: 7px;
  border: 1px solid rgba(195, 236, 235, 0.24);
  border-radius: 12px;
  background: rgba(9, 25, 32, 0.96);
  color: #e8f9f7;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(18px);
  transform-origin: top right;
  animation: themeMenuIn 0.16s var(--ease-out);
}

.theme-picker-menu::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 22px;
  width: 10px;
  height: 10px;
  border-left: 1px solid rgba(195, 236, 235, 0.24);
  border-top: 1px solid rgba(195, 236, 235, 0.24);
  background: rgba(9, 25, 32, 0.96);
  transform: rotate(45deg);
}

.theme-picker-menu button {
  position: relative;
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s var(--ease-out);
}

.theme-picker-menu button svg {
  width: 16px;
  height: 16px;
  color: var(--amber);
}

.theme-picker-menu button:hover {
  background: rgba(22, 199, 199, 0.13);
  color: #ffffff;
  transform: translateX(2px);
}

.theme-picker-menu button.active {
  background: linear-gradient(135deg, rgba(242, 189, 103, 0.26), rgba(22, 199, 199, 0.16));
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(242, 189, 103, 0.22);
}

.theme-picker-menu[hidden] {
  display: none;
}

.user-chip {
  max-width: 260px;
}

.user-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.banner-action.frontend-link {
  border-color: rgba(236, 72, 213, 0.52);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.84), rgba(236, 72, 213, 0.78));
  color: #ffffff;
  box-shadow: 0 16px 32px rgba(168, 85, 247, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.banner-action.frontend-link:hover {
  border-color: rgba(34, 211, 238, 0.72);
  background: linear-gradient(135deg, rgba(192, 132, 252, 0.94), rgba(236, 72, 213, 0.88), rgba(34, 211, 238, 0.68));
  box-shadow: 0 18px 36px rgba(236, 72, 213, 0.28), 0 0 0 3px rgba(236, 72, 213, 0.12);
}

.banner-action.frontend-link svg {
  color: #ffffff;
}

#logoutButton {
  border-color: rgba(248, 113, 113, 0.68);
  background: linear-gradient(135deg, rgba(185, 28, 28, 0.92), rgba(220, 38, 38, 0.84));
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(185, 28, 28, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

#logoutButton:hover {
  border-color: rgba(254, 202, 202, 0.9);
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.98), rgba(239, 68, 68, 0.9));
  box-shadow: 0 18px 36px rgba(220, 38, 38, 0.32), 0 0 0 3px rgba(248, 113, 113, 0.14);
}

#logoutButton svg {
  color: #ffffff;
}

.banner-meta svg,
.banner-action svg {
  width: 17px;
  height: 17px;
  color: var(--cyan);
}

.eyebrow {
  margin: 0 0 4px;
  color: #78e6e1;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  line-height: 1.12;
  color: inherit;
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

h2 {
  margin-bottom: 4px;
  font-size: 1.12rem;
}

h3 {
  margin-bottom: 12px;
  font-size: 1rem;
}

.topbar-actions,
.panel-header,
.toolbar,
.tabs,
.form-two {
  display: flex;
  align-items: center;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.btn,
.tab,
.icon-btn {
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  white-space: nowrap;
}

.btn {
  padding: 0 14px;
  font-weight: 700;
  transition: transform 0.16s var(--ease-out), box-shadow 0.16s ease, background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn:hover:not(:disabled),
.icon-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled),
.icon-btn:active:not(:disabled),
.banner-action:active {
  transform: translateY(0) scale(0.98);
}

.btn svg,
.tab svg,
.icon-btn svg,
.search-box svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.btn.primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 18px rgba(8, 127, 120, 0.13);
}

.btn.primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 14px 24px rgba(8, 127, 120, 0.2);
}

.btn.secondary {
  background: var(--panel-soft);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.secondary:hover {
  background: #eef3f7;
}

.btn.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #ffc8c0;
}

.btn.danger:hover {
  background: #ffd7d1;
}

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

.icon-btn {
  width: 36px;
  height: 36px;
  background: transparent;
  color: var(--muted);
  transition: transform 0.16s var(--ease-out), background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.icon-btn.bordered {
  border: 1px solid var(--line);
  background: #ffffff;
}

.icon-btn:hover {
  background: var(--panel-soft);
  color: var(--ink);
}

.icon-btn.danger-icon {
  color: var(--danger);
}

.icon-btn.danger-icon:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.tabs {
  position: fixed;
  z-index: 10;
  top: var(--sidebar-top);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  align-items: stretch;
  flex-direction: column;
  gap: 8px;
  padding: 18px 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 252, 0.96)),
    #ffffff;
  border-right: 1px solid rgba(146, 164, 181, 0.28);
  box-shadow: 12px 0 30px rgba(20, 34, 47, 0.06);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  transition: width 0.18s ease, padding 0.18s ease, box-shadow 0.18s ease;
  animation: appSlideIn 360ms var(--ease-out) 120ms both;
}

.tabs::before {
  content: "功能選單";
  padding: 0 10px 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.sidebar-toggle {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid rgba(8, 127, 120, 0.18);
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 900;
  white-space: nowrap;
  transition: transform 0.16s var(--ease-out), background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.sidebar-toggle:hover {
  transform: translateX(2px);
  border-color: rgba(8, 127, 120, 0.36);
  background: #cff0ec;
}

.sidebar-toggle svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.tab {
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  color: #526171;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid transparent;
  font-weight: 700;
  transition: transform 0.18s var(--ease-out), background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.tab:hover {
  transform: translateX(3px);
  background: #ffffff;
  border-color: rgba(8, 127, 120, 0.2);
  color: var(--primary-dark);
}

.tab.active {
  transform: translateX(4px);
  background:
    linear-gradient(135deg, rgba(8, 127, 120, 0.95), rgba(7, 95, 90, 0.98)),
    var(--primary);
  border-color: rgba(22, 199, 199, 0.24);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(8, 127, 120, 0.18);
}

.tab.active svg {
  color: #baf2ef;
}

main {
  margin-left: var(--sidebar-width);
  padding: 24px 32px 40px;
  transition: margin-left 0.18s ease;
}

body.sidebar-collapsed .tabs {
  width: var(--sidebar-collapsed-width);
  padding: 18px 10px;
}

body.sidebar-collapsed .tabs::before {
  display: none;
}

body.sidebar-collapsed .sidebar-toggle,
body.sidebar-collapsed .tab {
  justify-content: center;
  padding-inline: 0;
}

body.sidebar-collapsed .sidebar-toggle:hover,
body.sidebar-collapsed .tab:hover,
body.sidebar-collapsed .tab.active {
  transform: translateX(0) scale(1.03);
}

body.sidebar-collapsed .sidebar-toggle span,
body.sidebar-collapsed .tab span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

body.sidebar-collapsed main {
  margin-left: var(--sidebar-collapsed-width);
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: appFadeUp 260ms var(--ease-out) both;
}

.view.active.view-replay {
  animation: appFadeUp 260ms var(--ease-out) both;
}

.view.active > .stat-grid,
.view.active > .dashboard-grid,
.view.active > .panel,
.view.active > .management-layout,
.view.active > .warehouse-layout,
.view.active > .brand-layout,
.view.active > .records-layout,
.view.active > .profile-layout,
.view.active > .inventory-layout,
.view.active > .logs-layout,
.view.active > .transfer-workspace {
  animation: appFadeUp 320ms var(--ease-out) both;
}

.view.active > :nth-child(2) {
  animation-delay: 45ms;
}

.view.active > :nth-child(3) {
  animation-delay: 90ms;
}

.view.active > :nth-child(4) {
  animation-delay: 130ms;
}

#dashboardView.view.active,
#checkoutView.view.active,
#checkinView.view.active {
  display: grid;
  min-height: 0;
  height: calc(100vh - 120px);
}

#dashboardView.view.active {
  grid-template-rows: auto minmax(146px, auto) minmax(150px, 0.56fr) minmax(340px, 1.44fr);
  gap: 18px;
}

#dashboardView .stat-grid {
  grid-template-columns: repeat(6, minmax(118px, 1fr));
}

#checkoutView.view.active,
#checkinView.view.active {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
}

#usersView.view.active,
#borrowRequestsView.view.active {
  display: block;
  height: calc(100vh - 120px);
  min-height: 0;
}

#usersView > .panel,
#borrowRequestsView > .panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

#usersView > .panel > .panel-header,
#borrowRequestsView > .panel > .panel-header {
  flex: 0 0 auto;
}

#usersView .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#usersView thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #ffffff;
}

.borrow-request-list {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.borrow-request-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  animation: appFadeUp 280ms var(--ease-out) both;
  transition: transform 0.16s var(--ease-out), border-color 0.16s ease, box-shadow 0.16s ease;
}

.borrow-request-card:hover {
  z-index: 2;
  transform: translateY(-4px) scale(1.014);
  border-color: rgba(8, 127, 120, 0.2);
  box-shadow: 0 22px 38px rgba(24, 36, 50, 0.12);
}

.borrow-request-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.borrow-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.borrow-title-row h3 {
  margin: 0;
}

.borrow-request-head p,
.borrow-request-dates span,
.borrow-contact span,
.borrow-item-list span,
.borrow-notes p {
  color: var(--muted);
}

.borrow-request-dates,
.borrow-contact,
.borrow-item-list,
.borrow-notes {
  display: grid;
  gap: 8px;
}

.borrow-contact {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.borrow-contact span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.borrow-contact svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.borrow-item-list {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.borrow-item-list > div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.borrow-notes {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.borrow-notes p {
  margin: 0;
}

.borrow-notes strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
}

.request-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
  transition: transform 0.16s var(--ease-out), filter 0.16s ease;
}

.request-status:hover {
  transform: translateY(-1px);
  filter: saturate(1.06);
}

.request-status.pending {
  background: var(--warning-soft);
  color: var(--warning);
}

.request-status.approved {
  background: var(--success-soft);
  color: var(--success);
}

.request-status.ready,
.request-status.checked_out,
.request-status.returned,
.request-status.completed {
  background: #e8e7ff;
  color: #4338ca;
}

.request-status.rejected,
.request-status.cancelled {
  background: var(--danger-soft);
  color: var(--danger);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: transform 0.18s var(--ease-out), border-color 0.18s ease, box-shadow 0.18s ease;
  position: relative;
}

.stat {
  min-height: 112px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  position: relative;
  overflow: hidden;
  animation: appFadeUp 360ms var(--ease-out) both;
}

.stat-shortcut {
  width: 100%;
  border: 1px solid var(--line);
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.stat-shortcut:hover {
  z-index: 2;
  transform: translateY(-5px) scale(1.025);
  border-color: rgba(15, 118, 110, 0.38);
  box-shadow: 0 26px 48px rgba(15, 23, 42, 0.16);
}

.stat-shortcut:focus-visible {
  outline: 3px solid rgba(22, 199, 199, 0.28);
  outline-offset: 3px;
}

.stat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), rgba(22, 199, 199, 0.18));
}

.stat span {
  color: var(--muted);
  font-weight: 700;
}

.stat strong {
  font-size: 2.15rem;
  line-height: 1;
}

.stat.success {
  background: var(--success-soft);
}

.stat.warning {
  background: var(--warning-soft);
}

.stat.danger {
  background: var(--danger-soft);
}

.panel {
  overflow: hidden;
}

.panel:hover {
  z-index: 2;
  transform: translateY(-4px) scale(1.01);
  border-color: rgba(8, 127, 120, 0.16);
  box-shadow: 0 28px 52px rgba(24, 36, 50, 0.14);
}

.panel-header {
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #fbfcfd);
}

.panel-header.compact {
  min-height: 58px;
}

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

.urgent-panel {
  margin-bottom: 18px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
  min-height: 0;
}

.task-dashboard {
  grid-template-columns: minmax(0, 1.48fr) minmax(300px, 0.52fr);
}

#dashboardView .dashboard-grid.task-dashboard {
  min-height: 146px;
}

#dashboardView .task-dashboard > .panel {
  min-height: 146px;
}

.task-list,
.notification-list,
.inventory-session-list,
.inventory-result-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

#dashboardTasks {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.task-item,
.inventory-session,
.notification-card,
.inventory-asset {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 6px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  position: relative;
  animation: appFadeUp 240ms var(--ease-out) both;
  transition: transform 0.16s var(--ease-out), border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.inventory-session:hover,
.notification-card:hover,
.inventory-asset:hover {
  z-index: 2;
  transform: translateY(-3px) scale(1.018);
  border-color: rgba(8, 127, 120, 0.2);
  box-shadow: 0 18px 30px rgba(24, 36, 50, 0.11);
}

.task-item strong {
  font-size: 1.7rem;
}

.task-item small,
.inventory-session small,
.notification-card span,
.inventory-asset small {
  color: var(--muted);
  font-weight: 700;
}

.task-item.danger {
  border-color: rgba(180, 35, 24, 0.28);
  background: var(--danger-soft);
}

.task-item.danger::before {
  background: var(--danger);
}

.task-item.danger .task-icon,
.task-item.danger strong {
  background: rgba(180, 35, 24, 0.1);
  color: var(--danger);
}

.task-item.warning {
  border-color: rgba(180, 83, 9, 0.25);
  background: var(--warning-soft);
}

.task-item.warning::before {
  background: var(--warning);
}

.task-item.warning .task-icon,
.task-item.warning strong {
  background: rgba(180, 83, 9, 0.1);
  color: var(--warning);
}

.task-item.success {
  border-color: rgba(20, 122, 63, 0.22);
  background: var(--success-soft);
}

.task-item.success::before {
  background: var(--success);
}

.task-item.success .task-icon,
.task-item.success strong {
  background: rgba(20, 122, 63, 0.1);
  color: var(--success);
}

.task-item.pending::before {
  background: var(--cyan);
}

.task-item.pending .task-icon,
.task-item.pending strong {
  background: rgba(22, 199, 199, 0.12);
  color: var(--primary-dark);
}

.notification-card.unread {
  border-color: rgba(8, 127, 120, 0.35);
  box-shadow: inset 3px 0 0 var(--primary);
}

.notification-card .btn {
  justify-self: start;
}

.compact-list {
  max-height: 240px;
  overflow-y: auto;
}

#dashboardView .task-dashboard .compact-list {
  max-height: 88px;
}

.compact-btn {
  padding-inline: 12px;
}

.task-item {
  position: relative;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 82px;
  gap: 12px;
  overflow: hidden;
  padding: 14px;
  background: #ffffff;
  transition: transform 0.16s var(--ease-out), border-color 0.16s ease, box-shadow 0.16s ease;
  animation: appFadeUp 280ms var(--ease-out) both;
}

.task-item::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--primary);
}

.task-item:hover {
  z-index: 2;
  transform: translateY(-4px) scale(1.018);
  border-color: rgba(8, 127, 120, 0.26);
  box-shadow: 0 22px 38px rgba(15, 23, 42, 0.12);
}

.task-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.task-icon svg {
  width: 18px;
  height: 18px;
}

.task-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.task-copy > span {
  color: var(--ink);
  font-weight: 900;
}

.task-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-item strong {
  min-width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
}

#dashboardView .stat-grid,
#dashboardView .urgent-panel,
#dashboardView .dashboard-grid {
  margin-bottom: 0;
}

#dashboardView .urgent-panel,
#dashboardView .dashboard-grid > .panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#dashboardView .dashboard-grid.task-dashboard > .panel {
  min-height: 146px;
}

#dashboardView > .dashboard-grid:not(.task-dashboard) {
  grid-template-columns: minmax(0, 1.48fr) minmax(300px, 0.52fr);
  min-height: 340px;
}

#dashboardView > .dashboard-grid:not(.task-dashboard) > .panel:first-child {
  min-height: 340px;
}

#dashboardView .task-dashboard .panel-header.compact {
  min-height: 46px;
  padding: 12px 16px 10px;
}

#dashboardView .task-dashboard .task-list,
#dashboardView .task-dashboard .notification-list {
  padding: 10px;
}

#dashboardTasks .task-item {
  min-height: 72px;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 9px;
  padding: 10px;
}

#dashboardTasks .task-icon {
  width: 32px;
  height: 32px;
}

#dashboardTasks .task-icon svg {
  width: 16px;
  height: 16px;
}

#dashboardTasks .task-item strong {
  min-width: 32px;
  height: 32px;
  font-size: 1.12rem;
}

#dashboardTasks .task-copy {
  gap: 1px;
}

#dashboardTasks .task-copy > span,
#dashboardTasks .task-copy small {
  font-size: 0.78rem;
}

#dashboardView .urgent-panel .table-wrap,
#categoryOverview,
#recentMovements {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#categoryOverview {
  overflow-x: hidden;
  padding: 12px 18px 30px 12px;
}

#categoryOverview .category-card {
  min-width: 0;
  max-width: 100%;
}

#categoryOverview .category-card > div,
#categoryOverview .category-meta {
  min-width: 0;
  max-width: 100%;
}

#categoryOverview .category-meta {
  row-gap: 4px;
}

#categoryOverview .category-meta span {
  white-space: nowrap;
}

#categoryOverview .drag-handle {
  justify-self: end;
}

#categoryOverview .category-card:hover {
  transform: translateY(-2px);
}

#dashboardView .urgent-panel .empty:not([hidden]) {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 18px;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
  grid-template-areas:
    "profile-account profile-password"
    "profile-logs profile-logs";
  gap: 18px;
  align-items: start;
  height: auto;
  min-height: 0;
}

.profile-layout > .panel {
  display: flex;
  flex-direction: column;
  max-height: none;
  min-height: 0;
  position: relative;
  top: auto;
  overflow: hidden;
}

.profile-layout > .panel:nth-child(1) {
  grid-area: profile-account;
}

.profile-layout > .panel:nth-child(2) {
  grid-area: profile-password;
}

.profile-layout > .panel > .panel-header {
  flex: 0 0 auto;
}

.profile-summary,
.profile-account-form,
.profile-password-form {
  flex: 0 0 auto;
  min-height: 0;
  overflow-y: visible;
  overscroll-behavior: contain;
  scrollbar-gutter: auto;
}

.profile-summary {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.profile-summary article {
  min-height: 72px;
  display: grid;
  align-content: space-between;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.profile-summary span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.profile-summary strong {
  font-size: 1.05rem;
}

.profile-password-form {
  padding-top: 4px;
}

.profile-account-form {
  border-top: 1px solid var(--line);
}

.profile-log-panel {
  grid-area: profile-logs;
  grid-column: 1 / -1;
  position: static;
  max-height: none;
}

.profile-log-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.profile-log-preview article {
  display: grid;
  gap: 8px;
  min-height: 82px;
  align-content: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.profile-log-preview span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.profile-log-preview strong {
  color: var(--ink);
  font-size: 1rem;
}

.settings-layout {
  display: block;
}

.settings-scope-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
}

.settings-scope-switch button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 900;
  transition: transform 0.16s var(--ease-out), border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}

.settings-scope-switch button svg {
  width: 18px;
  height: 18px;
}

.settings-scope-switch button:hover {
  transform: translateY(-2px);
  border-color: rgba(8, 127, 120, 0.28);
  color: var(--ink);
  box-shadow: 0 14px 24px rgba(24, 36, 50, 0.08);
}

.settings-scope-switch button.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary-soft), rgba(22, 199, 199, 0.12));
  color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary), 0 14px 26px rgba(8, 127, 120, 0.1);
}

.settings-section {
  padding: 18px;
  border-top: 1px solid var(--line);
}

.settings-section-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.settings-section-heading h3,
.branding-card-body h4 {
  margin: 0;
}

.settings-section-heading p,
.branding-card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.branding-color-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(circle at 0 0, var(--primary-soft), transparent 38%),
    var(--panel-soft);
  box-shadow: var(--shadow-glass);
}

.copy-settings-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.38)),
    var(--panel-soft);
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(18px) saturate(1.2);
}

.theme-dark .copy-settings-panel {
  background:
    linear-gradient(135deg, rgba(8, 23, 31, 0.78), rgba(8, 23, 31, 0.48)),
    var(--panel-soft);
}

.branding-color-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.branding-color-heading h4 {
  margin: 0 0 4px;
}

.branding-color-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.branding-color-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.copy-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.copy-settings-grid label {
  min-width: 0;
}

.copy-settings-grid label.span-2 {
  grid-column: 1 / -1;
}

.copy-settings-grid small {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.color-field {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--glass-soft);
}

.color-field > span {
  color: var(--ink);
}

.color-picker-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 26px;
  align-items: center;
  gap: 10px;
}

.color-picker-row input[type="color"] {
  width: 44px;
  height: 38px;
  min-height: 38px;
  padding: 3px;
  border-radius: 10px;
  cursor: pointer;
}

.color-picker-row strong {
  color: var(--ink);
  font-size: 0.9rem;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.color-picker-row i {
  width: 26px;
  height: 26px;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: var(--swatch-color, var(--primary));
  box-shadow: 0 0 0 3px rgba(8, 127, 120, 0.1), 0 10px 22px rgba(8, 127, 120, 0.18);
}

.color-field small {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.branding-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.branding-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  position: relative;
  overflow: hidden;
  animation: appFadeUp 240ms var(--ease-out) both;
}

.branding-card::after {
  content: attr(data-image-mode);
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 8px;
  border: 1px solid rgba(8, 127, 120, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  backdrop-filter: blur(10px);
}

.branding-card.using-custom-image::after {
  border-color: rgba(8, 127, 120, 0.3);
  background: var(--primary-soft);
  color: var(--primary);
}

.branding-card.wide-branding-card {
  grid-column: 1 / -1;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.branding-preview {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 126px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed rgba(8, 127, 120, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(22, 199, 199, 0.12), rgba(214, 140, 32, 0.08)),
    var(--panel);
  color: var(--primary);
  font-weight: 900;
}

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

.branding-card.has-image .branding-preview span {
  display: none;
}

.logo-preview {
  aspect-ratio: 1;
  min-height: 132px;
}

.banner-preview {
  aspect-ratio: 10 / 3;
  min-height: 0;
}

.login-bg-preview {
  aspect-ratio: 16 / 9;
  min-height: 0;
}

.frontend-hero-preview {
  aspect-ratio: 12 / 5;
  min-height: 0;
}

.branding-card-body {
  display: grid;
  gap: 12px;
  align-content: center;
  min-width: 0;
  padding-right: 72px;
}

.branding-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.branding-actions input[type="file"] {
  display: none;
}

#imageCropDialog.modal {
  width: min(1040px, calc(100vw - 40px));
  max-width: calc(100vw - 40px);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}

.crop-modal-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  max-height: calc(100dvh - 32px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.crop-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  height: min(62vh, 600px);
  min-height: min(360px, 50vh);
  max-height: none;
  overflow: hidden;
  border: 1px solid rgba(22, 199, 199, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(22, 199, 199, 0.08) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(0deg, rgba(22, 199, 199, 0.06) 1px, transparent 1px) 0 0 / 42px 42px,
    #071016;
}

.crop-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(min(62vh, 600px) - 2px);
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.crop-selection {
  position: absolute;
  border: 2px solid var(--cyan);
  border-radius: 4px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.48), 0 0 24px rgba(22, 199, 199, 0.28);
  cursor: move;
  touch-action: none;
}

.crop-selection::before,
.crop-selection::after {
  content: "";
  position: absolute;
  inset: 33.333% 0 auto;
  height: 1px;
  background: rgba(255, 255, 255, 0.42);
}

.crop-selection::after {
  inset: 66.666% 0 auto;
}

.crop-handle {
  position: absolute;
  right: -9px;
  bottom: -9px;
  width: 18px;
  height: 18px;
  border: 2px solid #071016;
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(22, 199, 199, 0.24);
  cursor: nwse-resize;
}

.crop-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.crop-footer p {
  min-width: 0;
  margin: 0;
}

.category-list,
.category-filter-list {
  padding: 12px;
}

.category-card,
.category-filter {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
  transition: transform 0.16s var(--ease-out), border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.sortable-category {
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: center;
  position: relative;
}

.sortable-category.dragging {
  opacity: 0.55;
}

.sortable-category.drag-insert-before::before,
.sortable-category.drag-insert-after::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--primary));
  box-shadow: 0 0 0 3px rgba(22, 199, 199, 0.14);
  pointer-events: none;
  z-index: 2;
}

.sortable-category.drag-insert-before::before {
  top: -7px;
}

.sortable-category.drag-insert-after::after {
  bottom: -7px;
}

.drag-insert-line {
  position: fixed;
  z-index: 9999;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #14f1ff, var(--primary));
  box-shadow: 0 0 0 4px rgba(20, 241, 255, 0.16), 0 0 18px rgba(20, 241, 255, 0.38);
  transform: translateY(-2px);
  pointer-events: none;
  animation: dragLineGlow 800ms ease-in-out infinite alternate;
}

.drag-handle {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
}

.drag-handle:hover {
  background: var(--panel-soft);
  color: var(--ink);
}

.drag-handle:active {
  cursor: grabbing;
}

.drag-handle svg {
  width: 18px;
  height: 18px;
}

.category-card + .category-card,
.category-filter + .category-filter {
  margin-top: 10px;
}

.category-card strong,
.category-filter strong {
  font-size: 1rem;
}

.category-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.88rem;
}

.category-filter {
  cursor: pointer;
}

.category-card:hover,
.category-filter:hover {
  z-index: 2;
  transform: translateY(-3px) scale(1.018);
  border-color: rgba(8, 127, 120, 0.22);
  box-shadow: 0 18px 32px rgba(24, 36, 50, 0.12);
}

.category-filter.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary), 0 10px 22px rgba(8, 127, 120, 0.08);
}

.category-admin-item {
  grid-template-columns: minmax(0, 1fr) auto 34px;
  align-items: center;
  cursor: default;
}

.brand-category-item {
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  cursor: default;
}

.category-main {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.category-admin-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  justify-content: flex-end;
}

.category-admin-actions .icon-btn {
  width: 32px;
  height: 32px;
  min-height: 32px;
}

.category-admin-actions .icon-btn svg {
  width: 16px;
  height: 16px;
}

.category-edge-handle {
  justify-self: end;
  align-self: center;
}

.warehouse-item {
  cursor: default;
}

.warehouse-edge-handle {
  justify-self: end;
  align-self: center;
}

#managementCategories {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 8px 10px 10px;
  scrollbar-gutter: stable;
}

#managementCategories .category-filter {
  gap: 4px;
  padding: 9px 10px;
}

#managementCategories .category-filter + .category-filter {
  margin-top: 8px;
}

#managementCategories .category-filter strong {
  font-size: 0.95rem;
  line-height: 1.2;
}

#managementCategories .category-main {
  gap: 4px;
}

#managementCategories .category-meta {
  gap: 6px;
  row-gap: 2px;
  font-size: 0.78rem;
  line-height: 1.2;
}

#managementCategories .category-meta span {
  white-space: nowrap;
}

#managementCategories .category-admin-item {
  grid-template-columns: minmax(0, 1fr) auto 28px;
  column-gap: 4px;
}

#managementCategories .category-admin-actions {
  gap: 0;
}

#managementCategories .category-admin-actions .icon-btn,
#managementCategories .category-edge-handle {
  width: 26px;
  height: 26px;
  min-height: 26px;
  border-radius: 6px;
}

#managementCategories .category-admin-actions .icon-btn svg,
#managementCategories .category-edge-handle svg {
  width: 14px;
  height: 14px;
}

.brand-row {
  cursor: pointer;
}

.brand-row.active {
  background: var(--primary-soft);
}

.brand-row.dragging {
  opacity: 0.55;
}

.asset-row.active {
  background: var(--primary-soft);
}

.asset-row.dragging {
  opacity: 0.55;
}

.asset-row.drag-insert-before,
.brand-row.drag-insert-before {
  box-shadow: inset 0 3px 0 var(--cyan);
}

.asset-row.drag-insert-after,
.brand-row.drag-insert-after {
  box-shadow: inset 0 -3px 0 var(--cyan);
}

.brand-select-button {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.brand-select-button strong {
  font-weight: 800;
}

.brand-select-button span {
  color: var(--muted);
  font-size: 0.82rem;
}

.table-drag-cell {
  width: 48px;
  text-align: right;
}

.table-drag-handle {
  margin-left: auto;
}

.brand-asset-list {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.brand-asset-list.page-mode {
  min-height: 420px;
  align-content: start;
}

.brand-asset-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  position: relative;
  animation: appFadeUp 240ms var(--ease-out) both;
  transition: transform 0.16s var(--ease-out), border-color 0.16s ease, box-shadow 0.16s ease;
}

.brand-asset-card:hover {
  z-index: 2;
  transform: translateY(-3px) scale(1.016);
  border-color: rgba(8, 127, 120, 0.2);
  box-shadow: 0 18px 34px rgba(24, 36, 50, 0.11);
}

.brand-asset-card div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.brand-asset-card strong,
.brand-asset-card span {
  overflow-wrap: anywhere;
}

.brand-asset-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.brand-asset-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.management-layout {
  display: grid;
  grid-template-columns: 250px minmax(520px, 1fr) minmax(320px, 400px);
  gap: 18px;
  align-items: start;
}

.inventory-layout,
.logs-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  height: calc(100vh - 120px);
  min-height: 0;
}

.logs-layout {
  grid-template-columns: minmax(0, 1fr);
}

.inventory-side-panel,
.inventory-main-panel,
.logs-layout > .panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - 120px);
}

.compact-form {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.inventory-session-list,
.inventory-result-list,
.logs-layout .notification-list,
#auditLogList {
  overflow-y: auto;
  min-height: 0;
}

.inventory-session.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.scan-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.inventory-result-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
}

.inventory-result-grid section {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.inventory-result-grid h3 {
  margin: 0;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.inventory-result-grid .inventory-result-list,
.logs-layout .notification-list,
#auditLogList {
  flex: 1 1 auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.audit-log-panel {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  min-height: 0;
}

.audit-log-list {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding: 14px;
}

.audit-log-list .movement-item {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.audit-log-list .movement-item + .movement-item {
  margin-top: 10px;
}

.inventory-asset.wrong_warehouse {
  border-color: rgba(180, 83, 9, 0.28);
  background: var(--warning-soft);
}

.inventory-asset.missing {
  color: var(--muted);
}

.management-layout .category-panel {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  max-height: calc(100vh - 120px);
  min-height: 0;
  position: sticky;
  top: 18px;
}

.management-layout .asset-panel,
.management-layout .detail-panel {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  max-height: calc(100vh - 120px);
  min-height: 0;
  position: sticky;
  top: 18px;
}

.management-layout .category-panel .panel-header,
.management-layout .asset-panel .panel-header,
.management-layout .detail-panel .panel-header,
.management-layout .asset-panel .toolbar {
  flex: 0 0 auto;
}

.management-layout .asset-panel .table-wrap,
.management-layout #assetDetail,
.management-layout #assetDetailPlaceholder {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.management-layout .asset-panel .table-wrap {
  overflow-x: auto;
}

.management-layout .asset-panel thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #ffffff;
}

.brand-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  height: calc(100vh - 120px);
  min-height: 0;
}

.warehouse-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  height: calc(100vh - 120px);
  min-height: 0;
}

.records-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  height: calc(100vh - 120px);
  min-height: 0;
}

.brand-layout .category-panel,
.warehouse-layout .category-panel,
.records-layout .category-panel,
.brand-main-panel,
.warehouse-panel,
.records-layout > .panel {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  max-height: calc(100vh - 120px);
  min-height: 0;
  position: sticky;
  top: 18px;
}

.brand-layout .category-panel .panel-header,
.warehouse-layout .category-panel .panel-header,
.records-layout .category-panel .panel-header,
.brand-main-panel .panel-header,
.warehouse-panel .panel-header,
.records-layout > .panel .panel-header,
.warehouse-summary,
#warehouseCategoryFilterShell,
#warehouseCategoryFilters,
.warehouse-transfer,
.records-layout > .panel .toolbar,
.record-filter-summary {
  flex: 0 0 auto;
}

#warehouseList,
#brandCategories {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#brandListPane,
#brandDetailPane {
  flex: 1 1 auto;
  min-height: 0;
}

#brandListPane:not([hidden]),
#brandDetailPane:not([hidden]) {
  display: flex;
  flex-direction: column;
}

.brand-main-panel .table-wrap,
.brand-asset-list.page-mode,
.warehouse-panel .table-wrap,
.records-layout > .panel .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.brand-main-panel .table-wrap,
.warehouse-panel .table-wrap,
.records-layout > .panel .table-wrap {
  overflow-x: auto;
}

.brand-main-panel thead th,
.warehouse-panel thead th,
.records-layout > .panel thead th,
#dashboardView .urgent-panel thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #ffffff;
}

#recordCategories,
.record-asset-list {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.inner-header {
  border-top: 1px solid var(--line);
}

.record-asset-list {
  max-height: 540px;
  overflow: auto;
  padding: 12px;
}

.record-asset {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  position: relative;
  animation: appFadeUp 220ms var(--ease-out) both;
  transition: transform 0.16s var(--ease-out), border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.record-asset:hover {
  z-index: 2;
  transform: translateY(-3px) scale(1.018);
  border-color: rgba(8, 127, 120, 0.22);
  box-shadow: 0 18px 30px rgba(24, 36, 50, 0.11);
}

.record-asset + .record-asset {
  margin-top: 10px;
}

.record-asset.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.record-asset span,
.record-asset small {
  color: var(--muted);
  font-size: 0.82rem;
}

.record-toolbar {
  align-items: end;
}

.record-toolbar label {
  min-width: 180px;
}

.record-filter-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.9rem;
}

.record-filter-summary strong {
  color: var(--ink);
}

.warehouse-summary {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.warehouse-category-filter-shell {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: stretch;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.warehouse-category-filter-bar {
  display: flex;
  gap: 10px;
  min-width: 0;
  padding: 2px 0 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.warehouse-category-filter-bar::-webkit-scrollbar {
  display: none;
}

.strip-scroll-button {
  width: 38px;
  min-height: 58px;
  border: 1px solid rgba(8, 127, 120, 0.2);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #ffffff, #f4faf9);
  color: var(--primary-dark);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.07);
  transition: transform 0.16s var(--ease-out), border-color 0.16s ease, color 0.16s ease, opacity 0.16s ease, box-shadow 0.16s ease;
}

.strip-scroll-button svg {
  width: 18px;
  height: 18px;
}

.strip-scroll-button:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.04);
  border-color: rgba(8, 127, 120, 0.4);
  color: var(--primary);
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.1);
}

.strip-scroll-button:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.strip-scroll-button:disabled {
  cursor: not-allowed;
  opacity: 0.28;
  box-shadow: none;
}

.warehouse-category-button {
  flex: 0 0 auto;
  min-width: 132px;
  max-width: 190px;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.warehouse-category-button strong,
.warehouse-category-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warehouse-category-button span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.warehouse-category-button:hover {
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.warehouse-category-button.active {
  border-color: rgba(15, 118, 110, 0.82);
  background: rgba(22, 199, 199, 0.14);
  color: var(--primary-dark);
}

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

.warehouse-detail p {
  margin-bottom: 4px;
  color: var(--muted);
}

.mini-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.mini-stat-grid article {
  min-height: 74px;
  display: grid;
  align-content: space-between;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.mini-stat-grid span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.mini-stat-grid strong {
  font-size: 1.55rem;
}

.compact-placeholder {
  min-height: 130px;
}

.warehouse-transfer {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) minmax(160px, 220px) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px 18px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
}

.warehouse-transfer h3 {
  margin-bottom: 4px;
}

.warehouse-transfer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.transfer-grid {
  display: grid;
  gap: 18px;
  min-height: 0;
  margin-top: 0;
}

.transfer-workspace {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
}

.transfer-workspace > .panel-header {
  flex: 0 0 auto;
}

.transfer-body {
  display: grid;
  grid-template-columns: 220px minmax(320px, 1fr) minmax(300px, 420px);
  gap: 16px;
  padding: 16px;
  flex: 1 1 auto;
  min-height: 0;
}

.transfer-body.inbound {
  grid-template-columns: minmax(320px, 1fr) minmax(300px, 420px);
}

.transfer-sidebar,
.transfer-list,
.transfer-selected {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.transfer-list-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.transfer-list-header h3,
.transfer-sidebar h3,
.transfer-selected h3 {
  flex: 0 0 auto;
  margin-bottom: 0;
}

.compact-search {
  min-width: 0;
  flex: 0 1 220px;
}

.transfer-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.scan-code-box {
  min-width: 150px;
  max-width: 190px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
}

.scan-code-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.scan-code-box:focus-within {
  border-color: rgba(15, 118, 110, 0.62);
  box-shadow: 0 0 0 3px rgba(22, 199, 199, 0.16);
}

.category-panel,
.asset-panel,
.detail-panel {
  min-height: 520px;
}

.toolbar {
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.search-box {
  min-width: min(420px, 100%);
  flex: 1 1 260px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.search-box:focus-within {
  border-color: rgba(8, 127, 120, 0.45);
  box-shadow: 0 0 0 3px rgba(8, 127, 120, 0.1);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.segmented {
  display: inline-flex;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.segmented button {
  min-width: 68px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  transition: transform 0.16s var(--ease-out), background-color 0.16s ease, color 0.16s ease;
}

.segmented button:hover {
  background: var(--panel-soft);
  color: var(--primary-dark);
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--primary);
  color: #ffffff;
  transform: translateY(-1px);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 740px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

td {
  font-size: 0.92rem;
}

tbody tr:hover {
  background: var(--panel-soft);
}

tbody tr {
  animation: rowIn 220ms var(--ease-out) both;
  transition: background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s var(--ease-out);
}

tbody tr:hover {
  box-shadow: inset 3px 0 0 rgba(8, 127, 120, 0.26);
}

.asset-name {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.asset-name.has-thumb {
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.asset-name img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.asset-name strong {
  display: block;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-name span {
  min-width: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  transition: transform 0.16s var(--ease-out), filter 0.16s ease;
}

.status-pill:hover {
  transform: translateY(-1px);
  filter: saturate(1.06);
}

.status-pill.available {
  color: var(--success);
  background: var(--success-soft);
}

.status-pill.out {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-pill.repair {
  color: var(--danger);
  background: var(--danger-soft);
}

.empty,
.placeholder {
  color: var(--muted);
  text-align: center;
}

.empty {
  padding: 24px;
}

.placeholder {
  min-height: 360px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 24px;
}

.placeholder svg {
  width: 36px;
  height: 36px;
  color: var(--primary);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.field-with-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
}

.asset-photo-editor {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.asset-photo-editor img {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.asset-photo-editor img[hidden] + label {
  grid-column: 1 / 3;
}

.request-link-hint {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(8, 127, 120, 0.22);
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 0.86rem;
  font-weight: 800;
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.field-hint {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.5;
}

.field-message,
.form-message {
  margin: 0;
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.5;
}

.form-message {
  padding: 10px 12px;
  border: 1px solid rgba(180, 35, 24, 0.24);
  border-radius: 8px;
  background: var(--danger-soft);
}

.field-invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.1);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #ffffff;
  color: var(--ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: rgba(8, 127, 120, 0.48);
  box-shadow: 0 0 0 3px rgba(8, 127, 120, 0.1);
}

input[readonly] {
  background: var(--panel-soft);
  color: var(--muted);
  cursor: default;
}

textarea {
  resize: vertical;
}

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

.asset-danger-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dialog-context {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 700;
}

.qr-preview {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  justify-self: center;
  gap: 10px;
  width: min(300px, 100%);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
}

.qr-preview img {
  width: 96px;
  aspect-ratio: 1;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
}

.qr-preview p {
  margin: 0 0 4px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.84rem;
}

.qr-preview strong {
  display: block;
  font-size: 0.98rem;
}

.scanner-panel {
  display: grid;
  gap: 12px;
}

.scanner-panel video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
}

.scanner-fallback {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.scanner-fallback .scan-code-box {
  max-width: none;
}

.database-info {
  display: grid;
  gap: 10px;
}

.database-actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.file-upload-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.file-upload-row span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.file-upload-row input {
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

.database-info p {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.database-info strong {
  color: var(--muted);
}

.database-info code {
  min-width: 0;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 6px;
  background: #e8f3f2;
  color: var(--primary);
  font-weight: 800;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.asset-accessory-block {
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
  border-bottom: 1px solid var(--line);
}

.form-grid .asset-accessory-block {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.modal-card .asset-accessory-block {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.asset-accessory-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.asset-accessory-header h3 {
  margin-bottom: 4px;
}

.asset-accessory-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.asset-accessory-list {
  display: grid;
  gap: 8px;
}

.asset-accessory-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  position: relative;
  animation: appFadeUp 220ms var(--ease-out) both;
  transition: transform 0.16s var(--ease-out), border-color 0.16s ease, box-shadow 0.16s ease;
}

.asset-accessory-card:hover {
  z-index: 2;
  transform: translateY(-3px) scale(1.016);
  border-color: rgba(8, 127, 120, 0.2);
  box-shadow: 0 18px 28px rgba(24, 36, 50, 0.11);
}

.asset-accessory-card strong,
.asset-accessory-card span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-accessory-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.asset-accessory-inline {
  display: block;
  margin-top: 4px;
  color: var(--primary-dark);
  font-size: 0.8rem;
}

.asset-option .asset-accessory-inline,
.selected-item .asset-accessory-inline {
  color: var(--primary-dark);
  font-size: 0.8rem;
}

.history-block {
  padding: 0 16px 16px;
}

.timeline {
  padding: 14px 18px 18px;
}

.timeline.dense {
  padding: 0;
}

.movement-item {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  animation: rowIn 220ms var(--ease-out) both;
}

.movement-item:last-child {
  border-bottom: 0;
}

.movement-item strong {
  font-size: 0.94rem;
}

.movement-item span {
  color: var(--muted);
  font-size: 0.84rem;
}

html:has(dialog[open]),
body:has(dialog[open]) {
  overflow: hidden;
}

.modal {
  width: min(560px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.modal[open] {
  animation: modalIn 220ms var(--ease-out) both;
}

.wide-modal {
  width: min(760px, calc(100vw - 24px));
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.modal[open]::backdrop {
  animation: backdropIn 180ms ease both;
}

.modal-card {
  display: grid;
  gap: 14px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  max-height: calc(100dvh - 24px);
  padding: 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.modal-card > * {
  min-width: 0;
  animation: appFadeUp 220ms var(--ease-out) both;
}

.modal-card > :nth-child(2) {
  animation-delay: 35ms;
}

.modal-card > :nth-child(3) {
  animation-delay: 60ms;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 2px;
}

.modal-header > :first-child {
  min-width: 0;
}

.modal-header .icon-btn {
  flex: 0 0 auto;
}

.modal-header h2 {
  margin: 0;
  overflow-wrap: anywhere;
}

.form-two {
  gap: 12px;
}

.form-two label {
  flex: 1 1 0;
}

.asset-picker {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.asset-picker.tall {
  max-height: 440px;
}

#checkoutCategories,
.transfer-list .asset-picker,
.transfer-selected .transfer-form {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.transfer-list .asset-picker.tall {
  max-height: none;
}

.asset-option {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  animation: rowIn 220ms var(--ease-out) both;
  transition: transform 0.16s var(--ease-out), background-color 0.16s ease, box-shadow 0.16s ease;
}

.asset-option:hover {
  position: relative;
  z-index: 2;
  transform: scale(1.01);
  background: #ffffff;
  box-shadow: inset 3px 0 0 rgba(8, 127, 120, 0.22), 0 12px 24px rgba(24, 36, 50, 0.08);
}

.transfer-list .asset-option {
  grid-template-columns: minmax(0, 1fr) auto;
}

.asset-option:last-child {
  border-bottom: 0;
}

.asset-option input {
  width: 18px;
  height: 18px;
}

.asset-option strong {
  display: block;
}

.asset-option span {
  color: var(--muted);
  font-size: 0.84rem;
}

.selected-list {
  min-height: 96px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  margin-bottom: 12px;
}

.transfer-selected .selected-list {
  flex: 0 1 220px;
  min-height: 88px;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.selected-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  animation: appFadeUp 220ms var(--ease-out) both;
  transition: transform 0.16s var(--ease-out), background-color 0.16s ease, box-shadow 0.16s ease;
}

.selected-item:hover {
  position: relative;
  z-index: 2;
  transform: scale(1.01);
  background: #ffffff;
  box-shadow: 0 12px 22px rgba(24, 36, 50, 0.08);
}

.selected-item:last-child {
  border-bottom: 0;
}

.selected-item strong {
  display: block;
  font-size: 0.92rem;
}

.selected-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

.transfer-form {
  display: grid;
  gap: 12px;
  align-content: start;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  box-shadow: var(--shadow);
  font-weight: 700;
  z-index: 20;
}

.toast:not([hidden]) {
  animation: toastIn 220ms var(--ease-out) both;
}

body.theme-dark .tabs {
  background:
    linear-gradient(180deg, rgba(12, 26, 34, 0.98), rgba(7, 16, 22, 0.96)),
    #071016;
  border-right-color: rgba(91, 128, 143, 0.32);
  box-shadow: 14px 0 34px rgba(0, 0, 0, 0.24);
}

body.theme-dark .tabs::before,
body.theme-dark .tab {
  color: var(--muted);
}

body.theme-dark .tab {
  background: rgba(16, 32, 42, 0.76);
}

body.theme-dark .tab:hover {
  background: rgba(24, 48, 61, 0.86);
  border-color: rgba(32, 223, 229, 0.22);
  color: #d8fbfb;
}

body.theme-dark .sidebar-toggle {
  background: rgba(18, 184, 170, 0.18);
  border-color: rgba(32, 223, 229, 0.2);
  color: #baf7f3;
}

body.theme-dark .sidebar-toggle:hover {
  background: rgba(18, 184, 170, 0.26);
  border-color: rgba(32, 223, 229, 0.36);
}

body.theme-dark .panel,
body.theme-dark .stat,
body.theme-dark .modal {
  background: var(--panel);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

body.theme-dark .panel-header,
body.theme-dark .warehouse-category-filter-shell,
body.theme-dark .warehouse-category-filter-bar {
  background: linear-gradient(180deg, #111f29, #0e1a22);
  border-color: var(--line);
}

body.theme-dark .stat.success,
body.theme-dark .stat.warning,
body.theme-dark .stat.danger,
body.theme-dark .task-item.success,
body.theme-dark .task-item.warning,
body.theme-dark .task-item.danger {
  background: var(--panel);
}

body.theme-dark .btn.secondary,
body.theme-dark .icon-btn.bordered,
body.theme-dark .compact-btn,
body.theme-dark .strip-scroll-button {
  background: linear-gradient(180deg, #132633, #0e1a22);
  border-color: var(--line);
  color: var(--ink);
}

body.theme-dark .btn.secondary:hover,
body.theme-dark .icon-btn:hover,
body.theme-dark .strip-scroll-button:hover:not(:disabled) {
  background: #18313e;
  border-color: rgba(32, 223, 229, 0.28);
}

body.theme-dark .btn.primary {
  background: #0fa79b;
  box-shadow: 0 12px 22px rgba(18, 184, 170, 0.16);
}

body.theme-dark .btn.primary:hover {
  background: #12b8aa;
}

body.theme-dark .banner-action.theme-picker {
  border-color: rgba(242, 189, 103, 0.36);
}

body.theme-dark .banner-action.theme-picker svg {
  color: var(--amber);
}

body.theme-dark .banner-action.frontend-link {
  border-color: rgba(236, 72, 213, 0.58);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.76), rgba(236, 72, 213, 0.64));
  box-shadow: 0 18px 36px rgba(236, 72, 213, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

body.theme-dark .banner-action.frontend-link:hover {
  border-color: rgba(32, 223, 229, 0.8);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.92), rgba(236, 72, 213, 0.84), rgba(32, 223, 229, 0.6));
}

body.theme-dark .category-card,
body.theme-dark .category-filter,
body.theme-dark .task-item,
body.theme-dark .inventory-session,
body.theme-dark .notification-card,
body.theme-dark .inventory-asset,
body.theme-dark .borrow-request-card,
body.theme-dark .borrow-item-list > div,
body.theme-dark .borrow-notes,
body.theme-dark .brand-asset-card,
body.theme-dark .record-asset,
body.theme-dark .warehouse-category-button,
body.theme-dark .asset-option,
body.theme-dark .selected-item,
body.theme-dark .profile-summary article,
body.theme-dark .mini-stat-grid article,
body.theme-dark .asset-accessory-card,
body.theme-dark .database-info p,
body.theme-dark .form-grid .asset-accessory-block {
  background: #101f2a;
  border-color: var(--line);
}

body.theme-dark .category-filter.active,
body.theme-dark .warehouse-category-button.active,
body.theme-dark .inventory-session.active {
  background: var(--primary-soft);
  border-color: rgba(32, 223, 229, 0.66);
  color: #d8fbfb;
  box-shadow: inset 3px 0 0 var(--cyan), 0 14px 28px rgba(0, 0, 0, 0.2);
}

body.theme-dark .category-card:hover,
body.theme-dark .category-filter:hover,
body.theme-dark .borrow-request-card:hover,
body.theme-dark .brand-asset-card:hover,
body.theme-dark .record-asset:hover,
body.theme-dark .warehouse-category-button:hover,
body.theme-dark .inventory-session:hover,
body.theme-dark .notification-card:hover,
body.theme-dark .inventory-asset:hover,
body.theme-dark .asset-option:hover,
body.theme-dark .selected-item:hover {
  background: #152b38;
  border-color: rgba(32, 223, 229, 0.3);
  box-shadow: 0 20px 36px rgba(0, 0, 0, 0.24);
}

body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea,
body.theme-dark .search-box,
body.theme-dark .scan-code-box,
body.theme-dark .segmented,
body.theme-dark .selected-list,
body.theme-dark .asset-picker,
body.theme-dark .asset-photo-editor,
body.theme-dark .file-upload-row,
body.theme-dark .dialog-context,
body.theme-dark .modal-card .asset-accessory-block {
  background: #0a151d;
  border-color: var(--line);
  color: var(--ink);
}

body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder {
  color: #718895;
}

body.theme-dark input[readonly] {
  background: #111f29;
  color: var(--muted);
}

body.theme-dark input:focus,
body.theme-dark select:focus,
body.theme-dark textarea:focus,
body.theme-dark .search-box:focus-within,
body.theme-dark .scan-code-box:focus-within {
  border-color: rgba(32, 223, 229, 0.58);
  box-shadow: 0 0 0 3px rgba(32, 223, 229, 0.14);
}

body.theme-dark th,
body.theme-dark td,
body.theme-dark .movement-item,
body.theme-dark .selected-item,
body.theme-dark .asset-option {
  border-color: var(--line);
}

body.theme-dark tbody tr:hover {
  background: rgba(32, 223, 229, 0.06);
}

body.theme-dark .brand-main-panel thead th,
body.theme-dark .warehouse-panel thead th,
body.theme-dark .records-layout > .panel thead th,
body.theme-dark #dashboardView .urgent-panel thead th,
body.theme-dark .management-layout .asset-panel thead th,
body.theme-dark #usersView thead th {
  background: #0e1a22;
}

body.theme-dark .segmented button:hover {
  background: #152b38;
  color: #d8fbfb;
}

body.theme-dark .qr-preview,
body.theme-dark .qr-preview img,
body.theme-dark .asset-photo-editor img {
  background: #ffffff;
}

body.theme-dark .database-info code {
  background: rgba(18, 184, 170, 0.18);
  color: var(--cyan);
}

body.theme-dark .request-link-hint,
body.theme-dark .notification-card.unread {
  background: rgba(18, 184, 170, 0.12);
}

body.theme-dark .settings-scope-switch button {
  background: rgba(16, 32, 42, 0.82);
  border-color: var(--line);
}

body.theme-dark .settings-scope-switch button.active {
  background: linear-gradient(135deg, rgba(18, 184, 170, 0.24), rgba(32, 223, 229, 0.08));
  color: var(--cyan);
}

body.theme-dark .branding-card::after {
  background: rgba(7, 16, 22, 0.78);
  border-color: rgba(157, 187, 198, 0.24);
  color: var(--muted);
}

body.theme-dark .branding-card.using-custom-image::after {
  background: rgba(18, 184, 170, 0.18);
  border-color: rgba(32, 223, 229, 0.3);
  color: var(--cyan);
}

body.theme-dark .modal::backdrop {
  background: rgba(0, 0, 0, 0.68);
}

body.theme-dark .modal-card {
  background: var(--panel);
  color: var(--ink);
}

body.theme-dark .toast {
  background: #e8fbfb;
  color: #071016;
}

body.theme-dark ::selection {
  background: rgba(32, 223, 229, 0.32);
}

/* Liquid glass visual layer */
body {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78) 0%, rgba(235, 244, 248, 0.84) 42%, rgba(223, 238, 243, 0.92) 100%),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(22, 199, 199, 0.12), transparent 34%, rgba(214, 140, 32, 0.08) 64%, transparent),
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.18));
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(8, 127, 120, 0.08) 1px, transparent 1px) 0 0 / 86px 86px,
    linear-gradient(0deg, rgba(8, 127, 120, 0.06) 1px, transparent 1px) 0 0 / 86px 86px;
  opacity: 0.32;
  mask-image: linear-gradient(180deg, #000, transparent 82%);
}

body.theme-dark {
  background:
    linear-gradient(135deg, rgba(7, 16, 22, 0.98) 0%, rgba(8, 27, 34, 0.94) 44%, rgba(7, 16, 22, 0.98) 100%),
    var(--bg);
}

body.theme-dark::before {
  background:
    linear-gradient(125deg, rgba(32, 223, 229, 0.12), transparent 38%, rgba(242, 189, 103, 0.09) 66%, transparent),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
}

body.theme-dark::after {
  opacity: 0.22;
}

.login-panel,
.panel,
.stat,
.tabs,
.modal,
.modal-card,
.category-card,
.category-filter,
.task-item,
.notification-card,
.inventory-session,
.inventory-asset,
.borrow-request-card,
.borrow-item-list > div,
.borrow-notes,
.brand-asset-card,
.record-asset,
.warehouse-category-button,
.asset-option,
.selected-item,
.profile-summary article,
.profile-log-preview article,
.mini-stat-grid article,
.asset-accessory-card,
.database-info p,
.form-grid .asset-accessory-block,
.branding-card,
.branding-preview,
.settings-scope-switch button,
.dialog-context,
.qr-preview,
.asset-photo-editor,
.file-upload-row,
.selected-list,
.asset-picker,
.search-box,
.scan-code-box,
.segmented,
input,
select,
textarea {
  border-color: var(--glass-line);
  background-color: var(--glass);
  box-shadow: var(--glass-inner);
  backdrop-filter: blur(24px) saturate(1.24);
  -webkit-backdrop-filter: blur(24px) saturate(1.24);
}

.panel,
.stat,
.modal-card,
.login-panel,
.borrow-request-card,
.category-card,
.category-filter,
.notification-card,
.inventory-session,
.inventory-asset,
.brand-asset-card,
.record-asset,
.asset-option,
.selected-item,
.branding-card {
  box-shadow: var(--shadow-glass);
}

.panel,
.stat,
.modal-card,
.login-panel {
  border-radius: 18px;
}

.category-card,
.category-filter,
.task-item,
.notification-card,
.inventory-session,
.inventory-asset,
.borrow-request-card,
.brand-asset-card,
.record-asset,
.warehouse-category-button,
.asset-option,
.selected-item,
.profile-summary article,
.profile-log-preview article,
.mini-stat-grid article,
.asset-accessory-card,
.branding-card {
  border-radius: 14px;
}

.panel-header,
.toolbar,
.warehouse-category-filter-shell,
.warehouse-category-filter-bar,
.modal-header,
.compact-form,
.scan-row {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.12));
  border-color: rgba(255, 255, 255, 0.46);
}

.topbar {
  border-bottom-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 18px 54px rgba(14, 28, 40, 0.26);
}

.banner-action,
.btn,
.tab,
.icon-btn,
.sidebar-toggle,
.compact-btn,
.strip-scroll-button,
.status-pill,
.segmented button {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68), 0 10px 24px rgba(32, 47, 68, 0.1);
  backdrop-filter: blur(18px) saturate(1.24);
  -webkit-backdrop-filter: blur(18px) saturate(1.24);
}

.btn.primary,
.tab.active,
.sidebar-toggle,
.settings-scope-switch button.active,
.segmented button.active {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.58), rgba(20, 210, 198, 0.28)),
    rgba(20, 210, 198, 0.2);
  border-color: rgba(20, 210, 198, 0.46);
  color: var(--primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 16px 34px rgba(8, 127, 120, 0.16);
}

.btn.primary:hover,
.banner-action:hover,
.tab:hover,
.category-card:hover,
.category-filter:hover,
.panel:hover,
.stat-shortcut:hover,
.borrow-request-card:hover,
.brand-asset-card:hover,
.record-asset:hover,
.warehouse-category-button:hover,
.inventory-session:hover,
.notification-card:hover,
.inventory-asset:hover,
.asset-option:hover,
.selected-item:hover {
  border-color: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-glass), 0 0 0 1px rgba(20, 210, 198, 0.08);
  filter: saturate(1.04);
}

.btn.danger {
  background: rgba(255, 140, 129, 0.18);
  border-color: rgba(255, 140, 129, 0.42);
}

input,
select,
textarea {
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus,
.search-box:focus-within,
.scan-code-box:focus-within {
  border-color: rgba(20, 210, 198, 0.62);
  box-shadow: 0 0 0 4px rgba(20, 210, 198, 0.14), var(--glass-inner);
}

table {
  background: transparent;
}

th {
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(18px) saturate(1.18);
  -webkit-backdrop-filter: blur(18px) saturate(1.18);
}

tbody tr {
  transition: background-color 0.16s ease, transform 0.16s var(--ease-out), box-shadow 0.16s ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.46);
}

.modal::backdrop {
  background:
    linear-gradient(135deg, rgba(235, 244, 248, 0.56), rgba(7, 16, 22, 0.28));
  backdrop-filter: blur(14px) saturate(1.18);
  -webkit-backdrop-filter: blur(14px) saturate(1.18);
}

body.theme-dark .panel-header,
body.theme-dark .toolbar,
body.theme-dark .warehouse-category-filter-shell,
body.theme-dark .warehouse-category-filter-bar,
body.theme-dark .modal-header,
body.theme-dark .compact-form,
body.theme-dark .scan-row {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025));
  border-color: rgba(255, 255, 255, 0.1);
}

body.theme-dark .banner-action,
body.theme-dark .btn,
body.theme-dark .tab,
body.theme-dark .icon-btn,
body.theme-dark .sidebar-toggle,
body.theme-dark .compact-btn,
body.theme-dark .strip-scroll-button,
body.theme-dark .status-pill,
body.theme-dark .segmented button {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.11), 0 14px 34px rgba(0, 0, 0, 0.22);
}

body.theme-dark .btn.primary,
body.theme-dark .tab.active,
body.theme-dark .sidebar-toggle,
body.theme-dark .settings-scope-switch button.active,
body.theme-dark .segmented button.active {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(32, 223, 229, 0.2)),
    rgba(18, 184, 170, 0.12);
  border-color: rgba(32, 223, 229, 0.38);
  color: #dcffff;
}

body.theme-dark th,
body.theme-dark tbody tr:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.theme-dark .modal::backdrop {
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.52), rgba(7, 16, 22, 0.72));
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 1460px) {
  .management-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .detail-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1180px) {
  :root {
    --sidebar-width: 210px;
  }

  .topbar {
    gap: 20px;
    padding: 28px 26px;
  }

  .brand-block {
    flex-basis: 300px;
    min-width: 280px;
  }

  .banner-action {
    padding-inline: 11px;
  }

  main {
    padding: 20px 22px 34px;
  }

  #dashboardView.view.active {
    height: auto;
    grid-template-rows: auto auto auto auto;
  }

  #dashboardView .stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #dashboardView .dashboard-grid.task-dashboard,
  #dashboardView > .dashboard-grid:not(.task-dashboard) {
    grid-template-columns: minmax(0, 1fr);
  }

  #dashboardTasks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .management-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .branding-card.wide-branding-card {
    grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  }

  .branding-color-grid {
    grid-template-columns: 1fr;
  }

  .copy-settings-grid {
    grid-template-columns: 1fr;
  }

  .copy-settings-grid label.span-2 {
    grid-column: auto;
  }

  .branding-card-body {
    padding-right: 58px;
  }

  .transfer-body {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .modal {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .modal-card {
    max-height: calc(100dvh - 16px);
    gap: 12px;
    padding: 14px;
  }

  .scanner-fallback {
    grid-template-columns: 1fr;
  }

  .scanner-fallback .btn {
    width: 100%;
  }

  .database-info p {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .asset-accessory-header {
    align-items: stretch;
    flex-direction: column;
  }

  .asset-accessory-header .btn {
    width: 100%;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
    min-height: 236px;
    padding: 24px 18px 18px;
    background-position: center right 28%;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .brand-block {
    flex: none;
    min-width: 0;
    width: 100%;
  }

  .brand-mark {
    width: 56px;
    height: 56px;
  }

  .brand-mark::before {
    width: 40px;
    height: 40px;
  }

  .brand-mark::after {
    width: 25px;
    height: 25px;
  }

  .brand-mark svg {
    width: 44px;
    height: 44px;
  }

  h1 {
    font-size: 1.48rem;
  }

  .banner-caption {
    font-size: 0.78rem;
  }

  .banner-meta {
    width: 100%;
    justify-content: flex-start;
  }

  .banner-action {
    flex: 1 1 130px;
    min-width: 0;
    background: rgba(8, 26, 34, 0.72);
  }

  .banner-action.refresh-indicator {
    flex: 0 0 auto;
    min-width: 58px;
    padding: 0 9px;
  }

  .tabs {
    position: sticky;
    top: 0;
    left: auto;
    bottom: auto;
    width: auto;
    align-items: center;
    flex-direction: row;
    gap: 10px;
    padding: 12px 18px;
    border-right: 0;
    border-bottom: 1px solid rgba(146, 164, 181, 0.28);
    box-shadow: 0 10px 26px rgba(20, 34, 47, 0.05);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-gutter: auto;
  }

  .sidebar-toggle {
    display: none;
  }

  .tabs::before {
    display: none;
  }

  body.sidebar-collapsed .tabs {
    width: auto;
    padding: 12px 18px;
  }

  body.sidebar-collapsed .tab {
    width: auto;
    justify-content: center;
    padding: 0 12px;
  }

  body.sidebar-collapsed .tab span {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }

  body.sidebar-collapsed main {
    margin-left: 0;
  }

  main {
    margin-left: 0;
    padding: 18px;
  }

  #dashboardView.view.active,
  #checkoutView.view.active,
  #checkinView.view.active,
  #usersView.view.active {
    display: block;
    height: auto;
  }

  #dashboardView .stat-grid,
  .stat-grid,
  .dashboard-grid,
  .task-dashboard,
  .profile-layout,
  .settings-layout,
  .management-layout,
  .inventory-layout,
  .logs-layout,
  .inventory-result-grid,
  .brand-layout,
  .warehouse-layout,
  .records-layout,
  .scan-row,
  .transfer-body,
  .transfer-body.inbound {
    grid-template-columns: 1fr;
  }

  #dashboardView > .dashboard-grid:not(.task-dashboard) {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  #dashboardView > .dashboard-grid:not(.task-dashboard) > .panel {
    width: 100%;
    min-width: 0;
  }

  .profile-layout {
    grid-template-areas:
      "profile-account"
      "profile-password"
      "profile-logs";
  }

  .branding-grid,
  .branding-card,
  .branding-card.wide-branding-card,
  .profile-log-preview {
    grid-template-columns: 1fr;
  }

  .branding-color-heading {
    flex-direction: column;
  }

  .branding-color-heading .btn {
    width: 100%;
  }

  .branding-card-body {
    padding-right: 0;
  }

  .branding-card::after {
    top: 12px;
    right: 12px;
  }

  #imageCropDialog.modal {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  .crop-modal-card {
    max-height: calc(100dvh - 20px);
    gap: 10px;
    padding: 14px;
  }

  .crop-stage {
    height: min(52vh, 420px);
    min-height: min(280px, 44vh);
  }

  .crop-stage img {
    max-height: calc(min(52vh, 420px) - 2px);
  }

  .crop-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .crop-footer .row-actions {
    justify-content: flex-end;
  }

  .profile-layout,
  .inventory-layout,
  .logs-layout,
  .brand-layout,
  .warehouse-layout,
  .records-layout {
    height: auto;
  }

  .profile-layout > .panel,
  .inventory-side-panel,
  .inventory-main-panel,
  .logs-layout > .panel,
  .brand-layout .category-panel,
  .warehouse-layout .category-panel,
  .records-layout .category-panel,
  .brand-main-panel,
  .warehouse-panel,
  .records-layout > .panel {
    height: auto;
    max-height: none;
    position: static;
  }

  .management-layout .category-panel {
    height: auto;
    max-height: none;
    position: static;
  }

  .management-layout .asset-panel,
  .management-layout .detail-panel {
    height: auto;
    max-height: none;
    position: static;
  }

  #managementCategories {
    overflow-y: visible;
    scrollbar-gutter: auto;
  }

  .management-layout .asset-panel .table-wrap,
  .management-layout #assetDetail,
  .management-layout #assetDetailPlaceholder {
    overflow-y: visible;
    scrollbar-gutter: auto;
  }

  #dashboardView .urgent-panel .table-wrap,
  #categoryOverview,
  #recentMovements,
  .inventory-session-list,
  .inventory-result-list,
  .logs-layout .notification-list,
  #auditLogList,
  .profile-summary,
  .profile-account-form,
  .profile-password-form,
  #warehouseList,
  #brandCategories,
  #recordCategories,
  .record-asset-list,
  .brand-main-panel .table-wrap,
  .brand-asset-list.page-mode,
  .warehouse-panel .table-wrap,
  .records-layout > .panel .table-wrap,
  #usersView .table-wrap,
  #checkoutCategories,
  .transfer-list .asset-picker,
  .transfer-selected .selected-list,
  .transfer-selected .transfer-form {
    overflow-y: visible;
    scrollbar-gutter: auto;
  }

  #dashboardTasks {
    grid-template-columns: 1fr;
  }

  .transfer-grid {
    margin-top: 18px;
  }

  .transfer-workspace {
    max-height: none;
  }

  .transfer-selected .selected-list {
    flex: none;
    max-height: 260px;
  }

  .transfer-list-header {
    align-items: stretch;
    flex-direction: column;
  }

  .compact-search {
    flex-basis: auto;
  }

  .transfer-tools {
    align-items: stretch;
    justify-content: stretch;
  }

  .transfer-tools .search-box,
  .transfer-tools .scan-code-box {
    flex: 1 1 100%;
    max-width: none;
  }

  .transfer-tools .btn {
    flex: 1 1 calc(50% - 4px);
  }

  .warehouse-detail,
  .warehouse-transfer {
    grid-template-columns: 1fr;
  }

  .record-filter-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .record-toolbar label {
    min-width: 0;
    width: 100%;
  }

  .warehouse-detail {
    flex-direction: column;
  }

  .category-panel,
  .asset-panel,
  .detail-panel {
    min-height: auto;
  }

  .form-grid,
  .form-two {
    grid-template-columns: 1fr;
    display: grid;
  }

  .asset-photo-editor {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .asset-photo-editor img {
    width: 72px;
    height: 54px;
  }

  .asset-photo-editor .btn {
    grid-column: 1 / -1;
  }

  .asset-danger-actions,
  .row-actions {
    flex-direction: column;
  }

  .row-actions .btn,
  .asset-danger-actions .btn {
    width: 100%;
  }

  .tab {
    width: auto;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 112px;
  }
}

/* ===== 新功能：行事曆 / 套組 / 耗材 / 統計 / QR列印 / 匯入 / 通知設定 ===== */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* 預約行事曆 */
.cal-legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 14px 0 18px; font-size: 14px; color: var(--text-soft, #94a7b8); }
.cal-legend span { display: inline-flex; align-items: center; gap: 7px; }
.cal-dot { width: 11px; height: 11px; border-radius: 4px; display: inline-block; }
.cal-dot.pending { background: #e0a33e; }
.cal-dot.approved { background: #17c9c9; }
.cal-dot.ready { background: #4f8cff; }
.cal-dot.checked_out { background: #9b5cff; }
.cal-dot.overdue { background: #ef5466; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.cal-head { text-align: center; font-size: 13.5px; font-weight: 800; color: var(--text-soft, #94a7b8); padding: 6px 0; }
.cal-cell {
  min-height: 96px; border: 1px solid var(--glass-line, rgba(120,180,200,0.18));
  border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 5px;
  background: rgba(255,255,255,0.02); cursor: pointer; transition: border-color .18s ease, background .18s ease;
}
.cal-cell:hover { border-color: rgba(61,220,200,0.55); }
.cal-cell.other { opacity: 0.38; }
.cal-cell.today .cal-date { background: var(--accent, #16c7c7); color: #04252b; }
.cal-date { font-size: 13.5px; font-weight: 800; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.cal-chips { display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.cal-chip {
  font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 7px;
  color: #04252b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-chip.pending { background: #ffcf78; }
.cal-chip.approved { background: #7de8de; }
.cal-chip.ready { background: #a9c8ff; }
.cal-chip.checked_out { background: #cbb0ff; }
.cal-chip.overdue { background: #ff9aa7; }
.cal-more { font-size: 11.5px; color: var(--text-soft, #94a7b8); }
.cal-day-detail { margin-top: 20px; border-top: 1px dashed var(--glass-line, rgba(120,180,200,0.2)); padding-top: 16px; }
.cal-day-detail h3 { font-size: 17px; margin-bottom: 12px; }
.cal-day-list { display: flex; flex-direction: column; gap: 10px; }

/* 套組 */
.kit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.kit-card {
  border: 1px solid var(--glass-line, rgba(120,180,200,0.2)); border-radius: 16px;
  padding: 18px; background: rgba(255,255,255,0.03); display: flex; flex-direction: column; gap: 12px;
}
.kit-card h3 { font-size: 18px; display: flex; align-items: center; justify-content: space-between; }
.kit-card .kit-desc { font-size: 14px; color: var(--text-soft, #94a7b8); }
.kit-badge { font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; }
.kit-badge.ready { background: rgba(23,201,201,0.18); color: #35d5c5; }
.kit-badge.partial { background: rgba(224,163,62,0.18); color: #ffc078; }
.kit-items { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.kit-item-row { display: flex; justify-content: space-between; gap: 8px; }
.kit-item-row .st-available { color: #35d5c5; font-weight: 700; }
.kit-item-row .st-out { color: #ffc078; font-weight: 700; }
.kit-item-row .st-repair { color: #ff9aa7; font-weight: 700; }
.kit-actions { display: flex; gap: 8px; margin-top: auto; }
.kit-asset-picker span { display: block; font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.kit-asset-list {
  max-height: 300px; overflow-y: auto; border: 1px solid var(--glass-line, rgba(120,180,200,0.2));
  border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px;
}
.kit-asset-option {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  cursor: pointer; font-size: 14.5px;
}
.kit-asset-option:hover { background: rgba(255,255,255,0.05); }
.kit-asset-option.checked { background: rgba(23,201,201,0.14); }
.kit-asset-option .asset-code { color: var(--text-soft, #94a7b8); font-size: 12.5px; margin-left: auto; }
.kit-quick-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.kit-quick-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14.5px; color: var(--text-soft, #94a7b8); }
.kit-quick-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.kit-quick-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid rgba(61,220,200,0.4); background: rgba(23,201,201,0.08);
  color: inherit; font-weight: 700; font-size: 14px; cursor: pointer; transition: all .18s ease;
}
.kit-quick-btn:hover:not(:disabled) { background: rgba(23,201,201,0.2); transform: translateY(-1px); }
.kit-quick-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.kit-quick-btn small { opacity: 0.75; font-weight: 600; }

/* 統計圖表 */
.stat-cards-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-mini { border: 1px solid var(--glass-line, rgba(120,180,200,0.2)); border-radius: 14px; padding: 14px 16px; }
.stat-mini .label { font-size: 13px; color: var(--text-soft, #94a7b8); }
.stat-mini .value { font-size: 28px; font-weight: 900; margin-top: 4px; }
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card { border: 1px solid var(--glass-line, rgba(120,180,200,0.2)); border-radius: 16px; padding: 18px; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card h3 { font-size: 16px; margin-bottom: 14px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 44px; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 14px; }
.bar-row .bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.bar-track { height: 20px; background: rgba(255,255,255,0.06); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #0e9a94, #2ce0d0); transition: width .6s var(--ease-out, ease); }
.bar-row .bar-val { font-weight: 900; text-align: right; }
.cat-usage-row { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: center; margin-bottom: 12px; font-size: 14px; }
.cat-usage-stack { display: flex; height: 24px; border-radius: 8px; overflow: hidden; background: rgba(255,255,255,0.06); }
.cat-usage-stack span { display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 800; color: #04252b; }
.cat-usage-stack .u-av { background: #35d5c5; }
.cat-usage-stack .u-out { background: #ffc078; }
.cat-usage-stack .u-rep { background: #ff9aa7; }
.cat-usage-name { font-weight: 700; display: flex; justify-content: space-between; }

/* QR 批次列印 */
.qr-print-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.qr-print-count { font-weight: 800; color: var(--text-soft, #94a7b8); }
.qr-print-list {
  max-height: 340px; overflow-y: auto; border: 1px solid var(--glass-line, rgba(120,180,200,0.2));
  border-radius: 12px; padding: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px;
}
.qr-print-option { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.qr-print-option:hover { background: rgba(255,255,255,0.05); }
.qr-print-option .asset-code { color: var(--text-soft, #94a7b8); margin-left: auto; font-size: 12.5px; }

/* 匯入 */
.import-steps { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; font-size: 14.5px; line-height: 1.7; color: var(--text-soft, #a8bccc); }
.import-steps a { color: #3ddcc8; font-weight: 700; }
.import-steps b { color: #fff; }
.import-file-label { display: block; margin-bottom: 14px; }

.import-result { border: 1px solid var(--glass-line, rgba(120,180,200,0.2)); border-radius: 12px; padding: 14px; margin-bottom: 14px; font-size: 14px; max-height: 220px; overflow-y: auto; }
.import-result .ok { color: #35d5c5; font-weight: 800; }
.import-result .fail { color: #ff9aa7; }

/* 通知設定 */
.notify-card { border: 1px solid var(--glass-line, rgba(120,180,200,0.2)); border-radius: 16px; padding: 20px 22px; margin-top: 16px; }
.notify-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.notify-copy h3 { font-size: 17px; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.notify-copy p { font-size: 14px; color: var(--text-soft, #94a7b8); line-height: 1.7; }
.notify-fields { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.notify-fields label span { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 6px; }
.notify-fields input {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--glass-line, rgba(120,180,200,0.25)); background: rgba(0,0,0,0.2); color: inherit;
}
.notify-actions { display: flex; gap: 10px; }
.notify-help { font-size: 13px; color: var(--text-soft, #94a7b8); line-height: 1.7; }
.notify-help code { background: rgba(0,0,0,0.3); padding: 2px 8px; border-radius: 6px; font-size: 12.5px; }
.notify-detected { border: 1px dashed rgba(61,220,200,0.5); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.notify-detected b { display: block; margin-bottom: 8px; }
.notify-detected .id-chip {
  display: inline-flex; align-items: center; gap: 8px; background: rgba(23,201,201,0.12);
  border-radius: 8px; padding: 5px 10px; margin: 0 6px 6px 0; cursor: pointer; font-family: Consolas, monospace;
}
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; flex-shrink: 0; }
.switch input { display: none; }
.switch .slider {
  width: 46px; height: 26px; border-radius: 999px; background: rgba(120,140,160,0.35);
  position: relative; transition: background .2s ease;
}
.switch .slider::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; transition: transform .2s var(--ease-out, ease);
}
.switch input:checked + .slider { background: var(--accent, #16c7c7); }
.switch input:checked + .slider::after { transform: translateX(20px); }
.switch .switch-label { font-weight: 800; font-size: 14px; }

/* 耗材表格 */
.low-stock-pill { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.low-stock-pill.yes { background: rgba(239,84,102,0.18); color: #ff8a99; }
.low-stock-pill.ok { background: rgba(53,213,197,0.15); color: #35d5c5; }
.qty-controls { display: inline-flex; gap: 6px; }
.qty-btn {
  width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--glass-line, rgba(120,180,200,0.3));
  background: rgba(255,255,255,0.04); color: inherit; font-weight: 900; cursor: pointer; font-size: 15px;
}
.qty-btn:hover { border-color: rgba(61,220,200,0.6); }

@media (max-width: 900px) {
  .charts-grid { grid-template-columns: 1fr; }
  .qr-print-list { grid-template-columns: 1fr; }
  .cal-cell { min-height: 64px; }
  .cal-chips { display: none; }
  .cal-cell.today .cal-date { outline: 2px solid rgba(61,220,200,0.5); }
  .notify-row { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
}

/* 核取清單修復：覆蓋全域 input/label 樣式 */
.kit-asset-list label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.kit-asset-list label span {
  color: inherit;
  font-size: 14.5px;
  font-weight: 600;
  margin: 0;
}
.kit-asset-list input[type="checkbox"],
.qr-print-list input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--accent, #16c7c7);
  cursor: pointer;
}
.qr-print-list label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.qr-print-list label span {
  color: inherit;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}
