:root {
  --bg-page:       #0f1117;
  --bg-surface:    #181c27;
  --bg-surface2:   #1e2333;
  --bg-hover:      #252a3a;
  --border:        #2a2f3d;
  --border-sub:    #3a4258;

  --text-primary:   #e8eaf0;
  --text-secondary: #8b92a5;
  --text-muted:     #4b5263;

  --red-bg:      #1f0f0f;
  --red-border:  #5c1a1a;
  --red-text:    #f09595;
  --red-strong:  #E24B4A;
  --red-deep:    #2a0f0f;

  --amber-bg:     #1f1700;
  --amber-border: #5c3d00;
  --amber-text:   #FAC775;
  --amber-strong: #EF9F27;
  --amber-deep:   #2a1a00;

  --green-bg:     #071a12;
  --green-border: #0d4d2e;
  --green-text:   #5DCAA5;
  --green-strong: #1D9E75;
  --green-deep:   #0a2a1a;

  --blue-bg:      #0a1a2e;
  --blue-border:  #0f3060;
  --blue-text:    #85B7EB;
  --blue-strong:  #378ADD;

  --chart-1: #1D9E75;
  --chart-2: #378ADD;
  --chart-3: #D85A30;
  --chart-4: #7F77DD;
  --chart-5: #EF9F27;
}

:root[data-theme="light"] {
  --bg-page: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface2: #f6f9ff;
  --bg-hover: #edf3fb;
  --border: #dbe4f2;
  --border-sub: #e6edf7;

  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;

  --red-bg: #fff1f1;
  --red-border: #f4c7c7;
  --red-text: #b42318;
  --red-strong: #dc2626;
  --red-deep: #fee2e2;

  --amber-bg: #fff8e8;
  --amber-border: #f1d79b;
  --amber-text: #8a5b00;
  --amber-strong: #d97706;
  --amber-deep: #fef3c7;

  --green-bg: #edfdf5;
  --green-border: #b6efd1;
  --green-text: #0f7a49;
  --green-strong: #0f9f6f;
  --green-deep: #dcfce7;

  --blue-bg: #eff6ff;
  --blue-border: #bfd7ff;
  --blue-text: #1d4ed8;
  --blue-strong: #2563eb;
}

body {
  background: var(--bg-page);
  color: var(--text-primary);
}

[data-theme="dark"] {
  background: var(--bg-page);
  color: var(--text-primary);
}
[data-theme="dark"] .bg-white { background-color: var(--bg-surface) !important; }
[data-theme="dark"] .bg-gray-50,
[data-theme="dark"] .bg-gray-100 { background-color: var(--bg-surface2) !important; }
[data-theme="dark"] .text-gray-900,
[data-theme="dark"] .text-gray-800,
[data-theme="dark"] .text-gray-700 { color: var(--text-primary) !important; }
[data-theme="dark"] .text-gray-600,
[data-theme="dark"] .text-gray-500 { color: var(--text-secondary) !important; }
[data-theme="dark"] .text-gray-400 { color: var(--text-muted) !important; }
[data-theme="dark"] .border,
[data-theme="dark"] .border-gray-100,
[data-theme="dark"] .border-gray-200,
[data-theme="dark"] .border-gray-300 { border-color: var(--border) !important; }
[data-theme="dark"] .border-b,
[data-theme="dark"] .border-t,
[data-theme="dark"] .border-l,
[data-theme="dark"] .border-r { border-color: var(--border-sub) !important; }
[data-theme="dark"] .divide-y > :not([hidden]) ~ :not([hidden]),
[data-theme="dark"] .divide-x > :not([hidden]) ~ :not([hidden]) { border-color: var(--border-sub) !important; }
[data-theme="dark"] .hover\:bg-gray-50:hover,
[data-theme="dark"] .hover\:bg-gray-100:hover { background-color: var(--bg-hover) !important; }
[data-theme="dark"] .hover\:text-\[\#0F6E56\]:hover { color: var(--green-strong) !important; }

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--bg-surface2) !important;
  color: var(--text-primary) !important;
  border: 0.5px solid var(--border) !important;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: var(--text-muted) !important;
}
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  outline: none !important;
  border-color: #0F6E56 !important;
  box-shadow: 0 0 0 1px rgba(46, 122, 113, 0.2) !important;
}
[data-theme="dark"] input:disabled,
[data-theme="dark"] select:disabled,
[data-theme="dark"] textarea:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus,
[data-theme="dark"] input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text-primary) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--bg-surface2) inset !important;
  box-shadow: 0 0 0 1000px var(--bg-surface2) inset !important;
  border: 0.5px solid var(--border) !important;
}

