/* ============================================================
   위해정보분석평가시스템 — Global Stylesheet
   한국소비자원 | KICA Hazard Info Analysis & Evaluation System
   ============================================================ */

/* ──────────────────────────────────────────
   0. CSS Custom Properties (Design Tokens)
   ────────────────────────────────────────── */
:root {
  /* Brand */
  --color-brand-navy:       #4170c0;
  --color-brand-blue:       #1e4db7;
  --color-accent-blue:      #3b82f6;
  --color-accent-sky:       #60a5fa;

  /* Status */
  --color-status-collect:   #3b82f6;  /* 수집 */
  --color-status-transfer:  #60a5fa;  /* 이관 */
  --color-status-receive:   #2dd4bf;  /* 접수 */
  --color-status-process:   #f97316;  /* 처리중 */
  --color-status-complete:  #94a3b8;  /* 처리완료 */

  /* Semantic */
  --color-success:          #22c55e;
  --color-error:            #ef4444;
  --color-warning:          #f59e0b;
  --color-info:             #06b6d4;
  --color-neutral:          #94a3b8;

  /* Chart Series */
  --chart-col-1:            #1e4db7;
  --chart-col-2:            #93c5fd;
  --chart-col-3:            #ef4444;
  --chart-col-4:            #f97316;
  --chart-col-5:            #3b82f6;
  --chart-col-6:            #8b5cf6;
  --chart-col-7:            #06b6d4;

  /* Neutral UI */
  --color-text-primary:     #1e293b;
  --color-text-secondary:   #64748b;
  --color-text-muted:       #94a3b8;
  --color-text-white:       #ffffff;
  --color-border:           #e2e8f0;
  --color-border-dark:      #cbd5e1;

  /* Backgrounds */
  --bg-body:                #ffffff;
  --bg-white:               #ffffff;
  --bg-sidebar:             #4170c0;
  --bg-header:              #ffffff;
  --bg-table-header:        #f1f5f9;
  --bg-table-row-hover:     #f8fafc;
  --bg-input:               #ffffff;
  --bg-filter:              #fafbfd;

  /* Shadows */
  --shadow-card:            0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-dropdown:        0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-header:          0 1px 3px rgba(0, 0, 0, 0.06);

  /* Spacing */
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   12px;
  --space-lg:   16px;
  --space-xl:   20px;
  --space-2xl:  24px;

  /* Border Radius */
  --radius-sm:  3px;
  --radius-md:  4px;
  --radius-lg:  6px;
  --radius-xl:  8px;
  --radius-pill: 20px;

  /* Typography */
  --font-family:   'Noto Sans KR', 'Malgun Gothic', '맑은 고딕', sans-serif;
  --font-size-xs:  11px;
  --font-size-sm:  12px;
  --font-size-md:  13px;
  --font-size-lg:  14px;
  --font-size-xl:  16px;
  --font-size-2xl: 20px;
  --font-size-3xl: 24px;
  --line-height:   1.5;

  /* Layout */
  --sidebar-width:          210px;
  --sidebar-collapsed-width: 60px;
  --header-height:          48px;
  --tab-bar-height:         36px;
  --filter-area-height:     auto;
}

