/* ====================================================
   AS Support System Premium Dark UI
   ==================================================== */

:root {
  /* Colors - Light Theme based on gtogway.iptime.org */
  --bg-primary: #f8fafc; /* slate-50 */
  --bg-secondary: #ffffff; /* white */
  --bg-tertiary: #f1f5f9; /* slate-100 */
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --glass-bg: #ffffff;
  --glass-border: #e2e8f0; /* slate-200 */
  --glass-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); /* subtle shadow */

  --text-primary: #111827; /* gray-900 */
  --text-secondary: #4b5563; /* gray-600 */
  --text-muted: #6b7280; /* gray-500 */
  --text-inverse: #ffffff;

  --accent-purple: #7c3aed;
  --accent-blue: #2563eb; /* blue-600 */
  --accent-cyan: #0891b2; /* cyan-600 */
  --accent-green: #059669; /* emerald-600 */
  --accent-yellow: #d97706; /* amber-600 */
  --accent-red: #dc2626; /* red-600 */
  --accent-orange: #ea580c; /* orange-600 */

  --gradient-primary: linear-gradient(135deg, #2563eb, #1d4ed8);
  --gradient-accent: linear-gradient(135deg, #2563eb, #0891b2);
  --gradient-warm: linear-gradient(135deg, #d97706, #dc2626);
  --gradient-green: linear-gradient(135deg, #059669, #0891b2);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-xs: 0.6875rem; /* 11px */
  --font-sm: 0.75rem; /* 12px */
  --font-base: 0.875rem; /* 14px */
  --font-md: 1rem; /* 16px */
  --font-lg: 1.125rem; /* 18px */
  --font-xl: 1.25rem; /* 20px */
  --font-2xl: 1.5rem; /* 24px */
  --font-3xl: 2rem; /* 32px */

  /* Spacing & Borders */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====== RESET ====== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  font-size: var(--font-base);
}

a { color: var(--accent-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ====== ANIMATIONS ====== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

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

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

.animate-fade { animation: fadeIn 0.4s var(--transition-slow) forwards; }
.animate-slide { animation: slideUp 0.5s var(--transition-slow) forwards; }

/* ====== LAYOUT ====== */
html, body {
  height: 100vh;
  overflow: hidden;
}

.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ====== SIDEBAR ====== */
.sidebar {
  width: 72px;
  background: #ffffff;
  border-right: 1px solid #dbe3ef;
  display: flex;
  flex-direction: column;
  padding: 0;
  z-index: 100;
  flex-shrink: 0;
  color: #0f172a;
  box-shadow: 1px 0 0 rgba(15, 23, 42, 0.02);
}

.sidebar.sidebar-admin {
  background: #111827;
  border-right-color: #1f2937;
  color: #f8fafc;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 0;
  padding: 14px 0 12px;
  border-bottom: 1px solid #e2e8f0;
}

.sidebar.sidebar-admin .sidebar-header {
  border-bottom-color: #1f2937;
}

.logo-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  border-radius: var(--radius-sm);
  border: 1px solid #bfdbfe;
  color: #2563eb;
}

.sidebar.sidebar-admin .logo-icon {
  background: #0f172a;
  border-color: #334155;
}

.brand-text {
  display: none;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.15;
  color: #0f172a;
  background: none;
  -webkit-text-fill-color: currentColor;
}

.sidebar.sidebar-admin .brand-text {
  color: #ffffff;
}

.sidebar-user {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid #e2e8f0;
  position: relative;
}

.sidebar.sidebar-admin .sidebar-user {
  border-bottom-color: #1f2937;
}

.user-profile-button {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  border-radius: 8px;
  padding: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  column-gap: 10px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-profile-button:hover,
.user-profile-button:focus-visible,
.user-profile-button.active {
  background: #f8fafc;
  border-color: #dbeafe;
  outline: none;
}

.sidebar.sidebar-admin .user-profile-button:hover,
.sidebar.sidebar-admin .user-profile-button:focus-visible,
.sidebar.sidebar-admin .user-profile-button.active {
  background: #1f2937;
  border-color: #334155;
}

.sidebar-user .user-avatar {
  grid-area: avatar;
  width: 32px;
  height: 32px;
  font-size: 12px;
  border-radius: 50%;
  background: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
}

.user-avatar-shell {
  position: relative;
  overflow: hidden;
}

.user-avatar-shell img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.user-avatar-shell .avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar-shell.has-image .avatar-fallback {
  display: none;
}

.user-avatar-shell.image-failed img {
  display: none;
}

.user-avatar-shell.image-failed .avatar-fallback {
  display: flex;
}

.sidebar-user .user-info {
  display: none !important;
  grid-area: info;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.sidebar-user .user-name {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 0;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user .user-role {
  font-size: 11px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar.sidebar-admin .sidebar-user .user-name {
  color: #f8fafc;
}

.sidebar.sidebar-admin .sidebar-user .user-role {
  color: #94a3b8;
}

.user-context {
  display: none;
  grid-area: context;
  width: fit-content;
  max-width: 100%;
  margin-top: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
}

.sidebar.sidebar-admin .user-context {
  background: #1e293b;
  color: #cbd5e1;
}

.portal-context {
  display: none;
  padding: 0 8px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.sidebar.sidebar-admin .portal-context {
  color: #94a3b8;
}

.profile-popover {
  position: absolute;
  top: 10px;
  left: calc(100% + 12px);
  z-index: 2500;
  width: 260px;
  overflow: visible;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
  animation: profilePopoverIn 0.14s ease-out;
}

.mobile-profile-layer {
  display: none;
}

.mobile-profile-backdrop {
  display: none;
}

.profile-popover::before {
  content: '';
  position: absolute;
  top: 18px;
  left: -5px;
  width: 10px;
  height: 10px;
  border-left: 1px solid #dbe3ef;
  border-bottom: 1px solid #dbe3ef;
  background: #f8fafc;
  transform: rotate(45deg);
}

.profile-popover-header {
  padding: 10px 12px 9px;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 7px 7px 0 0;
  background: #f8fafc;
}

.profile-popover-kicker {
  margin-bottom: 3px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.profile-popover-id {
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-popover-meta {
  margin-top: 4px;
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-popover-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px;
}

.profile-popover-item {
  width: 100%;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.profile-popover-item:hover,
.profile-popover-item:focus-visible {
  background: #eff6ff;
  color: #1d4ed8;
  outline: none;
}

.profile-popover-icon,
.profile-popover-footer-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.profile-popover-icon svg,
.profile-popover-footer-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-popover-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid #e2e8f0;
  border-radius: 0 0 7px 7px;
  background: #f8fafc;
}

.profile-popover-footer-btn {
  min-width: 0;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 8px;
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.profile-popover-footer-btn:hover,
.profile-popover-footer-btn:focus-visible {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  outline: none;
}

.profile-popover-footer-btn.danger {
  border-color: #fecaca;
  color: #dc2626;
}

.profile-popover-footer-btn.danger:hover,
.profile-popover-footer-btn.danger:focus-visible {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #b91c1c;
}

.profile-popover-footer-btn.danger .profile-popover-footer-icon {
  color: currentColor;
}

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

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 14px;
  scrollbar-width: none;
}

.sidebar-menu::-webkit-scrollbar {
  display: none;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-section-title {
  width: 26px;
  height: 1px;
  padding: 0;
  margin: 3px auto 0;
  overflow: hidden;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.3;
  color: #94a3b8;
  background: #e2e8f0;
  text-indent: -999px;
}

.sidebar.sidebar-admin .nav-section-title {
  color: #64748b;
  background: #334155;
}

.nav-item {
  width: 100%;
  min-height: 38px;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  color: #475569;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-family: var(--font-family);
  position: relative;
}

.sidebar.sidebar-admin .nav-item {
  color: #cbd5e1;
}

.nav-icon,
.logout-btn-full .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg,
.logout-btn-full .icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.nav-item:hover {
  color: #0f172a;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.nav-item:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.sidebar.sidebar-admin .nav-item:hover {
  color: #ffffff;
  background: #1f2937;
  border-color: #334155;
}

.nav-item.active {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

.sidebar.sidebar-admin .nav-item.active {
  color: #111827;
  background: #ffffff;
  border-color: #ffffff;
  box-shadow: none;
}

.nav-item-child {
  min-height: 30px;
  padding-left: 38px;
  font-size: 12px;
  font-weight: 650;
}

.nav-item-child .nav-icon {
  display: none;
}

.nav-chevron {
  width: 15px;
  height: 15px;
  color: #94a3b8;
  display: inline-flex;
  transition: transform var(--transition-fast);
}

.nav-chevron svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-group.is-open .nav-chevron {
  transform: rotate(180deg);
}

.nav-submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 3px;
}

#customer-sub-menu .nav-item.active {
  background: #eff6ff;
  border-left: none;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: center;
}

.sidebar.sidebar-admin .sidebar-bottom {
  border-top-color: #1f2937;
}

.logout-btn-full {
  background: transparent;
  border: 1px solid transparent;
  color: #64748b;
  cursor: pointer;
  min-height: 38px;
  padding: 0;
  border-radius: 8px;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  font-family: var(--font-family);
  position: relative;
}

.sidebar.sidebar-admin .logout-btn-full {
  color: #94a3b8;
}

.logout-btn-full:hover {
  color: #dc2626;
  background: #fef2f2;
  border-color: #fecaca;
}

.logout-btn-full .text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}

.sidebar-tooltip {
  position: fixed;
  z-index: 3000;
  transform: translateY(-50%) translateX(-6px);
  padding: 7px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.16);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.sidebar-tooltip::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 50%;
  width: 8px;
  height: 8px;
  background: inherit;
  transform: translateY(-50%) rotate(45deg);
  border-left: 1px solid #bfdbfe;
  border-bottom: 1px solid #bfdbfe;
}

.sidebar-tooltip.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}

.sidebar-tooltip.admin {
  border-color: #334155;
  background: #1f2937;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.28);
}

.sidebar-tooltip.admin::before {
  border-color: #334155;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: var(--glass-bg);
}

/* ====== MAIN CONTENT ====== */
.main-content {
  flex: 1;
  position: relative;
  z-index: 1;
  height: 100vh;
  overflow-y: auto;
  min-width: 0;
}

/* Authentication pages fallbacks inside main-content */
.auth-layout-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ====== AUTH PAGES ====== */
.auth-container {
  min-height: 100vh;
  padding: clamp(20px, 4vw, 48px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef3f9;
  color: #0f172a;
}

.auth-shell {
  width: min(100%, 900px);
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 410px);
  gap: clamp(22px, 4vw, 44px);
  align-items: center;
}

.auth-shell-register {
  grid-template-columns: minmax(280px, 0.78fr) minmax(420px, 480px);
}

.auth-context {
  min-width: 0;
  padding: 0;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.auth-brand-mark {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #2563eb;
  color: #f8fafc;
  font-size: 18px;
  font-weight: 900;
}

.auth-brand > div > strong,
.auth-brand > div > span {
  display: block;
}

.auth-brand > div > strong {
  color: #0f172a;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
}

.auth-brand > div > span {
  margin-top: 3px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.auth-showcase {
  position: relative;
  width: min(100%, 350px);
  height: 260px;
  margin-top: 42px;
}

.auth-showcase::before {
  content: "";
  position: absolute;
  inset: 14px 52px 14px 0;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  background:
    linear-gradient(#e2e8f0 1px, transparent 1px),
    linear-gradient(90deg, #e2e8f0 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.45;
}

.auth-showcase-card {
  position: absolute;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #fbfcfe;
  box-shadow: 0 18px 40px rgba(30, 41, 59, 0.08);
}

.auth-showcase-main {
  left: 34px;
  top: 22px;
  width: 252px;
  height: 148px;
  padding: 18px;
}

.auth-showcase-sub {
  right: 0;
  bottom: 26px;
  width: 210px;
  height: 96px;
  padding: 16px;
}

.auth-showcase-card span {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: #dbeafe;
}

.auth-showcase-main span:first-child {
  width: 48px;
  height: 26px;
  border-radius: 8px;
  background: #2563eb;
}

.auth-showcase-main span:nth-child(2) {
  width: 174px;
  margin-top: 24px;
  background: #cbd5e1;
}

.auth-showcase-main span:nth-child(3) {
  width: 132px;
  margin-top: 12px;
  background: #e2e8f0;
}

.auth-showcase-sub span:first-child {
  width: 142px;
  background: #bfdbfe;
}

.auth-showcase-sub span:nth-child(2) {
  width: 92px;
  margin-top: 12px;
  background: #dbe3ef;
}

.auth-showcase-orbit {
  position: absolute;
  left: 0;
  bottom: 46px;
  display: flex;
  gap: 8px;
}

.auth-showcase-orbit i {
  width: 28px;
  height: 28px;
  display: block;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.auth-showcase-orbit i:nth-child(2) {
  background: #f8fafc;
}

.auth-showcase-orbit i:nth-child(3) {
  background: #dbeafe;
}

.auth-card {
  width: 100%;
  padding: 32px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #fbfcfe;
  box-shadow: 0 24px 56px rgba(30, 41, 59, 0.1);
}

.auth-header {
  margin-bottom: 24px;
  text-align: left;
}

.auth-header h1 {
  margin: 0;
  color: #0f172a;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.2;
}

.auth-header p {
  margin: 8px 0 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group label .required {
  color: var(--accent-red);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--font-base);
  font-family: var(--font-family);
  transition: all var(--transition-base);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
  background: rgba(255, 255, 255, 0.06);
}

.form-control::placeholder {
  color: var(--text-muted);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a0a0c0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

select.form-control option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.auth-field span {
  color: #334155;
  font-size: 12px;
  font-weight: 850;
}

.auth-field strong {
  color: #dc2626;
}

.auth-field .form-control {
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fdfefe;
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
}

.auth-field .form-control:focus {
  border-color: #93c5fd;
  background: #fdfefe;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.auth-password-wrap {
  position: relative;
}

.auth-password-wrap .form-control {
  padding-right: 46px;
}

.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 6px;
  background: #eef2f7;
  color: #475569;
  cursor: pointer;
}

.auth-password-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
  background: #dbeafe;
  color: #1d4ed8;
  outline: none;
}

.auth-check {
  margin: 2px 0 4px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.auth-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #2563eb;
}

.auth-submit.btn {
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  border-radius: 8px;
  background: #2563eb;
  color: #f8fafc;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.2);
}

.auth-submit.btn:hover:not(:disabled),
.auth-submit.btn:focus-visible {
  background: #1d4ed8;
  outline: none;
}

.auth-submit.btn:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.auth-footer {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.auth-footer-center {
  justify-content: center;
}

.auth-link {
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: #475569;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.auth-link:hover,
.auth-link:focus-visible {
  color: #1d4ed8;
  outline: none;
}

.auth-message {
  margin-bottom: 2px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.auth-message.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.auth-message[hidden] {
  display: none;
}

.auth-legal-consent {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #f8fafc;
}

.auth-legal-check {
  min-width: 0;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  color: #334155;
  font-size: 12px;
  font-weight: 850;
}

.auth-legal-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #2563eb;
}

.auth-legal-inline-link,
.auth-legal-link {
  border: 0;
  background: transparent;
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.auth-legal-inline-link:hover,
.auth-legal-inline-link:focus-visible,
.auth-legal-link:hover,
.auth-legal-link:focus-visible {
  color: #1d4ed8;
  outline: none;
}

.auth-legal-links {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 800;
}

.legal-document-page,
.legal-agreement-page {
  min-height: 100vh;
  padding: clamp(24px, 5vw, 56px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: #eef3f9;
  color: #0f172a;
}

.legal-document-card,
.legal-agreement-card {
  width: min(100%, 880px);
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  background: #fbfcfe;
  box-shadow: 0 24px 56px rgba(30, 41, 59, 0.1);
  overflow: hidden;
}

.legal-agreement-card {
  width: min(100%, 640px);
}

.legal-document-header,
.legal-agreement-header {
  padding: 28px 30px 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid #e2e8f0;
}

.legal-agreement-header {
  display: block;
}

.legal-kicker {
  margin: 0 0 8px;
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
}

.legal-document-header h1,
.legal-agreement-header h1 {
  margin: 0;
  color: #0f172a;
  font-size: 24px;
  font-weight: 950;
  line-height: 1.25;
}

.legal-document-header p:not(.legal-kicker),
.legal-agreement-header p:not(.legal-kicker) {
  margin: 10px 0 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.6;
}

.legal-back-btn {
  flex: 0 0 auto;
}

.legal-document-meta {
  padding: 14px 30px;
  display: flex;
  gap: 14px;
  border-bottom: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 12px;
  font-weight: 850;
}

.legal-document-body {
  padding: 24px 30px 34px;
  color: #1e293b;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.75;
}

.legal-document-body h2 {
  margin: 22px 0 8px;
  color: #0f172a;
  font-size: 16px;
  font-weight: 950;
}

.legal-document-body h2:first-child {
  margin-top: 0;
}

.legal-document-body p {
  margin: 5px 0;
}

.legal-doc-gap {
  height: 12px;
}

.legal-document-body .legal-bullet {
  position: relative;
  padding-left: 14px;
  color: #334155;
}

.legal-document-body .legal-bullet::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.78em;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: #94a3b8;
}

.legal-document-loading {
  min-height: 260px;
}

.legal-agreement-form {
  padding: 24px 30px 30px;
}

.legal-agreement-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.legal-agreement-item {
  padding: 16px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #f8fafc;
}

.legal-agreement-item input,
.legal-agreement-all input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #2563eb;
}

.legal-agreement-item strong,
.legal-agreement-item small {
  display: block;
}

.legal-agreement-item strong {
  color: #0f172a;
  font-size: 14px;
  font-weight: 950;
}

.legal-agreement-item small {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.legal-text-link {
  border: 0;
  background: transparent;
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.legal-agreement-all {
  margin-top: 16px;
  padding: 14px 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 900;
}

.legal-agreement-actions {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.legal-modal-open {
  overflow: hidden;
}

.legal-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10020;
  padding: clamp(18px, 4vw, 42px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.42);
}

.legal-modal {
  width: min(100%, 760px);
  max-height: min(86vh, 820px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  background: #fbfcfe;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.legal-modal-header {
  padding: 18px 22px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.legal-modal-header h2 {
  margin: 0;
  color: #0f172a;
  font-size: 19px;
  font-weight: 950;
  line-height: 1.25;
}

.legal-modal-close {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #dbe3ef;
  border-radius: 9px;
  background: #f8fafc;
  color: #64748b;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.legal-modal-close:hover,
.legal-modal-close:focus-visible {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #2563eb;
  outline: none;
}

.legal-modal-scroll {
  min-height: 260px;
  overflow-y: auto;
  background: #f8fafc;
}

.legal-modal-meta {
  padding: 10px 22px;
  display: flex;
  gap: 12px;
  border-bottom: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 12px;
  font-weight: 850;
}

.legal-modal-body {
  padding: 16px 22px 22px;
  background: #fbfcfe;
  color: #263244;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.62;
}

.legal-modal-body h2 {
  margin: 15px 0 6px;
  font-size: 14px;
  font-weight: 950;
}

.legal-modal-body h2:first-child {
  margin-top: 0;
}

.legal-modal-body p {
  margin: 3px 0;
}

.legal-modal-body .legal-bullet {
  margin: 4px 0;
  padding-left: 13px;
}

.legal-modal-body .legal-bullet::before {
  top: 0.74em;
  width: 3px;
  height: 3px;
}

.legal-modal-body .legal-doc-gap {
  height: 8px;
}

.legal-modal-actions {
  padding: 14px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid #e2e8f0;
  background: #fbfcfe;
}

.legal-modal-actions .btn {
  min-width: 118px;
}

@media (max-width: 900px) {
  .auth-container {
    align-items: flex-start;
    padding: 28px 20px;
  }

  .auth-shell,
  .auth-shell-register {
    width: min(100%, 460px);
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .auth-context {
    padding: 0;
  }

  .auth-showcase {
    display: none;
  }

  .auth-card {
    padding: 26px 24px;
  }
}

@media (max-width: 480px) {
  .auth-container {
    padding: 24px 14px;
  }

  .auth-brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 9px;
  }

  .auth-card {
    padding: 22px 18px;
    border-radius: 10px;
  }

  .auth-header {
    margin-bottom: 18px;
  }

  .auth-header h1 {
    font-size: 22px;
  }

  .auth-footer {
    justify-content: space-between;
  }

  .auth-footer-center {
    justify-content: center;
  }

  .auth-legal-check {
    align-items: flex-start;
  }

  .legal-document-page,
  .legal-agreement-page {
    padding: 18px 12px;
  }

  .legal-document-header,
  .legal-agreement-header,
  .legal-document-body,
  .legal-agreement-form {
    padding-left: 18px;
    padding-right: 18px;
  }

  .legal-document-header {
    flex-direction: column;
  }

  .legal-document-meta {
    padding-left: 18px;
    padding-right: 18px;
    flex-direction: column;
    gap: 6px;
  }

  .legal-agreement-item {
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .legal-text-link {
    grid-column: 2;
    justify-self: start;
    padding: 0;
  }

  .legal-agreement-actions {
    flex-direction: column-reverse;
  }

  .legal-agreement-actions .btn {
    width: 100%;
  }

  .legal-modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }

  .legal-modal {
    max-height: 88vh;
    border-radius: 14px 14px 0 0;
  }

  .legal-modal-header,
  .legal-modal-body,
  .legal-modal-meta,
  .legal-modal-actions {
    padding-left: 16px;
    padding-right: 16px;
  }

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

  .legal-modal-actions .btn {
    width: 100%;
  }
}

/* 날짜 조회: 네이티브 달력 아이콘 영역이 보이고 클릭 가능하도록 */
input[type="date"].form-control {
  cursor: pointer;
}

input[type="date"].form-control::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.75;
  padding: 4px;
  margin-left: 2px;
}

input[type="date"].form-control::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* ====== BUTTONS ====== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  border: none;
  transition: all var(--transition-base);
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.btn-secondary {
  background: var(--glass-bg);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-success {
  background: var(--gradient-green);
  color: white;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
  padding: 6px 12px;
  font-size: var(--font-xs);
}

.btn-lg {
  width: 100%;
  padding: 14px;
  font-size: var(--font-md);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ====== PAGE LAYOUT ====== */
.page-container {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* Fallback for simple pages like settings/users */
.page-simple {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

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

.page-title {
  font-size: var(--font-lg);
  font-weight: 700;
}

.page-title .gradient-text {
  color: var(--accent-blue);
}

/* ====== PROFILE PAGE ====== */
.profile-page {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 32px clamp(24px, 4vw, 56px) 56px;
  background: linear-gradient(180deg, #f7f9fc 0%, #eef3f9 100%);
}

.profile-page-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.profile-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding: 24px 26px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fbfcfe;
  box-shadow: 0 14px 36px rgba(30, 41, 59, 0.07);
}

.profile-hero-main {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.profile-avatar-large {
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  border-radius: 14px;
  background: #1d4ed8;
  color: #f8fbff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.2);
}

.profile-avatar-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.profile-avatar-trigger {
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.2);
}

.profile-avatar-trigger .profile-avatar-large {
  box-shadow: none;
}

.profile-avatar-trigger:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 3px;
}

.profile-avatar-trigger:disabled {
  cursor: wait;
}

.profile-avatar-camera {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  background: rgba(15, 23, 42, 0.62);
  color: #f8fafc;
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}

.profile-avatar-camera svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-avatar-trigger:hover .profile-avatar-camera,
.profile-avatar-trigger:focus-visible .profile-avatar-camera,
.profile-avatar-trigger.is-loading .profile-avatar-camera {
  opacity: 1;
  transform: scale(1);
}

.profile-avatar-trigger.is-loading .profile-avatar-camera svg {
  animation: avatarCameraPulse 0.9s ease-in-out infinite;
}

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

.profile-avatar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-image-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
  white-space: nowrap;
}

.profile-image-button.subtle {
  color: #64748b;
  background: #f8fafc;
  border-color: #dbe4f0;
}

.profile-hero-copy {
  min-width: 0;
}

.profile-eyebrow,
.profile-section-kicker {
  margin-bottom: 4px;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.profile-hero-copy h1 {
  margin: 0;
  color: #0f172a;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.18;
}

.profile-hero-copy p {
  margin-top: 8px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.55;
}

.profile-role-card {
  min-width: 150px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eef5ff;
}

.profile-role-card span {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.profile-role-card strong {
  display: block;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 800;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  gap: 20px;
  align-items: start;
}

.profile-panel {
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fbfcfe;
  box-shadow: 0 14px 34px rgba(30, 41, 59, 0.055);
  padding: 24px 26px;
}

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

.profile-panel-header h2 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
  font-weight: 800;
}

.profile-panel-header p:not(.profile-section-kicker) {
  margin-top: 6px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.profile-info-list {
  display: block;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}

.profile-info-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid #e8eef6;
}

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

.profile-info-item dt {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.profile-info-item dd {
  margin: 0;
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.profile-security-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-security-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 2px 0 18px;
  border-bottom: 1px solid #e2e8f0;
  background: transparent;
}

.profile-security-icon {
  width: 42px;
  height: 42px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eef5ff;
  color: #1d4ed8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.profile-security-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-security-copy {
  min-width: 0;
}

.profile-security-copy h3 {
  margin: 0;
  color: #0f172a;
  font-size: 14px;
  font-weight: 800;
}

.profile-security-copy p {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.profile-security-action {
  white-space: nowrap;
}

.profile-security-note,
.profile-modal-guide {
  padding: 13px 14px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f7f9fc;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.profile-security-note strong,
.profile-modal-guide strong {
  display: block;
  margin-bottom: 4px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.profile-security-note p,
.profile-modal-guide p {
  margin: 0;
}

.profile-notification-panel {
  grid-column: 1 / -1;
}

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

.profile-slack-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid #dbe5f2;
  border-radius: 8px;
  background: #f8fbff;
}

.profile-slack-card.is-disabled {
  background: #f8fafc;
}

.profile-slack-copy {
  min-width: 0;
}

.profile-slack-copy strong,
.profile-slack-account strong {
  display: block;
  color: #0f172a;
  font-size: 13px;
  font-weight: 850;
}

.profile-slack-copy p,
.profile-slack-account span,
.profile-slack-status {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.profile-slack-status {
  margin: 0;
  padding: 6px 10px;
  border: 1px solid #dbe5f2;
  border-radius: 999px;
  background: #ffffff;
}

.profile-slack-account {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-slack-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #e9eff8;
  color: #2563eb;
  font-size: 13px;
  font-weight: 900;
}

.profile-slack-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-slack-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-slack-actions .btn,
.profile-slack-connect {
  min-height: 36px;
  border-radius: 8px;
  white-space: nowrap;
}

.profile-slack-actions .btn.danger {
  border-color: #fecaca;
  background: #fff7f7;
  color: #b91c1c;
}

.profile-channel-selector {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid #dbe5f2;
  border-radius: 8px;
  background: #fbfdff;
}

.profile-channel-selector-copy strong {
  display: block;
  color: #0f172a;
  font-size: 13px;
  font-weight: 850;
}

.profile-channel-selector-copy p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.profile-channel-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.profile-channel-option {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 11px 13px;
  border: 1px solid #dbe5f2;
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.profile-channel-option:hover {
  border-color: #bfcef4;
  background: #f3f7ff;
}

.profile-channel-option.is-selected {
  border-color: #2563eb;
  background: #eef4ff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.profile-channel-option.is-disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.profile-channel-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.profile-channel-option strong,
.profile-channel-option small {
  display: block;
}

.profile-channel-option strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 850;
}

.profile-channel-option small {
  margin-top: 3px;
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.3;
}

.profile-notification-group {
  min-width: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}

.profile-notification-group h3 {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
}

.profile-notification-list {
  display: flex;
  flex-direction: column;
}

.profile-notification-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 15px 16px;
  border-bottom: 1px solid #e8eef6;
}

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

.profile-notification-copy {
  min-width: 0;
}

.profile-notification-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.profile-notification-title-row strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}

.profile-notification-copy p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.profile-notification-channels {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-channel-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #475569;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.profile-channel-toggle.is-disabled {
  color: #94a3b8;
}

.profile-notification-single-toggle {
  justify-self: end;
}

.profile-notification-switch {
  position: relative;
  display: inline-flex;
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
  cursor: pointer;
}

.profile-notification-switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
}

.profile-notification-switch span {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #cbd5e1;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.profile-notification-switch span::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f8fafc;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.22);
  transition: transform 0.18s ease;
}

.profile-notification-switch input:checked + span {
  background: #2563eb;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.22);
}

.profile-notification-switch input:checked + span::after {
  transform: translateX(18px);
}

.profile-notification-switch input:focus-visible + span {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 3px;
}

.profile-notification-switch input:disabled + span {
  cursor: not-allowed;
  opacity: 0.74;
}

.profile-notification-empty {
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.profile-password-modal-overlay {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
}

.profile-password-modal {
  max-width: 480px;
  padding: 24px;
  border-radius: 8px;
  background: #fbfcfe;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.profile-password-modal .modal-header {
  margin-bottom: 16px;
}

.profile-password-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.profile-form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.profile-form-field label {
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.profile-form-field .form-control {
  min-height: 42px;
}

.profile-password-hint {
  margin: 0;
  padding: 12px 13px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.profile-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.profile-modal-actions .btn {
  min-width: 110px;
  min-height: 40px;
  font-weight: 800;
}

/* ====== TICKET WORKSPACE ====== */
.ticket-workspace-page {
  height: 100vh;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: #eef3f9;
}

.ticket-workspace {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 20px 0;
  overflow: hidden;
}

.ticket-workspace.ticket-drawer-pinned {
  display: grid;
  grid-template-columns: minmax(320px, 28vw) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
}

.ticket-workspace.ticket-drawer-pinned .ticket-workspace-toolbar {
  grid-column: 2;
  grid-row: 1;
}

.ticket-workspace-toolbar {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fbfcfe;
  box-shadow: 0 10px 28px rgba(30, 41, 59, 0.06);
}

.ticket-workspace-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.ticket-workspace-title .page-title {
  margin: 0;
  color: #0f172a;
}

.ticket-workspace-title p {
  margin-top: 3px;
  max-width: 64ch;
  color: #64748b;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-drawer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  white-space: nowrap;
}

.ticket-drawer-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ticket-drawer-backdrop {
  position: absolute;
  inset: 0;
  z-index: 45;
  background: rgba(15, 23, 42, 0.05);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out;
}

.ticket-drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.pane-list.ticket-list-drawer {
  position: absolute;
  top: 90px;
  left: 20px;
  bottom: 0;
  z-index: 60;
  width: 30vw;
  min-width: 360px;
  max-width: 480px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fbfcfe;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateX(calc(-100% - 36px));
  opacity: 0;
  pointer-events: none;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), opacity 160ms ease-out;
}

.ticket-workspace.ticket-drawer-pinned .pane-list.ticket-list-drawer {
  position: relative;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  grid-column: 1;
  grid-row: 1 / 3;
  width: auto;
  min-width: 0;
  max-width: none;
  height: 100%;
  min-height: 0;
  transform: none;
  opacity: 1;
  pointer-events: auto;
  box-shadow: 0 14px 34px rgba(30, 41, 59, 0.065);
}

.ticket-workspace.ticket-drawer-pinned .ticket-drawer-backdrop {
  display: none;
}

.ticket-workspace.ticket-drawer-pinned .pane-detail.ticket-split-detail {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
}

.pane-list.ticket-list-drawer.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.ticket-list-drawer .pane-list-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: #fbfcfe;
  border-bottom: 1px solid #e2e8f0;
}

.ticket-list-drawer .pane-list-content {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 14px 16px;
  background: #f7f9fc;
}

.ticket-list-loading-overlay {
  position: sticky;
  top: calc(50% - 24px);
  z-index: 5;
  display: none;
  width: 100%;
  height: 0;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.ticket-list-drawer .pane-list-content.is-loading .ticket-list-loading-overlay {
  display: flex;
}

.ticket-list-drawer .pane-list-content.is-loading .ticket-list,
.ticket-list-drawer .pane-list-content.is-loading .pagination {
  opacity: 0.52;
  transition: opacity 160ms ease-out;
}

.ticket-list-loading-overlay .spinner {
  width: 30px;
  height: 30px;
  border-width: 3px;
  background: rgba(247, 249, 252, 0.78);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
}

.ticket-list-drawer .ticket-list {
  gap: 10px;
}

.ticket-list-drawer .ticket-card {
  min-height: 76px !important;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 12px 14px !important;
  border-color: #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.ticket-list-drawer .ticket-card:hover {
  border-color: #bfdbfe;
  background: #f8fbff;
  transform: none;
}

.ticket-list-drawer .ticket-card.active {
  border-color: #a78bfa;
  background: #f5f3ff;
  box-shadow: 0 8px 18px rgba(124, 58, 237, 0.12);
  transform: none;
}

.ticket-list-drawer .ticket-priority-bar {
  display: none;
}

.ticket-list-drawer .ticket-body {
  gap: 4px !important;
}

.ticket-list-drawer .ticket-title {
  margin-bottom: 0 !important;
  color: #0f172a;
  font-size: 13px !important;
  font-weight: 800;
}

.ticket-list-drawer .ticket-right {
  min-width: 72px !important;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
}

.ticket-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ticket-drawer-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ticket-drawer-title {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
  font-weight: 800;
}

.ticket-drawer-close {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.ticket-drawer-pin {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.ticket-drawer-pin svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ticket-drawer-close:hover,
.ticket-drawer-pin:hover,
.ticket-drawer-pin.active {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.ticket-drawer-pin.active {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ticket-status-filter {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #eef3f9;
}

.ticket-status-filter .stats-item {
  min-width: 0;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.ticket-status-filter .stats-item:hover {
  background: #fbfcfe;
}

.ticket-status-filter .stats-item.active {
  background: #ffffff;
  color: #1d4ed8;
  box-shadow: 0 1px 4px rgba(30, 41, 59, 0.08);
}

.ticket-status-filter .stats-item span {
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.ticket-status-filter .stats-item strong {
  color: #0f172a;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.15;
}

.ticket-new-badge {
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #fecaca;
  border-radius: 999px;
  background: #fff1f2;
  color: #e11d48;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  vertical-align: 1px;
}

.ticket-card.has-unread-replies .ticket-title {
  color: #0f172a;
  font-weight: 900;
}

.drawer-filter-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(132px, 0.72fr) 34px;
  gap: 6px;
}

.drawer-filter-control,
.drawer-date-filter .form-control {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 34px;
  padding: 6px 10px;
  border-color: #cbd5e1;
  border-radius: 8px;
  background-color: #ffffff;
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
}

.drawer-filter-control:focus,
.drawer-date-filter .form-control:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.drawer-filter-icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.drawer-filter-icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drawer-filter-icon-btn:hover,
.drawer-filter-icon-btn.active {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.drawer-date-filter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f7f9fc;
}

.drawer-date-filter > span {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 800;
}

.smart-date-field {
  position: relative;
  min-width: 0;
}

.drawer-date-filter .smart-date-input {
  padding-right: 32px;
  letter-spacing: 0;
}

.smart-date-input.is-invalid {
  border-color: #fca5a5;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.smart-date-picker-button {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transform: translateY(-50%);
  transition: color 150ms ease;
}

.smart-date-picker-button:hover {
  color: #1d4ed8;
}

.smart-date-picker-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.smart-date-popover {
  position: fixed;
  z-index: 1200;
  width: 240px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow: auto;
  padding: 8px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.smart-date-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 4px;
  color: #0f172a;
  font-size: 12px;
}

.smart-date-popover-header strong {
  font-weight: 800;
}

.smart-date-nav {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.smart-date-nav:hover {
  background: #f1f5f9;
  color: #1d4ed8;
}

.smart-date-nav svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.smart-date-weekdays,
.smart-date-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.smart-date-weekdays {
  margin-bottom: 4px;
}

.smart-date-weekdays span {
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 800;
}

.smart-date-day {
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.smart-date-day:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

.smart-date-day.muted {
  color: #cbd5e1;
}

.smart-date-day.today:not(.selected) {
  box-shadow: inset 0 0 0 1px #93c5fd;
}

.smart-date-day.selected {
  background: #2563eb;
  color: #ffffff;
}

.date-preset-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.date-preset-btn {
  min-height: 30px;
  border: 1px solid #dbe3ef;
  border-radius: 7px;
  background: #ffffff;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.date-preset-btn:hover {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.drawer-advanced-panel {
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 8px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f7f9fc;
}

.drawer-search-button {
  width: 100%;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.pane-detail.ticket-split-detail {
  flex: 1;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  background: transparent;
}

.ticket-detail-shell {
  --ticket-question-fr: 3fr;
  --ticket-reply-fr: 2fr;
  flex: 1;
  height: auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, var(--ticket-question-fr)) 0 minmax(360px, var(--ticket-reply-fr));
  gap: 12px;
}

.ticket-split-resizer {
  position: relative;
  z-index: 40;
  width: 22px;
  height: 100%;
  align-self: stretch;
  justify-self: center;
  display: flex;
  align-items: stretch;
  justify-content: center;
  cursor: col-resize;
  touch-action: none;
  opacity: 0;
  transition: opacity 140ms ease, transform 140ms ease;
}

.ticket-split-resizer::before {
  content: "";
  position: absolute;
  inset: 0 -8px;
}

.ticket-split-resizer span {
  width: 3px;
  min-height: 100%;
  border-radius: 999px;
  background: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1), 0 8px 22px rgba(37, 99, 235, 0.2);
}

.ticket-split-resizer:hover,
.ticket-split-resizer:focus-visible,
.ticket-detail-shell.is-resizing .ticket-split-resizer {
  opacity: 1;
}

.ticket-split-resizer:focus-visible {
  outline: 0;
}

.ticket-split-resizer:focus-visible span {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18), 0 8px 22px rgba(37, 99, 235, 0.22);
}

body.is-ticket-split-resizing {
  cursor: col-resize;
  user-select: none;
}

.ticket-detail-panel {
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fbfcfe;
  box-shadow: 0 14px 34px rgba(30, 41, 59, 0.055);
  overflow: hidden;
}

.ticket-panel-header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e2e8f0;
  background: #fbfcfe;
}

.ticket-panel-heading {
  min-width: 0;
  flex: 1;
}

.ticket-panel-kicker {
  margin-bottom: 5px;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.ticket-panel-header h2 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}

.ticket-control-panel {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 0 0 auto;
  max-width: 330px;
}

.ticket-control-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 128px;
}

.ticket-control-field span {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.ticket-control-field .form-control {
  min-height: 34px;
  padding: 6px 32px 6px 10px;
  border-color: #cbd5e1;
  background-color: #ffffff;
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
}

.ticket-control-readonly {
  min-height: 56px;
  justify-content: flex-end;
  padding: 8px 10px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f7f9fc;
}

.ticket-control-readonly strong {
  color: #1d4ed8;
  font-size: 12px;
  line-height: 1.35;
}

.ticket-customer-control-panel {
  max-width: 430px;
}

.ticket-delete-button {
  min-height: 40px;
  align-self: flex-end;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 850;
}

.ticket-shared-badge {
  margin-left: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  vertical-align: middle;
}

.ticket-question-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 18px;
}

.ticket-meta-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 8px;
  padding: 4px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #eef3f9;
}

.ticket-meta-strip div {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fbfcfe;
}

.ticket-meta-strip span {
  display: block;
  margin-bottom: 3px;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.ticket-meta-strip strong {
  display: block;
  color: #0f172a;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.detail-content.ticket-content {
  margin-bottom: 0;
  background: #ffffff;
  padding: 22px 24px;
  line-height: 1.75;
  white-space: normal;
}

.detail-content.ticket-content #ticket-content-inner {
  white-space: normal;
}

.detail-content.ticket-content #ticket-content-inner > :first-child {
  margin-top: 0;
}

.detail-content.ticket-content #ticket-content-inner > :last-child {
  margin-bottom: 0;
}

.ticket-conversation-panel .reply-thread {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 14px 16px;
  gap: 12px;
}

.ticket-conversation-panel .reply-form {
  position: relative;
  flex: 0 0 auto;
  flex-direction: column;
  margin: 0;
  padding: 20px 16px 16px;
  border: 0;
  border-top: 1px solid #e2e8f0;
  border-radius: 0;
  background: #ffffff;
  z-index: 10;
}

.ticket-conversation-panel .ql-container {
  min-height: 92px;
  max-height: 360px;
}

.ticket-conversation-panel .file-drop-zone {
  background: #f8fafc !important;
}

.ticket-conversation-panel #reply-file-drop-zone {
  min-height: 48px !important;
  padding: 10px 12px !important;
  align-items: center !important;
  justify-content: center !important;
  border-color: #dbe3ef !important;
  background: #f8fafc !important;
}

.ticket-conversation-panel #reply-drop-zone-placeholder {
  margin-top: 0 !important;
  color: #64748b !important;
  font-size: 12px;
  font-weight: 800;
}

.ticket-conversation-panel #reply-submit {
  min-width: 104px;
  min-height: 42px;
  padding: 0 20px !important;
  border-radius: 8px;
  font-size: 13px !important;
  font-weight: 900 !important;
  transform: none !important;
}

.ticket-conversation-panel .reply-section-title {
  margin: 0;
}

.ticket-sheet-handle,
.ticket-reply-sheet-button {
  display: none;
}

/* ====== SPLIT PANES ====== */
.pane-list {
  width: 450px;
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  flex-shrink: 0;
}

.pane-list-header {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--glass-border);
}

.pane-list-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pane-detail {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  position: relative;
}

.pane-detail-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pane-detail-body {
  flex: 1;
  overflow: hidden;
  padding: 24px;
  display: flex;
  height: 100%;
}

.detail-main {
  flex: 1;
  min-width: 0;
  padding-right: 24px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.detail-meta-sidebar {
  width: 200px;
  flex-shrink: 0;
  border-left: 1px solid var(--glass-border);
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.empty-detail {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all var(--transition-base);
  animation: fadeIn 0.4s ease-out forwards;
  opacity: 0;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 58, 237, 0.3);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.1);
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.stat-card:nth-child(5) { animation-delay: 0.25s; }

.stat-label {
  font-size: var(--font-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: var(--font-2xl);
  font-weight: 800;
}

.stat-value.purple { color: var(--accent-purple); }
.stat-value.blue { color: var(--accent-blue); }
.stat-value.cyan { color: var(--accent-cyan); }
.stat-value.green { color: var(--accent-green); }
.stat-value.yellow { color: var(--accent-yellow); }
.stat-value.red { color: var(--accent-red); }

/* ====== FILTER BAR ====== */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar .form-control {
  width: auto;
  min-width: 150px;
  padding: 8px 14px;
  font-size: var(--font-sm);
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrap .form-control {
  padding-left: 36px;
}

.search-input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* ====== TICKET LIST ====== */
.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ticket-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  cursor: pointer;
  transition: all var(--transition-base);
  animation: fadeIn 0.3s ease-out forwards;
  opacity: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 92px;
}

.ticket-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(124, 58, 237, 0.25);
  transform: translateX(4px);
}

.ticket-card.active {
  background: rgba(124, 58, 237, 0.08);
  border-color: var(--accent-purple);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.1);
  transform: translateX(4px);
}

.ticket-card:nth-child(1) { animation-delay: 0.03s; }
.ticket-card:nth-child(2) { animation-delay: 0.06s; }
.ticket-card:nth-child(3) { animation-delay: 0.09s; }
.ticket-card:nth-child(4) { animation-delay: 0.12s; }
.ticket-card:nth-child(5) { animation-delay: 0.15s; }
.ticket-card:nth-child(6) { animation-delay: 0.18s; }
.ticket-card:nth-child(7) { animation-delay: 0.21s; }
.ticket-card:nth-child(8) { animation-delay: 0.24s; }
.ticket-card:nth-child(9) { animation-delay: 0.27s; }
.ticket-card:nth-child(10) { animation-delay: 0.30s; }

.ticket-priority-bar {
  width: 4px;
  min-height: 48px;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: stretch;
}

.priority-low { background: var(--accent-green); }
.priority-medium { background: var(--accent-blue); }
.priority-high { background: var(--accent-orange); }
.priority-urgent { background: var(--accent-red); }

.ticket-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ticket-title {
  font-size: var(--font-md);
  font-weight: 600;
  margin-bottom: 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ticket-title .badge {
  margin-left: 8px;
  vertical-align: middle;
}

.ticket-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: var(--font-xs);
  color: var(--text-muted);
  flex-wrap: nowrap;
  overflow: hidden;
}

.ticket-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.ticket-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.ticket-date-time-left {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ====== STATUS & PRIORITY BADGES ====== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: var(--font-xs);
  font-weight: 600;
  white-space: nowrap;
}

.badge-open {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.3);
}

.badge-in_progress {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-resolved {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-closed {
  background: rgba(107, 107, 141, 0.15);
  color: #9ca3af;
  border: 1px solid rgba(107, 107, 141, 0.3);
}

.badge-priority-low {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
}

.badge-priority-medium {
  background: rgba(37, 99, 235, 0.1);
  color: #60a5fa;
}

.badge-priority-high {
  background: rgba(249, 115, 22, 0.1);
  color: #fb923c;
}

.badge-priority-urgent {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  animation: pulse 2s infinite;
}

.badge-admin {
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(124, 58, 237, 0.3);
}

.badge-customer {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-count {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 2px 8px;
}

/* ====== TICKET DETAIL ====== */
.ticket-detail {
  animation: fadeIn 0.4s ease-out;
}

.detail-header {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
}

.detail-title {
  font-size: var(--font-xl);
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-info {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

.detail-info-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-content {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-attachments {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
  white-space: normal;
}

.detail-attachments > span {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: #475569;
  font-size: 12px !important;
  font-weight: 850 !important;
  line-height: 1.3;
}

.attachment-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 0;
  white-space: normal;
}

.attachment-item {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  white-space: normal;
  transition: all var(--transition-base);
}

.attachment-item:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.attachment-item-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #eaf2ff;
  color: #2563eb;
}

.attachment-item-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.attachment-item-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-item-size {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
  margin-left: auto;
}

/* ====== REPLY THREAD ====== */
.reply-section {
  margin-bottom: 24px;
}

.reply-section-title {
  font-size: var(--font-md);
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.reply-thread {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reply-item {
  display: flex;
  gap: 12px;
  animation: fadeIn 0.3s ease-out;
}

.reply-item.admin-reply {
  flex-direction: row-reverse;
}

.reply-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-xs);
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.reply-item:not(.admin-reply) .reply-avatar {
  background: linear-gradient(135deg, #06b6d4, #2563eb);
}

.reply-item.admin-reply .reply-avatar {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
}

.reply-bubble {
  width: max-content;
  max-width: 100%;
  min-width: min(92px, 100%);
  box-sizing: border-box;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.reply-item.admin-reply .reply-bubble {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.2);
}

.reply-bubble.reply-bubble-internal {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: #166534;
}

.reply-bubble.reply-bubble-internal .reply-content {
  color: inherit;
}

.reply-internal-icon {
  color: #64748b;
  flex-shrink: 0;
}

.reply-header {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 8px;
  font-size: var(--font-xs);
}

.reply-author {
  font-weight: 600;
  color: var(--text-primary);
}

.reply-time {
  color: var(--text-muted);
}

.reply-content {
  font-size: var(--font-sm);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: break-word;
  line-break: strict;
}

/* Reply form */
.reply-form {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 24px;
}

.reply-form-title {
  font-size: var(--font-sm);
  font-weight: 600;
  margin-bottom: 12px;
}

/* ====== 새 문의 등록 ====== */
.ticket-create-container {
  display: block;
  overflow: hidden;
  background: #eef3f9;
}

.ticket-create-page {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 28px clamp(20px, 3vw, 40px) 42px;
  color: #0f172a;
}

.ticket-create-form {
  --ticket-side-width: 332px;
  --ticket-grid-gap: 16px;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

.ticket-create-header {
  margin-bottom: 16px;
  display: block;
}

.ticket-create-header h1 {
  margin: 0;
  color: #0f172a;
  font-size: 25px;
  font-weight: 850;
  line-height: 1.2;
}

.ticket-create-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--ticket-side-width);
  gap: var(--ticket-grid-gap);
  align-items: start;
}

.ticket-create-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ticket-create-section,
.ticket-create-side-card {
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fbfcfe;
  box-shadow: 0 14px 34px rgba(30, 41, 59, 0.055);
}

.ticket-create-section {
  padding: 18px;
}

.ticket-create-section-head {
  margin-bottom: 14px;
}

.ticket-create-section-head h2,
.ticket-create-side-card h2 {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
  font-weight: 850;
}

.ticket-create-section-head h2 strong {
  color: #dc2626;
}

.ticket-create-section-head p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.ticket-create-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.ticket-create-field span {
  color: #334155;
  font-size: 12px;
  font-weight: 850;
}

.ticket-create-field span strong {
  color: #dc2626;
}

.ticket-create-field small {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.ticket-create-field .form-control {
  min-height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background-color: #fdfefe;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
}

.ticket-create-field .form-control:focus {
  border-color: #93c5fd;
  background-color: #fdfefe;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.ticket-create-field .form-control::placeholder {
  color: #94a3b8;
}

.ticket-create-field-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ticket-editor-shell {
  overflow: hidden;
  border-radius: 8px;
}

.ticket-editor-shell .ql-toolbar.ql-snow {
  border-color: #dbe3ef !important;
  background: #f8fafc;
}

.ticket-editor-shell .ql-container.ql-snow {
  min-height: 340px;
  height: clamp(300px, 38vh, 420px);
  border-color: #dbe3ef !important;
  background: #fdfefe;
  color: #0f172a !important;
}

.ticket-editor-shell .ql-editor {
  padding: 16px;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.7;
}

.ticket-editor-shell .ql-editor.ql-blank::before {
  color: #94a3b8 !important;
}

.ticket-editor-shell .ql-snow .ql-stroke {
  stroke: #475569 !important;
}

.ticket-editor-shell .ql-snow .ql-fill {
  fill: #475569 !important;
}

.ticket-editor-shell .ql-snow .ql-picker {
  color: #475569 !important;
}

.ql-snow .ql-tooltip[hidden],
.ql-snow .ql-tooltip.ql-hidden {
  display: none !important;
  visibility: hidden !important;
}

.ql-snow .ql-tooltip.ql-hidden::before,
.ql-snow .ql-tooltip.ql-hidden a.ql-action::after,
.ql-snow .ql-tooltip.ql-hidden a.ql-remove::before {
  content: "" !important;
}

.ticket-create-aside {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ticket-create-side-card {
  padding: 16px;
}

.ticket-share-option {
  margin-top: 14px;
  padding: 11px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
}

.ticket-share-option input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: #2563eb;
}

.ticket-share-option strong {
  display: block;
}

.ticket-share-option strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
}

.ticket-priority-note {
  margin-top: 10px;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
}

.ticket-priority-note[hidden] {
  display: none;
}

.ticket-priority-note.urgent {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.ticket-priority-note strong {
  font-size: 11px;
  font-weight: 850;
}

.ticket-create-summary dl {
  margin: 14px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ticket-create-summary dl div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eef2f7;
}

.ticket-create-summary dl div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.ticket-create-summary dt {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.ticket-create-summary dd {
  margin: 0;
  color: #0f172a;
  font-size: 12px;
  font-weight: 850;
  text-align: right;
}

.ticket-create-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.ticket-create-actions .btn {
  min-height: 42px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 850;
}

.ticket-create-actions .btn-primary {
  background: #2563eb;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.2);
}

.ticket-create-actions .btn-secondary {
  border-color: #dbe3ef;
  background: #fbfcfe;
  color: #334155;
}

.ticket-upload-area.file-upload-area {
  margin-top: 0;
}

.ticket-upload-area .ticket-drop-zone.file-drop-zone {
  min-height: 132px;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  box-sizing: border-box;
  font-size: inherit;
}

.ticket-upload-area .ticket-drop-zone.file-drop-zone.has-files {
  min-height: 0;
  padding: 12px;
  justify-content: flex-start;
}

.ticket-upload-area .ticket-drop-zone.file-drop-zone:hover,
.ticket-upload-area .ticket-drop-zone.file-drop-zone.drag-over {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.ticket-drop-placeholder {
  width: 100%;
  min-height: 130px;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
  box-sizing: border-box;
}

.ticket-drop-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
}

.ticket-drop-icon svg,
.ticket-file-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ticket-drop-placeholder strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.ticket-drop-placeholder span:last-child {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.ticket-upload-area .ticket-file-list.file-preview-list {
  width: 100%;
  margin-top: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.ticket-upload-area .ticket-file-list.file-preview-list:empty {
  display: none;
}

.ticket-file-item {
  min-width: 0;
  padding: 10px;
  gap: 9px;
  border-color: #dbe3ef;
  border-radius: 8px;
  background: #fdfefe;
  cursor: default;
}

.ticket-file-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
}

.ticket-file-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ticket-file-info strong {
  overflow: hidden;
  color: #0f172a;
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-file-info small {
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
}

.ticket-file-item .file-remove-btn {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
}

.ticket-file-item .file-remove-btn:hover,
.ticket-file-item .file-remove-btn:focus-visible {
  background: #fee2e2;
  outline: none;
}

@media (max-width: 1024px) {
  .ticket-create-layout {
    grid-template-columns: 1fr;
  }

  .ticket-create-aside {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ticket-create-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .ticket-create-container {
    height: calc(100dvh - var(--mobile-nav-height) - env(safe-area-inset-bottom));
  }

  .ticket-create-page {
    padding: 16px 12px 156px;
  }

  .ticket-create-header {
    margin-bottom: 12px;
  }

  .ticket-create-header h1 {
    font-size: 24px;
  }

  .ticket-create-section {
    padding: 14px;
  }

  .ticket-create-field-grid {
    grid-template-columns: 1fr;
  }

  .ticket-editor-shell .ql-toolbar.ql-snow {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    padding: 8px;
  }

  .ticket-editor-shell .ql-container.ql-snow {
    min-height: 300px;
    height: 34vh;
  }

  .ticket-create-aside {
    display: flex;
    flex-direction: column;
  }

  .ticket-create-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    z-index: 900;
    margin: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr);
    border-top: 1px solid #dbe3ef;
    background: rgba(248, 250, 252, 0.96);
    box-shadow: 0 -12px 28px rgba(15, 23, 42, 0.08);
  }

  .ticket-create-actions .btn {
    width: 100%;
    min-height: 44px;
  }

  .ticket-file-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .ticket-create-page {
    padding-left: 14px;
    padding-right: 14px;
  }

  .ticket-create-actions {
    padding-left: 14px;
    padding-right: 14px;
  }

  .ticket-upload-area .ticket-drop-zone.file-drop-zone {
    min-height: 120px;
  }

  .ticket-drop-placeholder {
    min-height: 118px;
  }

  .ticket-drop-placeholder strong {
    white-space: normal;
  }
}

/* ====== FILE UPLOAD ====== */
.file-upload-area {
  margin-top: 12px;
}

.file-drop-zone {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  color: var(--text-muted);
  font-size: var(--font-sm);
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
  border-color: var(--accent-purple);
  background: rgba(124, 58, 237, 0.05);
  color: var(--accent-purple);
}

.file-drop-zone input[type="file"] {
  display: none;
}

.file-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 12px;
}

.file-preview-item {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-xs);
}

.file-remove-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all var(--transition-fast);
}

.file-remove-btn:hover {
  background: rgba(239, 68, 68, 0.3);
}

/* ====== ADMIN PANELS ====== */
.admin-panel {
  animation: fadeIn 0.4s ease-out;
}

.data-table-wrap {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 14px 20px;
  text-align: left;
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--glass-border);
}

.data-table td {
  padding: 14px 20px;
  font-size: var(--font-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

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

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ====== 고객사 관리 ====== */
.customer-management-page {
  --customer-management-max: 1280px;
  width: 100%;
  min-height: 100vh;
  padding: 28px clamp(20px, 3vw, 40px) 40px;
  background: #eef3f9;
  color: #0f172a;
  overflow-y: auto;
}

.customer-management-header {
  width: 100%;
  max-width: var(--customer-management-max);
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.customer-management-header h1 {
  margin: 0;
  color: #0f172a;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
}

.customer-management-tabs {
  width: 100%;
  max-width: var(--customer-management-max);
  margin: 0 auto 12px;
  padding: 0;
  display: flex;
  justify-content: flex-start;
  gap: 6px;
  border: 0;
  background: transparent;
}

.customer-management-tab {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.customer-management-tab:hover,
.customer-management-tab:focus-visible {
  background: #eff6ff;
  color: #1d4ed8;
  outline: none;
}

.customer-management-tab.active {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.customer-tab-alert {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 11px;
  font-weight: 800;
}

.customer-tab-alert strong {
  color: #9a3412;
  font-size: 11px;
}

.customer-management-panel {
  width: 100%;
  max-width: var(--customer-management-max);
  margin: 0 auto;
}

/* ====== 회사 관리 ====== */
.company-page {
  width: 100%;
  min-height: 100vh;
  padding: 28px clamp(20px, 3vw, 40px) 40px;
  background: #eef3f9;
  color: #0f172a;
  overflow-y: auto;
}

.company-page-embedded {
  min-height: 0;
  padding: 0;
  background: transparent;
  overflow: visible;
}

.company-header {
  max-width: 1280px;
  margin: 0 auto 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.company-page-embedded .company-header {
  max-width: none;
  margin: 0 0 12px;
  justify-content: flex-end;
}

.company-page-embedded .company-header > div {
  display: none;
}

.company-header h1 {
  margin: 0;
  color: #0f172a;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
}

.company-add-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border-radius: 8px;
}

.company-add-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.company-table-card {
  max-width: 1280px;
  margin: 0 auto;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fbfcfe;
  box-shadow: 0 14px 34px rgba(30, 41, 59, 0.055);
  overflow: hidden;
}

.company-page-embedded .company-table-card {
  max-width: none;
}

.company-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px 180px;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.company-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.company-search svg {
  position: absolute;
  left: 11px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #94a3b8;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.company-search input,
.company-filter {
  width: 100%;
  min-height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
}

.company-search input {
  padding: 7px 10px 7px 34px;
}

.company-filter {
  padding: 7px 30px 7px 10px;
}

.company-search input:focus,
.company-filter:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.company-table-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 9px 14px 0;
  background: #fbfcfe;
}

.company-result-count {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

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

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

.company-table th {
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: #fbfcfe;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  text-align: left;
}

.company-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #eef2f7;
  color: #0f172a;
  vertical-align: middle;
}

.company-table tr:last-child td {
  border-bottom: 0;
}

.company-table tbody tr:hover td {
  background: #f8fafc;
}

.company-table tr.is-inactive td {
  background: #fafafa;
  color: #64748b;
}

.company-name-cell,
.company-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.company-name-cell strong,
.company-stack strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.company-name-cell span,
.company-stack span,
.company-muted {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.company-status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.company-status-chip.active {
  border-color: #bbf7d0;
  background: #ecfdf3;
  color: #166534;
}

.company-status-chip.inactive {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.company-service-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 220px;
}

.company-service-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 800;
}

.company-ellipsis {
  max-width: 240px;
  overflow: hidden;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.company-icon-btn,
.company-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.company-icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
}

.company-icon-btn:hover {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.company-icon-btn svg,
.company-action-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.company-action-btn {
  gap: 5px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid;
  background: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.company-action-btn.danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.company-action-btn.success {
  border-color: #bbf7d0;
  background: #ecfdf3;
  color: #166534;
}

.company-empty-row td {
  padding: 0 !important;
}

.company-empty-state {
  padding: 36px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #64748b;
}

.company-empty-state strong {
  color: #0f172a;
  font-size: 14px;
}

.company-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 3400;
  display: flex;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.34);
  animation: companyDrawerFadeIn 160ms ease-out;
}

.company-drawer {
  width: min(640px, calc(100vw - 32px));
  height: 100dvh;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #dbe3ef;
  background: #f8fafc;
  box-shadow: -24px 0 48px rgba(15, 23, 42, 0.18);
  animation: companyDrawerSlideIn 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.company-drawer-header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 18px;
  border-bottom: 1px solid #dbe3ef;
  background: #fbfcfe;
}

.company-drawer-title {
  margin: 0;
  color: #0f172a;
  font-size: 19px;
  font-weight: 850;
  letter-spacing: 0;
}

.company-drawer-subtitle {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 750;
}

.company-drawer-close {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.company-drawer-close:hover,
.company-drawer-close:focus-visible {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  outline: none;
}

.company-form {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.company-drawer-form {
  min-height: 0;
  flex: 1 1 auto;
  padding: 0;
  gap: 0;
}

.company-drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 22px;
}

.company-drawer .form-control:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.company-form-section {
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fbfcfe;
  padding: 15px;
}

.company-form-section-title {
  margin-bottom: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
}

.company-form-section-title strong {
  color: #0f172a;
  font-size: 14px;
  font-weight: 800;
}

.company-form-section-title span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

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

.company-service-picker {
  min-height: 44px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
}

.company-service-picker .company-service-option {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fbfcfe;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.company-service-picker .company-service-option:hover,
.company-service-picker .company-service-option:focus-within {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.company-service-picker .company-service-option.is-selected,
.company-service-picker .company-service-option:has(input:checked) {
  border-color: #93c5fd;
  background: #eaf2ff;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.company-service-picker .company-service-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.company-service-check {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: transparent;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.company-service-check svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.company-service-option.is-selected .company-service-check,
.company-service-option:has(input:checked) .company-service-check {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
}

.company-service-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-drawer-actions {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid #dbe3ef;
  background: #fbfcfe;
}

.company-drawer-actions .btn {
  min-width: 92px;
  min-height: 38px;
  border-radius: 8px;
  font-weight: 800;
}

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

@keyframes companyDrawerSlideIn {
  from {
    transform: translateX(28px);
    opacity: 0.78;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ====== 담당자 관리 ====== */
.representative-page {
  width: 100%;
  min-height: 0;
  color: #0f172a;
}

.representative-table-card {
  width: 100%;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fbfcfe;
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.representative-toolbar {
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px 180px;
  gap: 8px;
  border-bottom: 1px solid #e2e8f0;
  background: #fbfcfe;
}

.representative-search {
  position: relative;
  min-width: 0;
}

.representative-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  fill: none;
  stroke: #64748b;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.representative-search input,
.representative-filter {
  width: 100%;
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
}

.representative-search input {
  padding: 0 12px 0 36px;
}

.representative-filter {
  padding: 0 10px;
}

.representative-search input:focus,
.representative-filter:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

.representative-sections {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}

.representative-section {
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.representative-section[hidden] {
  display: none;
}

.representative-section-header {
  min-height: 44px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.representative-section-header h2 {
  margin: 0;
  color: #0f172a;
  font-size: 14px;
  font-weight: 850;
}

.representative-section-header span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.representative-section.pending .representative-section-header h2 {
  color: #c2410c;
}

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

.representative-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.representative-table th {
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 850;
  text-align: left;
  white-space: nowrap;
}

.representative-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #eef2f7;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
}

.representative-table tr:last-child td {
  border-bottom: 0;
}

.representative-person-cell,
.representative-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.representative-person-cell strong,
.representative-stack strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.representative-person-cell span,
.representative-stack span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  word-break: break-word;
}

.representative-company-chip,
.representative-role-chip,
.representative-status-chip {
  min-height: 24px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.representative-company-chip {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.representative-company-chip.muted {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #64748b;
}

.representative-state-stack {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.representative-role-chip {
  border: 1px solid #dbe3ef;
  background: #f8fafc;
  color: #475569;
}

.representative-role-chip.admin {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.representative-status-chip.active {
  border: 1px solid #bbf7d0;
  background: #ecfdf3;
  color: #166534;
}

.representative-status-chip.inactive {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.representative-actions-cell {
  width: 1%;
  white-space: nowrap;
}

.representative-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 6px;
}

.representative-icon-btn,
.representative-action-btn {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.representative-icon-btn {
  width: 32px;
  border: 1px solid #dbe3ef;
  background: #ffffff;
  color: #475569;
}

.representative-action-btn {
  padding: 0 10px;
  border: 1px solid #dbe3ef;
  background: #ffffff;
  color: #334155;
}

.representative-icon-btn svg,
.representative-action-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.representative-icon-btn:hover,
.representative-icon-btn:focus-visible {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  outline: none;
}

.representative-action-btn.primary {
  border-color: #bfdbfe;
  background: #2563eb;
  color: #ffffff;
}

.representative-action-btn.primary:hover,
.representative-action-btn.primary:focus-visible {
  background: #1d4ed8;
  outline: none;
}

.representative-action-btn.danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #dc2626;
}

.representative-action-btn.danger:hover,
.representative-action-btn.danger:focus-visible {
  border-color: #fca5a5;
  background: #fee2e2;
  outline: none;
}

.representative-action-btn.success {
  border-color: #bbf7d0;
  background: #ecfdf3;
  color: #166534;
}

.representative-action-btn.success:hover,
.representative-action-btn.success:focus-visible {
  border-color: #86efac;
  background: #dcfce7;
  outline: none;
}

.representative-empty-state {
  padding: 34px 16px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
  color: #64748b;
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.representative-readonly-field {
  min-height: 42px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
}

.representative-readonly-field span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.representative-readonly-field strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 850;
}

.representative-check-option {
  min-height: 42px;
  margin-top: 12px;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.representative-check-option input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.representative-drawer-actions {
  align-items: center;
}

.representative-action-spacer {
  flex: 1 1 auto;
}

.representative-reset-button {
  border-color: #fecaca !important;
  background: #fef2f2 !important;
  color: #dc2626 !important;
}

.representative-reset-button:hover,
.representative-reset-button:focus-visible {
  border-color: #fca5a5 !important;
  background: #fee2e2 !important;
  outline: none;
}

@media (max-width: 768px) {
  .representative-toolbar {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .representative-sections {
    padding: 10px;
    gap: 10px;
  }

  .representative-section-header {
    padding: 0 12px;
  }

  .representative-table-wrap {
    overflow-x: visible;
  }

  .representative-table,
  .representative-table tbody,
  .representative-table tr,
  .representative-table td {
    display: block;
    width: 100%;
  }

  .representative-table thead {
    display: none;
  }

  .representative-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .representative-table tr {
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
  }

  .representative-table td {
    min-height: 42px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 10px;
    border-bottom: 1px solid #eef2f7;
    white-space: normal;
  }

  .representative-table td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 11px;
    font-weight: 850;
  }

  .representative-table td:last-child {
    border-bottom: 0;
  }

  .representative-person-cell strong,
  .representative-stack strong {
    white-space: normal;
  }

  .representative-actions-cell {
    width: 100%;
  }

  .representative-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .representative-drawer-actions {
    flex-wrap: wrap;
  }

  .representative-drawer-actions .btn {
    flex: 1 1 0;
  }

  .representative-action-spacer {
    display: none;
  }

  .representative-reset-button {
    flex-basis: 100% !important;
  }
}

.user-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

/* ====== MODAL ====== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease-out;
  padding: 24px;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
}

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

.modal-title {
  font-size: var(--font-lg);
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition-base);
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}

/* ====== STATUS CHANGE DROPDOWN ====== */
.status-dropdown {
  position: relative;
  display: inline-block;
}

.status-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 4px;
  z-index: 100;
  min-width: 160px;
  animation: fadeIn 0.15s ease-out;
  box-shadow: var(--glass-shadow);
}

.status-option {
  display: block;
  width: 100%;
  padding: 8px 14px;
  text-align: left;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: var(--font-sm);
  font-family: var(--font-family);
  cursor: pointer;
  border-radius: 4px;
  transition: background var(--transition-fast);
}

.status-option:hover {
  background: var(--glass-bg);
}

/* ====== 환경설정 ====== */
.settings-page {
  --settings-max: 1280px;
  width: 100%;
  min-height: 100vh;
  padding: 28px clamp(20px, 3vw, 40px) 40px;
  background: #eef3f9;
  color: #0f172a;
  overflow-y: auto;
}

.settings-page-header {
  width: 100%;
  max-width: var(--settings-max);
  margin: 0 auto 14px;
}

.settings-page-header h1 {
  margin: 0;
  color: #0f172a;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
}

.settings-tabs {
  width: 100%;
  max-width: var(--settings-max);
  margin: 0 auto 12px;
  display: flex;
  gap: 6px;
}

.settings-tab {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.settings-tab:hover,
.settings-tab:focus-visible {
  background: #eff6ff;
  color: #1d4ed8;
  outline: none;
}

.settings-tab.active {
  border-color: #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.settings-panel {
  width: 100%;
  max-width: var(--settings-max);
  margin: 0 auto;
}

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

.settings-card-modern,
.settings-card {
  width: 100%;
  margin-bottom: 14px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fbfcfe;
  box-shadow: 0 14px 34px rgba(30, 41, 59, 0.055);
  overflow: hidden;
}

.settings-card {
  padding: 24px;
}

.settings-card h3 {
  margin: 0 0 4px;
  color: #0f172a;
  font-size: 16px;
  font-weight: 800;
}

.settings-card p {
  margin: 0 0 16px;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.settings-card-header {
  min-height: 64px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #fbfcfe;
}

.settings-card-header h2 {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
  font-weight: 850;
  line-height: 1.3;
}

.settings-card-header p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.settings-policy-row {
  padding: 12px 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.settings-policy-row-compact {
  padding-top: 10px;
  padding-bottom: 10px;
}

.settings-policy-tile {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.settings-policy-tile span,
.settings-policy-tile strong {
  display: block;
}

.settings-policy-tile span {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.settings-policy-tile strong {
  margin-top: 3px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.settings-primary-action {
  flex: 0 0 auto;
  gap: 8px;
  min-height: 36px;
  border-radius: 8px;
}

.settings-primary-action svg,
.settings-search svg,
.settings-icon-btn svg,
.settings-action-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-inline {
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.settings-inline {
  padding: 0;
  display: flex;
  align-items: center;
}

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

.settings-field span {
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.settings-field input,
.settings-search input,
.settings-filter {
  width: 100%;
  min-height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
}

.settings-field input {
  padding: 7px 10px;
}

.settings-search input {
  padding: 7px 10px 7px 34px;
}

.settings-filter {
  padding: 7px 30px 7px 10px;
}

.settings-field input:focus,
.settings-search input:focus,
.settings-filter:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.settings-inline-actions {
  display: flex;
  gap: 8px;
}

.settings-inline-actions .btn {
  min-width: 78px;
  min-height: 36px;
  border-radius: 8px;
  font-weight: 800;
}

.settings-service-toolbar {
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.settings-mail-card,
.settings-integration-card {
  max-width: none;
  margin: 0 0 14px;
}

.settings-mail-form {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.settings-mail-field {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(180px, 240px);
  align-items: center;
  gap: 16px;
}

.settings-mail-field label {
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.settings-mail-field select {
  width: 100%;
  min-height: 42px;
  padding: 0 34px 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
  outline: none;
}

.settings-mail-field select:hover {
  border-color: #93a4bc;
}

.settings-mail-field select:focus {
  border-color: #3563e9;
  box-shadow: 0 0 0 3px rgba(53, 99, 233, 0.12);
}

.settings-mail-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.settings-mail-note {
  margin: 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.settings-integration-switch {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #334155;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.settings-integration-switch.is-disabled {
  color: #94a3b8;
  cursor: not-allowed;
}

.settings-integration-body {
  padding: 18px;
  display: grid;
  gap: 16px;
}

.settings-integration-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.settings-integration-status > div {
  min-width: 0;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.settings-integration-status span,
.settings-integration-status strong,
.settings-integration-status small {
  display: block;
}

.settings-integration-status span {
  color: #64748b;
  font-size: 11px;
  font-weight: 850;
}

.settings-integration-status strong {
  margin-top: 4px;
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
}

.settings-integration-status small {
  margin-top: 8px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.settings-slack-log-panel {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.settings-slack-log-header {
  min-height: 44px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #fbfcfe;
}

.settings-slack-log-header strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 850;
}

.settings-slack-log-header span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.settings-slack-log-table {
  min-width: 620px;
}

.settings-slack-log-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  font-size: 11px;
  font-weight: 850;
}

.settings-slack-log-status.sent,
.settings-slack-log-status.dry_run {
  background: #dcfce7;
  color: #166534;
}

.settings-slack-log-status.failed {
  background: #fee2e2;
  color: #b91c1c;
}

.settings-slack-log-status.skipped {
  background: #e0f2fe;
  color: #0369a1;
}

.settings-service-meta {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.settings-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.settings-search svg {
  position: absolute;
  left: 11px;
  color: #94a3b8;
  pointer-events: none;
}

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

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

.settings-table th {
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: #fbfcfe;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  text-align: left;
}

.settings-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #eef2f7;
  color: #0f172a;
  vertical-align: middle;
}

.settings-table tr:last-child td {
  border-bottom: 0;
}

.settings-table tbody tr:hover td {
  background: #f8fafc;
}

.settings-service-list {
  display: flex;
  flex-direction: column;
}

.settings-service-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid #eef2f7;
  background: #ffffff;
  transition: background 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.settings-service-row:last-child {
  border-bottom: 0;
}

.settings-service-row:hover {
  background: #f8fafc;
}

.settings-service-row.is-dragging {
  position: relative;
  z-index: 2;
  opacity: 0.72;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
  transform: scale(0.995);
}

.settings-service-list.is-sorting .settings-service-row:not(.is-dragging) {
  transition: background 150ms ease;
}

.settings-service-drag {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d7e0ec;
  border-radius: 9px;
  background: #ffffff;
  color: #64748b;
  cursor: grab;
  touch-action: none;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.settings-service-drag:hover,
.settings-service-drag:focus-visible {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  outline: none;
}

.settings-drag-dots {
  width: 10px;
  display: grid;
  grid-template-columns: repeat(2, 3px);
  grid-auto-rows: 3px;
  gap: 4px;
}

.settings-drag-dots i {
  display: block;
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.settings-service-row.is-dragging .settings-service-drag,
body.is-service-code-dragging .settings-service-drag {
  cursor: grabbing;
}

.settings-service-row.is-drag-disabled .settings-service-drag {
  cursor: not-allowed;
  opacity: 0.42;
}

body.is-service-code-dragging {
  cursor: grabbing;
  user-select: none;
}

.settings-service-main {
  min-width: 0;
}

.settings-service-main strong {
  display: block;
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.settings-service-main span {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.settings-account-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.settings-account-cell strong {
  display: block;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.settings-account-cell span:not(.settings-avatar) {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.settings-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: #2563eb;
  color: #ffffff;
  font-size: 12px;
  font-weight: 850;
}

.settings-role-chip,
.settings-status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.settings-role-chip.admin {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.settings-role-chip.manager {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #4338ca;
}

.settings-status-chip.active {
  border-color: #bbf7d0;
  background: #ecfdf3;
  color: #166534;
}

.settings-contact-text {
  color: #475569;
  font-size: 12px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.settings-service-scope-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 360px;
}

.settings-service-scope-tags span,
.settings-service-scope-all,
.settings-service-scope-empty {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
}

.settings-service-scope-tags span {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.settings-service-scope-all {
  border: 1px solid #bbf7d0;
  background: #ecfdf3;
  color: #166534;
}

.settings-service-scope-empty {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
}

.settings-managed-service-picker {
  gap: 8px;
}

.settings-actions-cell {
  width: 1%;
  white-space: nowrap;
}

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

.settings-icon-btn,
.settings-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.settings-icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
}

.settings-icon-btn:hover,
.settings-icon-btn:focus-visible {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  outline: none;
}

.settings-action-btn {
  gap: 5px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid;
  background: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.settings-action-btn.danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.settings-empty-state,
.settings-empty-row td {
  padding: 32px 16px;
  color: #64748b;
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.settings-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.settings-empty-state[hidden] {
  display: none;
}

.settings-empty-state strong {
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
}

.settings-empty-state span {
  max-width: 420px;
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.settings-drawer {
  width: min(560px, calc(100vw - 32px));
}

.settings-drawer-note {
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}

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

.settings-service-form-grid .settings-field-full {
  grid-column: 1 / -1;
}

.settings-service-note {
  min-height: 104px;
  padding: 9px 10px;
  resize: vertical;
  font-weight: 700;
  line-height: 1.45;
}

@media (max-width: 768px) {
  .settings-page {
    min-height: calc(100dvh - var(--mobile-nav-height) - env(safe-area-inset-bottom));
    padding: 16px 12px 28px;
  }

  .settings-page-header {
    margin-bottom: 12px;
  }

  .settings-page-header h1 {
    font-size: 24px;
  }

  .settings-tabs {
    width: 100%;
    max-width: none;
    padding: 4px;
    gap: 4px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #f8fafc;
  }

  .settings-tab {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    padding: 0 8px;
  }

  .settings-card-header {
    padding: 14px;
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .settings-policy-row {
    grid-template-columns: 1fr;
    padding: 10px 12px;
  }

  .settings-policy-tile {
    padding: 9px 10px;
  }

  .settings-primary-action {
    width: 100%;
    justify-content: center;
  }

  .settings-inline-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-inline-actions .btn {
    width: 100%;
  }

  .settings-service-toolbar {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .settings-mail-form {
    padding: 14px;
  }

  .settings-mail-field {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .settings-mail-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-integration-switch {
    justify-content: space-between;
  }

  .settings-integration-body {
    padding: 14px;
  }

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

  .settings-service-meta {
    justify-self: start;
  }

  .settings-service-row {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
  }

  .settings-service-drag {
    order: 2;
    width: 100%;
  }

  .settings-service-row .settings-actions {
    order: 3;
  }

  .settings-table {
    min-width: 0;
  }

  .settings-table thead {
    display: none;
  }

  .settings-table,
  .settings-table tbody,
  .settings-table tr,
  .settings-table td {
    display: block;
    width: 100%;
  }

  .settings-table tbody {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .settings-table tr {
    overflow: hidden;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #ffffff;
  }

  .settings-table td {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f7;
    overflow-wrap: anywhere;
  }

  .settings-table td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
  }

  .settings-table td:last-child {
    border-bottom: 0;
  }

  .settings-account-cell {
    align-items: flex-start;
  }

  .settings-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .settings-empty-row td {
    display: block;
    padding: 28px 12px;
  }

  .settings-empty-row td::before {
    display: none;
  }

  .settings-drawer {
    width: 100%;
    border-left: 0;
  }
}

@media (max-width: 480px) {
  .settings-table td {
    grid-template-columns: 76px minmax(0, 1fr);
  }
}

/* ====== TOAST ====== */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(480px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  width: max-content;
  min-width: 260px;
  background: #1f2937;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  font-weight: 700;
  color: #f8fafc;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
  animation: toastIn 0.3s ease-out;
  max-width: 380px;
  pointer-events: auto;
}

.toast.toast-out {
  animation: toastOut 0.3s ease-out forwards;
}

.toast-success {
  border-color: rgba(4, 120, 87, 0.28);
  background: #047857;
  color: #ecfdf5;
}

.toast-error {
  border-color: rgba(185, 28, 28, 0.3);
  background: #b91c1c;
  color: #fff5f5;
}

.toast-info {
  border-color: rgba(29, 78, 216, 0.3);
  background: #1d4ed8;
  color: #eff6ff;
}

@media (max-width: 768px) {
  .toast-container {
    top: 14px;
    left: 50%;
    width: calc(100vw - 24px);
  }

  .toast {
    width: 100%;
    max-width: none;
  }
}

/* ====== EMPTY STATE ====== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: var(--font-lg);
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: var(--font-sm);
  margin-bottom: 20px;
}

/* ====== PAGINATION ====== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-top: 24px;
}

.pagination button {
  padding: 8px 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--font-sm);
  font-family: var(--font-family);
  transition: all var(--transition-base);
}

.pagination button:hover:not(:disabled) {
  border-color: var(--accent-purple);
  color: var(--text-primary);
}

.pagination button.active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: white;
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ====== LOADING ====== */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}

.page-container > .loading-spinner {
  flex: 1;
  width: 100%;
  min-height: 100%;
}

.mail-link-loading > .loading-spinner {
  min-height: 100vh;
}

.panel-loading {
  width: 100%;
  min-height: min(420px, calc(100vh - 180px));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.customer-management-panel > .panel-loading {
  min-height: calc(100vh - 180px);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ====== BACK BUTTON ====== */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: none;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--font-sm);
  font-family: var(--font-family);
  transition: all var(--transition-base);
  margin-bottom: 20px;
}

.btn-back:hover {
  border-color: var(--accent-purple);
  color: var(--text-primary);
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
  :root {
    --mobile-nav-height: 72px;
  }

  html,
  body {
    min-height: 100dvh;
  }

  .app-layout {
    display: block;
    min-height: 100dvh;
  }

  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    min-height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    padding: 0;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid #dbe3ef;
    background: rgba(255, 255, 255, 0.96);
    z-index: 1000;
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(16px);
  }

  .sidebar.sidebar-admin {
    background: rgba(17, 24, 39, 0.96);
    border-top-color: #1f2937;
  }

  .sidebar-header,
  .sidebar-user,
  .nav-section-title,
  .nav-chevron,
  .sidebar-bottom {
    display: none;
  }

  .sidebar.sidebar-customer .sidebar-user {
    width: 64px;
    height: 100%;
    flex: 0 0 64px;
    display: flex;
    padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
    border-right: 1px solid #e2e8f0;
    border-bottom: none;
  }

  .sidebar.sidebar-customer .user-profile-button {
    min-height: 56px;
    padding: 6px;
  }

  .sidebar.sidebar-customer .profile-popover {
    top: auto;
    bottom: calc(100% + 10px);
    left: 8px;
    width: min(280px, calc(100vw - 16px));
  }

  .sidebar.sidebar-customer .profile-popover::before {
    top: auto;
    bottom: -5px;
    left: 22px;
    border-left: 0;
    border-bottom: 0;
    border-top: 1px solid #dbe3ef;
    border-right: 1px solid #dbe3ef;
  }

  .mobile-profile-layer {
    position: fixed;
    inset: 0;
    z-index: 2400;
    display: block;
    pointer-events: none;
  }

  .mobile-profile-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: auto;
    left: 0;
    width: 100vw;
    height: calc(100vh - var(--mobile-nav-height) - env(safe-area-inset-bottom));
    display: block;
    border: 0;
    background: rgba(15, 23, 42, 0.24);
    cursor: pointer;
    pointer-events: auto;
  }

  .mobile-profile-layer .profile-popover {
    position: fixed;
    top: auto;
    right: 10px;
    bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 10px);
    left: 10px;
    width: auto;
    max-width: none;
    pointer-events: auto;
    animation: mobileProfileSheetIn 0.18s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .mobile-profile-layer .profile-popover::before {
    display: none;
  }

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

  .sidebar-menu {
    flex: 1;
    width: auto;
    height: 100%;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    overflow-x: hidden;
    overflow-y: hidden;
  }

  .nav-section {
    display: contents;
  }

  .nav-group {
    display: contents;
  }

  .nav-submenu {
    display: contents;
  }

  .nav-group-toggle {
    display: none;
  }

  .nav-item {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    max-width: 112px;
    min-height: 56px;
    padding: 7px 6px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    font-size: 11px;
    text-align: center;
  }

  .nav-item::after,
  .logout-btn-full::after {
    display: none;
  }

  .nav-item-child {
    padding-left: 6px;
  }

  .nav-item-child .nav-icon {
    display: inline-flex;
  }

  .nav-label {
    position: static;
    width: auto;
    height: auto;
    overflow: hidden;
    clip: auto;
    clip-path: none;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
    max-width: 100%;
    line-height: 1.12;
    overflow-wrap: anywhere;
  }

  .main-content {
    width: 100%;
    height: 100dvh;
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
  }

  .page-container {
    height: calc(100dvh - var(--mobile-nav-height) - env(safe-area-inset-bottom));
    padding: 20px 16px;
    overflow-x: hidden;
  }

  .profile-page {
    padding: 0 0 28px;
  }

  .profile-hero {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
    padding: 20px;
  }

  .profile-hero-main {
    align-items: flex-start;
    gap: 14px;
  }

  .profile-avatar-block {
    width: 100%;
    justify-content: space-between;
    align-items: flex-start;
  }

  .profile-avatar-actions {
    justify-content: flex-end;
  }

  .profile-avatar-large {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    border-radius: 12px;
    font-size: 20px;
  }

  .profile-avatar-trigger {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    border-radius: 12px;
  }

  .profile-hero-copy h1 {
    font-size: 24px;
  }

  .profile-hero-copy p {
    font-size: 12px;
  }

  .profile-role-card {
    min-width: 0;
  }

  .profile-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .profile-notification-content {
    grid-template-columns: 1fr;
  }

  .profile-slack-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .profile-slack-account,
  .profile-slack-actions {
    justify-content: space-between;
  }

  .profile-slack-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-channel-selector {
    grid-template-columns: 1fr;
  }

  .profile-channel-options {
    grid-template-columns: 1fr;
  }

  .profile-panel {
    padding: 20px;
  }

  .profile-panel-header {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
  }

  .profile-info-item {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px 0;
  }

  .profile-security-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .profile-security-action {
    grid-column: 1 / -1;
    width: 100%;
  }

  .profile-notification-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .profile-notification-channels {
    width: 100%;
    justify-content: space-between;
  }

  .profile-channel-toggle {
    min-height: 32px;
  }

  .profile-password-modal-overlay {
    align-items: flex-end;
    padding: 16px;
  }

  .profile-password-modal {
    max-width: none;
    padding: 20px;
    border-radius: 8px;
  }

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

  .profile-modal-actions .btn {
    width: 100%;
  }

  .pane-list {
    width: 100%;
    min-width: 0;
    border-right: none;
  }

  .pane-detail {
    display: none;
  }

  .pane-list-header {
    padding: 16px;
  }

  .pane-list-content {
    padding: 14px 16px 24px;
  }

  .empty-state {
    padding: 24px 16px 32px;
  }

  .empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
  }

  .empty-state p {
    margin-bottom: 14px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-bar {
    flex-direction: column;
  }

  .filter-bar .form-control,
  .search-input-wrap {
    width: 100%;
    min-width: 100%;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ticket-card {
    flex-direction: column;
    gap: 12px;
  }

  .ticket-right {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
  }

  .detail-header {
    padding: 20px;
  }

  .ticket-workspace-page {
    height: calc(100dvh - var(--mobile-nav-height) - env(safe-area-inset-bottom));
    padding: 0;
  }

  .ticket-workspace {
    padding: 12px;
    gap: 10px;
  }

  .ticket-workspace-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }

  .ticket-workspace-title {
    align-items: flex-start;
  }

  .ticket-workspace-title p {
    white-space: normal;
  }

  .pane-list.ticket-list-drawer {
    top: 84px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    min-width: 0;
    max-width: none;
  }

  .ticket-workspace.ticket-drawer-pinned {
    display: flex;
    grid-template-columns: none;
    grid-template-rows: none;
  }

  .ticket-workspace.ticket-drawer-pinned .ticket-workspace-toolbar,
  .ticket-workspace.ticket-drawer-pinned .pane-detail.ticket-split-detail {
    grid-column: auto;
    grid-row: auto;
  }

  .ticket-drawer-pin {
    display: none;
  }

  .ticket-workspace.ticket-drawer-pinned .pane-list.ticket-list-drawer {
    position: absolute;
    top: 84px;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    height: auto;
    transform: translateX(calc(-100% - 36px));
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
  }

  .ticket-workspace.ticket-drawer-pinned .pane-list.ticket-list-drawer.open {
    transform: translateX(0);
  }

  .ticket-list-drawer .pane-list-header {
    padding: 14px;
  }

  .ticket-list-drawer .pane-list-content {
    padding: 12px 14px 16px;
  }

  .ticket-workspace .pane-detail {
    display: flex;
  }

  .ticket-detail-shell {
    flex: 1;
    display: block;
    min-height: 0;
    overflow: hidden;
    position: relative;
  }

  .ticket-split-resizer {
    display: none;
  }

  .ticket-detail-panel {
    height: 100%;
  }

  .ticket-question-panel {
    display: flex;
    padding-bottom: 76px;
  }

  .ticket-conversation-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    height: 100%;
    display: flex;
    border-radius: 12px 12px 8px 8px;
    box-shadow: 0 -14px 36px rgba(15, 23, 42, 0.14);
    transform: translateY(calc(100% - 72px));
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
  }

  .ticket-conversation-panel.expanded {
    transform: translateY(0);
  }

  .ticket-panel-header {
    flex-direction: column;
    gap: 10px;
    padding: 14px;
  }

  .ticket-control-panel {
    width: 100%;
    max-width: none;
    justify-content: stretch;
  }

  .ticket-control-field {
    flex: 1;
    min-width: 0;
  }

  .ticket-question-scroll {
    padding: 14px;
  }

  .ticket-meta-strip {
    grid-template-columns: 1fr;
  }

  .ticket-conversation-panel .reply-thread {
    padding: 14px;
    display: none;
  }

  .ticket-conversation-panel .reply-form {
    padding: 18px 14px 14px;
    display: none;
  }

  .ticket-conversation-panel.expanded .reply-thread,
  .ticket-conversation-panel.expanded .reply-form {
    display: flex;
  }

  .ticket-reply-header {
    position: relative;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding-top: 22px;
    cursor: pointer;
  }

  .ticket-sheet-handle {
    display: block;
    position: absolute;
    top: 8px;
    left: 50%;
    width: 46px;
    height: 5px;
    border-radius: 999px;
    background: #cbd5e1;
    transform: translateX(-50%);
  }

  .ticket-reply-sheet-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    height: 30px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
  }

  .reply-bubble {
    max-width: 100%;
  }

  .reply-content-box {
    max-width: min(92%, 560px) !important;
  }

  .auth-shell .auth-card {
    padding: 22px 18px;
  }

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

  .customer-management-page {
    min-height: calc(100dvh - var(--mobile-nav-height) - env(safe-area-inset-bottom));
    padding: 16px 12px 28px;
  }

  .customer-management-header {
    margin-bottom: 12px;
  }

  .customer-management-tabs {
    width: 100%;
    max-width: none;
    display: flex;
    padding: 4px;
    gap: 4px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #f8fafc;
  }

  .customer-management-tab {
    flex: 1;
    justify-content: center;
    min-width: 0;
    border: 0;
    background: transparent;
  }

  .customer-tab-alert {
    padding: 0 6px;
    font-size: 10px;
  }

  .user-management-embedded .page-header {
    align-items: stretch !important;
    justify-content: stretch !important;
  }

  .user-management-embedded .page-header > div {
    width: 100%;
  }

  .user-management-embedded .page-header div[style*="width: 250px"] {
    width: 100% !important;
  }

  .user-management-embedded .user-management-sections {
    margin-top: 18px !important;
  }

  .user-management-embedded .user-management-section-title {
    margin: 22px 0 10px !important;
    font-size: 15px !important;
  }

  .user-management-embedded .user-table-card {
    padding: 0 !important;
    overflow: hidden;
    border-color: #dbe3ef !important;
    border-radius: 8px !important;
    background: #fbfcfe !important;
  }

  .user-management-embedded .user-management-table {
    min-width: 0;
    width: 100%;
  }

  .user-management-embedded .user-management-table thead {
    display: none;
  }

  .user-management-embedded .user-management-table,
  .user-management-embedded .user-management-table tbody,
  .user-management-embedded .user-management-table tr,
  .user-management-embedded .user-management-table td {
    display: block;
    width: 100%;
  }

  .user-management-embedded .user-management-table tbody {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .user-management-embedded .user-management-table tr {
    overflow: hidden;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #ffffff;
  }

  .user-management-embedded .user-management-table td {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 10px;
    padding: 10px 12px !important;
    border-bottom: 1px solid #eef2f7 !important;
    color: #0f172a;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }

  .user-management-embedded .user-management-table td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
  }

  .user-management-embedded .user-management-table td:last-child {
    border-bottom: 0 !important;
  }

  .user-management-embedded .user-actions-cell .user-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
  }

  .user-management-embedded .user-actions-cell .badge {
    margin-right: 0 !important;
  }

  .user-management-embedded .user-empty-row td {
    display: block;
    padding: 28px 12px !important;
    text-align: center !important;
    color: #64748b !important;
  }

  .user-management-embedded .user-empty-row td::before {
    display: none;
  }

  .company-toolbar {
    grid-template-columns: 1fr;
  }

  .company-page {
    min-height: calc(100dvh - var(--mobile-nav-height) - env(safe-area-inset-bottom));
    padding: 16px 12px 28px;
  }

  .company-page-embedded {
    min-height: 0;
    padding: 0;
  }

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

  .company-add-button {
    width: 100%;
    justify-content: center;
  }

  .company-table-meta {
    justify-content: flex-start;
    padding: 10px 12px 0;
  }

  .company-table {
    min-width: 0;
  }

  .company-table thead {
    display: none;
  }

  .company-table,
  .company-table tbody,
  .company-table tr,
  .company-table td {
    display: block;
    width: 100%;
  }

  .company-table tbody {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .company-table tr {
    overflow: hidden;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #ffffff;
  }

  .company-table td {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f7;
  }

  .company-table td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
  }

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

  .company-ellipsis {
    max-width: none;
    white-space: normal;
  }

  .company-form-grid {
    grid-template-columns: 1fr;
  }

  .company-form-section-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .company-drawer {
    width: 100%;
    border-left: 0;
  }

  .company-drawer-header {
    padding: 16px 14px;
  }

  .company-drawer-body {
    padding: 12px;
  }

  .company-drawer-actions {
    padding: 12px;
  }

  .company-drawer-actions .btn {
    flex: 1 1 0;
  }

  .company-service-picker {
    grid-template-columns: 1fr;
  }

  .brand-text {
    display: none;
  }
  
  .user-badge span:not(.user-avatar) {
    display: none;
  }
}

/* 모바일 QA 보정: iPhone 12 Pro 폭에서 업무 흐름이 끊기지 않도록 터치/밀도/시트를 재정렬한다. */
@media (max-width: 768px) {
  .page-container {
    padding: 16px 12px;
  }

  .btn,
  .form-control,
  .auth-submit.btn,
  .ticket-drawer-toggle,
  .ticket-drawer-close,
  .drawer-filter-icon-btn,
  .smart-date-picker-button,
  .company-add-button,
  .company-action-btn,
  .representative-action-btn,
  .settings-icon-btn,
  .settings-action-btn,
  .company-drawer-close,
  .ticket-reply-sheet-button {
    min-height: 44px;
  }

  .ticket-drawer-close,
  .drawer-filter-icon-btn,
  .smart-date-picker-button,
  .settings-icon-btn,
  .company-drawer-close {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  .toast-container {
    top: calc(env(safe-area-inset-top) + 12px);
    left: 50%;
    bottom: auto;
    width: calc(100vw - 24px);
  }

  .toast {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
  }

  .auth-container {
    min-height: 100dvh;
    padding: 16px 12px;
  }

  .auth-shell,
  .auth-shell-register {
    width: 100%;
    gap: 14px;
  }

  .auth-brand {
    gap: 10px;
  }

  .auth-card {
    border-radius: 12px;
  }

  .auth-header {
    gap: 6px;
  }

  .auth-header h1 {
    font-size: 24px;
    line-height: 1.2;
  }

  .auth-field .form-control {
    font-size: 15px;
  }

  .profile-page {
    padding: 0 0 22px;
  }

  .profile-hero {
    padding: 16px;
    gap: 14px;
  }

  .profile-hero-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-avatar-block {
    gap: 12px;
  }

  .profile-hero-copy h1 {
    font-size: 22px;
    line-height: 1.22;
    letter-spacing: 0;
    word-break: keep-all;
    overflow-wrap: normal;
  }

  .profile-hero-copy p {
    max-width: 30ch;
    line-height: 1.45;
    word-break: keep-all;
  }

  .profile-panel {
    padding: 16px;
    border-radius: 12px;
  }

  .profile-password-modal-overlay {
    padding: 10px;
  }

  .profile-password-modal {
    width: 100%;
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
  }

  .sidebar.sidebar-customer .profile-popover {
    position: fixed;
    right: 10px;
    bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 10px);
    left: 10px;
    width: auto;
  }

  .sidebar.sidebar-customer .profile-popover::before {
    left: 34px;
  }

  .profile-popover-item,
  .profile-popover-footer-btn {
    min-height: 44px;
  }

  .pane-list.ticket-list-drawer {
    top: 10px;
    right: 10px;
    bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 10px);
    left: 10px;
    visibility: hidden;
    transform: translateX(-10px) scale(0.985);
  }

  .pane-list.ticket-list-drawer.open {
    visibility: visible;
    transform: translateX(0) scale(1);
  }

  .ticket-drawer-backdrop {
    visibility: hidden;
  }

  .ticket-drawer-backdrop.active {
    visibility: visible;
  }

  .ticket-workspace-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px 10px;
    border-radius: 12px;
  }

  .ticket-workspace-title {
    display: contents;
  }

  .ticket-workspace-title > div {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .ticket-workspace-title h1 {
    font-size: 22px;
    line-height: 1.22;
  }

  .ticket-workspace-title p {
    max-width: 100%;
    color: #64748b;
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .ticket-workspace-toolbar .btn-sm {
    justify-content: center;
  }

  .ticket-workspace-toolbar #btn-new-ticket {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: end;
  }

  .ticket-workspace-toolbar .ticket-drawer-toggle {
    grid-column: 1;
    grid-row: 1;
    width: auto;
    min-width: 112px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .ticket-list-drawer .pane-list-header {
    padding: 12px;
  }

  .ticket-list-drawer .pane-list-content {
    padding: 10px 12px 14px;
  }

  .ticket-list-drawer .ticket-card {
    gap: 8px;
    padding: 12px;
  }

  .ticket-list-drawer .ticket-title {
    font-size: 14px;
    line-height: 1.32;
    word-break: keep-all;
    overflow-wrap: anywhere;
  }

  .ticket-panel-header {
    gap: 12px;
    padding: 12px;
  }

  .ticket-panel-header h2 {
    font-size: 18px;
    line-height: 1.28;
    word-break: keep-all;
    overflow-wrap: anywhere;
  }

  .ticket-control-panel {
    gap: 8px;
  }

  .ticket-control-field .form-control {
    min-height: 44px;
    font-size: 14px;
  }

  .ticket-question-scroll {
    padding: 12px;
  }

  .ticket-meta-strip {
    gap: 6px;
  }

  .ticket-meta-item {
    padding: 10px 12px;
  }

  .detail-content.ticket-content {
    min-height: 180px;
    padding: 16px 12px;
  }

  .ticket-conversation-panel {
    height: min(92dvh, calc(100dvh - var(--mobile-nav-height) - env(safe-area-inset-bottom)));
    border-radius: 14px 14px 0 0;
    transform: translateY(calc(100% - 64px));
  }

  .ticket-conversation-panel.expanded {
    position: fixed;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    top: 10px;
    right: 10px;
    bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 10px);
    left: 10px;
    z-index: 900;
    height: auto;
    transform: translateY(0);
  }

  .ticket-workspace.ticket-drawer-active .ticket-conversation-panel {
    display: none;
  }

  .ticket-reply-header {
    min-height: 64px;
    padding: 20px 12px 10px;
  }

  .ticket-conversation-panel.expanded .ticket-reply-header {
    min-height: 64px;
  }

  .ticket-reply-sheet-button {
    min-width: 64px;
    height: 38px;
    padding: 0 12px;
  }

  .ticket-conversation-panel .reply-thread {
    flex: 1 1 auto;
    min-height: 0;
    padding: 12px;
  }

  .ticket-conversation-panel .reply-form {
    flex: 0 0 auto;
    max-height: 36dvh;
    overflow-y: auto;
    padding: 14px 12px 12px;
  }

  .ticket-conversation-panel .ql-container {
    min-height: 92px;
    max-height: 150px;
  }

  .ticket-conversation-panel #reply-form > div:last-child {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 10px !important;
  }

  .ticket-conversation-panel .file-upload-area {
    min-width: 0 !important;
  }

  .ticket-conversation-panel #reply-file-drop-zone {
    min-height: 42px !important;
  }

  .ticket-conversation-panel #reply-form > div:last-child > div:last-child {
    justify-content: space-between !important;
    gap: 8px !important;
  }

  .ticket-conversation-panel #reply-submit {
    flex: 0 0 auto;
    min-width: 96px;
  }

  .ql-toolbar.ql-snow button {
    width: 44px !important;
    height: 44px !important;
  }

  .customer-management-page {
    padding: 14px 10px 22px;
  }

  .customer-management-header h1,
  .company-header h1 {
    font-size: 24px;
    line-height: 1.2;
  }

  .customer-management-tabs {
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .customer-management-tab {
    min-height: 44px;
  }

  .company-toolbar,
  .representative-toolbar,
  .settings-service-toolbar {
    gap: 8px;
  }

  .company-table td,
  .representative-table td,
  .settings-table td,
  .user-management-embedded .user-management-table td {
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
    line-height: 1.42;
  }

  .company-table td::before,
  .representative-table td::before,
  .settings-table td::before,
  .user-management-embedded .user-management-table td::before {
    font-size: 10px;
    line-height: 1.3;
    word-break: keep-all;
    overflow-wrap: normal;
  }

  .company-actions,
  .representative-actions,
  .settings-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .company-action-btn,
  .representative-action-btn,
  .settings-action-btn {
    flex: 1 1 auto;
  }

  .company-drawer,
  .representative-drawer {
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .company-drawer-header {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .company-drawer-body {
    padding-bottom: 96px;
  }

  .company-drawer-actions {
    position: sticky;
    right: 0;
    bottom: 0;
    left: 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .settings-service-row {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 12px;
  }

  .settings-service-drag {
    order: 0;
    grid-column: 1;
    grid-row: 1;
    width: 44px;
    height: 44px;
  }

  .settings-service-main {
    grid-column: 2;
    grid-row: 1;
  }

  .settings-service-row .settings-actions {
    order: 3;
    grid-column: 1 / -1;
    justify-content: stretch;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .detail-info {
    flex-direction: column;
    gap: 2px;
  }
}

/* ====== LINK STYLE BUTTON ====== */
.link-btn {
  background: none;
  border: none;
  color: var(--accent-cyan);
  cursor: pointer;
  font-size: var(--font-sm);
  font-family: var(--font-family);
  padding: 0;
  text-decoration: underline;
}

.link-btn:hover {
  color: var(--accent-purple);
}

/* ====== FORM ROW ====== */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ====== TABS ====== */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--glass-bg);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  overflow-x: auto;
}

.tab-btn {
  padding: 8px 20px;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--font-sm);
  font-weight: 500;
  font-family: var(--font-family);
  border-radius: 6px;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--accent-purple);
  color: white;
}

/* ====== DASHBOARD SPLIT LAYOUT ====== */
.dashboard-split-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  width: 100%;
}

.dashboard-sidebar {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
}

.dashboard-sidebar .stats-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

.dashboard-sidebar .stat-card {
  padding: 16px;
}

.dashboard-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

@media (max-width: 1024px) {
  .dashboard-sidebar {
    flex: 1 1 100%;
  }
  
  .dashboard-sidebar .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

/* ====== INLINE IMAGE PREVIEWS ====== */
.image-preview-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0;
  width: 100%;
}

.inline-image-container {
  position: relative;
  max-width: 400px;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  background: var(--bg-tertiary);
}

.inline-image-container:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.inline-image {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  transition: opacity var(--transition-base);
}

.inline-image:hover {
  opacity: 0.9;
}

.image-name-tag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 4px 8px;
  font-size: 11px;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.inline-image-container:hover .image-name-tag {
  opacity: 1;
}

/* ====== QUILL RICH TEXT EDITOR DARK THEME ====== */
.ql-toolbar.ql-snow {
  border: 1px solid var(--glass-border) !important;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px !important;
}

.ql-toolbar.ql-snow .ql-formats {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-right: 4px !important;
}

.ql-toolbar.ql-snow button {
  width: 30px !important;
  height: 30px !important;
  padding: 5px !important;
  border-radius: 6px;
  transition: background 150ms ease, color 150ms ease;
}

.ql-toolbar.ql-snow button:hover,
.ql-toolbar.ql-snow button:focus-visible,
.ql-toolbar.ql-snow button.ql-active {
  background: #eff6ff;
  outline: none;
}

.ql-container.ql-snow {
  border: 1px solid var(--glass-border) !important;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  background: var(--bg-card);
  font-family: 'Inter', sans-serif !important;
  font-size: 14px !important;
  color: var(--text-primary) !important;
  min-height: 200px;
  height: auto; /* Removed !important to allow resizing */
}

.ql-editor {
  line-height: 1.6;
  height: 100%; 
  min-height: inherit;
  overflow-y: auto; 
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}

.ql-editor img {
  max-width: 100% !important;
  height: auto !important;
  display: block;
  margin: 10px 0;
}


.ql-editor.ql-blank::before {
  color: var(--text-muted) !important;
  font-style: normal !important;
}

.ql-snow .ql-stroke {
  stroke: var(--text-secondary) !important;
}

.ql-snow .ql-fill {
  fill: var(--text-secondary) !important;
}

.ql-snow .ql-picker {
  color: var(--text-secondary) !important;
}

.ql-snow .ql-picker-options {
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--glass-border) !important;
}

/* Response zone specific editor height */
.reply-editor-container .ql-container.ql-snow {
  min-height: 80px;
  max-width: 100%;
  overflow: hidden;
}

/* Inline images in rendered content */
.detail-content img, .reply-content img {
  max-width: 100% !important;
  height: auto !important;
  border-radius: 8px;
  margin: 12px 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  display: block;
  cursor: zoom-in;
  transition: transform 0.2s ease;
}

/* Customer replies (right side) alignment */
.reply-right .reply-content img {
  margin-left: auto;
  margin-right: 0;
}

.detail-content img:hover, .reply-content img:hover {
  transform: translateY(-2px);
}

/* Premium Lightbox Styles */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: zoom-out;
}

.lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  max-width: 90%;
  max-height: 90%;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: #333; /* Placeholder color before load */
}

.lightbox-overlay.active .lightbox-content {
  transform: scale(1);
}


/* Custom 8-Handle Image Resizer Styles */
.ql-custom-resize-overlay {
  transition: none !important;
}

.ql-custom-resize-handle {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.ql-custom-resize-handle:hover {
  transform: scale(1.2);
  background-color: #fff !important;
  border-color: var(--accent-blue) !important;
}

/* Theme Toggle Button & Light Mode */
.theme-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  box-shadow: var(--glass-shadow);
  transition: all var(--transition-base);
}

.theme-toggle-btn:hover {
  transform: scale(1.1);
  background: var(--bg-card-hover);
  border-color: var(--accent-purple);
}

body.light-mode {
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f3f5;
  --bg-card: rgba(0, 0, 0, 0.03);
  --bg-card-hover: rgba(0, 0, 0, 0.05);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);

  --text-primary: #212529;
  --text-secondary: #495057;
  --text-muted: #868e96;
  --text-inverse: #ffffff;
}

body.light-mode::before {
  background:
    radial-gradient(ellipse at 20% 20%, rgba(124, 58, 237, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(37, 99, 235, 0.03) 0%, transparent 70%);
}

/* Adjustments for light mode */
body.light-mode .nav-item.active {
  background: rgba(124, 58, 237, 0.1);
}
body.light-mode .ticket-card, 
body.light-mode .stat-card,
body.light-mode .auth-card {
  background: #ffffff;
}
body.light-mode .pane-list, 
body.light-mode .pane-detail {
  background: #f8f9fa;
}
body.light-mode .form-control {
  background: #ffffff;
  color: #212529;
}
body.light-mode .form-control:focus {
  background: #ffffff;
}
body.light-mode .ql-toolbar.ql-snow {
  background: #f8f9fa;
}
body.light-mode .ql-container.ql-snow {
  background: #ffffff;
}
body.light-mode .reply-bubble {
  background: #ffffff;
}
body.light-mode .ticket-detail-wrapper {
  background: #ffffff;
}

.stats-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.stats-item.active {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

/* ====== 다크 모드 테마 ====== */
body.theme-dark {
  color-scheme: dark;
  --app-bg: #0f141b;
  --surface-base: #141b25;
  --surface-panel: #182130;
  --surface-raised: #1e2938;
  --surface-hover: #243247;
  --surface-pressed: #2a3a52;
  --line-soft: #273448;
  --line-strong: #35445a;
  --text-strong: #f0f5fb;
  --text-main: #d8e0ec;
  --text-muted-dark: #9aa8ba;
  --text-faint: #718197;
  --accent-main: #6d96ff;
  --accent-hover: #86a9ff;
  --accent-soft-dark: rgba(109, 150, 255, 0.14);
  --accent-line: rgba(109, 150, 255, 0.34);
  --success-main: #54d99c;
  --success-soft: rgba(84, 217, 156, 0.13);
  --warning-main: #f0b85c;
  --warning-soft: rgba(240, 184, 92, 0.14);
  --danger-main: #ff7181;
  --danger-soft: rgba(255, 113, 129, 0.14);
  --shadow-dark-sm: 0 8px 24px rgba(0, 0, 0, 0.26);
  --shadow-dark-lg: 0 24px 70px rgba(0, 0, 0, 0.34);

  --bg-primary: var(--app-bg);
  --bg-secondary: var(--surface-panel);
  --bg-tertiary: var(--surface-raised);
  --bg-card: var(--surface-panel);
  --bg-card-hover: var(--surface-hover);
  --glass-bg: var(--surface-panel);
  --glass-border: var(--line-soft);
  --glass-shadow: var(--shadow-dark-sm);
  --text-primary: var(--text-strong);
  --text-secondary: var(--text-main);
  --text-muted: var(--text-muted-dark);
  --text-inverse: #0f141b;
  --accent-purple: var(--accent-main);
  --accent-blue: var(--accent-main);
  --accent-cyan: #6ed6e6;
  --accent-green: var(--success-main);
  --accent-yellow: var(--warning-main);
  --accent-red: var(--danger-main);
  --accent-orange: #ff9f60;
  --gradient-primary: linear-gradient(135deg, #5f86ff, #4772f0);
  --gradient-accent: linear-gradient(135deg, #5f86ff, #45c8d9);
  --gradient-warm: linear-gradient(135deg, #f0b85c, #ff7181);
  --gradient-green: linear-gradient(135deg, #54d99c, #45c8d9);

  background: var(--app-bg);
  color: var(--text-main);
}

body.theme-dark ::selection {
  background: rgba(109, 150, 255, 0.34);
  color: var(--text-strong);
}

body.theme-dark ::-webkit-scrollbar-track {
  background: var(--surface-base);
}

body.theme-dark ::-webkit-scrollbar-thumb {
  background: #3a475a;
}

body.theme-dark ::-webkit-scrollbar-thumb:hover {
  background: #4b5b72;
}

body.theme-dark .main-content,
body.theme-dark .auth-container,
body.theme-dark .ticket-workspace-page,
body.theme-dark .ticket-create-container,
body.theme-dark .customer-management-page,
body.theme-dark .company-page,
body.theme-dark .settings-page,
body.theme-dark .profile-page {
  background: var(--app-bg);
  color: var(--text-main);
}

body.theme-dark .sidebar {
  background: #101721;
  border-color: var(--line-soft);
  color: var(--text-main);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.03);
}

body.theme-dark .sidebar.sidebar-admin {
  background: #0b1119;
  border-color: #1d2736;
}

body.theme-dark .sidebar-header,
body.theme-dark .sidebar-user,
body.theme-dark .sidebar.sidebar-admin .sidebar-header,
body.theme-dark .sidebar.sidebar-admin .sidebar-user {
  border-color: var(--line-soft);
}

body.theme-dark .logo-icon,
body.theme-dark .sidebar.sidebar-admin .logo-icon {
  background: rgba(109, 150, 255, 0.12);
  border-color: var(--accent-line);
  color: var(--accent-hover);
}

body.theme-dark .user-profile-button:hover,
body.theme-dark .user-profile-button:focus-visible,
body.theme-dark .user-profile-button.active,
body.theme-dark .sidebar.sidebar-admin .user-profile-button:hover,
body.theme-dark .sidebar.sidebar-admin .user-profile-button:focus-visible,
body.theme-dark .sidebar.sidebar-admin .user-profile-button.active {
  background: var(--surface-raised);
  border-color: var(--line-strong);
}

body.theme-dark .sidebar-user .user-avatar,
body.theme-dark .settings-avatar,
body.theme-dark .profile-avatar-large {
  background: #4772f0;
  color: #f6f9ff;
}

body.theme-dark .user-avatar-shell.has-image,
body.theme-dark .user-avatar-shell.image-failed {
  border-color: rgba(148, 163, 184, 0.3);
}

body.theme-dark .profile-image-button.subtle {
  background: #101721;
  border-color: #263449;
  color: #cbd5e1;
}

body.theme-dark .profile-avatar-camera {
  background: rgba(2, 6, 23, 0.68);
  color: #f8fbff;
}

body.theme-dark .nav-section-title,
body.theme-dark .portal-context,
body.theme-dark .sidebar-user .user-role {
  color: var(--text-faint);
}

body.theme-dark .nav-item {
  color: var(--text-muted-dark);
}

body.theme-dark .nav-item:hover,
body.theme-dark .nav-item:focus-visible {
  background: var(--surface-raised);
  color: var(--text-strong);
}

body.theme-dark .nav-item.active {
  background: rgba(109, 150, 255, 0.16);
  color: var(--text-strong);
  box-shadow: inset 0 0 0 1px rgba(109, 150, 255, 0.2);
}

body.theme-dark .sidebar.sidebar-admin .nav-item.active {
  border-color: var(--accent-line);
  background: rgba(109, 150, 255, 0.16);
  color: var(--text-strong);
  box-shadow: inset 0 0 0 1px rgba(109, 150, 255, 0.18);
}

body.theme-dark .sidebar-tooltip,
body.theme-dark .sidebar-tooltip.admin {
  border-color: var(--line-strong);
  background: var(--surface-raised);
  color: var(--text-strong);
  box-shadow: var(--shadow-dark-sm);
}

body.theme-dark .sidebar-tooltip::before,
body.theme-dark .sidebar-tooltip.admin::before {
  border-color: var(--line-strong);
}

body.theme-dark .profile-popover {
  border-color: var(--line-strong);
  background: var(--surface-panel);
  color: var(--text-main);
  box-shadow: var(--shadow-dark-lg);
}

body.theme-dark .profile-popover::before {
  border-color: var(--line-strong);
  background: var(--surface-raised);
}

body.theme-dark .profile-popover-header {
  border-color: var(--line-soft);
  background: var(--surface-raised);
}

body.theme-dark .profile-popover-kicker,
body.theme-dark .profile-popover-meta,
body.theme-dark .profile-popover-item,
body.theme-dark .profile-popover-footer-btn {
  color: var(--text-muted-dark);
}

body.theme-dark .profile-popover-id,
body.theme-dark .profile-popover-item span:last-child,
body.theme-dark .profile-popover-footer-btn span:last-child {
  color: var(--text-strong);
}

body.theme-dark .profile-popover-body,
body.theme-dark .profile-popover-footer {
  border-color: var(--line-soft);
}

body.theme-dark .profile-popover-footer {
  background: var(--surface-base);
}

body.theme-dark .profile-popover-item:hover,
body.theme-dark .profile-popover-item:focus-visible,
body.theme-dark .profile-popover-footer-btn:hover,
body.theme-dark .profile-popover-footer-btn:focus-visible {
  background: var(--surface-hover);
  color: var(--text-strong);
}

body.theme-dark .profile-popover-footer-btn {
  border-color: var(--line-strong);
  background: var(--surface-raised);
}

body.theme-dark .profile-popover-footer-btn.danger {
  border-color: rgba(255, 113, 129, 0.32);
  background: var(--danger-soft);
  color: var(--danger-main);
}

body.theme-dark .profile-popover-footer-btn.danger span:last-child {
  color: #ff9daa;
}

body.theme-dark .btn-primary,
body.theme-dark .auth-submit.btn,
body.theme-dark .ticket-create-actions .btn-primary {
  background: #4772f0;
  color: #f6f9ff;
  box-shadow: 0 12px 28px rgba(71, 114, 240, 0.28);
}

body.theme-dark .btn-primary:hover:not(:disabled),
body.theme-dark .auth-submit.btn:hover:not(:disabled),
body.theme-dark .auth-submit.btn:focus-visible {
  background: #5f86ff;
  box-shadow: 0 14px 32px rgba(71, 114, 240, 0.34);
}

body.theme-dark .btn-secondary,
body.theme-dark .ticket-create-actions .btn-secondary,
body.theme-dark .btn-back {
  border-color: var(--line-strong);
  background: var(--surface-raised);
  color: var(--text-main);
}

body.theme-dark .btn-secondary:hover,
body.theme-dark .btn-back:hover {
  border-color: var(--accent-line);
  background: var(--surface-hover);
  color: var(--text-strong);
}

body.theme-dark .form-control,
body.theme-dark .auth-field .form-control,
body.theme-dark .ticket-create-field .form-control,
body.theme-dark .drawer-filter-control,
body.theme-dark .drawer-date-filter .form-control,
body.theme-dark .ticket-control-field .form-control,
body.theme-dark .company-search input,
body.theme-dark .company-filter,
body.theme-dark .settings-field input,
body.theme-dark .settings-search input,
body.theme-dark .settings-filter,
body.theme-dark .representative-search input,
body.theme-dark .representative-filter,
body.theme-dark .company-form .form-control {
  border-color: var(--line-strong);
  background-color: var(--surface-base);
  color: var(--text-strong);
}

body.theme-dark select.form-control,
body.theme-dark .company-filter,
body.theme-dark .settings-filter,
body.theme-dark .representative-filter {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239aa8ba' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
  appearance: none;
}

body.theme-dark .form-control:focus,
body.theme-dark .auth-field .form-control:focus,
body.theme-dark .ticket-create-field .form-control:focus,
body.theme-dark .drawer-filter-control:focus,
body.theme-dark .drawer-date-filter .form-control:focus,
body.theme-dark .ticket-control-field .form-control:focus,
body.theme-dark .company-search input:focus,
body.theme-dark .company-filter:focus,
body.theme-dark .settings-field input:focus,
body.theme-dark .settings-search input:focus,
body.theme-dark .settings-filter:focus,
body.theme-dark .representative-search input:focus,
body.theme-dark .representative-filter:focus,
body.theme-dark .company-drawer .form-control:focus {
  border-color: var(--accent-line);
  background-color: #111925;
  box-shadow: 0 0 0 3px rgba(109, 150, 255, 0.16);
}

body.theme-dark .form-control::placeholder,
body.theme-dark .auth-field .form-control::placeholder,
body.theme-dark .ticket-create-field .form-control::placeholder,
body.theme-dark .settings-search input::placeholder,
body.theme-dark .company-search input::placeholder,
body.theme-dark .representative-search input::placeholder {
  color: var(--text-faint);
}

body.theme-dark select.form-control option,
body.theme-dark select option {
  background: var(--surface-panel);
  color: var(--text-strong);
}

body.theme-dark .auth-card,
body.theme-dark .auth-showcase-card,
body.theme-dark .ticket-workspace-toolbar,
body.theme-dark .ticket-detail-panel,
body.theme-dark .ticket-create-section,
body.theme-dark .ticket-create-side-card,
body.theme-dark .company-table-card,
body.theme-dark .representative-table-card,
body.theme-dark .settings-card-modern,
body.theme-dark .settings-card,
body.theme-dark .profile-hero,
body.theme-dark .profile-panel {
  border-color: var(--line-soft);
  background: var(--surface-panel);
  color: var(--text-main);
  box-shadow: var(--shadow-dark-sm);
}

body.theme-dark .auth-showcase::before {
  border-color: var(--line-soft);
  background:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  opacity: 0.38;
}

body.theme-dark .auth-brand-mark {
  background: #4772f0;
  color: #f6f9ff;
}

body.theme-dark .auth-brand > div > strong,
body.theme-dark .auth-header h1,
body.theme-dark .ticket-workspace-title .page-title,
body.theme-dark .ticket-panel-header h2,
body.theme-dark .ticket-drawer-title,
body.theme-dark .ticket-create-header h1,
body.theme-dark .ticket-create-section-head h2,
body.theme-dark .ticket-create-side-card h2,
body.theme-dark .customer-management-header h1,
body.theme-dark .company-header h1,
body.theme-dark .settings-page-header h1,
body.theme-dark .settings-card h3,
body.theme-dark .settings-card-header h2,
body.theme-dark .settings-policy-tile strong,
body.theme-dark .settings-service-main strong,
body.theme-dark .settings-empty-state strong,
body.theme-dark .profile-hero h1,
body.theme-dark .profile-panel-title,
body.theme-dark .profile-panel-header h2,
body.theme-dark .profile-info-item dd,
body.theme-dark .profile-security-copy h3,
body.theme-dark .profile-notification-group h3,
body.theme-dark .profile-notification-title-row strong,
body.theme-dark .profile-security-note strong,
body.theme-dark .profile-modal-guide strong {
  color: var(--text-strong);
}

body.theme-dark .auth-brand > div > span,
body.theme-dark .auth-header p,
body.theme-dark .auth-check,
body.theme-dark .auth-link,
body.theme-dark .ticket-workspace-title p,
body.theme-dark .ticket-panel-kicker,
body.theme-dark .ticket-control-field span,
body.theme-dark .ticket-meta,
body.theme-dark .ticket-date-time-left,
body.theme-dark .ticket-create-section-head p,
body.theme-dark .ticket-create-field small,
body.theme-dark .ticket-create-summary dt,
body.theme-dark .settings-card p,
body.theme-dark .settings-card-header p,
body.theme-dark .settings-policy-tile span,
body.theme-dark .settings-service-main span,
body.theme-dark .settings-service-meta,
body.theme-dark .settings-empty-state span,
body.theme-dark .profile-hero p,
body.theme-dark .profile-panel-description,
body.theme-dark .profile-panel-header p:not(.profile-section-kicker),
body.theme-dark .profile-info-item dt,
body.theme-dark .profile-security-copy p,
body.theme-dark .profile-notification-copy p,
body.theme-dark .profile-notification-empty,
body.theme-dark .profile-security-note,
body.theme-dark .profile-modal-guide,
body.theme-dark .profile-info-label {
  color: var(--text-muted-dark);
}

body.theme-dark .auth-field span,
body.theme-dark .ticket-create-field span,
body.theme-dark .settings-field span,
body.theme-dark .company-form-section-title strong,
body.theme-dark .representative-person-cell strong,
body.theme-dark .representative-stack strong,
body.theme-dark .settings-account-cell strong,
body.theme-dark .company-name-cell strong,
body.theme-dark .company-stack strong,
body.theme-dark .ticket-list-drawer .ticket-title,
body.theme-dark .ticket-status-filter .stats-item strong,
body.theme-dark .ticket-meta-strip strong,
body.theme-dark .ticket-create-summary dd {
  color: var(--text-strong);
}

body.theme-dark .auth-password-toggle,
body.theme-dark .ticket-drawer-close,
body.theme-dark .drawer-filter-icon-btn,
body.theme-dark .company-icon-btn,
body.theme-dark .representative-icon-btn,
body.theme-dark .settings-icon-btn,
body.theme-dark .company-drawer-close,
body.theme-dark .modal-close {
  border-color: var(--line-strong);
  background: var(--surface-raised);
  color: var(--text-main);
}

body.theme-dark .auth-password-toggle:hover,
body.theme-dark .auth-password-toggle:focus-visible,
body.theme-dark .ticket-drawer-close:hover,
body.theme-dark .ticket-drawer-pin:hover,
body.theme-dark .ticket-drawer-pin.active,
body.theme-dark .drawer-filter-icon-btn:hover,
body.theme-dark .drawer-filter-icon-btn.active,
body.theme-dark .company-icon-btn:hover,
body.theme-dark .representative-icon-btn:hover,
body.theme-dark .representative-icon-btn:focus-visible,
body.theme-dark .settings-icon-btn:hover,
body.theme-dark .settings-icon-btn:focus-visible,
body.theme-dark .company-drawer-close:hover,
body.theme-dark .company-drawer-close:focus-visible {
  border-color: var(--accent-line);
  background: var(--accent-soft-dark);
  color: var(--accent-hover);
}

body.theme-dark .ticket-drawer-backdrop {
  background: rgba(4, 8, 14, 0.48);
}

body.theme-dark .ticket-drawer-pin {
  border-color: var(--line-strong);
  background: var(--surface-card);
  color: var(--text-muted-dark);
}

body.theme-dark .ticket-drawer-pin.active {
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
}

body.theme-dark .pane-list.ticket-list-drawer {
  border-color: var(--line-soft);
  background: var(--surface-panel);
  box-shadow: var(--shadow-dark-lg);
}

body.theme-dark .ticket-list-drawer .pane-list-header,
body.theme-dark .ticket-list-drawer .pane-list-content,
body.theme-dark .ticket-panel-header,
body.theme-dark .ticket-conversation-panel .reply-form,
body.theme-dark .company-toolbar,
body.theme-dark .company-table-meta,
body.theme-dark .representative-toolbar,
body.theme-dark .settings-card-header,
body.theme-dark .settings-policy-row,
body.theme-dark .settings-service-toolbar {
  border-color: var(--line-soft);
  background: var(--surface-base);
}

body.theme-dark .ticket-list-loading-overlay .spinner {
  background: rgba(15, 23, 42, 0.82);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
}

body.theme-dark .settings-policy-tile {
  border-color: var(--line-soft);
  background: var(--surface-panel);
}

body.theme-dark .settings-mail-field label {
  color: var(--text-main);
}

body.theme-dark .settings-mail-field select {
  border-color: var(--line-soft);
  background: var(--surface-base);
  color: var(--text-main);
}

body.theme-dark .settings-mail-field select:hover,
body.theme-dark .settings-mail-field select:focus {
  border-color: var(--accent-line);
}

body.theme-dark .settings-mail-note {
  color: var(--text-muted-dark);
}

body.theme-dark .settings-mail-footer {
  border-color: var(--line-soft);
}

body.theme-dark .profile-slack-card,
body.theme-dark .profile-channel-selector,
body.theme-dark .profile-channel-option,
body.theme-dark .settings-integration-status > div,
body.theme-dark .settings-slack-log-panel {
  border-color: var(--line-soft);
  background: var(--surface-base);
}

body.theme-dark .profile-slack-copy strong,
body.theme-dark .profile-slack-account strong,
body.theme-dark .profile-channel-selector-copy strong,
body.theme-dark .profile-channel-option strong,
body.theme-dark .settings-integration-status strong,
body.theme-dark .settings-slack-log-header strong {
  color: var(--text-main);
}

body.theme-dark .profile-slack-copy p,
body.theme-dark .profile-slack-account span,
body.theme-dark .profile-slack-status,
body.theme-dark .profile-channel-toggle,
body.theme-dark .profile-channel-selector-copy p,
body.theme-dark .profile-channel-option small,
body.theme-dark .settings-integration-switch,
body.theme-dark .settings-integration-status span,
body.theme-dark .settings-integration-status small,
body.theme-dark .settings-slack-log-header span {
  color: var(--text-muted-dark);
}

body.theme-dark .profile-slack-status,
body.theme-dark .profile-slack-avatar,
body.theme-dark .settings-slack-log-header {
  border-color: var(--line-soft);
  background: var(--surface-panel);
}

body.theme-dark .profile-slack-actions .btn.danger {
  border-color: rgba(248, 113, 113, 0.34);
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

body.theme-dark .profile-channel-option:hover,
body.theme-dark .profile-channel-option.is-selected {
  border-color: var(--accent-line);
  background: var(--accent-soft-dark);
}

body.theme-dark .settings-slack-log-status {
  background: var(--surface-hover);
  color: var(--text-main);
}

body.theme-dark .settings-slack-log-status.sent,
body.theme-dark .settings-slack-log-status.dry_run {
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
}

body.theme-dark .settings-slack-log-status.failed {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
}

body.theme-dark .settings-slack-log-status.skipped {
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
}

body.theme-dark .settings-service-row {
  border-color: var(--line-soft);
  background: var(--surface-raised);
}

body.theme-dark .profile-notification-group,
body.theme-dark .profile-notification-empty {
  border-color: var(--line-soft);
  background: var(--surface-base);
}

body.theme-dark .profile-notification-group h3,
body.theme-dark .profile-notification-item {
  border-color: var(--line-soft);
}

body.theme-dark .profile-notification-switch span {
  background: var(--surface-hover);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

body.theme-dark .profile-notification-switch span::after {
  background: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.32);
}

body.theme-dark .profile-notification-switch input:checked + span {
  background: #4772f0;
  box-shadow: inset 0 0 0 1px rgba(109, 150, 255, 0.35);
}

body.theme-dark .settings-service-row:hover {
  background: var(--surface-hover);
}

body.theme-dark .settings-service-row.is-dragging {
  box-shadow: var(--shadow-dark-lg);
}

body.theme-dark .settings-service-drag {
  border-color: var(--line-strong);
  background: var(--surface-base);
  color: var(--text-muted-dark);
}

body.theme-dark .settings-service-drag:hover,
body.theme-dark .settings-service-drag:focus-visible {
  border-color: var(--accent-line);
  background: var(--accent-soft-dark);
  color: var(--accent-hover);
}

body.theme-dark .ticket-status-filter,
body.theme-dark .drawer-date-filter,
body.theme-dark .drawer-advanced-panel,
body.theme-dark .date-preset-btn,
body.theme-dark .ticket-meta-strip,
body.theme-dark .ticket-share-option,
body.theme-dark .settings-tabs,
body.theme-dark .customer-management-tabs,
body.theme-dark .profile-password-hint,
body.theme-dark .profile-security-note,
body.theme-dark .profile-modal-guide {
  border-color: var(--line-soft);
  background: var(--surface-base);
}

body.theme-dark .settings-tabs {
  background: transparent;
}

body.theme-dark .ticket-status-filter .stats-item {
  color: var(--text-muted-dark);
}

body.theme-dark .ticket-status-filter .stats-item:hover,
body.theme-dark .stats-item:hover,
body.theme-dark .date-preset-btn:hover {
  background: var(--surface-raised);
}

body.theme-dark .date-preset-btn {
  color: var(--text-main);
}

body.theme-dark .date-preset-btn:hover {
  border-color: var(--accent-line);
  color: var(--accent-hover);
}

body.theme-dark .ticket-status-filter .stats-item.active,
body.theme-dark .stats-item.active {
  background: var(--surface-raised);
  color: var(--accent-hover);
  box-shadow: inset 0 0 0 1px rgba(109, 150, 255, 0.22);
}

body.theme-dark .ticket-list-drawer .ticket-card,
body.theme-dark .ticket-card {
  border-color: var(--line-soft);
  background: var(--surface-raised);
  color: var(--text-main);
  box-shadow: none;
}

body.theme-dark .ticket-list-drawer .ticket-card:hover,
body.theme-dark .ticket-card:hover {
  border-color: var(--accent-line);
  background: var(--surface-hover);
}

body.theme-dark .ticket-list-drawer .ticket-card.active,
body.theme-dark .ticket-card.active {
  border-color: rgba(109, 150, 255, 0.52);
  background: rgba(109, 150, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(109, 150, 255, 0.08);
}

body.theme-dark .detail-content.ticket-content,
body.theme-dark .detail-content,
body.theme-dark .reply-bubble,
body.theme-dark .ticket-meta-strip div,
body.theme-dark .ticket-control-readonly,
body.theme-dark .ticket-conversation-panel .file-drop-zone,
body.theme-dark .file-drop-zone,
body.theme-dark .ticket-upload-area .ticket-drop-zone.file-drop-zone {
  border-color: var(--line-soft);
  background: var(--surface-base) !important;
  color: var(--text-main);
}

body.theme-dark .reply-bubble.reply-bubble-internal {
  border-color: rgba(74, 222, 128, 0.48);
  background: rgba(22, 101, 52, 0.24) !important;
  color: #dcfce7;
  box-shadow: inset 0 0 0 1px rgba(187, 247, 208, 0.08), 0 8px 22px rgba(0, 0, 0, 0.22);
}

body.theme-dark .reply-bubble.reply-bubble-internal .reply-content,
body.theme-dark .reply-bubble.reply-bubble-internal .reply-text {
  color: #dcfce7;
}

body.theme-dark .reply-item.internal-reply .reply-internal-icon {
  color: #86efac;
}

body.theme-dark .file-drop-zone:hover,
body.theme-dark .file-drop-zone.drag-over,
body.theme-dark .ticket-upload-area .ticket-drop-zone.file-drop-zone:hover,
body.theme-dark .ticket-upload-area .ticket-drop-zone.file-drop-zone.drag-over {
  border-color: var(--accent-line);
  background: var(--accent-soft-dark) !important;
  color: var(--accent-hover);
}

body.theme-dark .ticket-control-readonly strong,
body.theme-dark .ticket-shared-badge,
body.theme-dark .ticket-priority-note {
  color: var(--accent-hover);
}

body.theme-dark .ticket-shared-badge,
body.theme-dark .ticket-priority-note,
body.theme-dark .company-service-chip,
body.theme-dark .representative-company-chip,
body.theme-dark .settings-role-chip.admin {
  border-color: var(--accent-line);
  background: var(--accent-soft-dark);
  color: var(--accent-hover);
}

body.theme-dark .ticket-priority-note.urgent,
body.theme-dark .badge-priority-urgent {
  border-color: rgba(255, 113, 129, 0.34);
  background: var(--danger-soft);
  color: var(--danger-main);
}

body.theme-dark .ticket-new-badge {
  border-color: rgba(255, 113, 129, 0.34);
  background: var(--danger-soft);
  color: var(--danger-main);
}

body.theme-dark .ticket-card.has-unread-replies .ticket-title {
  color: var(--text-strong);
}

body.theme-dark .ticket-split-resizer span {
  background: var(--accent-hover);
  box-shadow: 0 0 0 4px rgba(109, 150, 255, 0.16), 0 8px 22px rgba(109, 150, 255, 0.22);
}

body.theme-dark .ticket-delete-button {
  border-color: rgba(255, 113, 129, 0.34);
  background: var(--danger-soft);
  color: var(--danger-main);
}

body.theme-dark .ticket-delete-button:hover,
body.theme-dark .ticket-delete-button:focus-visible {
  background: rgba(255, 113, 129, 0.2);
}

body.theme-dark .ticket-editor-shell .ql-toolbar.ql-snow,
body.theme-dark .ql-toolbar.ql-snow {
  border-color: var(--line-soft) !important;
  background: var(--surface-raised);
}

body.theme-dark .ticket-editor-shell .ql-container.ql-snow,
body.theme-dark .ql-container.ql-snow {
  border-color: var(--line-soft) !important;
  background: var(--surface-base);
  color: var(--text-main) !important;
}

body.theme-dark .ticket-editor-shell .ql-editor,
body.theme-dark .ql-editor {
  color: var(--text-main);
}

body.theme-dark .ticket-editor-shell .ql-editor.ql-blank::before,
body.theme-dark .ql-editor.ql-blank::before {
  color: var(--text-faint) !important;
}

body.theme-dark .ql-snow .ql-stroke,
body.theme-dark .ticket-editor-shell .ql-snow .ql-stroke {
  stroke: var(--text-muted-dark) !important;
}

body.theme-dark .ql-snow .ql-fill,
body.theme-dark .ticket-editor-shell .ql-snow .ql-fill {
  fill: var(--text-muted-dark) !important;
}

body.theme-dark .ql-snow .ql-picker,
body.theme-dark .ticket-editor-shell .ql-snow .ql-picker {
  color: var(--text-muted-dark) !important;
}

body.theme-dark .ql-snow .ql-picker-options {
  border-color: var(--line-strong) !important;
  background: var(--surface-panel) !important;
}

body.theme-dark .ql-toolbar.ql-snow button:hover,
body.theme-dark .ql-toolbar.ql-snow button:focus-visible,
body.theme-dark .ql-toolbar.ql-snow button.ql-active {
  background: var(--accent-soft-dark);
}

body.theme-dark .ticket-conversation-panel #reply-file-drop-zone {
  border-color: var(--line-soft) !important;
  background: var(--surface-base) !important;
}

body.theme-dark .ticket-conversation-panel #reply-drop-zone-placeholder {
  color: var(--text-muted-dark) !important;
}

body.theme-dark .attachment-item,
body.theme-dark .ticket-file-item {
  border-color: var(--line-soft);
  background: var(--surface-raised);
  color: var(--text-main);
}

body.theme-dark .detail-attachments {
  border-color: var(--line-soft);
  background: var(--surface-raised);
}

body.theme-dark .detail-attachments > span {
  color: var(--text-main);
}

body.theme-dark .attachment-item:hover {
  border-color: var(--accent-line);
  background: var(--surface-hover);
}

body.theme-dark .attachment-item-icon,
body.theme-dark .ticket-file-icon {
  border-color: var(--accent-line);
  background: var(--accent-soft-dark);
  color: var(--accent-hover);
}

body.theme-dark .attachment-item-name,
body.theme-dark .ticket-file-info strong {
  color: var(--text-strong);
}

body.theme-dark .attachment-item-size,
body.theme-dark .ticket-file-info small {
  color: var(--text-muted-dark);
}

body.theme-dark .ticket-drop-icon {
  border-color: var(--accent-line);
  background: var(--accent-soft-dark);
  color: var(--accent-hover);
}

body.theme-dark .ticket-drop-placeholder strong {
  color: var(--text-strong);
}

body.theme-dark .ticket-drop-placeholder span:last-child {
  color: var(--text-muted-dark);
}

body.theme-dark .ticket-share-option strong {
  color: var(--text-strong);
}

body.theme-dark .ticket-create-summary dl div {
  border-color: var(--line-soft);
}

body.theme-dark .customer-management-tab,
body.theme-dark .settings-tab {
  border-color: var(--line-soft);
  background: var(--surface-base);
  color: var(--text-muted-dark);
}

body.theme-dark .customer-management-tab:hover,
body.theme-dark .customer-management-tab:focus-visible,
body.theme-dark .settings-tab:hover,
body.theme-dark .settings-tab:focus-visible {
  background: var(--surface-hover);
  color: var(--text-strong);
}

body.theme-dark .customer-management-tab.active,
body.theme-dark .settings-tab.active {
  border-color: var(--accent-line);
  background: var(--surface-raised);
  color: var(--text-strong);
  box-shadow: inset 0 0 0 1px rgba(109, 150, 255, 0.08);
}

body.theme-dark .customer-tab-alert {
  border-color: rgba(240, 184, 92, 0.34);
  background: var(--warning-soft);
  color: var(--warning-main);
}

body.theme-dark .customer-tab-alert strong {
  color: #ffd08a;
}

body.theme-dark .company-table th,
body.theme-dark .representative-table th,
body.theme-dark .settings-table th {
  border-color: var(--line-soft);
  background: var(--surface-base);
  color: var(--text-muted-dark);
}

body.theme-dark .representative-section,
body.theme-dark .representative-table-wrap,
body.theme-dark .representative-table tbody {
  background: var(--surface-panel);
}

body.theme-dark .representative-section-header {
  border-color: var(--line-soft);
  background: var(--surface-base);
}

body.theme-dark .representative-section-header h2 {
  color: var(--text-strong);
}

body.theme-dark .company-table tr,
body.theme-dark .representative-table tr,
body.theme-dark .settings-table tr {
  background: transparent;
}

body.theme-dark .company-table td,
body.theme-dark .representative-table td,
body.theme-dark .settings-table td {
  border-color: var(--line-soft);
  background: transparent;
  color: var(--text-main);
}

body.theme-dark .company-table tbody tr:hover td,
body.theme-dark .representative-table tbody tr:hover td,
body.theme-dark .settings-table tbody tr:hover td {
  background: rgba(109, 150, 255, 0.07);
}

body.theme-dark .company-table tr.is-inactive td {
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-muted-dark);
}

body.theme-dark .company-name-cell span,
body.theme-dark .company-stack span,
body.theme-dark .company-muted,
body.theme-dark .company-ellipsis,
body.theme-dark .representative-person-cell span,
body.theme-dark .representative-stack span,
body.theme-dark .representative-section-header span,
body.theme-dark .settings-account-cell span:not(.settings-avatar),
body.theme-dark .settings-empty-state,
body.theme-dark .company-empty-state,
body.theme-dark .representative-empty-state {
  color: var(--text-muted-dark);
}

body.theme-dark .company-status-chip.active,
body.theme-dark .representative-status-chip.active,
body.theme-dark .settings-status-chip.active,
body.theme-dark .settings-service-scope-all,
body.theme-dark .representative-action-btn.success,
body.theme-dark .company-action-btn.success {
  border-color: rgba(84, 217, 156, 0.32);
  background: var(--success-soft);
  color: var(--success-main);
}

body.theme-dark .company-status-chip.inactive,
body.theme-dark .representative-status-chip.inactive,
body.theme-dark .company-action-btn.danger,
body.theme-dark .representative-action-btn.danger,
body.theme-dark .settings-action-btn.danger {
  border-color: rgba(255, 113, 129, 0.32);
  background: var(--danger-soft);
  color: var(--danger-main);
}

body.theme-dark .representative-role-chip,
body.theme-dark .settings-role-chip.manager,
body.theme-dark .settings-service-scope-tags span {
  border-color: rgba(154, 177, 255, 0.28);
  background: rgba(154, 177, 255, 0.12);
  color: #b7c7ff;
}

body.theme-dark .settings-contact-text {
  color: var(--text-muted-dark);
}

body.theme-dark .settings-service-scope-empty {
  border-color: var(--line-soft);
  background: var(--surface-raised);
  color: var(--text-muted-dark);
}

body.theme-dark .representative-role-chip.admin {
  border-color: var(--accent-line);
  background: var(--accent-soft-dark);
  color: var(--accent-hover);
}

body.theme-dark .representative-section.pending .representative-section-header h2 {
  color: var(--warning-main);
}

body.theme-dark .representative-section {
  border-color: var(--line-soft);
}

body.theme-dark .company-drawer-overlay,
body.theme-dark .settings-drawer-overlay,
body.theme-dark .representative-drawer-overlay {
  background: rgba(4, 8, 14, 0.58);
}

body.theme-dark .company-drawer,
body.theme-dark .settings-drawer,
body.theme-dark .representative-drawer {
  border-color: var(--line-soft);
  background: var(--app-bg);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.42);
}

body.theme-dark .company-drawer-header,
body.theme-dark .company-drawer-actions {
  border-color: var(--line-soft);
  background: var(--surface-panel);
}

body.theme-dark .company-form-section,
body.theme-dark .representative-readonly-field,
body.theme-dark .settings-drawer-note {
  border-color: var(--line-soft);
  background: var(--surface-panel);
  color: var(--text-main);
}

body.theme-dark .company-service-picker {
  border-color: var(--line-strong);
  background: var(--surface-base);
}

body.theme-dark .company-service-picker .company-muted {
  color: var(--text-muted-dark);
}

body.theme-dark .company-service-picker .company-service-option {
  border-color: var(--line-strong);
  background: var(--surface-raised);
  color: var(--text-main);
}

body.theme-dark .company-service-picker .company-service-option:hover,
body.theme-dark .company-service-picker .company-service-option:focus-within,
body.theme-dark .company-service-picker .company-service-option.is-selected,
body.theme-dark .company-service-picker .company-service-option:has(input:checked) {
  border-color: var(--accent-line);
  background: var(--accent-soft-dark);
  color: var(--accent-hover);
  box-shadow: inset 0 0 0 1px rgba(109, 150, 255, 0.08);
}

body.theme-dark .company-service-check {
  border-color: var(--line-strong);
  background: var(--surface-base);
  color: transparent;
}

body.theme-dark .company-service-option.is-selected .company-service-check,
body.theme-dark .company-service-option:has(input:checked) .company-service-check {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: #0b1220;
}

body.theme-dark .company-drawer-title {
  color: var(--text-strong);
}

body.theme-dark .company-drawer-subtitle,
body.theme-dark .company-form-section-title span,
body.theme-dark .representative-readonly-field span {
  color: var(--text-muted-dark);
}

body.theme-dark .representative-readonly-field strong {
  color: var(--text-strong);
}

body.theme-dark .representative-check-option {
  border-color: var(--line-soft);
  background: var(--surface-base);
  color: var(--text-main);
}

body.theme-dark .modal-overlay {
  background: rgba(4, 8, 14, 0.7);
}

body.theme-dark .modal-content {
  border-color: var(--line-soft);
  background: var(--surface-panel);
  color: var(--text-main);
  box-shadow: var(--shadow-dark-lg);
}

body.theme-dark .modal-title {
  color: var(--text-strong);
}

body.theme-dark .profile-permission-card,
body.theme-dark .profile-role-card,
body.theme-dark .profile-security-item,
body.theme-dark .profile-security-note {
  border-color: var(--line-soft);
  background: var(--surface-base);
}

body.theme-dark .profile-role-card span {
  color: var(--text-muted-dark);
}

body.theme-dark .profile-role-card strong {
  color: var(--accent-hover);
}

body.theme-dark .profile-section-kicker,
body.theme-dark .profile-eyebrow {
  color: var(--accent-hover);
}

body.theme-dark .profile-form-field label {
  color: var(--text-muted-dark);
}

body.theme-dark .profile-modal-guide {
  border-color: rgba(101, 152, 255, 0.28);
  background: rgba(73, 122, 255, 0.1);
  color: var(--text-muted-dark);
}

body.theme-dark .profile-modal-guide strong {
  color: var(--accent-hover);
}

body.theme-dark .profile-info-row,
body.theme-dark .profile-modal-actions {
  border-color: var(--line-soft);
}

body.theme-dark .toast {
  border-color: rgba(148, 163, 184, 0.24);
  background: #1f2937;
  color: #f8fafc;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
}

body.theme-dark .toast-success {
  border-color: rgba(52, 211, 153, 0.34);
  background: #047857;
  color: #ecfdf5;
}

body.theme-dark .toast-error {
  border-color: rgba(248, 113, 113, 0.34);
  background: #b91c1c;
  color: #fff5f5;
}

body.theme-dark .toast-info {
  border-color: rgba(96, 165, 250, 0.36);
  background: #1d4ed8;
  color: #eff6ff;
}

body.theme-dark .badge-open,
body.theme-dark .badge-priority-medium {
  border-color: var(--accent-line);
  background: var(--accent-soft-dark);
  color: var(--accent-hover);
}

body.theme-dark .badge-in_progress,
body.theme-dark .badge-priority-high {
  border-color: rgba(240, 184, 92, 0.34);
  background: var(--warning-soft);
  color: var(--warning-main);
}

body.theme-dark .badge-resolved,
body.theme-dark .badge-priority-low {
  border-color: rgba(84, 217, 156, 0.32);
  background: var(--success-soft);
  color: var(--success-main);
}

body.theme-dark .badge-closed {
  border-color: var(--line-strong);
  background: rgba(154, 168, 186, 0.11);
  color: var(--text-muted-dark);
}

body.theme-dark .badge-admin {
  border-color: rgba(167, 139, 250, 0.28);
  background: rgba(167, 139, 250, 0.13);
  color: #c4b5fd;
}

body.theme-dark .badge-customer {
  border-color: rgba(110, 214, 230, 0.28);
  background: rgba(110, 214, 230, 0.12);
  color: #8ae8f3;
}

body.theme-dark .auth-message {
  border-color: rgba(255, 113, 129, 0.32);
  background: var(--danger-soft);
  color: #ffc2c9;
}

body.theme-dark .auth-message.success {
  border-color: rgba(84, 217, 156, 0.32);
  background: var(--success-soft);
  color: #b8f4d5;
}

body.theme-dark .auth-legal-consent,
body.theme-dark .legal-document-card,
body.theme-dark .legal-agreement-card,
body.theme-dark .legal-agreement-item {
  border-color: var(--line-soft);
  background: var(--surface-panel);
}

body.theme-dark .legal-document-page,
body.theme-dark .legal-agreement-page {
  background: var(--app-bg);
  color: var(--text-main);
}

body.theme-dark .legal-document-header,
body.theme-dark .legal-agreement-header,
body.theme-dark .legal-document-meta {
  border-color: var(--line-soft);
}

body.theme-dark .legal-document-header h1,
body.theme-dark .legal-agreement-header h1,
body.theme-dark .legal-document-body h2,
body.theme-dark .legal-agreement-item strong {
  color: var(--text-strong);
}

body.theme-dark .legal-document-header p:not(.legal-kicker),
body.theme-dark .legal-agreement-header p:not(.legal-kicker),
body.theme-dark .legal-document-meta,
body.theme-dark .legal-document-body,
body.theme-dark .legal-document-body .legal-bullet,
body.theme-dark .legal-agreement-item small,
body.theme-dark .auth-legal-check {
  color: var(--text-muted-dark);
}

body.theme-dark .auth-legal-inline-link,
body.theme-dark .auth-legal-link,
body.theme-dark .legal-kicker,
body.theme-dark .legal-text-link {
  color: var(--accent-hover);
}

body.theme-dark .legal-agreement-all {
  border-color: var(--accent-line);
  background: var(--accent-soft-dark);
  color: var(--accent-hover);
}

body.theme-dark .legal-modal-overlay {
  background: rgba(3, 7, 13, 0.68);
}

body.theme-dark .legal-modal,
body.theme-dark .legal-modal-body,
body.theme-dark .legal-modal-actions {
  border-color: var(--line-soft);
  background: var(--surface-panel);
}

body.theme-dark .legal-modal-header,
body.theme-dark .legal-modal-meta,
body.theme-dark .legal-modal-actions {
  border-color: var(--line-soft);
}

body.theme-dark .legal-modal-scroll,
body.theme-dark .legal-modal-close {
  background: var(--surface-base);
}

body.theme-dark .legal-modal-header h2 {
  color: var(--text-strong);
}

body.theme-dark .legal-modal-meta {
  color: var(--text-muted-dark);
}

body.theme-dark .legal-modal-close {
  border-color: var(--line-strong);
  color: var(--text-muted-dark);
}

body.theme-dark .legal-modal-close:hover,
body.theme-dark .legal-modal-close:focus-visible {
  border-color: var(--accent-line);
  background: var(--accent-soft-dark);
  color: var(--accent-hover);
}

body.theme-dark .lightbox-overlay {
  background: rgba(2, 6, 12, 0.9);
}

@media (max-width: 768px) {
  body.theme-dark .sidebar {
    border-top-color: var(--line-soft);
    background: rgba(16, 23, 33, 0.96);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.34);
  }

  body.theme-dark .sidebar.sidebar-admin {
    border-top-color: #1d2736;
    background: rgba(11, 17, 25, 0.96);
  }

  body.theme-dark .sidebar.sidebar-customer .sidebar-user {
    border-right-color: var(--line-soft);
  }

  body.theme-dark .sidebar.sidebar-customer .profile-popover::before {
    border-color: var(--line-strong);
  }

  body.theme-dark .customer-management-tabs,
  body.theme-dark .settings-tabs {
    border-color: var(--line-soft);
    background: var(--surface-base);
  }

  body.theme-dark .company-table tr,
  body.theme-dark .representative-table tr,
  body.theme-dark .user-management-embedded .user-management-table tr {
    border-color: var(--line-soft);
    background: var(--surface-raised);
  }

  body.theme-dark .company-table td,
  body.theme-dark .representative-table td,
  body.theme-dark .user-management-embedded .user-management-table td {
    border-color: var(--line-soft);
    color: var(--text-main);
  }

  body.theme-dark .company-table td::before,
  body.theme-dark .representative-table td::before,
  body.theme-dark .user-management-embedded .user-management-table td::before {
    color: var(--text-muted-dark);
  }

  body.theme-dark .company-drawer {
    border-left: 0;
  }
}

@media (max-width: 768px) {
  .settings-tab,
  .ql-toolbar.ql-snow button {
    min-height: 44px;
  }

  .ql-toolbar.ql-snow button {
    width: 44px !important;
    height: 44px !important;
  }
}

.reply-composer-compact {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.reply-composer-tools {
  display: none;
}

@media (max-width: 768px) {
  .ticket-workspace {
    padding: 8px;
    gap: 8px;
  }

  .ticket-workspace-toolbar {
    padding: 10px;
  }

  .ticket-workspace-title h1 {
    font-size: 20px;
  }

  .ticket-question-panel {
    padding-bottom: 72px;
  }

  .ticket-question-panel .ticket-panel-header {
    padding: 10px 12px;
  }

  .ticket-question-panel .ticket-panel-kicker {
    margin-bottom: 2px;
    font-size: 10px;
  }

  .ticket-question-panel .ticket-panel-header h2 {
    font-size: 19px;
    line-height: 1.25;
  }

  .ticket-question-panel .ticket-control-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .ticket-question-panel .ticket-control-field {
    gap: 4px;
    min-width: 0;
  }

  .ticket-question-panel .ticket-control-field span {
    font-size: 10px;
  }

  .ticket-question-scroll {
    padding: 8px 12px 10px;
  }

  .ticket-meta-strip {
    gap: 0;
    margin-bottom: 8px;
    padding: 0;
    border-radius: 10px;
    background: #fbfcfe;
  }

  .ticket-meta-strip div {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 0;
    background: transparent;
  }

  .ticket-meta-strip div:first-child {
    border-radius: 9px 9px 0 0;
  }

  .ticket-meta-strip div:last-child {
    border-bottom: 0;
    border-radius: 0 0 9px 9px;
  }

  .ticket-meta-strip span {
    margin: 0;
    font-size: 10px;
  }

  .ticket-meta-strip strong {
    font-size: 13px;
    line-height: 1.3;
  }

  .detail-content.ticket-content {
    min-height: clamp(320px, 48dvh, 520px);
    padding: 16px 14px;
    line-height: 1.64;
  }

  .ticket-conversation-panel.expanded:not(.composer-open) {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .ticket-conversation-panel.expanded:not(.composer-open) .reply-thread {
    flex: 1 1 auto;
    padding: 12px;
  }

  .ticket-conversation-panel.expanded:not(.composer-open) .reply-form {
    flex: 0 0 auto;
    max-height: none;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    overflow: visible;
  }

  .ticket-conversation-panel.expanded:not(.composer-open) .reply-form form,
  .ticket-conversation-panel.expanded:not(.composer-open) .reply-form-resize-handle {
    display: none !important;
  }

  .ticket-conversation-panel.expanded .reply-composer-compact {
    width: 100%;
    min-height: 54px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: #ffffff;
    color: #64748b;
    cursor: text;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 8px 0 14px;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 800;
    text-align: left;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
  }

  .ticket-conversation-panel.expanded .reply-composer-action {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 10px;
    background: #2563eb;
    color: #ffffff;
  }

  .ticket-conversation-panel.expanded .reply-composer-action svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .ticket-conversation-panel.composer-open .reply-composer-compact {
    display: none;
  }

  .ticket-conversation-panel.composer-open .reply-form {
    max-height: 27dvh;
    position: relative;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .ticket-conversation-panel.composer-open .reply-form form {
    display: block;
  }

  .ticket-conversation-panel.composer-open .reply-composer-tools {
    display: flex;
    justify-content: flex-end;
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    margin-bottom: 0;
  }

  .ticket-conversation-panel.composer-open .reply-composer-toggle {
    width: 38px;
    height: 38px;
    min-height: 38px;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    background: #f8fafc;
    color: #2563eb;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease;
  }

  .ticket-conversation-panel.composer-open .reply-composer-toggle:hover,
  .ticket-conversation-panel.composer-open .reply-composer-toggle:focus-visible {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
    transform: translateY(-1px);
  }

  .ticket-conversation-panel.composer-open .reply-composer-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .ticket-conversation-panel.composer-open .reply-form-resize-handle {
    display: none !important;
  }

  .ticket-conversation-panel.composer-open .reply-thread {
    flex: 1 1 auto;
    min-height: 0;
  }

  .ticket-conversation-panel.composer-open .reply-editor-container {
    margin-bottom: 6px !important;
  }

  /* 모바일 답변 작성은 서식 편집기가 아니라 채팅 입력창처럼 보이도록 툴바를 숨긴다. */
  .ticket-conversation-panel.composer-open .ql-toolbar.ql-snow {
    display: none !important;
  }

  .ticket-conversation-panel.composer-open .reply-editor-container .ql-container.ql-snow {
    min-height: 78px;
    max-height: 92px;
    border-radius: 12px !important;
    background: #f8fafc;
  }

  .ticket-conversation-panel.composer-open .reply-editor-container .ql-editor {
    min-height: 78px;
    max-height: 92px;
    padding: 12px 14px !important;
    font-size: 14px;
    line-height: 1.5;
  }

  .ticket-conversation-panel.composer-open .reply-editor-container .ql-editor.ql-blank::before {
    left: 14px;
    right: 14px;
    color: #94a3b8 !important;
  }

  .ticket-conversation-panel.composer-open #reply-file-drop-zone {
    min-height: 34px !important;
    padding: 4px 10px !important;
    border-radius: 12px;
  }

  .ticket-conversation-panel.composer-open #reply-form > div:last-child {
    gap: 7px !important;
  }

  .ticket-conversation-panel.composer-open #reply-form > div:last-child > div:last-child {
    width: 100%;
    justify-content: space-between;
    gap: 8px !important;
  }

  .ticket-conversation-panel.composer-open #reply-form label {
    min-height: 32px;
    font-size: 12px !important;
  }

  .ticket-conversation-panel.composer-open #reply-submit {
    min-height: 40px;
    padding: 0 18px !important;
    font-size: 14px !important;
    transform: none !important;
  }
}

@media (max-width: 768px) {
  body.theme-dark .ticket-meta-strip {
    background: var(--surface-raised);
  }

  body.theme-dark .ticket-meta-strip div {
    border-color: var(--line-soft);
    background: transparent;
  }

  body.theme-dark .ticket-conversation-panel.expanded .reply-composer-compact {
    border-color: var(--line-strong);
    background: var(--surface-base);
    color: var(--text-subtle);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  }

  body.theme-dark .ticket-conversation-panel.expanded .reply-composer-action {
    background: var(--accent-main);
    color: #f8fbff;
  }

  body.theme-dark .ticket-conversation-panel.composer-open .reply-composer-toggle {
    border-color: var(--line-strong);
    background: var(--surface-raised);
    color: var(--text-main);
  }

  body.theme-dark .ticket-conversation-panel.composer-open .reply-composer-toggle:hover,
  body.theme-dark .ticket-conversation-panel.composer-open .reply-composer-toggle:focus-visible {
    border-color: var(--accent-soft);
    background: var(--surface-base);
    color: #bfdbfe;
  }

  body.theme-dark .ticket-conversation-panel.composer-open .reply-editor-container .ql-container.ql-snow {
    border-color: var(--line-strong) !important;
    background: var(--surface-base);
  }

  body.theme-dark .ticket-conversation-panel.composer-open .reply-editor-container .ql-editor.ql-blank::before {
    color: var(--text-muted-dark) !important;
  }
}






