:root {
  color-scheme: dark;
  --preview-width: 100%;
  --preview-scale: 1;
  --bg: #0a0d10;
  --panel: #151a20;
  --ink: #eef7f6;
  --muted: #aab6c2;
  --line: rgba(148, 163, 184, 0.22);
  --brand: #087a7a;
  --brand-dark: #05545b;
  --cyan: #00d6cc;
  --neon-green: #22c55e;
  --neon-mint: #34d399;
  --neon-lime: #a3e635;
  --pink: #ff4f7b;
  --amber: #ff9f1c;
  --soft: rgba(18, 28, 34, 0.94);
  --danger: #b42318;
  --radius: 8px;
  font-family: "Pretendard", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  background:
    radial-gradient(circle at 14% 10%, rgba(34, 197, 94, 0.18), transparent 28%),
    radial-gradient(circle at 86% 12%, rgba(0, 214, 204, 0.13), transparent 26%),
    radial-gradient(circle at 55% 100%, rgba(255, 79, 123, 0.08), transparent 34%),
    linear-gradient(145deg, #07090c, #11161b 48%, #0b1014);
  color: var(--ink);
  margin: 0;
  min-height: 100vh;
  min-width: 320px;
  padding-top: 92px;
}

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

button {
  cursor: pointer;
}

button,
a,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.app-shell,
.landing-preview {
  border-left: 1px solid rgba(8, 122, 122, 0.08);
  border-right: 1px solid rgba(8, 122, 122, 0.08);
  margin: 0 auto;
  min-height: 100vh;
  overflow: hidden;
  transform: scale(var(--preview-scale));
  transform-origin: top center;
  transition: width 180ms ease, transform 180ms ease;
  width: var(--preview-width);
}

.landing-preview {
  background: #ffffff;
  height: calc(100vh - 92px);
  min-height: 640px;
}

.landing-preview iframe {
  border: 0;
  display: block;
  height: 100%;
  width: 100%;
}

.preview-topbar {
  align-items: center;
  background: rgba(10, 13, 16, 0.96);
  border: 1px solid rgba(0, 214, 204, 0.2);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35), 0 0 18px rgba(0, 214, 204, 0.08);
  color: var(--ink);
  display: flex;
  gap: 14px;
  left: 0;
  min-height: 78px;
  overflow-x: auto;
  padding: 9px 8px;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 120;
}

body.production-domain .preview-topbar,
body.production-domain .landing-preview {
  display: none;
}

body.production-domain {
  padding-top: 0;
}

body.production-domain .app-shell {
  border-left: 0;
  border-right: 0;
  transform: none;
  width: 100%;
}

body.production-domain *,
body.production-domain *::before,
body.production-domain *::after {
  animation: none !important;
  transition-duration: 0.01ms !important;
  transition-delay: 0ms !important;
}

.preview-project {
  display: grid;
  flex: 0 0 265px;
  gap: 4px;
}

.preview-project strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.preview-project span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.preview-control-group {
  align-items: center;
  background: rgba(18, 24, 30, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-auto-flow: column;
  padding: 8px 10px;
}

.preview-group-label {
  color: #475467;
  font-size: 13px;
  font-weight: 900;
}

.preview-number,
.preview-section-button,
.preview-button,
.preview-apply-button,
.preview-fit-button {
  background: #ffffff;
  border: 1px solid #d8e1ee;
  border-radius: 8px;
  color: #101828;
  font-size: 14px;
  font-weight: 800;
  min-height: 42px;
  padding: 0 16px;
  white-space: nowrap;
}

.preview-section-button.is-active,
.preview-button.is-active,
.preview-fit-button {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.preview-number {
  min-height: 42px;
  padding: 0 10px;
  width: 108px;
}

.preview-number::-webkit-inner-spin-button,
.preview-number::-webkit-outer-spin-button {
  margin: 0;
}

.preview-px {
  color: #475467;
  font-size: 14px;
  font-weight: 800;
}

body.preview-tablet .dashboard-view,
body.preview-mobile .dashboard-view {
  grid-template-columns: 1fr;
}

body.preview-tablet .sidebar,
body.preview-mobile .sidebar {
  gap: 16px;
}

body.preview-tablet .brand,
body.preview-mobile .brand {
  margin-bottom: 0;
}

body.preview-tablet .nav-menu,
body.preview-mobile .nav-menu {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.preview-tablet .logout-button,
body.preview-mobile .logout-button {
  margin-top: 0;
}

body.preview-tablet .resource-grid,
body.preview-tablet .document-grid,
body.preview-tablet .document-grid.compact,
body.preview-tablet .metric-row,
body.preview-tablet .ai-workbench,
body.preview-tablet .ai-dashboard,
body.preview-tablet .client-workspace,
body.preview-mobile .resource-grid,
body.preview-mobile .document-grid,
body.preview-mobile .document-grid.compact,
body.preview-mobile .metric-row,
body.preview-mobile .ai-workbench,
body.preview-mobile .ai-dashboard,
body.preview-mobile .client-workspace {
  grid-template-columns: 1fr;
}

body.preview-mobile .login-panel,
body.preview-mobile .workspace {
  padding: 20px;
}

body.preview-mobile .topbar,
body.preview-mobile .section-head,
body.preview-mobile .category-head,
body.preview-mobile .inbound-toolbar {
  align-items: stretch;
  flex-direction: column;
}

body.preview-mobile .secondary-button,
body.preview-mobile .ghost-button {
  width: 100%;
}

.login-view {
  align-items: center;
  background:
    radial-gradient(circle at 18% 18%, rgba(34, 197, 94, 0.22), transparent 30%),
    radial-gradient(circle at 82% 20%, rgba(0, 214, 204, 0.18), transparent 26%),
    linear-gradient(135deg, #06191c, #101820 52%, #071114);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  background: rgba(18, 24, 30, 0.92);
  border: 1px solid rgba(0, 214, 204, 0.24);
  border-radius: var(--radius);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.52), 0 0 42px rgba(34, 197, 94, 0.18);
  max-width: 450px;
  padding: 34px;
  width: 100%;
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 8px;
}

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

h1 {
  font-size: 34px;
  margin-bottom: 10px;
}

.intro,
.section-head p,
.category-head p,
.coming-soon p {
  color: var(--muted);
  line-height: 1.6;
}

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

label {
  color: #dce7ef;
  display: grid;
  font-size: 14px;
  font-weight: 800;
  gap: 8px;
}

input,
select,
textarea {
  background: rgba(8, 12, 16, 0.88);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius);
  min-height: 46px;
  padding: 0 14px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(0, 214, 204, 0.13);
  outline: 0;
}

textarea {
  line-height: 1.5;
  padding: 12px 14px;
  resize: vertical;
}

.login-form button,
.secondary-button {
  background: linear-gradient(90deg, #064e3b, var(--neon-mint), var(--cyan));
  background-size: 190% 100%;
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 14px 30px rgba(0, 168, 168, 0.22);
  color: white;
  font-weight: 900;
  min-height: 46px;
  padding: 0 18px;
  transition:
    background-position 620ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 520ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 460ms cubic-bezier(0.22, 1, 0.36, 1);
}

.login-form button:hover,
.secondary-button:hover {
  background-position: 100% 50%;
  box-shadow: 0 18px 38px rgba(0, 168, 168, 0.26), 0 0 24px rgba(34, 197, 94, 0.24);
  transform: translateY(-1px);
}

.login-form button,
.secondary-button,
.mini-button,
.ghost-button,
.icon-action,
.icon-button,
.nav-item,
.subnav-item,
.owner-tab,
.sales-text-tab,
.major-select-card,
.mid-select-card,
.subcategory-card,
.contact-check {
  overflow: hidden;
  position: relative;
}

.login-form button::after,
.secondary-button::after,
.mini-button::after,
.ghost-button::after,
.icon-action::after,
.icon-button::after,
.nav-item::after,
.subnav-item::after,
.owner-tab::after,
.sales-text-tab::after,
.major-select-card::after,
.mid-select-card::after,
.subcategory-card::after,
.contact-check::after {
  background: linear-gradient(90deg, transparent, rgba(143, 255, 234, 0.38), transparent);
  content: "";
  height: 100%;
  left: -120%;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
  transform: skewX(-18deg);
  width: 72%;
}

.login-form button.is-pressing::after,
.secondary-button.is-pressing::after,
.mini-button.is-pressing::after,
.ghost-button.is-pressing::after,
.icon-action.is-pressing::after,
.icon-button.is-pressing::after,
.sales-text-tab.is-pressing::after,
.major-select-card.is-pressing::after,
.mid-select-card.is-pressing::after,
.subcategory-card.is-pressing::after {
  animation: neonSweep 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.login-form button:active,
.secondary-button:active,
.mini-button:active,
.ghost-button:active,
.icon-action:active,
.icon-button:active,
.nav-item:active,
.subnav-item:active,
.category-head:active,
.document-card:active {
  transform: translateY(1px) scale(0.992);
}

.login-version {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.login-version {
  align-items: center;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.18);
  border-radius: 999px;
  display: inline-flex;
  justify-self: start;
  padding: 6px 10px;
}

.login-version strong {
  color: #c7fff2;
  margin-left: 5px;
}

.dashboard-view {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 140ms ease;
}

.dashboard-view:has(.sidebar.collapsed) {
  grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(34, 197, 94, 0.13), transparent 24%),
    linear-gradient(160deg, #06191c, #0d2023 54%, #081417);
  color: white;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  padding: 18px 14px;
  position: relative;
}

.sidebar::after {
  animation: scanLine 5.5s linear infinite;
  background: linear-gradient(180deg, transparent, rgba(0, 214, 204, 0.56), transparent);
  content: "";
  height: 180px;
  position: absolute;
  right: 0;
  top: 0;
  width: 1px;
}

.brand {
  align-items: center;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 40px;
  gap: 10px;
  margin: 0 0 18px;
  min-height: 48px;
}

.brand-mark {
  align-items: center;
  animation: keyColorShift 7s ease infinite;
  background: linear-gradient(135deg, var(--neon-green), var(--neon-mint), var(--cyan));
  background-size: 180% 180%;
  border-radius: var(--radius);
  box-shadow: 0 0 22px rgba(34, 197, 94, 0.42);
  display: inline-flex;
  flex: 0 0 38px;
  font-weight: 900;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.brand small {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.22);
  border-radius: 999px;
  color: #c7ffe2;
  display: inline-flex;
  font-size: 11px;
  font-weight: 900;
  margin-top: 5px;
  padding: 3px 8px;
}

.sidebar.collapsed .brand-copy,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .subnav-item span,
.sidebar.collapsed .logout-button {
  opacity: 0;
  pointer-events: none;
  width: 0;
}

.sidebar.collapsed .brand-copy {
  display: none;
}

.sidebar.collapsed .brand {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 10px;
  min-height: 92px;
}

.sidebar.collapsed .sidebar-toggle {
  position: static;
}

.sidebar-toggle {
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(0, 214, 204, 0.22);
  border-radius: var(--radius);
  color: #ffffff;
  display: inline-grid;
  height: 40px;
  justify-content: center;
  place-items: center;
  transition:
    border-color 460ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 520ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 460ms cubic-bezier(0.22, 1, 0.36, 1),
    background 520ms cubic-bezier(0.22, 1, 0.36, 1);
  width: 40px;
}

.sidebar-toggle svg {
  height: 20px;
  width: 20px;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 14px 28px rgba(0, 25, 25, 0.22), 0 0 18px rgba(0, 214, 204, 0.16);
  transform: translateY(-1px);
}

.nav-menu {
  display: grid;
  gap: 10px;
  align-content: start;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}

.nav-divider {
  align-items: center;
  display: grid;
  height: 22px;
  padding: 4px 0;
  width: 100%;
}

.nav-divider::before {
  background: linear-gradient(90deg, transparent, rgba(52, 211, 153, 0.55), rgba(0, 214, 204, 0.38), transparent);
  border-radius: 999px;
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.18);
  content: "";
  display: block;
  height: 1px;
  width: 100%;
}

.nav-item,
.logout-button,
.subnav-item {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #d6dddd;
  display: flex;
  gap: 10px;
  min-height: 44px;
  min-width: 0;
  padding: 0 12px;
  justify-self: stretch;
  text-align: left;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
  white-space: nowrap;
  width: 100%;
}

.nav-item[data-page="clients"],
.nav-item[data-page="settlement"] {
  background: rgba(255, 255, 255, 0.015);
}

.nav-icon {
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  display: inline-flex;
  flex: 0 0 24px;
  font-size: 12px;
  font-weight: 900;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.nav-item.active,
.nav-item:hover,
.subnav-item.active,
.subnav-item:hover {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.16), rgba(0, 214, 204, 0.08));
  border-color: rgba(52, 211, 153, 0.28);
  box-shadow: inset 3px 0 0 var(--neon-mint);
  color: #ffffff;
  transform: none;
}

.client-subnav {
  display: grid;
  gap: 6px;
  margin: 0 0 2px;
  max-height: 260px;
  opacity: 1;
  padding: 2px 0 2px 34px;
  transform: translateY(0);
  transition:
    max-height 140ms ease,
    opacity 120ms ease,
    padding 120ms ease;
}

.client-subnav.collapsed {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding-bottom: 0;
  padding-top: 0;
  pointer-events: none;
  transform: none;
}

.sidebar.collapsed .client-subnav {
  margin: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0;
  pointer-events: none;
  transform: none;
}

.subnav-item {
  min-height: 34px;
  padding-left: 12px;
}

.logout-button {
  justify-content: center;
  margin-top: 6px;
}

/* 상단바 로그아웃 — nav 공용 스타일(width:100%·좌측정렬·큰 높이)을 덮는다. */
.topbar-logout {
  width: auto;
  min-height: 42px;
  margin-top: 0;
  padding: 0 16px;
  border-color: rgba(0, 168, 168, 0.25);
  background: rgba(18, 24, 30, 0.92);
  color: #c7fff2;
  font-weight: 900;
  white-space: nowrap;
}

.topbar-logout:hover {
  border-color: rgba(52, 211, 153, 0.42);
  box-shadow: 0 0 22px rgba(0, 214, 204, 0.2);
  color: #eafff9;
}

.workspace {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 240px),
    rgba(8, 11, 14, 0.8);
  min-width: 0;
  padding: 22px 28px;
}

.topbar,
.section-head {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.topbar {
  margin-bottom: 18px;
}

h2 {
  font-size: 28px;
  margin-bottom: 0;
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

/* 상단바 왼쪽 = 햄버거 + 제목. 데스크탑에선 햄버거를 숨긴다. */
.topbar-left {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}
.nav-drawer-toggle { display: none; }
.nav-drawer-backdrop { display: none; }

/*
  모바일 사이드바 = 오프캔버스 드로어.
  기본 상태(≤720px)에선 화면 밖(왼쪽)에 숨고, 햄버거를 누르면 밀려 들어온다.
  본문(.dashboard-view 1fr)은 이미 풀폭이라(styles.css 위 @media 720) 사이드바가
  세로 공간을 먹지 않는다. 사이드바 배경은 불투명 그라디언트라 본문 위에 떠도 안 비친다.
*/
@media (max-width: 720px) {
  .nav-drawer-toggle {
    align-items: center;
    background: rgba(18, 24, 30, 0.92);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    cursor: pointer;
    display: inline-flex;
    flex: none;
    height: 42px;
    justify-content: center;
    width: 42px;
  }
  .nav-drawer-toggle svg { height: 22px; width: 22px; }

  .sidebar {
    height: 100dvh;
    left: 0;
    overflow-y: auto;
    position: fixed;
    top: 0;
    transform: translateX(-100%);
    transition: transform 200ms ease;
    width: 270px;
    z-index: 60;
  }
  .sidebar.drawer-open { transform: translateX(0); }
  .sidebar .nav-menu { grid-template-columns: 1fr; }  /* 드로어 안에선 메뉴 1열 세로 */

  .nav-drawer-backdrop {
    background: rgba(0, 0, 0, 0.5);
    display: block;
    inset: 0;
    position: fixed;
    z-index: 55;
  }
  .nav-drawer-backdrop[hidden] { display: none; }
}

.version-pill {
  align-items: center;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.12), rgba(0, 214, 204, 0.1));
  border: 1px solid rgba(52, 211, 153, 0.26);
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.12);
  color: var(--brand-dark);
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  min-height: 34px;
  padding: 0 12px;
  white-space: nowrap;
}

