:root {
  --primary: #104336;       /* Evergreen Deep */
  --primary-light: #F0FDF4;
  --primary-dark: #0A241E;
  --secondary: #71717A;     /* Zinc 500 */
  --success: #059669;
  --warning: #F59E0B;
  --danger: #EF4444;
  --bg-app: #ffffff;        /* White Canvas from DESIGN.md (was Soft Gray) */
  --bg-card: #FFFFFF;
  --bg-pampas: #f3f1ec;     /* Pampas */
  --logo-blue: #1e40af;     /* HOOW Deep Blue */
  --logo-blue-dark: #1e3a8a;
  --text-main: #101f1e;     /* Mid-Tone Charcoal */
  --text-muted: #535e5d;     /* Graphite */
  --border: #94A3B8;        /* Slate 400 - Much clearer than Slate 200 */
  --sidebar-w: 280px;
  --header-h: 80px;
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Form Input Styling */
  --input-radius: 3px;
  --input-border: #94A3B8;
  --input-border-focus: var(--primary);
  --input-bg-disabled: #f1f5f9;
  --input-text-disabled: #94A3B8;
  --input-py: 0.625rem;    /* 10px */
  --input-px: 1rem;       /* 16px */
  --input-h: 2.75rem;      /* 44px */
}

/* Custom Category Selector Styles */
.cat-selector-container {
    position: relative;
    width: 100%;
}

.cat-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.25rem;
    height: 3.5rem;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.cat-display:hover {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.cat-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 1rem;
    display: none;
    animation: slideDown 0.2s ease-out;
}

.cat-dropdown.show {
    display: block;
}

.cat-list {
    max-height: 250px;
    overflow-y: auto;
    margin-top: 0.75rem;
}

.cat-item {
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #475569;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cat-item:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.cat-item.active {
    background: #f1f5f9;
    color: var(--primary);
    font-weight: 800;
}

/* Tree Structure Styles */
.cat-item.tree-node {
    position: relative;
    user-select: none;
}

.cat-item.tree-node .node-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.cat-item.tree-node .toggle-btn {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    margin-right: -4px;
}

.cat-item.tree-node .toggle-btn:hover {
    background: #e2e8f0;
}

.cat-filter-width {
    width: 320px !important;
}

.cat-list-scroll {
    max-height: 450px !important;
}

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

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Pretendard Variable', 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-app);
  line-height: 1.5;
  letter-spacing: -0.02em;
  -webkit-font-smoothing: antialiased;
}

/* Global Form Elements Enhancement */
input:not([type="checkbox"]):not([type="radio"]), textarea, select {
    background-color: #ffffff !important;
    border: 1px solid var(--input-border) !important; /* Slate 400 */
    border-radius: var(--input-radius) !important;
    color: var(--text-main) !important;
    font-weight: 500 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    outline: none !important;
}



textarea {
  height: auto !important;
  min-height: 120px;
}

/* Input Sizes */
.input-xs {
    --input-py: 0.25rem;      /* 세로 패딩 (약 4px) */
    --input-px: 0.5rem;       /* 가로 패딩 (약 8px) */
    --input-h: 1.75rem;       /* 높이 (28px, sm은 36px) */
    padding: var(--input-py) var(--input-px);
    height: var(--input-h) !important;
    font-size: 0.75rem;       /* 텍스트 크기도 작게 (12px) */
}

.input-sm {
    --input-py: 0.375rem;
    --input-px: 0.75rem;
    --input-h: 2.25rem;
    padding: var(--input-py) var(--input-px);
    height: var(--input-h) !important;
    font-size: 0.813rem !important;
}

.input-md {
    --input-py: 0.5rem;
    --input-px: 0.875rem;
    --input-h: 2.75rem;
    padding: var(--input-py) var(--input-px);
    height: var(--input-h) !important;
    font-size: 0.875rem !important;
}

.input-lg {
    --input-py: 0.75rem;
    --input-px: 1.25rem;
    --input-h: 3.5rem;
    padding: var(--input-py) var(--input-px);
    height: var(--input-h) !important;
    font-size: 1rem !important;
}

/* 아이콘이 있는 인풋을 위한 여백 오버라이드 */
.input-icon-left {
    padding-left: 3.5rem !important; /* 56px: 아이콘 공간 확보 */
}
.input-icon-right {
    padding-right: 3.5rem !important;
}

input:not([type="checkbox"]):not([type="radio"]):focus, textarea:focus, select:focus {
    background-color: #ffffff !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(17, 66, 50, 0.1), inset 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    outline: none !important;
}

/* 읽기 전용 또는 비활성화 상태와 확실히 대비 */
input:disabled, input[readonly], textarea:disabled, select:disabled {
  background: #f8fafc !important;
  border-color: #f1f5f9 !important;
  box-shadow: none !important;
  color: #94a3b8 !important;
  cursor: not-allowed !important;
  border-color: #e2e8f0 !important;
}

input::placeholder, textarea::placeholder {
  color: #94A3B8;
  font-weight: 400;
}

.font-outfit {
  font-family: 'Pretendard Variable', sans-serif;
}

/* Layout Components */
.layout-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  position: fixed;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible !important;
}

/* Sidebar Collapsed State */
html.sidebar-collapsed {
  --sidebar-w: 80px;
}

html.sidebar-collapsed .logo-expanded {
  display: none !important;
}

html.sidebar-collapsed .logo-collapsed {
  display: flex !important;
}