/* ──────────────────────────────────────────
   1. Reset & Base
   ────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 13px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  color: var(--color-text-primary);
  background-color: var(--bg-body);
  line-height: var(--line-height);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-brand-blue);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

img {
  display: block;
  max-width: 100%;
}

input, select, button, textarea {
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
}

/* ──────────────────────────────────────────
   2. Layout Shell
   ────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ──────────────────────────────────────────
   3. Top Header
   ────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  height: var(--header-height);
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-header);
  padding: 0 var(--space-lg);
  gap: var(--space-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-toggle-btn {
  width: 32px;
  height: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15,23,42,.05);
}
.header-toggle-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background-color: var(--color-text-secondary);
  border-radius: 1px;
}
.header-toggle-btn:hover span {
  background-color: var(--color-brand-blue);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}
.header-logo__icon {
  width: 28px;
  height: 28px;
}
.header-logo__text {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-brand-navy);
  line-height: 1.3;
  white-space: nowrap;
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  background-color: #eef2ff;
  border-radius: var(--radius-pill);
  padding: 3px var(--space-md);
  margin-left: var(--space-sm);
}
.header-breadcrumb span {
  color: var(--color-brand-blue);
  font-weight: 500;
}

.header-spacer {
  display:none;
}

.header-favorite-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 5px var(--space-md);
  background-color: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  color: #92400e;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.15s;
  margin-right:auto;
}
.header-favorite-btn:hover {
  background-color: #fef08a;
}
.header-favorite-btn.active {
  background-color: #fef08a;
  color: #78350f;
}

.header-session {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}
.header-session__timer {
  font-weight: 600;
  font-family: 'Courier New', monospace;
  color: var(--color-brand-navy);
}
.header-session__extend-btn {
  padding: 4px 10px;
  background-color: var(--bg-white);
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.header-session__extend-btn:hover {
  border-color: var(--color-brand-blue);
  color: var(--color-brand-blue);
}

.header-logout-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 5px var(--space-md);
  background-color: var(--color-brand-navy);
  border: none;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  color: var(--color-text-white);
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.15s;
  margin-left: auto;
}
.header-logout-btn:hover {
  background-color: #0f1c40;
}

/* ──────────────────────────────────────────
   4. Left Navigation Sidebar
   ────────────────────────────────────────── */
.sidebar-logo{
    height:76px;
    display:flex;
    align-items:center;
    padding:0 18px;
    gap:12px;

    background:#4170c0;
    border-bottom:1px solid rgba(255,255,255,.12);
}

.sidebar-logo img{
    width:30px;
    height:30px;
    object-fit:contain;
}

.sidebar-logo-text{
    color:#fff;
    font-size:13px;
    font-weight:600;
    line-height:1.4;
}   

.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width 0.2s ease;
  position: relative;
  z-index: 90;
}

.app-sidebar.collapsed {
  width:0;
  min-width:0;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-sm) 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
  width: 3px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
}

.sidebar-nav__item {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 var(--space-lg);
  gap: var(--space-sm);
  cursor: pointer;
  transition: background-color 0.15s;
  position: relative;
  text-decoration: none;
  color: #94a3b8;
  font-size: var(--font-size-sm);
  font-weight: 500;
  white-space: nowrap;
}

.sidebar-nav__item:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--color-text-white);
}

.sidebar-nav__item.active {
  background-color: rgba(255, 255, 255, 0.14);
  color: var(--color-text-white);
}

.sidebar-nav__item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background-color: var(--color-accent-blue);
  border-radius: 0 2px 2px 0;
}

.sidebar-nav__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.sidebar-nav__label {
  flex: 1;
  opacity: 1;
  transition: opacity 0.15s;
}

.app-sidebar.collapsed .sidebar-nav__label {
  opacity: 0;
  pointer-events: none;
}

.sidebar-nav__arrow {
  font-size: 10px;
  opacity: 0.5;
  transition: transform 0.15s;
}

.sidebar-nav__item.open .sidebar-nav__arrow {
  transform: rotate(90deg);
}

/* ──────────────────────────────────────────
   5. Main Content Area
   ────────────────────────────────────────── */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-body);
}

/* ──────────────────────────────────────────
   6. Tab Navigation Bar
   ────────────────────────────────────────── */
.tab-bar {
  display: flex;
  align-items: flex-end;
  height: var(--tab-bar-height);
  background-color: #ffffff;
  /* border-bottom 제거 → 그라디언트로 대체 */
  background-image: linear-gradient(
    to bottom,
    transparent calc(100% - 1px),
    var(--color-border) calc(100% - 1px)
  );
  padding: 0 var(--space-sm);
  gap: 2px;
  overflow-x: auto;
  flex-shrink: 0;
}