.fgss-notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 4px;
  border-radius: 9999px;
  background: var(--red-strong);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.125rem;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fgss-header-biz {
  background: transparent;
  border-bottom: none;
}

.fgss-sidebar-biz {
  background: transparent;
  border-right: none;
}

.fgss-header-shell {
  border: none !important;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent !important;
}

.fgss-sidebar-shell {
  border: none !important;
  margin: 0;
  border-radius: 0;
  height: 100%;
  box-shadow: none;
  background: transparent !important;
}

.fgss-header-shell.fgss-header-biz,
.fgss-sidebar-shell.fgss-sidebar-biz {
  border: none !important;
}

.fgss-main-shell {
  margin: 0.5rem 0.5rem 0.5rem 0;
  border-radius: 0.95rem;
  background: var(--bg-surface);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.09);
}

[data-theme="light"] .fgss-header-biz {
  background: #ffffff !important;
  border-bottom: none;
}

[data-theme="light"] .fgss-sidebar-biz {
  background: #ffffff !important;
  border-right: 1px solid var(--border-sub);
}

[data-theme="light"] .fgss-main-shell {
  background: #f3fbf6;
  border: none;
  border-radius: 1rem !important;
  box-shadow: none;
  overflow-y: auto;
  overflow-x: auto;
}

.fgss-main-shell {
  overflow-x: auto;
}

[data-theme="light"] .fgss-main-shell > div {
  background: #f3fbf6;
  border-radius: 1rem;
  min-height: 100%;
  overflow: visible;
}

[data-theme="dark"] .fgss-header-biz {
  background: var(--bg-page) !important;
}

[data-theme="dark"] .fgss-sidebar-biz {
  background: var(--bg-page) !important;
}

.fgss-sidebar-biz .sidebar-link {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
}
.fgss-sidebar-biz .sidebar-link .sidebar-icon {
  font-size: 1.8rem !important;
  font-variation-settings: "FILL" 0, "wght" 350, "GRAD" 0, "opsz" 24;
}
.fgss-sidebar-biz .sidebar-link:hover {
  background: rgba(46, 122, 113, 0.12);
  color: #0F6E56;
}

.fgss-sidebar-biz .sidebar-link.is-active {
  background: rgba(46, 122, 113, 0.16);
  color: #0F6E56 !important;
}
.fgss-sidebar-biz .sidebar-link.is-active .sidebar-icon {
  font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 24;
}
.flash-biz-success { background: var(--green-bg); color: var(--green-text); border: 0.5px solid var(--green-border); }
.flash-biz-error { background: var(--red-bg); color: var(--red-text); border: 0.5px solid var(--red-border); }
.flash-biz-info { background: var(--blue-bg); color: var(--blue-text); border: 0.5px solid var(--blue-border); }
.text-biz-primary { color: #0F6E56; }
.text-light-primary { color: #1f2937; }
.footer-biz { background: var(--bg-page); color: var(--text-muted); }
.footer-light { background: #fff; color: #6b7280; }

.fgss-wordmark {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
  }

  #sidebarToggleBtn {
    position: relative;
    left: 3px; /* 2~4px */
  }

.fgss-wordmark {
  color: #0F6E56;
}

.sidebar-link .sidebar-icon {
  font-size: 1.6rem !important;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
  transition: color 120ms ease, font-variation-settings 120ms ease;
}

.sidebar-link:hover .sidebar-icon {
  color: #0F6E56;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
}

.sidebar-link.is-active .sidebar-icon {
  color: #0F6E56;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 20 !important;
}

.sidebar-link.justify-center {
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.sidebar-link.justify-center.is-active {
  background: transparent;
}

.sidebar-link.justify-center.is-active .sidebar-icon {
  color: #0F6E56;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 20 !important;
}

#sidebar.w-14 {
  width: 4.5rem !important;
}

#sidebar.w-56 {
  width: 16rem !important;
}

.theme-toggle-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  border: 0.5px solid var(--border);
  background: var(--bg-surface2);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}