.icon-action,
.icon-button {
  align-items: center;
  background: rgba(18, 24, 30, 0.92);
  border: 1px solid rgba(0, 168, 168, 0.25);
  border-radius: var(--radius);
  color: #c7fff2;
  display: inline-flex;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  transition:
    border-color 460ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 520ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 460ms cubic-bezier(0.22, 1, 0.36, 1);
  width: 42px;
}

.icon-action:hover,
.icon-button:hover {
  border-color: rgba(52, 211, 153, 0.42);
  box-shadow: 0 0 22px rgba(0, 214, 204, 0.2), 0 12px 24px rgba(7, 38, 42, 0.08);
  transform: translateY(-1px);
}

.user-pill {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22), 0 0 18px rgba(0, 214, 204, 0.1);
  color: #dffff8;
  font-weight: 900;
  padding: 10px 16px;
}

.page-section,
.sales-library {
  display: grid;
  gap: 12px;
  grid-auto-flow: dense;
}

.page-section,
.page-section.is-entering {
  animation: none;
}

#salesPage {
  gap: 8px;
  padding-top: 0;
}

.section-head,
.category-head,
.static-head,
.coming-soon {
  background:
    linear-gradient(120deg, rgba(25, 31, 38, 0.98), rgba(10, 28, 31, 0.9)),
    #121820;
  border: 1px solid rgba(0, 214, 204, 0.22);
  border-radius: var(--radius);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22), 0 0 24px rgba(0, 214, 204, 0.08);
  padding: 16px 18px;
}

.section-head {
  overflow: hidden;
  position: relative;
}

.section-head::before {
  animation: keyColorShift 8s ease infinite;
  background: linear-gradient(90deg, var(--neon-green), var(--neon-mint), var(--cyan), var(--neon-lime));
  background-size: 220% 100%;
  content: "";
  height: 3px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.section-head h3 {
  font-size: 20px;
  margin-bottom: 4px;
}

.resource-category {
  display: grid;
  gap: 8px;
}

.category-head {
  align-items: center;
  color: var(--ink);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  min-height: 76px;
  text-align: left;
  transition:
    border-color 520ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 560ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1),
    background 620ms cubic-bezier(0.22, 1, 0.36, 1);
  width: 100%;
}

.material-vault-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
}

.material-vault-card {
  align-items: end;
  border-radius: var(--radius);
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 158px;
  overflow: hidden;
  padding: 22px;
  position: relative;
  transition:
    border-color 620ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 680ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 560ms cubic-bezier(0.22, 1, 0.36, 1);
}

.material-vault-card::before {
  animation: keyColorShift 8s ease infinite;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.95), rgba(0, 214, 204, 0.9), rgba(255, 159, 28, 0.88));
  background-size: 220% 100%;
  content: "";
  height: 3px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.material-vault-card:hover {
  transform: translateY(-2px);
}

.material-vault-card.active {
  transform: translateY(-2px);
}

.material-vault-card.active::after {
  animation: neonPulse 2.2s ease-in-out infinite;
  border: 1px solid rgba(199, 255, 242, 0.32);
  border-radius: inherit;
  content: "";
  inset: 7px;
  pointer-events: none;
  position: absolute;
}

.pricing-vault {
  background:
    radial-gradient(circle at 82% 22%, rgba(34, 197, 94, 0.22), transparent 32%),
    linear-gradient(135deg, rgba(18, 27, 30, 0.98), rgba(8, 26, 22, 0.96));
  border: 1px solid rgba(34, 197, 94, 0.32);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28), 0 0 32px rgba(34, 197, 94, 0.12);
}

.pricing-vault.active {
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.34), 0 0 40px rgba(34, 197, 94, 0.24);
}

.reference-vault,
.reference-image-vault,
.reference-link-vault {
  background:
    radial-gradient(circle at 82% 22%, rgba(0, 214, 204, 0.22), transparent 32%),
    linear-gradient(135deg, rgba(18, 24, 34, 0.98), rgba(8, 19, 34, 0.96));
  border: 1px solid rgba(0, 214, 204, 0.34);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28), 0 0 32px rgba(0, 214, 204, 0.12);
}

.reference-vault.active,
.reference-image-vault.active,
.reference-link-vault.active {
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.34), 0 0 40px rgba(0, 214, 204, 0.24);
}

.reference-link-vault {
  background:
    radial-gradient(circle at 86% 20%, rgba(139, 92, 246, 0.22), transparent 34%),
    linear-gradient(135deg, rgba(15, 22, 32, 0.98), rgba(10, 24, 30, 0.96));
  border-color: rgba(139, 92, 246, 0.34);
}

.material-vault-card h3 {
  font-size: 22px;
  margin-bottom: 6px;
}

.material-vault-card p {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0;
}

.vault-icon {
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  box-shadow: 0 0 22px rgba(0, 214, 204, 0.16);
  color: #dffff8;
  display: inline-flex;
  font-weight: 900;
  height: 34px;
  justify-content: center;
  margin-bottom: 14px;
  width: 34px;
}