.tab-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  height: 30px;
  padding: 0 var(--space-md);
  background-color: #d1daf0;
  border: 1px solid var(--color-border);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  max-width: 160px;
  transition: background-color 0.15s;
}

.tab-item:hover {
  background-color: #c5d2eb;
}

.tab-item.active {
  background-color: var(--bg-white);
  color: var(--color-brand-blue);
  font-weight: 600;
  border: 1px solid var(--color-border);
  border-bottom: none;
  height: 32px;
}

.tab-item__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* ──────────────────────────────────────────
   7. Content Wrapper
   ────────────────────────────────────────── */
.content-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-lg);
}

.content-wrap::-webkit-scrollbar {
  width: 6px;
}
.content-wrap::-webkit-scrollbar-thumb {
  background: var(--color-border-dark);
  border-radius: 3px;
}

/* ──────────────────────────────────────────
   8. Filter / Search Area
   ────────────────────────────────────────── */
.filter-area {
  background-color: var(--bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-md);
}

.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.filter-row:last-child {
  margin-bottom: 0;
}

.filter-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  font-weight: 500;
  white-space: nowrap;
  min-width: 64px;
  text-align: right;
}

.filter-select {
  height: 28px;
  min-width: 100px;
  padding: 0 24px 0 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--bg-input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  -webkit-appearance: none;
  appearance: none;
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: border-color 0.15s;
}

.filter-select:focus {
  outline: none;
  border-color: var(--color-brand-blue);
  box-shadow: 0 0 0 2px rgba(30, 77, 183, 0.12);
}

.filter-input {
  height: 28px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--bg-input);
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
  transition: border-color 0.15s;
}

.filter-input:focus {
  outline: none;
  border-color: var(--color-brand-blue);
  box-shadow: 0 0 0 2px rgba(30, 77, 183, 0.12);
}

.filter-date-range {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.filter-date-input {
  height: 28px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--bg-input);
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-left: auto;
}

/* ──────────────────────────────────────────
   9. Buttons
   ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  height: 28px;
  padding: 0 var(--space-md);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(30, 77, 183, 0.25);
}

.btn--primary {
  background-color: var(--color-brand-blue);
  color: var(--color-text-white);
}
.btn--primary:hover { background-color: #1740a0; }

.btn--send {
  background-color: var(--color-brand-blue);
  color: var(--color-text-white);
  height: 38px;
}
.btn--send:hover { background-color: #1740a0; }

.btn--secondary {
  background-color: var(--color-neutral);
  color: var(--color-text-white);
}
.btn--secondary:hover { background-color: #78899c; }

.btn--success {
  background-color: #16a34a;
  color: var(--color-text-white);
}
.btn--success:hover { background-color: #15803d; }

.btn--warning {
  background-color: var(--color-warning);
  color: var(--color-text-white);
}
.btn--warning:hover { background-color: #d97706; }

.btn--info {
  background-color: var(--color-info);
  color: var(--color-text-white);
}
.btn--info:hover { background-color: #0891b2; }

.btn--error {
  background-color: var(--color-error);
  color: var(--color-text-white);
}
.btn--error:hover { background-color: #dc2626; }

.btn--outline {
  background-color: transparent;
  border: 1px solid var(--color-brand-blue);
  color: var(--color-brand-blue);
}
.btn--outline:hover {
  background-color: #eef2ff;
}

.btn--ghost {
  background-color: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}
.btn--ghost:hover {
  background-color: var(--bg-table-row-hover);
}

/* Button icon size */
.btn .btn-icon {
  font-size: 12px;
}

/* ──────────────────────────────────────────
   10. Table Toolbar
   ────────────────────────────────────────── */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.table-toolbar__title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--color-text-primary);
}

.table-toolbar__count {
  font-size: var(--font-size-sm);
  color: var(--color-brand-blue);
  font-weight: 600;
}

.table-toolbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.table-toolbar__help {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--color-error);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
}