.theme-toggle-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.user-dropdown-panel {
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition: opacity 140ms ease, transform 140ms ease;
}
.user-dropdown-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.dropdown-item {
  min-height: 2.6rem;
  padding: 0 1rem;
  display: flex !important;
  align-items: center;
  gap: 0.65rem;
  line-height: 1;
}
.dropdown-item:hover {
  background: var(--bg-hover);
}

.dropdown-header {
  padding: 0;
}
.dropdown-header-name {
  min-height: 2.6rem;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text-primary);
}
.dropdown-divider {
  height: 1px;
  margin: 0.35rem 0;
  background: var(--border);
}
.dropdown-group {
  padding: 0.1rem 0;
}
.dropdown-icon {
  width: 1rem;
  height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 1rem;
  font-size: 1rem;
  line-height: 1;
  vertical-align: middle;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
  position: relative;
  top: 0;
}
.dropdown-item.theme-row {
  justify-content: space-between;
}
.dropdown-item.theme-row .theme-row-left {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}
.theme-submenu {
  position: absolute;
  top: 0;
  right: calc(100% + 10px);
  width: 10rem;
  border-radius: 0.75rem;
  border: 0.5px solid var(--border);
  background: var(--bg-surface2);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  padding: 0.4rem 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px) scale(0.98);
  transition: opacity 130ms ease, transform 130ms ease;
  z-index: 70;
}
.theme-submenu.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.theme-option {
  min-height: 2.6rem;
  width: 100%;
  text-align: left;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* ============================================================
   임무17 · base.css 모바일 대응
   ============================================================ */
@media (max-width: 640px) {
  /* 헤더 높이 유지 (56px) 및 좌우 padding 축소 */
  header .h-14 { padding-left: 12px; padding-right: 12px; }

  /* 드롭다운 패널 폭 화면 맞춤 */
  #userDropdown { width: calc(100vw - 24px); max-width: 280px; }

  /* main 컨텐츠 좌우 padding 축소 */
  main.w-full { padding-left: 12px !important; padding-right: 12px !important; }

  /* 헤더 우측 유저 메뉴 완전 hidden (햄버거로만 접근) */
  .fgss-header-right-menu > * {
    display: none !important;
  }
  /* 비로그인 상태 로그인/회원가입 버튼은 유지 */
  .fgss-header-right-menu > .flex.gap-2 {
    display: flex !important;
  }
}

/* ── 알림 드롭다운 패널 ── */
/* OI-82: 사이드바 폭 기준 fixed 좌표 (부모 #notif-trigger 폭 변동과 무관) */
.notif-panel {
  position: fixed;
  /* collapsed 기본: #sidebar.w-14 → 4.5rem + 8px */
  left: calc(4.5rem + 8px);
  top: 0;
  width: 320px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 200;
  overflow: hidden;
}

/* expanded: #sidebar.w-56 → 16rem + 8px */
body:has(#sidebar.w-56) .notif-panel {
  left: calc(16rem + 8px);
}

/* 모바일 오버레이 사이드바(280px / max 88vw) */
@media (max-width: 640px) {
  body:has(#sidebar.is-mobile-open) .notif-panel {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border-default);
}
.notif-panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.notif-panel-all-btn {
  font-size: 12px;
  color: var(--color-primary, #0F6E56);
  text-decoration: none;
  font-weight: 600;
}
.notif-panel-all-btn:hover { text-decoration: underline; }
.notif-panel-list {
  max-height: 400px;
  overflow-y: auto;
}
.notif-panel-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-default);
  cursor: pointer;
  transition: background .15s;
  text-align: left;
}
.notif-item:last-child { border-bottom: none; }
.notif-item-unread {
  background: #f0faf6;
}
.notif-item-read {
  background: var(--bg-surface);
}
.notif-item:hover { filter: brightness(.97); }
.notif-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.notif-item-msg {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.notif-item-date {
  font-size: 11px;
  color: var(--text-tertiary, #9ca3af);
}

/* ── 알림 상세 모달 ── */
.notif-detail-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notif-detail-box {
  background: var(--bg-surface);
  border-radius: 12px;
  padding: 24px;
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 16px 40px rgba(0,0,0,.18);
}
.notif-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.notif-detail-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.notif-detail-close {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-secondary);
}
.notif-detail-date {
  font-size: 12px;
  color: var(--text-tertiary, #9ca3af);
  margin-bottom: 14px;
}
.notif-detail-body {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
}