.reference-button,
.reference-link-button {
  background: linear-gradient(90deg, #0f3f5b, var(--cyan), #8b5cf6);
}

.reference-link-button {
  background: linear-gradient(90deg, #0f766e, #00d6cc, #22c55e);
}

.material-vault-section {
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  padding: 12px;
}

.hierarchy-vault-section {
  gap: 8px;
  padding: 0;
}

.material-page-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.material-page-head h3 {
  font-size: 22px;
  margin: 0;
}

.fixed-search {
  flex: 0 0 360px;
}

.major-selection-grid,
.mid-selection-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 10px;
}

.major-select-card,
.mid-select-card {
  background: linear-gradient(145deg, rgba(19, 26, 32, 0.98), rgba(10, 17, 22, 0.98));
  border: 1px solid rgba(0, 214, 204, 0.16);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  min-width: 0;
  padding: 12px;
  position: relative;
  text-align: left;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.major-select-card {
  --major-rgb: 0, 214, 204;
  --major-accent: #8fffea;
  --major-accent-strong: #dcfffb;
  --major-bg: rgba(0, 214, 204, 0.08);
  --major-border: rgba(0, 214, 204, 0.26);
  --major-glow: rgba(0, 214, 204, 0.18);
  background:
    radial-gradient(circle at 92% 14%, var(--major-bg), transparent 34%),
    linear-gradient(145deg, rgba(18, 26, 31, 0.98), rgba(8, 15, 20, 0.98));
  border-color: var(--major-border);
  overflow: hidden;
}

.major-select-card::after {
  background: linear-gradient(90deg, transparent, var(--major-accent), transparent);
  content: "";
  height: 1px;
  left: 12px;
  opacity: 0.42;
  position: absolute;
  right: 12px;
  top: 0;
}

.major-select-card[data-major-theme="price-guide"] {
  --major-rgb: 34, 197, 94;
  --major-accent: #5fffb0;
  --major-accent-strong: #e1fff0;
  --major-bg: rgba(34, 197, 94, 0.12);
  --major-border: rgba(34, 197, 94, 0.4);
  --major-glow: rgba(34, 197, 94, 0.2);
}

.major-select-card[data-major-theme="reference-image"] {
  --major-rgb: 56, 189, 248;
  --major-accent: #7dd3fc;
  --major-accent-strong: #e0f7ff;
  --major-bg: rgba(56, 189, 248, 0.12);
  --major-border: rgba(56, 189, 248, 0.38);
  --major-glow: rgba(56, 189, 248, 0.2);
}

.major-select-card[data-major-theme="reference-link"] {
  --major-rgb: 245, 158, 11;
  --major-accent: #ffd166;
  --major-accent-strong: #fff4cf;
  --major-bg: rgba(245, 158, 11, 0.12);
  --major-border: rgba(245, 158, 11, 0.4);
  --major-glow: rgba(245, 158, 11, 0.2);
}

.major-select-card:hover,
.major-select-card.active {
  background:
    radial-gradient(circle at 92% 14%, rgba(var(--major-rgb), 0.18), transparent 38%),
    linear-gradient(145deg, rgba(22, 32, 38, 0.98), rgba(10, 18, 23, 0.98));
  border-color: var(--major-accent);
  box-shadow: 0 0 0 2px rgba(var(--major-rgb), 0.12), 0 0 24px var(--major-glow), 0 14px 32px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.mid-select-card:hover,
.mid-select-card.active {
  background: linear-gradient(145deg, rgba(24, 39, 38, 0.98), rgba(13, 30, 28, 0.98));
  border-color: rgba(52, 211, 153, 0.55);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.09), 0 14px 32px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.major-select-main {
  align-items: flex-start;
  display: flex;
  gap: 10px;
}

.major-select-main strong {
  align-items: center;
  color: var(--major-accent-strong);
  display: flex;
  flex-wrap: wrap;
  font-size: 18px;
  gap: 8px;
  letter-spacing: 0;
  line-height: 1.2;
  margin-bottom: 4px;
  text-shadow: 0 0 14px rgba(var(--major-rgb), 0.28);
}

.major-inline-count {
  background: rgba(var(--major-rgb), 0.1);
  border: 1px solid rgba(var(--major-rgb), 0.22);
  border-radius: 999px;
  color: var(--major-accent);
  display: inline-flex;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  padding: 6px 8px;
  text-shadow: none;
}

.major-select-main p {
  color: rgba(232, 244, 244, 0.76);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
}

.major-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.major-badges span {
  background: rgba(var(--major-rgb), 0.1);
  border: 1px solid rgba(var(--major-rgb), 0.2);
  border-radius: 999px;
  color: var(--major-accent);
  font-size: 11px;
  font-weight: 900;
  padding: 5px 8px;
}

.mid-select-card {
  align-items: center;
  display: flex;
  gap: 10px;
  min-height: 58px;
}

.mid-select-card strong {
  align-items: center;
  color: #f3fff9;
  display: flex;
  flex-wrap: wrap;
  font-size: 15px;
  gap: 8px;
}

.mid-inline-count {
  background: rgba(0, 214, 204, 0.08);
  border: 1px solid rgba(0, 214, 204, 0.18);
  border-radius: 999px;
  color: #8fffea;
  display: inline-flex;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  padding: 5px 8px;
}

.mid-select-card small {
  color: var(--muted);
  font-weight: 800;
  margin-left: auto;
}

.subcategory-list-panel {
  background: rgba(8, 14, 18, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  display: grid;
  gap: 6px;
  overflow: hidden;
}

.subcategory-list-head {
  align-items: center;
  background: rgba(16, 24, 30, 0.88);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  padding: 8px 10px;
}

.subcategory-list-head h4 {
  font-size: 17px;
  margin: 2px 0 0;
}

.subcategory-list-actions {
  display: flex;
  justify-content: flex-end;
  padding: 8px 8px 0;
}

.subcategory-row-list {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(6, 1fr);
  padding: 6px;
}

.row-number {
  align-items: center;
  background: rgba(0, 214, 204, 0.1);
  border: 1px solid rgba(0, 214, 204, 0.24);
  border-radius: 999px;
  color: #8fffea;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 900;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.pricing-vault-section {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(34, 197, 94, 0.16);
}

.reference-vault-section,
.reference-image-vault-section {
  background: linear-gradient(135deg, rgba(0, 214, 204, 0.07), rgba(139, 92, 246, 0.05));
  border: 1px solid rgba(0, 214, 204, 0.17);
}

.reference-link-vault-section {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(0, 214, 204, 0.04));
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.vault-section-head {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 4px 4px 8px;
}

.vault-section-head h4 {
  font-size: 20px;
  margin: 2px 0 0;
}

.vault-section-head p {
  color: var(--muted);
  margin: 3px 0 0;
}

.vault-section-head > .bulk-actions > strong {
  background: linear-gradient(135deg, rgba(0, 214, 204, 0.18), rgba(34, 197, 94, 0.14));
  border: 1px solid rgba(0, 214, 204, 0.22);
  border-radius: 999px;
  box-shadow: 0 0 22px rgba(0, 214, 204, 0.14);
  color: #bfffee;
  padding: 7px 10px;
}

.vault-category-list {
  display: grid;
  gap: 8px;
}

.major-category-card {
  background: linear-gradient(135deg, rgba(18, 25, 32, 0.98), rgba(8, 22, 24, 0.96));
  border: 1px solid rgba(0, 214, 204, 0.18);
  border-radius: var(--radius);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24), 0 0 22px rgba(0, 214, 204, 0.08);
  display: grid;
  gap: 0;
  margin-bottom: 8px;
  overflow: hidden;
}

.major-category-head {
  align-items: center;
  background:
    radial-gradient(circle at 86% 24%, rgba(34, 197, 94, 0.14), transparent 34%),
    linear-gradient(120deg, rgba(22, 32, 38, 0.98), rgba(10, 30, 31, 0.96));
  cursor: pointer;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 12px 14px;
}

.major-title-group,
.mid-title-group,
.subcategory-info,
.major-actions,
.mid-actions,
.subcategory-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.major-title-group {
  min-width: 0;
}

.major-icon {
  align-items: center;
  background: rgba(var(--major-rgb, 0, 214, 204), 0.13);
  border: 1px solid rgba(var(--major-rgb, 0, 214, 204), 0.32);
  border-radius: 10px;
  box-shadow: inset 0 0 14px rgba(var(--major-rgb, 0, 214, 204), 0.12), 0 0 18px var(--major-glow, rgba(0, 214, 204, 0.18));
  color: var(--major-accent-strong, #bfffee);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 18px;
  font-weight: 900;
  height: 36px;
  justify-content: center;
  text-shadow: 0 0 12px var(--major-glow, rgba(0, 214, 204, 0.18));
  width: 36px;
}

.major-category-head h4 {
  font-size: 20px;
  margin: 2px 0 2px;
}

.major-category-head p {
  color: var(--muted);
  line-height: 1.35;
  margin: 0;
}

.major-actions {
  flex: 0 0 auto;
}

.compact-action {
  min-height: 36px;
  padding: 0 12px;
}

.chevron {
  color: #8fffea;
  display: inline-flex;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  transition: transform 240ms ease;
}

.chevron.open {
  transform: rotate(180deg);
}

.major-category-body {
  display: grid;
  gap: 8px;
  max-height: 10000px;
  opacity: 1;
  overflow: hidden;
  padding: 8px;
  transition:
    max-height 420ms ease,
    opacity 260ms ease,
    padding 260ms ease;
}

.major-category-body.collapsed {
  max-height: 0;
  opacity: 0;
  padding-bottom: 0;
  padding-top: 0;
  pointer-events: none;
}

.mid-category-card {
  background: rgba(8, 14, 18, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  display: grid;
  overflow: hidden;
}

.mid-category-head {
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  min-height: 42px;
  padding: 8px 10px;
}

.mid-dot {
  background: var(--mid-dot);
  border-radius: 999px;
  box-shadow: 0 0 14px color-mix(in srgb, var(--mid-dot) 55%, transparent);
  display: inline-flex;
  height: 10px;
  width: 10px;
}

.mid-title-group strong {
  color: #f3fff9;
}

.mid-title-group small {
  color: var(--muted);
  font-weight: 800;
}

.mid-category-body {
  display: grid;
  gap: 6px;
  max-height: 10000px;
  opacity: 1;
  overflow: hidden;
  padding: 0 6px 6px;
  transition:
    max-height 360ms ease,
    opacity 240ms ease,
    padding 240ms ease;
}

.mid-category-body.collapsed {
  max-height: 0;
  opacity: 0;
  padding-bottom: 0;
  pointer-events: none;
}

.subcategory-block {
  display: grid;
  gap: 6px;
}

.subcategory-row,
.subcategory-card {
  align-items: center;
  background: rgba(16, 24, 30, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 44px;
  padding: 6px 10px;
  transition:
    border-color 220ms ease,
    box-shadow 220ms ease,
    background 220ms ease;
}

.subcategory-card {
  color: var(--ink);
  cursor: pointer;
  flex-direction: column;
  min-height: 88px;
  padding: 8px;
  text-align: left;
}

.subcategory-row:hover,
.subcategory-card:hover,
.subcategory-card.active {
  background: rgba(17, 31, 33, 0.94);
  border-color: rgba(52, 211, 153, 0.48);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.08);
}

.subcategory-info {
  min-width: 0;
  width: 100%;
}

.tag-icon {
  align-items: center;
  background: rgba(0, 214, 204, 0.1);
  border: 1px solid rgba(0, 214, 204, 0.24);
  border-radius: 999px;
  color: #8fffea;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 900;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.subcategory-info strong {
  color: #f5fffb;
  display: block;
  font-size: 14px;
}

.subcategory-info p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  margin: 1px 0 0;
}

.subcategory-actions {
  flex: 0 0 auto;
  justify-content: space-between;
  width: 100%;
}

.subcategory-actions > span {
  color: #8fffea;
  font-size: 12px;
  font-weight: 900;
}

.subcategory-materials {
  background: rgba(5, 10, 13, 0.55);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px;
}

.compact-document-grid {
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.subcategory-materials .document-card {
  grid-template-columns: minmax(0, 1fr) minmax(116px, 0.46fr);
  min-height: 116px;
}

.subcategory-materials .document-preview {
  min-height: 116px;
}

.subcategory-materials .document-meta {
  gap: 6px;
  padding: 42px 10px 10px;
}

.subcategory-materials .document-meta h5 {
  font-size: 14px;
}

.subcategory-materials .document-meta small {
  font-size: 11px;
}

.subcategory-materials .document-actions {
  gap: 6px;
}

.subcategory-materials .mini-button {
  min-height: 32px;
  padding: 0 10px;
}

.subcategory-materials-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.subcategory-materials-head h5 {
  color: #f3fff9;
  font-size: 15px;
  margin: 2px 0 0;
}

.subcategory-selection-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.selection-count {
  background: rgba(0, 214, 204, 0.08);
  border: 1px solid rgba(0, 214, 204, 0.18);
  border-radius: 999px;
  color: #8fffea;
  font-size: 12px;
  font-weight: 900;
  padding: 7px 9px;
}

.compact-empty {
  min-height: 54px;
  padding: 12px;
}

.category-head:hover {
  border-color: rgba(52, 211, 153, 0.36);
  box-shadow: 0 18px 42px rgba(7, 38, 42, 0.11), 0 0 26px rgba(34, 197, 94, 0.12);
  transform: translateY(-1px);
}

.category-head h4,
.static-head h4 {
  font-size: 19px;
  margin: 3px 0 0;
}

.category-head p {
  line-height: 1.35;
  margin: 4px 0 0;
}

.category-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

.category-count-card {
  align-items: center;
  background:
    radial-gradient(circle at 30% 0%, rgba(34, 197, 94, 0.22), transparent 58%),
    linear-gradient(135deg, rgba(15, 28, 32, 0.98), rgba(5, 23, 25, 0.98));
  border: 1px solid rgba(0, 214, 204, 0.32);
  border-radius: 999px;
  box-shadow: 0 0 24px rgba(0, 214, 204, 0.14);
  color: #dffff8;
  display: inline-flex;
  gap: 5px;
  min-width: 78px;
  padding: 8px 12px;
  justify-content: center;
}

.category-count-card strong {
  color: #ffffff;
  font-size: 18px;
  line-height: 1;
}

.category-count-card small {
  color: #8fffea;
  font-size: 12px;
  font-weight: 900;
}

.category-select-button {
  min-width: 84px;
}

.category-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.category-body {
  display: grid;
  gap: 10px;
  max-height: 10000px;
  opacity: 1;
  overflow: hidden;
  transform: translateY(0);
  transition:
    max-height 720ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 520ms ease,
    transform 640ms cubic-bezier(0.22, 1, 0.36, 1);
}

.category-body.collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
}

.category-body:not(.collapsed),
.major-category-body:not(.collapsed),
.mid-category-body:not(.collapsed) {
  animation: slideReveal 620ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.client-subnav:not(.collapsed) {
  animation: none;
}

.document-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.document-card {
  background: linear-gradient(145deg, rgba(22, 28, 35, 0.98), rgba(14, 18, 24, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 34px rgba(7, 38, 42, 0.08);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.52fr);
  min-height: 164px;
  overflow: hidden;
  position: relative;
  transform-origin: top center;
  transition:
    border-color 520ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 620ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1),
    grid-template-columns 760ms cubic-bezier(0.22, 1, 0.36, 1),
    min-height 760ms cubic-bezier(0.22, 1, 0.36, 1);
}

.document-card:hover {
  border-color: rgba(0, 168, 168, 0.34);
  box-shadow: 0 18px 42px rgba(7, 38, 42, 0.12), 0 0 24px rgba(0, 214, 204, 0.12);
  transform: translateY(-2px);
}

.document-card.selected {
  border-color: rgba(34, 197, 94, 0.52);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.16), 0 0 24px rgba(34, 197, 94, 0.18);
}

.document-card.expanded {
  animation: cardExpand 820ms cubic-bezier(0.22, 1, 0.36, 1) both;
  grid-column: 1 / -1;
  grid-template-columns: minmax(260px, 0.72fr) minmax(320px, 1fr);
  min-height: 320px;
  box-shadow: 0 22px 56px rgba(7, 38, 42, 0.16), 0 0 36px rgba(34, 197, 94, 0.16);
}

.document-preview {
  background:
    linear-gradient(135deg, rgba(0, 214, 204, 0.12), rgba(54, 124, 255, 0.09)),
    #111820;
  border-left: 1px solid var(--line);
  display: grid;
  height: 164px;
  min-height: 164px;
  order: 2;
  place-items: center;
  transition:
    height 780ms cubic-bezier(0.22, 1, 0.36, 1),
    min-height 780ms cubic-bezier(0.22, 1, 0.36, 1),
    background 620ms cubic-bezier(0.22, 1, 0.36, 1);
}

.document-preview img {
  display: block;
  height: 148px;
  max-height: 148px;
  max-width: 100%;
  object-fit: contain;
  padding: 12px;
  width: auto;
  transition:
    height 780ms cubic-bezier(0.22, 1, 0.36, 1),
    max-height 780ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 780ms cubic-bezier(0.22, 1, 0.36, 1);
}

.document-preview video {
  background: #050b0f;
  border-radius: 8px;
  display: block;
  height: 148px;
  max-height: 148px;
  max-width: calc(100% - 18px);
  object-fit: contain;
  width: calc(100% - 18px);
}

.document-card.expanded .document-preview {
  height: 320px;
  min-height: 320px;
}

.document-card.expanded .document-preview img {
  height: 296px;
  max-height: 296px;
  transform: scale(1.01);
}

.document-card.expanded .document-preview video {
  height: 296px;
  max-height: 296px;
}

.file-preview {
  align-items: center;
  color: #dffff8;
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 14px;
  text-align: center;
  width: 100%;
}

.file-preview span {
  align-items: center;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96) 0 68%, rgba(255, 225, 225, 0.96) 68% 100%);
  border: 1px solid rgba(248, 113, 113, 0.58);
  border-radius: 8px;
  box-shadow:
    0 14px 30px rgba(239, 68, 68, 0.2),
    inset 0 -5px 0 rgba(239, 68, 68, 0.12);
  color: #dc2626;
  display: inline-flex;
  font-size: 20px;
  font-weight: 950;
  height: 70px;
  justify-content: center;
  letter-spacing: 0;
  position: relative;
  width: 58px;
}

.file-preview span::after {
  border-color: rgba(248, 113, 113, 0.72) #151012 #151012 rgba(248, 113, 113, 0.72);
  border-style: solid;
  border-width: 0 13px 13px 0;
  content: "";
  position: absolute;
  right: -1px;
  top: -1px;
}

.file-preview strong,
.file-preview small {
  color: #f8fafc;
  line-height: 1.35;
  max-width: 220px;
  overflow-wrap: anywhere;
}

.file-preview small {
  color: #fecaca;
  font-size: 11px;
  font-weight: 900;
}

.media-type-badge {
  background: linear-gradient(135deg, rgba(0, 214, 204, 0.2), rgba(34, 197, 94, 0.14));
  border: 1px solid rgba(0, 214, 204, 0.28);
  border-radius: 999px;
  color: #dffff8;
  display: inline-flex;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
  padding: 7px 12px;
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 5;
}

.document-card[data-media-type="image"] .media-type-badge {
  background: linear-gradient(135deg, rgba(0, 214, 204, 0.24), rgba(34, 197, 94, 0.16));
  border-color: rgba(0, 214, 204, 0.32);
  box-shadow: 0 0 18px rgba(0, 214, 204, 0.1);
  color: #dffff8;
}

.document-card[data-media-type="video"] .media-type-badge {
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.28), rgba(245, 158, 11, 0.18));
  border-color: rgba(250, 204, 21, 0.42);
  box-shadow: 0 0 20px rgba(250, 204, 21, 0.16);
  color: #fff5c2;
}