html.sidebar-collapsed .sidebar-logo {
  padding-left: 0 !important;
  padding-right: 0 !important;
  justify-content: center !important;
}

html.sidebar-collapsed .sidebar-toggle-btn .icon-expanded {
  display: none !important;
}

html.sidebar-collapsed .sidebar-toggle-btn .icon-collapsed {
  display: block !important;
}

html.sidebar-collapsed .nav-item:not(.flyout-menu .nav-item) span,
html.sidebar-collapsed .sidebar .group\/header p,
html.sidebar-collapsed .sidebar .group\/header iconify-icon.shrink-0,
html.sidebar-collapsed .sidebar .group\/header iconify-icon[x-bind*="icon"],
html.sidebar-collapsed .sidebar .group\/header iconify-icon:not(.icon-collapsed):not(.icon-expanded):not(.group-collapsed-icon) {
  display: none !important;
}

html.sidebar-collapsed .group-collapsed-icon {
  display: block !important;
}

html.sidebar-collapsed .nav-item:not(.flyout-menu .nav-item) {
  justify-content: center !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

html.sidebar-collapsed .sidebar .group\/header {
  justify-content: center !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Hide accordion contents when collapsed */
html.sidebar-collapsed .sidebar [x-collapse] {
  display: none !important;
}

html.sidebar-collapsed .sidebar-bottom-box {
  display: none !important;
}

html.sidebar-collapsed .sidebar-bottom-collapsed {
  display: flex !important;
}

/* Force show flyout menu on hover when collapsed */
html.sidebar-collapsed .sidebar .relative:hover .flyout-menu {
  display: block !important;
  opacity: 1 !important;
  transform: translateX(0) !important;
  pointer-events: auto !important;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Sidebar Elements */
.sidebar-logo {
  height: var(--header-h);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-box {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), #114232);
  border-radius: var(--radius-standard);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.nav-menu {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Allow flyouts and tooltips to overflow in collapsed state */
html.sidebar-collapsed .nav-menu {
  overflow: visible !important;
}

/* Hide flyouts and tooltips in expanded state to prevent clipping */
html:not(.sidebar-collapsed) .flyout-menu,
html:not(.sidebar-collapsed) [data-tip]::after,
html:not(.sidebar-collapsed) [data-tip]::before {
  display: none !important;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  border-radius: 12px;
  transition: all 0.2s;
  margin-bottom: 0.25rem;
  font-size: 0.938rem;
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

.nav-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

/* Header Elements */
.main-header {
  height: var(--header-h);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-standard);
  transition: all 0.2s;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
}

.user-profile:hover {
  background: var(--primary-light);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #0ea5e9, #0369a1);
  border-radius: var(--radius-standard);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: white;
  box-shadow: 0 4px 12px rgba(3, 105, 161, 0.35);
}

/* Cards & Content */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-standard);
  border: 1px solid var(--border);
  padding: 2rem;
  margin-bottom: 2.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  box-shadow: var(--shadow);
}

.premium-btn {
  background: var(--primary);
  color: white;
  padding: 0.875rem 1.75rem;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
}

.premium-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(34, 204, 119, 0.2);
}

/* Custom Utilities for existing markup compatibility */
.p-24 {
  padding: 1.5rem;
}

.p-32 {
  padding: 2rem;
}

.p-48 {
  padding: 3rem;
}

.p-64 {
  padding: 4rem;
}

.px-24 {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.px-12 {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.py-12 {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.py-16 {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.py-4 {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.mb-8 {
  margin-bottom: 0.5rem;
}

.mb-16 {
  margin-bottom: 1rem;
}

.mb-24 {
  margin-bottom: 1.5rem;
}

.mb-32 {
  margin-bottom: 2rem;
}

.mr-8 {
  margin-right: 0.5rem;
}

.gap-16 {
  gap: 1rem;
}

.gap-32 {
  gap: 2rem;
}

.text-48 {
  font-size: 3rem;
}

.h1 {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
}

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

.text-success {
  color: var(--success);
}

/* Glassmorphism Cards */
.glass-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-standard);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

.border-glass-border {
  border-color: rgba(255, 255, 255, 0.1);
}

/* Button overrides */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border-radius: 0.75rem;
  transition: all 0.2s;
  cursor: pointer;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-secondary:hover {
  background-color: var(--primary-light);
  color: var(--text-main);
}

/* Badge styles */
.badge {
  display: inline-flex;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-standard);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background-color: #064e3b;
  color: #6ee7b7;
}

.badge-primary {
  background-color: #dbeafe;
  color: #1e40af;
}

.badge-error {
  background-color: #7f1d1d;
  color: #fca5a5;
}

.badge-secondary {
  background-color: #f1f5f9;
  color: #475569;
}

/* Table styles */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-standard);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

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

th {
  background: #f8fafc;
  padding: 1.25rem 1.5rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 1.25rem 1.5rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}

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

tr:hover td {
  background-color: var(--primary-light);
}

/* Animations */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-up {
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* --- Tooltip Styles --- */
[data-tip] {
  position: relative;
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 15px);
  top: 50%;
  transform: translateY(-50%) translateX(-10px);
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  color: white;
  padding: 8px 12px;
  border-radius: var(--radius-standard);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
}

[data-tip]::before {
  content: "";
  position: absolute;
  left: calc(100% + 5px);
  top: 50%;
  transform: translateY(-50%) translateX(-10px);
  border: 5px solid transparent;
  border-right-color: rgba(15, 23, 42, 0.9);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
}

[data-tip]:hover::after,
[data-tip]:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}