/* ──────────────────────────────────────────
   11. Data Table
   ────────────────────────────────────────── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background-color: var(--bg-white);
}

.table-wrap::-webkit-scrollbar {
  height: 6px;
}
.table-wrap::-webkit-scrollbar-thumb {
  background: var(--color-border-dark);
  border-radius: 3px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
  min-width: 800px;
}

.data-table thead tr {
  background-color: var(--bg-table-header);
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table th {
  padding: 7px var(--space-sm);
  text-align: center;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: #475569;
  border: 1px solid var(--color-border);
  white-space: nowrap;
}

.data-table td {
  padding: 6px var(--space-sm);
  text-align: center;
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table td.text-left { text-align: left; }

.data-table tbody tr:hover td {
  background-color: var(--bg-table-row-hover);
}

.data-table tbody tr:nth-child(even) td {
  background-color: #fdfdfe;
}

/* Checkbox column */
.data-table th.col-check,
.data-table td.col-check {
  width: 32px;
  min-width: 32px;
}

/* No. column */
.data-table th.col-no,
.data-table td.col-no {
  width: 40px;
  min-width: 40px;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* ──────────────────────────────────────────
   12. Status Badge / Pill
   ────────────────────────────────────────── */
.status-text {
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.status-text--error    { color: var(--color-error); }
.status-text--success  { color: var(--color-success); }
.status-text--warning  { color: var(--color-warning); }
.status-text--neutral  { color: var(--color-neutral); }
.status-text--info     { color: var(--color-info); }
.status-text--blue     { color: var(--color-brand-blue); }

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 600;
  line-height: 1.4;
}

.status-badge--error    { background-color: #fee2e2; color: #b91c1c; }
.status-badge--success  { background-color: #dcfce7; color: #15803d; }
.status-badge--warning  { background-color: #fef3c7; color: #b45309; }
.status-badge--neutral  { background-color: #f1f5f9; color: #475569; }
.status-badge--blue     { background-color: #dbeafe; color: #1d4ed8; }
.status-badge--transfer { background-color: #e0f2fe; color: #0369a1; }

/* ──────────────────────────────────────────
   13. Stage Pipeline Badges (위해정보 단계별)
   ────────────────────────────────────────── */
.pipeline-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  padding: var(--space-lg);
  background-color: var(--bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.pipeline-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.pipeline-stage__label {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  font-weight: 500;
}

.pipeline-stage__value {
  padding: 6px 24px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text-white);
  min-width: 80px;
  text-align: center;
}

.pipeline-stage__value--collect  { background-color: var(--color-status-collect); }
.pipeline-stage__value--transfer { background-color: var(--color-status-transfer); }
.pipeline-stage__value--receive  { background-color: var(--color-status-receive); }
.pipeline-stage__value--process  { background-color: var(--color-status-process); }
.pipeline-stage__value--complete { background-color: var(--color-status-complete); }

/* ──────────────────────────────────────────
   14. Card (차트/통계 컨테이너)
   ────────────────────────────────────────── */
.card {
  background-color: var(--bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.card-title {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--color-text-primary);
}

.card-title::before {
  content: '●';
  color: var(--color-brand-blue);
  font-size: 8px;
}

.card-date-range {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

/* Dashboard grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--space-lg);
  align-items: start;
}

.chart-grid-2x2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: var(--space-md);
}

/* ──────────────────────────────────────────
   15. Statistics Table (연도별 수치 테이블)
   ────────────────────────────────────────── */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-xs);
  margin-top: var(--space-sm);
}

.stats-table th {
  padding: 5px var(--space-sm);
  background-color: var(--bg-table-header);
  border: 1px solid var(--color-border);
  font-weight: 600;
  text-align: center;
  color: #475569;
}

.stats-table td {
  padding: 4px var(--space-sm);
  border: 1px solid var(--color-border);
  text-align: right;
  color: var(--color-text-primary);
}

.stats-table td.row-label {
  text-align: left;
  font-weight: 500;
  color: var(--color-text-secondary);
  background-color: #fafbfd;
}

/* ──────────────────────────────────────────
   16. Notice / Info Box
   ────────────────────────────────────────── */
.notice-box {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  color: #92400e;
  margin-bottom: var(--space-sm);
}

.notice-box--error {
  background-color: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.notice-box--info {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

/* ──────────────────────────────────────────
   17. Checkbox
   ────────────────────────────────────────── */
.checkbox {
  width: 14px;
  height: 14px;
  accent-color: var(--color-brand-blue);
  cursor: pointer;
}

/* ──────────────────────────────────────────
   18. Tooltip / Help Icon
   ────────────────────────────────────────── */
.tooltip-trigger {
  position: relative;
  display: inline-flex;
}

.tooltip-content {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background-color: #1e293b;
  color: white;
  font-size: var(--font-size-xs);
  padding: 5px var(--space-sm);
  border-radius: var(--radius-md);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 200;
}

.tooltip-trigger:hover .tooltip-content {
  opacity: 1;
}

/* ──────────────────────────────────────────
   19. Loading & Empty State
   ────────────────────────────────────────── */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-brand-blue);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  gap: var(--space-sm);
}

/* ──────────────────────────────────────────
   20. Scrollbar (Global)
   ────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: var(--color-border-dark);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-text-muted);
}

/* ──────────────────────────────────────────
   21. Utility Classes
   ────────────────────────────────────────── */
.text-primary   { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted     { color: var(--color-text-muted); }
.text-blue      { color: var(--color-brand-blue); }
.text-error     { color: var(--color-error); }
.text-success   { color: var(--color-success); }
.text-warning   { color: var(--color-warning); }
.text-info      { color: var(--color-info); }

.font-bold   { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.font-normal { font-weight: 400; }

.text-xs  { font-size: var(--font-size-xs); }
.text-sm  { font-size: var(--font-size-sm); }
.text-md  { font-size: var(--font-size-md); }
.text-lg  { font-size: var(--font-size-lg); }
.text-xl  { font-size: var(--font-size-xl); }

.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.flex-wrap   { flex-wrap: wrap; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.w-full  { width: 100%; }
.h-full  { height: 100%; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}


/* ──────────────────────────────────────────
    추가
   ────────────────────────────────────────── */

/* 아이콘을 정렬하기 위한 스타일 */
.feedback-container {
  display: flex;
  gap: 20px;
  justify-content: flex-end;
  align-items: center;
  padding: 1px;
}

/* 버튼 기본 스타일 제거 및 커서 변경 */
.feedback-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  transition: transform 0.2s, stroke 0.2s;
}

/* 마우스를 올렸을 때 효과 */
.feedback-btn:hover {
  transform: scale(1.1);
}
.feedback-btn:hover svg {
  stroke: #333; /* 마우스 올리면 선 색상이 진해짐 */
}

/* One-pager DOCX download button */
.canvas-actions{
  flex-shrink:0;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}
.canvas-download-btn{
  height:26px;
  padding:0 11px;
  border:1px solid #bfdbfe;
  border-radius:999px;
  background:#ffffff;
  color:#1e4db7;
  font-size:11px;
  font-weight:800;
  cursor:pointer;
  box-shadow:0 1px 2px rgba(15,23,42,.06);
  transition:.15s;
}
.canvas-download-btn:hover{
  background:#eff6ff;
  border-color:#93c5fd;
  transform:translateY(-1px);
}
.canvas-download-btn:active{transform:translateY(0);}
@media(max-width:768px){
  .canvas-actions{width:100%;justify-content:flex-start;}
}

/* Business Plan live canvas layout */
.business-plan-grid{grid-template-columns:1.15fr .85fr;align-items:stretch;}
.business-plan-panel{background:#fff;border:1px solid var(--color-border);border-radius:14px;box-shadow:var(--shadow-card);overflow:hidden;min-height:calc(100vh - 230px);}
.business-plan-canvas{padding:0;overflow:auto;}
.plan-status-box{margin:0 16px 12px;border:1px solid #fed7aa;background:#fff7ed;border-radius:12px;padding:11px 12px;display:grid;gap:4px;}
.plan-status-box strong{color:#c2410c;font-size:12px;}
.plan-status-box span{color:#7c2d12;font-size:12px;line-height:1.5;}
.plan-canvas-grid{gap:10px;padding-bottom:16px;}
.plan-section-card p{min-height:42px;}
.btn--send{height:38px;padding:0 18px;background:#1e4db7;color:#fff;border-radius:8px;font-size:13px;font-weight:800;}
.btn--send:hover{background:#1740a0;}
@media(max-width:1400px){.business-plan-grid{grid-template-columns:1fr!important}.business-plan-panel{min-height:auto}}

/* ==========================================================
   Markdown Chat Rendering
   ========================================================== */

.chat-message pre,
.chat-bubble pre,
.message-content pre,
.ai-message pre,
.markdown-body pre,
pre {
    background: #f8fafc !important;
    color: #334155 !important;

    border: 1px solid #e2e8f0;
    border-radius: 14px;

    padding: 16px 18px;

    margin: 14px 0;

    overflow-x: auto;

    font-size: 14px;
    line-height: 1.7;

    box-shadow:
        0 1px 2px rgba(15,23,42,0.04);

    white-space: pre-wrap;
    word-break: break-word;
}

.chat-message pre code,
.chat-bubble pre code,
.message-content pre code,
.ai-message pre code,
.markdown-body pre code,
pre code {
    background: transparent !important;
    color: inherit !important;

    padding: 0;
    border: 0;

    font-family:
        "JetBrains Mono",
        "Fira Code",
        Consolas,
        monospace;
}

/* 인라인 코드 */

.chat-message code:not(pre code),
.chat-bubble code:not(pre code),
.message-content code:not(pre code),
.ai-message code:not(pre code) {
    background: #eff6ff;

    color: #1d4ed8;

    padding: 2px 6px;

    border-radius: 6px;

    font-size: 0.92em;

    border: 1px solid #dbeafe;
}

/* Markdown 표 */

.md-table-wrap {
    overflow-x: auto;
    margin: 16px 0;
}

.md-table {
    width: 100%;
    border-collapse: collapse;

    background: #ffffff;

    border: 1px solid #e2e8f0;
    border-radius: 12px;

    overflow: hidden;
}

.md-table th {
    background: #f8fafc;

    color: #1e293b;

    font-weight: 700;

    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.md-table td {
    padding: 12px;

    border-bottom: 1px solid #e2e8f0;

    color: #475569;
}

.md-table tr:hover {
    background: #f8fbff;
}

/* Market Research Agent layout */
.market-history-layout .history-workspace{min-width:0;}
.market-section-grid{grid-template-columns:1.05fr .95fr;align-items:stretch;}
.market-chat-panel{height:calc(100vh - 230px);}
.market-report-panel{height:calc(100vh - 230px);overflow-y:auto;background:#fff;border:1px solid var(--color-border);border-radius:14px;box-shadow:var(--shadow-card);}
.market-report-canvas .canvas-grid{display:grid;gap:12px;}
.market-section-card .market-section-body{font-size:13px;line-height:1.7;color:#334155;}
.market-section-card .market-section-body p{margin:6px 0;}
.market-section-card .market-section-body ul,
.market-section-card .market-section-body ol{padding-left:20px;margin:8px 0;}
.market-section-card .market-section-body li{margin:4px 0;}
.market-section-card .md-table-wrap{margin:10px 0;}
.market-section-card .md-table th,
.market-section-card .md-table td{font-size:12px;padding:8px 10px;}
.plain-streaming{white-space:pre-wrap;word-break:break-word;line-height:1.65;}
@media(max-width:1400px){.market-section-grid{grid-template-columns:1fr}.market-report-panel{height:auto;max-height:none}.market-chat-panel{height:calc(100vh - 230px)}}