.document-card[data-media-type="pdf"] .media-type-badge {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(248, 113, 113, 0.16));
  border-color: rgba(248, 113, 113, 0.46);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.16);
  color: #ffe4e6;
}

.document-card[data-media-type="video"] .document-preview {
  background:
    linear-gradient(135deg, rgba(250, 204, 21, 0.16), rgba(245, 158, 11, 0.08)),
    #10120b;
}

.document-card[data-media-type="pdf"] .document-preview {
  background:
    radial-gradient(circle at 50% 24%, rgba(248, 113, 113, 0.28), transparent 42%),
    linear-gradient(135deg, rgba(239, 68, 68, 0.18), rgba(0, 214, 204, 0.06)),
    #151012;
}

.document-card[data-media-type="pdf"] .document-meta {
  padding-top: 52px;
}

.file-name {
  color: #a8b6c4;
  font-size: 12px;
  font-weight: 800;
}

.link-preview {
  align-items: center;
  color: #dffff8;
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 22px;
  text-align: center;
}

.link-preview span {
  align-items: center;
  background: linear-gradient(135deg, rgba(0, 214, 204, 0.22), rgba(139, 92, 246, 0.18));
  border: 1px solid rgba(0, 214, 204, 0.28);
  border-radius: 999px;
  box-shadow: 0 0 28px rgba(0, 214, 204, 0.18);
  display: inline-flex;
  font-size: 24px;
  font-weight: 900;
  height: 56px;
  justify-content: center;
  width: 56px;
}

.link-preview small {
  color: var(--muted);
  max-width: 190px;
  overflow-wrap: anywhere;
}

.link-list {
  border-left: 2px solid rgba(0, 214, 204, 0.35);
  display: grid;
  gap: 5px;
  max-height: 96px;
  overflow: auto;
  padding-left: 8px;
}

.link-list a {
  color: #8fffea;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-color: rgba(143, 255, 234, 0.35);
}

.document-meta {
  align-content: start;
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 46px 12px 12px;
}

.document-meta h5 {
  font-size: 14px;
  line-height: 1.35;
  margin: 0;
  overflow-wrap: anywhere;
}

.document-meta p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
  overflow-wrap: anywhere;
}

.document-meta small {
  color: #a8b6c4;
  font-size: 11px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.tag,
.status {
  align-self: start;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  justify-self: start;
  padding: 5px 9px;
}

.tag {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.18), rgba(0, 214, 204, 0.14));
  color: #c7fff2;
}

.material-check {
  align-items: center;
  background: rgba(8, 13, 18, 0.76);
  border: 1px solid rgba(0, 214, 204, 0.24);
  border-radius: 999px;
  display: inline-flex;
  height: 30px;
  justify-content: center;
  left: 8px;
  padding: 0;
  position: absolute;
  top: 8px;
  width: 30px;
  z-index: 3;
}

.material-check input {
  cursor: pointer;
  height: 16px;
  min-height: 16px;
  width: 16px;
}

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

.material-search {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: min(100%, 470px);
}

.material-search span {
  color: #8fffea;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 900;
}

.material-search input {
  background: rgba(7, 12, 16, 0.88);
  border: 1px solid rgba(0, 214, 204, 0.28);
  box-shadow: inset 0 0 18px rgba(0, 214, 204, 0.06);
  color: #eef7f6;
  min-width: 260px;
}

.mini-button,
.ghost-button {
  align-items: center;
  background: linear-gradient(180deg, rgba(26, 33, 40, 0.98), rgba(16, 24, 30, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #d8e7ee;
  display: inline-flex;
  font-size: 13px;
  font-weight: 900;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  text-decoration: none;
  transition:
    background 520ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 520ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 560ms cubic-bezier(0.22, 1, 0.36, 1),
    color 420ms ease,
    transform 460ms cubic-bezier(0.22, 1, 0.36, 1);
}

.mini-button:hover,
.ghost-button:hover {
  background: linear-gradient(180deg, rgba(31, 42, 50, 0.98), rgba(13, 43, 36, 0.98));
  border-color: rgba(34, 197, 94, 0.38);
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.16);
  color: #dffff8;
  transform: translateY(-1px);
}

.mini-button.danger {
  color: var(--danger);
}

.empty-category,
.empty-client {
  align-items: center;
  background: rgba(17, 23, 29, 0.9);
  border: 1px dashed #b8c3cf;
  border-radius: var(--radius);
  color: var(--muted);
  display: flex;
  font-weight: 800;
  min-height: 88px;
  padding: 18px;
}

.modal-backdrop {
  align-items: center;
  background: rgba(0, 0, 0, 0.68);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 50;
}

.modal-panel {
  background: linear-gradient(145deg, rgba(23, 29, 36, 0.98), rgba(10, 14, 18, 0.98));
  border: 1px solid rgba(0, 214, 204, 0.24);
  border-radius: var(--radius);
  box-shadow: 0 24px 90px rgba(15, 23, 42, 0.28), 0 0 36px rgba(0, 214, 204, 0.14);
  display: grid;
  gap: 16px;
  max-height: min(780px, calc(100vh - 48px));
  max-width: 620px;
  overflow: auto;
  padding: 24px;
  width: min(100%, 620px);
}

.modal-head {
  align-items: start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.modal-note {
  background: rgba(255, 159, 28, 0.09);
  border: 1px solid rgba(255, 159, 28, 0.22);
  border-radius: var(--radius);
  color: #ffdca3;
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  padding: 12px;
}

.file-picker-row {
  align-items: center;
  background: rgba(10, 13, 16, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius);
  display: flex;
  gap: 10px;
  min-height: 46px;
  padding: 6px;
}

.file-picker-button {
  flex: 0 0 auto;
}

.file-picker-status {
  color: #dce7ef;
  flex: 1 1 auto;
  font-size: 13px;
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visually-hidden-file {
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  width: 1px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.trash-log-list {
  display: grid;
  gap: 10px;
}

.trash-owner-group {
  border: 1px solid rgba(0, 214, 204, 0.2);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  padding: 12px;
}

.trash-owner-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.trash-owner-head strong {
  color: #dffff8;
  font-size: 16px;
}

.trash-owner-head span {
  background: rgba(0, 214, 204, 0.1);
  border: 1px solid rgba(0, 214, 204, 0.2);
  border-radius: 999px;
  color: #8fffea;
  font-size: 12px;
  font-weight: 900;
  padding: 6px 9px;
}

.trash-owner-list {
  display: grid;
  gap: 8px;
}

.trash-log-card {
  border: 1px solid var(--line);
  background: rgba(10, 16, 20, 0.68);
  border-radius: var(--radius);
  display: grid;
  gap: 6px;
  padding: 14px;
}

.trash-log-card span,
.trash-log-card small {
  color: var(--muted);
}

.toast {
  background: linear-gradient(90deg, #081c1f, #0d3033);
  border-radius: var(--radius);
  bottom: 22px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.25), 0 0 26px rgba(0, 214, 204, 0.18);
  color: #ffffff;
  font-weight: 900;
  left: 50%;
  padding: 13px 16px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 60;
}

.text-dashboard {
  display: grid;
  gap: 18px;
}

.sales-text-dashboard {
  display: grid;
  gap: 14px;
}

.sales-text-hero {
  background:
    radial-gradient(circle at 8% 0%, rgba(34, 197, 94, 0.16), transparent 34%),
    radial-gradient(circle at 95% 12%, rgba(0, 214, 204, 0.14), transparent 32%),
    linear-gradient(145deg, rgba(18, 28, 31, 0.98), rgba(8, 14, 18, 0.98));
  border: 1px solid rgba(0, 214, 204, 0.22);
  border-radius: var(--radius);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.22), 0 0 32px rgba(0, 214, 204, 0.08);
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
  padding: 20px;
  position: relative;
}

.sales-text-hero::before {
  animation: keyColorShift 8s ease infinite;
  background: linear-gradient(90deg, #22c55e, #00d6cc, #8b5cf6);
  background-size: 220% 100%;
  content: "";
  height: 3px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.sales-text-hero h3 {
  font-size: 28px;
  margin: 4px 0 8px;
}

.sales-text-hero p {
  color: var(--muted);
  margin: 0;
}

.sales-text-search {
  display: grid;
  gap: 8px;
}

.sales-text-search label {
  color: #8fffea;
  font-size: 12px;
  font-weight: 900;
}

.sales-text-tabs {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sales-text-tab {
  background: linear-gradient(145deg, rgba(22, 28, 35, 0.98), rgba(10, 18, 22, 0.98));
  border: 1px solid rgba(0, 214, 204, 0.18);
  border-radius: var(--radius);
  color: var(--ink);
  display: grid;
  gap: 5px;
  min-height: 92px;
  padding: 15px;
  text-align: left;
  transition:
    border-color 520ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 580ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.sales-text-tab strong {
  font-size: 20px;
}

.sales-text-tab small {
  color: var(--muted);
}

.sales-text-tab.active,
.sales-text-tab:hover {
  border-color: rgba(52, 211, 153, 0.5);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.11), 0 18px 46px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}

.sales-text-panel {
  background: linear-gradient(145deg, rgba(16, 25, 29, 0.98), rgba(7, 13, 17, 0.98));
  border: 1px solid rgba(0, 214, 204, 0.18);
  border-radius: var(--radius);
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.sales-textContent.is-switching,
.sales-text-panel.is-switching {
  animation: tableSlideIn 620ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.sales-text-panel.green {
  border-color: rgba(34, 197, 94, 0.28);
}

.sales-text-panel.cyan {
  border-color: rgba(0, 214, 204, 0.3);
}

.sales-text-panel.violet {
  border-color: rgba(139, 92, 246, 0.3);
}

.sales-text-panel-head {
  align-items: center;
  background: linear-gradient(120deg, rgba(16, 34, 32, 0.96), rgba(8, 21, 27, 0.94));
  border-bottom: 1px solid rgba(0, 214, 204, 0.16);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 18px;
}

.sales-text-panel-head h4 {
  font-size: 22px;
  margin: 3px 0 0;
}

.sales-text-panel-head p {
  color: var(--muted);
  margin: 4px 0 0;
}

.sales-text-panel-head > strong {
  background: rgba(0, 214, 204, 0.12);
  border: 1px solid rgba(0, 214, 204, 0.24);
  border-radius: 999px;
  color: #bfffee;
  flex: 0 0 auto;
  padding: 8px 12px;
}

.sales-text-table-wrap {
  overflow-x: auto;
}

.sales-text-table {
  border-collapse: collapse;
  min-width: 1380px;
  width: 100%;
}

.sales-text-vault {
  display: grid;
  gap: 10px;
}

.sales-text-category-panel {
  margin-top: 0;
}

.compact-sales-text-table {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  max-height: 420px;
  overflow: auto;
}

.compact-sales-text-table .sales-text-table {
  min-width: 1120px;
}

.compact-sales-text-table .sales-text-table th,
.compact-sales-text-table .sales-text-table td {
  padding: 9px 10px;
}

.sales-text-table th,
.sales-text-table td {
  border-bottom: 1px solid rgba(0, 214, 204, 0.12);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

.sales-text-table th {
  background: rgba(0, 214, 204, 0.08);
  color: #8fffea;
  font-size: 12px;
  font-weight: 900;
  position: sticky;
  top: 0;
  z-index: 1;
}

.sales-text-table td {
  color: #d7e4ea;
  font-size: 13px;
  line-height: 1.45;
}

.sales-text-table tr:hover td {
  background: rgba(34, 197, 94, 0.055);
}

.sales-text-table tbody tr {
  transition:
    background 420ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 460ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 460ms cubic-bezier(0.22, 1, 0.36, 1);
}

.sales-text-table tbody tr:hover {
  box-shadow: inset 3px 0 0 rgba(52, 211, 153, 0.44);
  transform: translateX(2px);
}

.major-chip {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(0, 214, 204, 0.14));
  border: 1px solid rgba(0, 214, 204, 0.22);
  border-radius: 999px;
  color: #dffff8;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  padding: 5px 8px;
  white-space: nowrap;
}

.empty-table-cell {
  color: var(--muted);
  padding: 34px !important;
  text-align: center !important;
}

.ai-doc-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ai-doc-button {
  background: linear-gradient(145deg, rgba(22, 28, 35, 0.98), rgba(12, 18, 23, 0.96));
  border: 1px solid rgba(0, 168, 168, 0.18);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(7, 38, 42, 0.1);
  color: var(--ink);
  display: grid;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  padding: 16px;
  position: relative;
  text-align: left;
  transition:
    border-color 520ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 560ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 460ms cubic-bezier(0.22, 1, 0.36, 1),
    background 620ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ai-doc-button.active,
.ai-doc-button:hover {
  border-color: rgba(0, 168, 168, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 214, 204, 0.11), 0 16px 40px rgba(7, 38, 42, 0.12);
  transform: translateY(-1px);
}

.ai-doc-button.active::before {
  animation: neonPulse 3.2s ease-in-out infinite;
  background: linear-gradient(180deg, var(--cyan), var(--amber), var(--pink));
  content: "";
  inset: 0 auto 0 0;
  position: absolute;
  width: 4px;
}

.ai-doc-button span,
.ai-doc-button small {
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.ai-doc-viewer {
  background: linear-gradient(145deg, rgba(22, 28, 35, 0.98), rgba(10, 16, 21, 0.98));
  border: 1px solid rgba(0, 168, 168, 0.2);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(7, 38, 42, 0.1);
  min-width: 0;
  overflow: hidden;
}

.ai-doc-toolbar {
  align-items: center;
  background: linear-gradient(120deg, rgba(17, 26, 31, 0.98), rgba(9, 30, 32, 0.9));
  border-bottom: 1px solid rgba(0, 168, 168, 0.18);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 18px;
}

.ai-doc-toolbar h4 {
  font-size: 20px;
  margin: 3px 0 0;
}

.ai-doc-toolbar input {
  max-width: 320px;
  width: 100%;
}

.ai-doc-content {
  color: #d7e4ea;
  font-size: 14px;
  line-height: 1.75;
  max-height: none;
  overflow: visible;
  padding: 22px;
}

.ai-summary-section {
  margin-bottom: 22px;
}

.ai-table-wrap {
  border: 1px solid rgba(0, 168, 168, 0.2);
  border-radius: var(--radius);
  margin: 14px 0;
  overflow-x: auto;
}

.ai-summary-table,
.ai-doc-content table {
  border-collapse: collapse;
  min-width: 980px;
  width: 100%;
}

.ai-summary-table th,
.ai-summary-table td,
.ai-doc-content table th,
.ai-doc-content table td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  white-space: pre-wrap;
}

.ai-summary-table th,
.ai-doc-content table th {
  background: linear-gradient(180deg, rgba(0, 214, 204, 0.16), rgba(34, 197, 94, 0.08));
  color: #c7fff2;
  font-size: 13px;
  font-weight: 900;
  position: static;
}

.ai-summary-table td,
.ai-doc-content table td {
  background: rgba(17, 23, 29, 0.82);
  color: #d7e4ea;
}

.ai-summary-table tr:nth-child(even) td,
.ai-doc-content table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.035);
}

.ai-doc-content mark {
  background: #fde68a;
  border-radius: 4px;
  padding: 0 2px;
}

.inbound-table-card {
  background: linear-gradient(145deg, rgba(22, 28, 35, 0.98), rgba(10, 16, 21, 0.98));
  border: 1px solid rgba(0, 168, 168, 0.2);
  border-radius: var(--radius);
  box-shadow: 0 16px 46px rgba(7, 38, 42, 0.1);
  overflow: hidden;
}

.inbound-table-wrap {
  overflow-x: auto;
}

.inbound-table {
  border-collapse: collapse;
  min-width: 1320px;
  width: 100%;
}

.inbound-table th,
.inbound-table td {
  border-bottom: 1px solid rgba(0, 214, 204, 0.12);
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
}

.inbound-table th {
  background: linear-gradient(180deg, rgba(0, 214, 204, 0.16), rgba(34, 197, 94, 0.08));
  color: #c7fff2;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.inbound-table td {
  background: rgba(17, 23, 29, 0.82);
  color: #d7e4ea;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.inbound-table tbody tr {
  position: relative;
  transition:
    background 460ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 460ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 460ms ease;
}

.inbound-table tbody tr:hover td {
  background: rgba(18, 41, 39, 0.92);
  color: #f2fffb;
  box-shadow: inset 0 1px 0 rgba(143, 255, 234, 0.08), inset 0 -1px 0 rgba(143, 255, 234, 0.08);
}

.inbound-table tbody tr.is-today-lead td {
  animation: freshLeadPulse 2.8s ease-in-out infinite;
  background: rgba(11, 43, 34, 0.92);
  border-bottom-color: rgba(34, 197, 94, 0.24);
  color: #eafff8;
}

.inbound-table tbody tr.is-today-lead td:first-child {
  box-shadow: inset 4px 0 0 var(--neon-mint);
}

.inbound-table tbody tr.is-contacted-lead td {
  background: rgba(48, 20, 31, 0.94);
  border-bottom-color: rgba(244, 63, 94, 0.24);
  color: #fff2f5;
}

.inbound-table tbody tr.is-contacted-lead td:first-child {
  box-shadow: inset 4px 0 0 rgba(244, 63, 94, 0.72);
}

.inbound-table tbody tr.is-contacted-lead:hover td {
  background: rgba(60, 24, 38, 0.98);
  color: #ffffff;
}

.inbound-table a {
  color: #21ddd2;
  font-weight: 900;
  text-decoration: none;
}

.inbound-table tbody tr:hover a,
.inbound-table tbody tr.is-contacted-lead a {
  color: #8fffea;
}

.fresh-badge {
  background: linear-gradient(90deg, var(--neon-green), var(--cyan));
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.28);
  color: #ffffff;
  display: inline-flex;
  font-size: 11px;
  font-weight: 900;
  margin-top: 6px;
  padding: 4px 8px;
  white-space: nowrap;
}

.contact-check {
  align-items: center;
  background: linear-gradient(180deg, rgba(26, 33, 40, 0.98), rgba(16, 24, 30, 0.98));
  border: 1px solid rgba(0, 168, 168, 0.24);
  border-radius: var(--radius);
  color: #d8e7ee;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  min-height: 30px;
  padding: 0 10px;
  transition: background 520ms cubic-bezier(0.22, 1, 0.36, 1), border-color 520ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 560ms cubic-bezier(0.22, 1, 0.36, 1), transform 460ms cubic-bezier(0.22, 1, 0.36, 1);
}

.contact-check:hover {
  border-color: rgba(34, 197, 94, 0.42);
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.18);
  transform: translateY(-1px);
}

.contact-check.checked {
  background: linear-gradient(90deg, #be123c, #fb7185);
  border-color: rgba(244, 63, 94, 0.48);
  box-shadow: 0 0 18px rgba(244, 63, 94, 0.18);
  color: #ffffff;
}

.contact-meta {
  color: #b8c7cf;
  display: block;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.45;
  margin-top: 6px;
  white-space: nowrap;
}

.contact-meta.muted {
  color: #93a3ad;
}

.inbound-table tbody tr.is-contacted-lead .contact-meta {
  color: #f8c8d0;
}

.client-owner-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.owner-tab {
  background: rgba(18, 24, 30, 0.92);
  border: 1px solid rgba(0, 168, 168, 0.22);
  border-radius: 999px;
  color: #d8e7ee;
  font-weight: 900;
  min-height: 40px;
  padding: 0 16px;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

.owner-tab.active,
.owner-tab:hover {
  background: linear-gradient(90deg, rgba(0, 214, 204, 0.16), rgba(255, 159, 28, 0.1));
  border-color: rgba(0, 168, 168, 0.45);
  box-shadow: inset 0 0 0 1px rgba(143, 255, 234, 0.12);
  color: #dffff8;
}

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

.metric-row article {
  background: linear-gradient(145deg, rgba(22, 28, 35, 0.98), rgba(12, 18, 23, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(7, 38, 42, 0.1);
  padding: 18px;
}

.metric-row span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 8px;
}

.metric-row strong {
  font-size: 30px;
}

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

.client-lane {
  background: rgba(17, 23, 29, 0.86);
  border: 1px solid rgba(0, 168, 168, 0.18);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(7, 38, 42, 0.08);
  padding: 16px;
}

.lane-head,
.status-column-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.lane-head {
  margin-bottom: 14px;
}

.lane-head span {
  font-size: 20px;
  font-weight: 900;
}

.lane-head strong,
.status-column-head strong {
  color: var(--brand-dark);
}

.client-status-grid {
  display: grid;
  gap: 12px;
}

.status-column {
  display: grid;
  gap: 10px;
}

.status-column-head {
  color: #475467;
  font-size: 13px;
  font-weight: 900;
}

.status-card-list {
  display: grid;
  gap: 10px;
}

.client-card {
  background: linear-gradient(145deg, rgba(20, 27, 33, 0.98), rgba(11, 17, 22, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  padding: 14px;
}

.client-card h4 {
  margin: 0;
}

.client-card p,
.client-card small {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.status.active {
  background: #ecfdf3;
  color: #027a48;
}

.status.pending {
  background: #fffaeb;
  color: #b54708;
}

.status.risk {
  background: #fef3f2;
  color: var(--danger);
}

.coming-soon {
  min-height: 260px;
}

.coming-soon h3 {
  font-size: 28px;
}

@keyframes neonPulse {
  0% {
    box-shadow: 0 0 0 rgba(0, 214, 204, 0), 0 0 14px rgba(0, 214, 204, 0.2);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(0, 214, 204, 0.09), 0 0 28px rgba(0, 214, 204, 0.42);
  }
  100% {
    box-shadow: 0 0 0 rgba(0, 214, 204, 0), 0 0 14px rgba(0, 214, 204, 0.2);
  }
}

@keyframes keyColorShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes scanLine {
  0% {
    transform: translateY(-120%);
  }
  100% {
    transform: translateY(120%);
  }
}

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

@keyframes cardExpand {
  from {
    opacity: 0.86;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes freshLeadPulse {
  0% {
    box-shadow: inset 0 0 0 rgba(34, 197, 94, 0), 0 0 0 rgba(34, 197, 94, 0);
  }
  50% {
    box-shadow: inset 0 0 22px rgba(34, 197, 94, 0.1), 0 0 24px rgba(34, 197, 94, 0.18);
  }
  100% {
    box-shadow: inset 0 0 0 rgba(34, 197, 94, 0), 0 0 0 rgba(34, 197, 94, 0);
  }
}

@keyframes neonSweep {
  0% {
    left: -120%;
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  100% {
    left: 145%;
    opacity: 0;
  }
}

@keyframes slideReveal {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes tableSlideIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@media (max-width: 1180px) {
  .document-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
}

@media (min-width: 1181px) {
  .sales-library {
    grid-template-columns: 1fr;
  }

  .section-head,
  .material-vault-section,
  .resource-category.has-materials {
    grid-column: 1 / -1;
  }
}

.mini-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

@media (max-width: 720px) {
  .dashboard-view,
  .dashboard-view:has(.sidebar.collapsed) {
    grid-template-columns: 1fr;
  }

  .sidebar {
    gap: 12px;
  }

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

  .client-subnav {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-left: 0;
  }

  .document-grid,
  .material-vault-grid,
  .sales-text-hero,
  .sales-text-tabs,
  .client-board,
  .ai-doc-list,
  .metric-row {
    grid-template-columns: 1fr;
  }

  .document-card,
  .document-card.expanded {
    grid-template-columns: 1fr;
  }

  .document-preview {
    border-bottom: 1px solid var(--line);
    border-left: 0;
    border-right: 0;
    order: 0;
  }
}

@media (max-width: 640px) {
  .login-panel,
  .workspace {
    padding: 20px;
  }

  /* 제목이 좁은 화면을 덜 먹게 축소. */
  h1 { font-size: 26px; }
  h2 { font-size: 22px; }

  /* 상단바가 세로로 갈릴 때, 액션 4버튼(pill·삭제기록·계정·로그아웃)도 넘치면 줄바꿈되게. */
  .topbar-actions { flex-wrap: wrap; }

  .topbar,
  .section-head,
  .category-head,
  .major-category-head,
  .subcategory-row,
  .ai-doc-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .category-head {
    min-height: auto;
  }

  .major-actions,
  .mid-category-head,
  .subcategory-actions {
    align-items: stretch;
    width: 100%;
  }

  .mid-category-head {
    flex-direction: column;
    gap: 8px;
  }

  .mid-actions,
  .subcategory-actions {
    justify-content: space-between;
  }

  .subcategory-materials {
    padding-left: 0;
  }

  .secondary-button,
  .ghost-button {
    width: 100%;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }
}

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

/* ------------------------------------------------------------------ */
/* 순위체크 — 애드로그 로우데이터                                      */
/* ------------------------------------------------------------------ */

.rank-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.rank-stat {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rank-stat-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.rank-stat strong {
  font-size: 22px;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}

.rank-empty {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
}

.rank-empty code {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 12px;
  background: rgba(0, 214, 204, 0.08);
  border: 1px solid rgba(0, 214, 204, 0.25);
  border-radius: 6px;
  color: var(--neon-mint);
  font-size: 13px;
}

.rank-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
}

.rank-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.rank-field input {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  padding: 8px 10px;
  font-size: 13px;
  min-width: 150px;
}

.rank-field input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(0, 214, 204, 0.22);
}

.rank-field-actions {
  display: flex;
  gap: 8px;
}

.rank-button {
  background: var(--brand);
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  padding: 9px 14px;
  transition: transform 0.12s ease, background-color 0.12s ease, opacity 0.12s ease;
}

/* 링크(<a>)로 쓰는 rank-button 은 인라인이라 세로 padding 이 안 먹는다. flex 로 맞춘다. */
a.rank-button { align-items: center; display: inline-flex; text-decoration: none; }

.rank-button:hover { background: var(--brand-dark); transform: translateY(-1px); }
.rank-button:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(0, 214, 204, 0.5); }
.rank-button:active { transform: translateY(0) scale(0.98); }
.rank-button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.rank-button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.rank-button.ghost:hover { background: rgba(148, 163, 184, 0.1); color: var(--ink); }

.rank-hint {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 10px;
}

.rank-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  /*
    우측 페이드 = "옆으로 더 있다" 힌트.
    local 그라디언트는 콘텐츠에 붙어 스크롤되므로, 끝까지 밀면 실제 끝과 만나 사라진다.
    scroll 그림자는 컨테이너에 고정돼 항상 우측 경계를 살짝 어둡게 한다.
    넓은 표(min-width 1080~1180px)를 모바일에서 스크롤할 때 첫 열 고정과 함께 방향을 알려 준다.
  */
  background:
    linear-gradient(to left, var(--soft), rgba(18, 28, 34, 0)) right / 32px 100% no-repeat local,
    radial-gradient(farthest-side at right, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0)) right / 14px 100% no-repeat scroll,
    var(--soft);
}

.rank-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 1180px;
  font-size: 13px;
}

.rank-table th,
.rank-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 12px;
  text-align: left;
  white-space: nowrap;
}

.rank-table th {
  background: rgba(8, 122, 122, 0.14);
  color: var(--neon-mint);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.rank-table td.num,
.rank-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rank-table tbody tr:hover { background: rgba(0, 214, 204, 0.05); }
.rank-table tbody tr:last-child td { border-bottom: none; }

/*
  넓은 표를 옆으로 스크롤할 때 첫 열(이름·날짜·업체 = 식별자)을 고정한다.
  안 그러면 오른쪽 숫자를 보다가 어느 행인지 잃는다. 정산 화면의 핵심 요구다.

  sticky 셀은 그 아래로 다른 열이 지나가므로 배경이 불투명해야 비쳐 보이지 않는다.
  --soft(rgba …,0.94)·헤더 틴트·hover 틴트를 각각 배경 위에 얹은 불투명색으로 계산해 맞춘다.
  th 는 이미 top:0 sticky(위 .rank-table th) — 여기에 left:0 을 더해 코너로 고정한다.
*/
.rank-table th:first-child,
.rank-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  box-shadow: 1px 0 0 var(--line);
}
.rank-table td:first-child { background: #121c22; }               /* --soft 불투명화 */
.rank-table th:first-child { background: #112929; z-index: 3; }   /* 헤더 틴트 얹은 불투명 (코너) */
.rank-table tbody tr:hover td:first-child { background: #11252a; } /* hover 틴트 얹은 불투명 */
.rank-table tfoot td:first-child { background: #11252a; }         /* 합계 행 톤에 맞춤 */

.rank-no-result {
  color: var(--muted);
  padding: 32px 12px;
  text-align: center;
}

.rank-pager {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 720px) {
  .rank-field input { min-width: 120px; }
  .rank-field-actions { width: 100%; }

  /* 터치 타겟은 최소 44px. 데스크탑 밀도는 그대로 두고 모바일에서만 키운다. */
  .rank-button,
  .rank-input,
  .rank-field input,
  .rank-combo,
  .rank-tab { min-height: 44px; }
}

/* ------------------------------------------------------------------ */
/* 애드로그 대행사 · 순위 추이                                          */
/* ------------------------------------------------------------------ */

.rank-tabs {
  display: flex;
  flex-wrap: wrap;          /* 정산 7탭·애드로그 9탭이 좁은 화면에서 찌그러지지 않고 줄바꿈된다 */
  gap: 4px;
  row-gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

/* 조회줄 인라인 필터 — 키워드 텍스트(+모드), 최근순위 범위 */
.board-inline { display: flex; align-items: center; gap: 6px; }
.board-inline .rank-input { min-width: 0; }
.board-inline-sep { color: var(--muted); }
.board-rank-num { width: 68px; }
#boardKwText { width: 110px; }
#boardKwMode { width: 92px; }

/* 대행사 보드 서식복사 필터 패널 (열 · 키워드) */
.board-filter {
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 12px 12px;
}
.board-filter summary {
  cursor: pointer;
  color: var(--neon-mint);
  font-weight: 700;
  padding: 4px 0;
}
.board-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 10px;
}
.board-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.board-filter-head strong { color: var(--ink); }
.board-filter .rank-input { width: 100%; margin-bottom: 6px; }
.board-check-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
}
.board-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 4px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.board-check input { width: 15px; height: 15px; flex: none; }
.board-check-empty { color: var(--muted); font-size: 12px; padding: 8px 4px; margin: 0; }
@media (max-width: 720px) { .board-filter-grid { grid-template-columns: 1fr; } }

.rank-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 10px 16px;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.rank-tab:hover { color: var(--ink); }
.rank-tab:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(0, 214, 204, 0.5); border-radius: 4px; }
.rank-tab.active { color: var(--neon-mint); border-bottom-color: var(--brand); }

.rank-field-check {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  align-self: flex-end;
  padding-bottom: 9px;
}

.rank-field-check input { min-width: 0; width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.rank-field-check span { color: var(--muted); font-size: 12px; cursor: pointer; }

/* 순위는 작을수록 좋다. 올라간 것(+)이 초록이다. */
.rank-delta { font-variant-numeric: tabular-nums; }
/* 순위 상승 = 빨강, 하락 = 파랑.
   시트에 복사한 표와 같은 색이다. 화면은 초록인데 시트는 빨강이면 같은 값이 달라 보인다.
   한국에서는 상승이 빨강이다(주식·시트 관행). '좋다=초록' 이 아니라 '오르면 빨강' 으로 읽는다. */
.rank-delta.up { color: #ff6b6b; font-weight: 600; }
.rank-delta.down { color: #60a5fa; font-weight: 600; }
.rank-delta.flat { color: var(--muted); }

.rank-badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  white-space: nowrap;
}

.rank-badge.stale { background: rgba(248, 113, 113, 0.15); color: #fca5a5; }
.rank-badge.fresh { background: rgba(0, 214, 204, 0.12); color: var(--neon-mint); }
.rank-badge.edited { background: rgba(250, 204, 21, 0.14); color: #fde047; }

.adlog-edit-input {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  font-size: 12px;
  padding: 4px 6px;
  width: 110px;
}

.adlog-edit-input:focus { outline: none; border-color: var(--brand); }

.adlog-row-actions { display: flex; gap: 6px; }

.adlog-mini-button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  padding: 4px 8px;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.adlog-mini-button:hover { color: var(--ink); border-color: var(--brand); }
.adlog-mini-button:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(0, 214, 204, 0.5); }
.adlog-mini-button.primary { border-color: var(--brand); color: var(--neon-mint); }
.adlog-mini-button:disabled { opacity: 0.4; cursor: not-allowed; }

/* 순위 추이 차트 — 의존성 없이 SVG 를 직접 그린다 */
.trend-chart-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  padding: 18px;
}

.trend-chart { width: 100%; min-height: 320px; }
.trend-chart svg { display: block; width: 100%; height: auto; }
.trend-chart .trend-axis { stroke: var(--line); stroke-width: 1; }
.trend-chart .trend-grid { stroke: var(--line); stroke-width: 1; opacity: 0.35; }
.trend-chart .trend-tick { fill: var(--muted); font-size: 10px; }
.trend-chart .trend-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend-chart .trend-line.ma { stroke-dasharray: 4 3; stroke-width: 1.5; opacity: 0.75; }
.trend-chart .trend-dot { stroke: var(--panel); stroke-width: 1; }
.trend-chart .trend-empty { fill: var(--muted); font-size: 13px; }

.trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 14px;
}

.trend-legend-item {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  gap: 6px;
}

.trend-legend-swatch { border-radius: 2px; display: inline-block; height: 10px; width: 10px; }
.trend-legend-more { color: var(--muted); font-size: 12px; margin-top: 8px; }

/* ------------------------------------------------------------------ */
/* 대행사 보드 — 담당자 → 대행사 → 업체                                  */
/* ------------------------------------------------------------------ */

.board-picker {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.board-owners {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.board-owner {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 6px 14px;
  transition: color 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}

.board-owner:hover { color: var(--ink); border-color: var(--brand); }
.board-owner:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(0, 214, 204, 0.5); }
.board-owner.active { background: var(--brand); border-color: var(--brand); color: var(--ink); }
.board-owner small { opacity: 0.7; margin-left: 4px; }

/* 대행사가 164곳이다. 카드로 늘어놓으니 화면을 다 덮어 원하는 곳을 못 찾았다.
   드롭다운으로 바꾸고 기본을 가나다순으로 뒀다. */
.board-agency-field select { min-width: 280px; }

.board-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 18px;
}

/* 컬럼 헤더를 눌러 정렬한다 */
.rank-table th.board-sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.12s ease;
}

.rank-table th.board-sortable:hover { color: var(--ink); }
.rank-table th.board-sortable.active { color: var(--neon-mint); }

/* 복붙 보기 — 탭 구분 텍스트. iframe 은 안 쓴다.
   복사·인쇄·접근성이 다 나빠지고, 여기서는 얻는 게 없다. */
.board-paste {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  padding: 14px;
}

.board-paste-text {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.6;
  margin: 0;
  max-height: 460px;
  overflow: auto;
  padding: 12px;
  tab-size: 12;
  white-space: pre;
  user-select: all;   /* 클릭 한 번으로 전체 선택 */
}

/* 업체 행을 펼치면 그 업체의 키워드가 나온다 */
.board-expand {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
}

.board-expand:hover { color: var(--neon-mint); }
.board-expand:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(0, 214, 204, 0.5); border-radius: 4px; }

.board-subrow td {
  background: rgba(0, 214, 204, 0.03);
  padding: 0 12px 10px;
}

.board-subtable {
  border-collapse: collapse;
  font-size: 12px;
  margin-left: 24px;
  width: calc(100% - 24px);
}

.board-subtable th,
.board-subtable td {
  border-bottom: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
  white-space: nowrap;
}

.board-subtable th { color: var(--muted); font-weight: 500; }
.board-subtable td.num { text-align: right; font-variant-numeric: tabular-nums; }
.board-subtable tr:last-child td { border-bottom: none; }


/* 검색 가능한 드롭다운 — select 대신 input + datalist.
   대행사가 161곳이라 select 로는 눈으로 훑을 수 없다. 쳐서 찾는다. */
.rank-combo {
  width: 100%;
  min-width: 150px;
  padding: 7px 10px;
  border: 1px solid var(--line, #d8dde5);
  border-radius: 8px;
  background: var(--surface, #fff);
  /* 배경이 흰색이다. color: inherit 로 두면 어두운 페이지의 흰 글씨를 상속해 안 보인다.
     입력값을 검정으로 고정한다. */
  color: #111;
  font: inherit;
  font-size: 13px;
}

.rank-combo::placeholder { color: #8a94a3; }

.rank-combo.wide { min-width: 240px; }

.rank-combo:focus {
  outline: none;
  border-color: var(--brand, #2f6fed);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.14);
}

.rank-combo::placeholder { color: #9aa3b0; }

.board-agency-field { flex: 1 1 260px; }


/* 구동 상태 — 뱃지 두 개까지. 구동중이면서 종료임박일 수 있다. */
.board-status { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* ------------------------------------------------------------------ */
/* 애드로그 매칭 — 고칠 카드 목록                                       */
/* ------------------------------------------------------------------ */

.rank-tabs.sub { margin-bottom: 14px; }

.match-list { display: flex; flex-direction: column; gap: 8px; }

.match-card {
  display: grid;
  grid-template-columns: 30px 1fr 96px;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.match-card.is-done {
  border-color: color-mix(in srgb, var(--neon-mint) 35%, var(--line));
  background: color-mix(in srgb, var(--neon-mint) 6%, var(--surface));
}

.match-card.is-done .match-fields { opacity: 0.5; }

.match-no {
  padding-top: 20px;
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.match-fields {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1fr 1.4fr;
  gap: 8px;
  min-width: 0;
}

@media (max-width: 1080px) { .match-fields { grid-template-columns: 1fr 1fr; } }
@media (max-width: 680px)  { .match-fields { grid-template-columns: 1fr; } }

.match-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.match-label {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-note { font-size: 11.5px; color: var(--muted); }
.match-note.warn,
.match-field.warn .match-note { color: var(--neon-amber, #d08a3a); font-weight: 600; }

.match-changes { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.match-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.match-copy:hover { border-color: var(--neon-mint); }
.match-copy:focus-visible { outline: 2px solid var(--neon-mint); outline-offset: 1px; }
.match-copy.copied { border-color: var(--neon-mint); }
.match-copy.copied .match-copy-icon { color: var(--neon-mint); }

.match-copy-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-copy-icon { flex: 0 0 auto; font-size: 11px; color: var(--muted); }

.match-copy.mid { font-variant-numeric: tabular-nums; color: var(--muted); }

.match-copy.group,
.match-copy.memo { font-weight: 600; }

.match-copy.group {
  border-color: color-mix(in srgb, var(--neon-blue, #5b7cff) 30%, var(--line));
  background: color-mix(in srgb, var(--neon-blue, #5b7cff) 8%, transparent);
}

.match-copy.memo {
  border-color: color-mix(in srgb, var(--neon-mint) 30%, var(--line));
  background: color-mix(in srgb, var(--neon-mint) 8%, transparent);
}

.match-mark {
  margin-top: 18px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.match-mark:hover { border-color: var(--neon-mint); color: var(--neon-mint); }
.match-mark:focus-visible { outline: 2px solid var(--neon-mint); outline-offset: 2px; }
.match-mark:disabled { opacity: 0.5; cursor: not-allowed; }

.match-card.is-done .match-mark {
  background: var(--neon-mint);
  border-color: var(--neon-mint);
  color: #0d1a12;
}

.match-mark.ghost { cursor: default; }
.match-mark.ghost:hover { border-color: var(--line); color: var(--muted); }

.match-who {
  grid-column: 2 / -1;
  font-size: 11.5px;
  color: var(--muted);
}

/* 등록 탭 — 체크박스 + 남은 일수 */
.match-pick {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.match-pick input {
  width: 18px;
  height: 18px;
  accent-color: var(--neon-mint);
  cursor: pointer;
}

.match-pick input:focus-visible { outline: 2px solid var(--neon-mint); outline-offset: 2px; }

/* 남은 일수는 표시일 뿐이다. 버튼처럼 보이면 눌러 보게 된다. */
.match-days {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.match-days.soon { color: var(--neon-amber, #d08a3a); font-weight: 600; }

/* ------------------------------------------------------------------ */
/* 6번 대행사 관리                                                      */
/* ------------------------------------------------------------------ */

/* 눌러서 상세로 들어가는 행. 버튼처럼 생긴 것은 눌리는 것이어야 한다(ERROR_LOG R-8). */
.rank-table tbody tr.board-clickable {
  cursor: pointer;
}

.rank-table tbody tr.board-clickable:hover {
  background: rgba(99, 102, 241, 0.08);
}

/* 누른 행 바로 아래에 펴는 상세. 표 밑에 따로 열면 어느 업체를 눌렀는지 잃어버린다. */
.rank-table tbody tr.is-open {
  background: rgba(99, 102, 241, 0.12);
}

.rank-table tbody tr.orders-expand > td {
  padding: 0;
  background: rgba(15, 23, 42, 0.03);
}

.orders-detail-inline {
  padding: 16px 20px 20px;
  border-left: 3px solid rgba(99, 102, 241, 0.6);
}

.orders-detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.orders-detail-head .rank-hint {
  margin: 0;
}

.orders-detail-inline h4 {
  margin: 16px 0 8px;
  font-size: 14px;
}

.orders-detail-inline .rank-table {
  margin-bottom: 8px;
}

/* 관리자 요약. 기간을 골라 총 물량을 본다. */
.orders-summary {
  margin-bottom: 20px;
  padding: 16px 20px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px;
}

.orders-summary.hidden {
  display: none;
}

.orders-summary-head {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.orders-summary-head > strong {
  align-self: center;
  margin-right: 4px;
}

.orders-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.orders-summary-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.08);
}

.orders-summary-card strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.orders-summary-label {
  font-size: 12px;
  opacity: 0.75;
}

/* ------------------------------------------------------------------ */
/* 7번 정산관리                                                          */
/* ------------------------------------------------------------------ */
/*
  색은 새로 만들지 않는다. 기존 토큰만 쓴다.

    빨강 .up (#ff6b6b)   오름 · 좋음    ← 5번 순위와 같은 규칙
    파랑 .down (#60a5fa) 내림 · 나쁨
    주황 --amber         경고           ← 빨강이 '좋음' 이라 경고에 빨강을 못 쓴다

  숫자는 tabular-nums. 세로로 자릿수가 맞아야 읽힌다.
*/

/* 점검 배지. 항상 맨 위. 숨기면 안 본다. */
.settle-alert {
  display: block;
  width: 100%;
  margin: 12px 0 4px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 159, 28, 0.45);
  border-radius: var(--radius);
  background: rgba(255, 159, 28, 0.12);
  color: var(--amber);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.settle-alert:hover { background: rgba(255, 159, 28, 0.2); }
.settle-alert:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(255, 159, 28, 0.6); }
.settle-alert:active { transform: scale(0.995); }

.settle-alert-inline {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(255, 159, 28, 0.1);
  color: var(--amber);
  font-size: 13px;
}

/* 지표 5개 */
#settleKpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.settle-kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

/* 실제 마진. 인센을 다 떼고 회사가 갖는 것. 이게 대표가 봐야 할 숫자다. */
.settle-kpi.accent {
  border-color: rgba(0, 214, 204, 0.4);
  background: linear-gradient(180deg, rgba(0, 214, 204, 0.08), var(--panel));
}

.settle-kpi-label { color: var(--muted); font-size: 12px; }

.settle-kpi-value {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.settle-kpi.accent .settle-kpi-value { color: var(--cyan); }
.settle-kpi-note { color: var(--muted); font-size: 12px; min-height: 16px; }

.settle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.settle-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  margin-bottom: 12px;
}

.settle-card h4 { margin: 0 0 6px; font-size: 14px; }
.settle-card .rank-hint { margin-top: 0; }

.settle-line {
  margin: 6px 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* 목표 달성 막대. 넘기면 빨강(좋음), 못 미치면 파랑. */
.settle-bar {
  height: 10px;
  margin: 10px 0;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.settle-bar span { display: block; height: 100%; border-radius: 999px; }
.settle-bar span.up { background: #ff6b6b; }
.settle-bar span.down { background: #60a5fa; }

.settle-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: settle;
}

.settle-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.settle-list li:last-child { border-bottom: none; }
.settle-list b { font-variant-numeric: tabular-nums; }

/* 일자별 차트. 5번 순위 추이의 SVG 인프라를 그대로 쓴다. */
.settle-chart { width: 100%; height: auto; }

/* 일자별 차트 호버 툴팁 + 세로 가이드선. */
#settleDaily { position: relative; }
.settle-hit { cursor: pointer; }
.settle-hover-guide {
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  transition: opacity 100ms ease;
}
.settle-chart-tip {
  background: rgba(10, 13, 16, 0.97);
  border: 1px solid rgba(0, 214, 204, 0.3);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 3px;
  padding: 8px 11px;
  pointer-events: none;
  position: absolute;
  transform: translate(-50%, calc(-100% - 14px));
  white-space: nowrap;
  z-index: 5;
}
.settle-chart-tip strong { color: var(--neon-mint); font-size: 13px; }
.settle-chart-tip b { color: #fff; }

/*
  아주 좁은 화면에선 차트를 100% 로 욱여넣지 않는다. 좌측 여백 108px(원 단위 금액 축)이
  눌려 축 라벨이 겹치기 때문이다. 최소폭을 주고 가로 스크롤을 허용한다.
  정확한 숫자는 바로 아래 일자별 표가 담으니 차트는 추세만 보면 된다.
*/
@media (max-width: 560px) {
  #settleDaily { overflow-x: auto; }
  .settle-chart { min-width: 460px; }
}

.settle-bar-rect { fill: rgba(0, 214, 204, 0.55); }
.settle-bar-rect:hover { fill: var(--cyan); }
.settle-rate-line { fill: none; stroke: #ff6b6b; stroke-width: 2; }
.settle-rate-dot { fill: #ff6b6b; }
/* 실마진율 — 총마진율(빨강 실선) 아래로 깔리는 옅은 점선. 인센 뗀 뒤라 항상 총마진율 이하다. */
.settle-net-rate-line {
  fill: none;
  stroke: rgba(255, 168, 120, 0.75);
  stroke-width: 1.6;
  stroke-dasharray: 5 4;
}

/* 일자별 표는 차트 바로 아래. 위쪽 여백만 준다. */
.settle-daily-table { margin-top: 14px; }

/* 지표 설명 범례 — 대표가 각 숫자가 뭔지 알게. */
.settle-legend {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.settle-legend b { color: var(--ink); }

/* 인센 — 계산 과정을 펼친다 */
.settle-owner {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  margin-bottom: 10px;
}

.settle-owner header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.settle-owner h4 { margin: 0; font-size: 15px; }

.settle-payout {
  font-size: 20px;
  font-weight: 700;
  color: var(--neon-mint);
  font-variant-numeric: tabular-nums;
}

.settle-breakdown {
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  border-left: 2px solid var(--brand);
  padding-left: 12px;
}

.settle-breakdown li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  font-size: 13px;
  color: var(--muted);
}

.settle-breakdown li.muted { color: var(--muted); font-style: italic; }
.settle-breakdown b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* 원장 */
.settle-real { color: var(--muted); font-size: 12px; }
.settle-mono { font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace; font-size: 12px; }

.rank-table td.up { color: #ff6b6b; font-weight: 600; }
.rank-table td.down { color: #60a5fa; font-weight: 600; }
.rank-table td.warn { color: var(--amber); font-weight: 600; }

.rank-badge.warn {
  background: rgba(255, 159, 28, 0.16);
  color: var(--amber);
  margin-left: 6px;
}

/* 입금 aging. 색이 아니라 단계다. */
.settle-warn td { background: rgba(255, 159, 28, 0.06); }
.settle-danger td { background: rgba(255, 159, 28, 0.14); font-weight: 600; }

.settle-calc td { font-size: 13px; }
.settle-calc tr:last-child td { border-bottom: none; }

.rank-field.wide { flex: 1 1 320px; }

/* 시트 최신화 버튼 — 조회와 구분되게 강조. 시트에서 데이터를 당기는 별개 동작이다. */
.settle-sync {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.16), rgba(0, 214, 204, 0.14));
  border-color: rgba(52, 211, 153, 0.4);
  font-weight: 800;
  white-space: nowrap;
}
.settle-sync:hover:not(:disabled) {
  border-color: rgba(52, 211, 153, 0.6);
  box-shadow: 0 0 18px rgba(0, 214, 204, 0.22);
}
.settle-sync:disabled { opacity: 0.55; cursor: progress; }

.settle-sync-note {
  margin-top: 8px;
  color: var(--brand-dark);
  font-weight: 700;
}

/*
  고객사 → 대행사 연결 표(4칼럼: 고객사·매출·대행사·직접고객).

  대행사 칼럼의 입력창이 min-width:180 인데 남는 폭까지 다 먹어 부풀면서,
  직접고객(체크박스) 칼럼이 우측으로 눌려 찌그러져 보였다.
  대행사 칼럼이 남는 폭을 갖되 입력창은 셀 안에 딱 맞추고,
  직접고객은 좁게 고정 + 가운데 정렬해 칸을 안정시킨다.
*/
#aliasBody td:nth-child(3) { width: 100%; }
#aliasBody .rank-combo {
  min-width: 160px;
  width: 100%;
  box-sizing: border-box;
}
.settle-card thead th:nth-child(4),
#aliasBody td:nth-child(4) {
  width: 84px;
  text-align: center;
  white-space: nowrap;
}
#aliasBody input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

@media (max-width: 900px) {
  #settleKpi { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .settle-kpi-value { font-size: 20px; }
}

/*
  좁은 카드 안의 표.

  .rank-table 은 min-width: 1180px 다. 5번 대행사 보드는 열이 많아 그게 맞다.
  그런데 요약 카드(약 520px) 안에 넣으면 표가 카드 밖으로 밀려 첫 열만 보인다.
  실제로 그렇게 렌더됐다. 렌더를 안 봤으면 못 잡았다.

  기존 규칙은 안 건드린다. 카드 안에서만 푼다.
*/
.settle-card .rank-table { min-width: 0; }
.settle-card .rank-table th,
.settle-card .rank-table td { padding: 8px 10px; }

/* 정산 원장·입금·점검은 열이 많다. 가로 스크롤을 허용한다. */
[data-settle-panel="rows"] .rank-table,
[data-settle-panel="payments"] .rank-table { min-width: 1080px; }

/*
  금액은 흰색으로. 배경이 어둡다.

  기존 .rank-table 은 본문을 var(--ink) 로 두지만, 표 안의 숫자가 주변 회색(--muted)에
  묻혀 읽기 어려웠다. 돈은 자릿수를 눈으로 세는 화면이다. 숫자가 제일 밝아야 한다.

  금액은 원 단위로 끝까지 쓴다(79,081,305). 줄여 쓰면(7,908만) 자릿수 비교가 안 된다.
*/
.settle-card .rank-table td,
[data-settle-panel] .rank-table td {
  color: var(--ink);
}

.settle-card .rank-table td.num,
[data-settle-panel] .rank-table td.num {
  color: #fff;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* 증감·경고 색은 흰색보다 우선한다. 의미가 있는 색이다. */
.settle-card .rank-table td.num.up,
[data-settle-panel] .rank-table td.num.up { color: #ff6b6b; }
.settle-card .rank-table td.num.down,
[data-settle-panel] .rank-table td.num.down { color: #60a5fa; }
.settle-card .rank-table td.num.warn,
[data-settle-panel] .rank-table td.num.warn { color: var(--amber); }

.settle-list li span { color: var(--ink); }
.settle-list b { color: #fff; font-weight: 600; }

.settle-kpi-value { color: #fff; }
.settle-line { color: var(--ink); }

.settle-breakdown li { color: var(--ink); }
.settle-breakdown b { color: #fff; }

/* 축 글자. 원 단위를 다 쓰므로 조금 작게. */
.settle-chart .trend-label { fill: var(--muted); font-size: 11px; }

/*
  영업자별·상품별 표는 열이 많다. min-width 를 고정하지 않는다(예전엔 860px 이었다).
  위 .settle-card .rank-table { min-width:0 } 을 그대로 살려, 표는 내용폭만큼만 넓어진다.
  좁은 표(일자별 6열·요약)는 카드 안에 딱 맞고, 넓은 표는 자연히 넘쳐
  .rank-table-wrap 의 가로 스크롤 + 첫 열 고정으로 읽힌다.
  (860px 고정은 좁은 표까지 억지로 스크롤시켜 무효화 대상이었다.)
*/

/* 실제 마진. 인센 다 떼고 회사가 갖는 돈. 이 표의 결론이다. */
.rank-table td.num.accent { color: var(--cyan); }

/* 합계 행 */
#settleLeaderFoot td {
  border-top: 2px solid var(--line);
  background: rgba(0, 214, 204, 0.05);
  font-weight: 700;
}

/* 기간 선택. 달 + 시작일 + 종료일. */
/*
  조회 바. 여러 화면(정산 헤더·원장·대행사)이 .rank-actions 로 인풋+버튼을 한 줄에 놓는다.
  이 클래스가 여태 CSS 에 없어(block 으로 흘러) .settle-range 의 flex-wrap 도 무효였다.
  여기서 flex 컨테이너로 정의해 데스크탑은 한 줄, 좁으면 줄바꿈되게 한다.
*/
.rank-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.settle-range { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.settle-range .rank-field { min-width: 150px; }

/* 모바일에선 조회 인풋·버튼이 폭에 맞게 늘어 눌리지 않게 한다. */
@media (max-width: 720px) {
  .settle-range .rank-field,
  .settle-range .rank-button { flex: 1 1 auto; }
}

/* 수집이 하루 넘게 안 들어왔다. 화면 숫자가 옛것이라는 뜻이다. */
.settle-stale { color: var(--amber); font-weight: 600; }

/* 안 이어진 대행사 */
.rank-table td.muted { color: var(--muted); font-style: italic; }

/* 담당자 정합성 — 불일치만 체크박스 */
.rank-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.rank-check input { width: 15px; height: 15px; cursor: pointer; }

/* 고르기 드롭다운은 어두운 배경이라 rank-combo 와 달리 밝은 글씨로 둔다. */
#ownerTableBody select.rank-input {
  background: var(--panel);
  color: var(--ink);
  min-width: 120px;
}

/* 고객사→대행사 자동 연결 배지. 이름이 대행사와 같아 자동으로 이어진 것. */
.settle-auto-badge {
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 214, 204, 0.14);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}

/* ---------------------------------------------------------------------------
   8번 플레이스 탐색기 — 담당자 -> 대행사 -> 플레이스 3단

   .rank-table 은 min-width:1180px 전제다(ERROR_LOG W-2). 좁은 칸에 넣으면
   첫 열만 보인다. 그래서 표는 3단 칼럼 안이 아니라 아래 상세 영역에만 쓴다.
   --------------------------------------------------------------------------- */

.place-explorer {
  display: grid;
  grid-template-columns: 200px 240px 1fr;
  gap: 12px;
  margin-top: 16px;
}

.place-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.02);
}

.place-column-head {
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #475569;
  background: rgba(148, 163, 184, 0.14);
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
}

.place-list {
  display: flex;
  flex-direction: column;
  max-height: 420px;
  overflow-y: auto;
}

.place-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.place-row:hover { background: rgba(37, 99, 235, 0.07); }
.place-row:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }
.place-row.active { background: rgba(37, 99, 235, 0.13); }
.place-row.active .place-row-name { color: #1d4ed8; }

.place-row-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.place-row-meta {
  font-size: 11px;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}

.place-empty {
  padding: 16px 12px;
  font-size: 12px;
  color: #94a3b8;
}

.place-detail {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.28);
}

.place-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.place-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.1);
}

.place-field span { font-size: 11px; color: #64748b; }
.place-field strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.place-profile-blocks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.place-block h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: #334155;
}

.place-longtext {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: #475569;
  white-space: pre-wrap;
  word-break: break-word;
}

.place-chiplist { display: flex; flex-wrap: wrap; gap: 6px; }

.place-chip {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}

.place-history-row td {
  padding: 8px 12px;
  font-size: 12px;
  color: #475569;
  background: rgba(148, 163, 184, 0.1);
  white-space: normal;
  word-break: break-word;
}

@media (max-width: 900px) {
  .place-explorer { grid-template-columns: 1fr; }
  .place-list { max-height: 240px; }
}

/* 9번 키워드 메뉴판 */
.menu-len { display: flex; align-items: center; gap: 6px; }
.menu-len input { width: 70px; }

.nav-item.sub .nav-icon {
  font-size: 11px;
  opacity: 0.85;
}

/* 조합 생성의 두 덩어리를 각각 가두는 영역.
   경계가 없으면 "입력 4칸" 과 "조합 선택" 이 한 덩어리로 보여서
   폭이 줄 때 어디까지가 한 묶음인지 안 보인다. */
.menu-combine-zone {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 14px;
  margin: 12px 0 16px;
  background: var(--panel);
}

.menu-combine-zone-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}

/* 열 수를 고정한다. auto-fit 은 폭이 줄면 4칸 -> 3칸 -> 2칸으로 접혀
   레이아웃이 튄다. 고정하면 칸이 같이 줄어들어 비율이 유지된다.
   minmax(0, 1fr) 의 0 이 핵심 — 기본값 auto 면 내용이 칸을 밀어내 넘친다. */
.menu-combine-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.menu-combine-grid textarea {
  width: 100%;
  resize: vertical;
  font: inherit;
  font-size: 12px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 8px;
}

.menu-combine-patterns {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
}

.menu-combine-patterns .place-block { min-width: 0; }
.menu-combine-patterns .place-chiplist { gap: 4px 10px; min-width: 0; }
.menu-combine-patterns .rank-field-check { font-size: 12px; }
.menu-combine-patterns h4 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* 여기서만 접는다. 그 전까지는 4칸이 비율대로 같이 줄어든다. */
@media (max-width: 1100px) {
  .menu-combine-grid,
  .menu-combine-patterns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .menu-combine-grid,
  .menu-combine-patterns { grid-template-columns: minmax(0, 1fr); }
}

/* 요청 영역만 살짝 띄운다. 밝은 배경을 쓰면 안 된다 — 이 앱은 다크다. */
.menu-combine-request {
  border-color: rgba(0, 214, 204, 0.35);
  background: var(--soft);
}
