/* ============================================================
   KIRA-MAT 서브페이지 공통 스타일
   projects / favorites / certificates / compare /
   notifications / settings / specbook 7개 페이지가 공유한다.
   (대시보드 index.html은 레이아웃이 달라 자체 스타일을 유지)
   페이지 전용 규칙은 각 HTML의 <style>에서 이 파일 뒤에 덮어쓴다.
   ============================================================ */

  @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700;800&display=swap');
  :root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --fg: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --accent: #1d4ed8;
    --accent-light: #eff6ff;
    --good: #059669;
    --good-light: #ecfdf5;
    --warn: #d97706;
    --warn-light: #fffbeb;
    --bad: #dc2626;
    --bad-light: #fef2f2;
    --iconsidebar-w: 52px;
    --rightpanel-w: 360px;
    --radius: 10px;
  }
  /* ── 다크 모드 ── */
  :root[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #1e293b;
    --fg: #e2e8f0;
    --muted: #94a3b8;
    --border: #334155;
    --accent: #60a5fa;
    --accent-light: rgba(96,165,250,0.14);
    --good: #34d399;
    --good-light: rgba(52,211,153,0.15);
    --warn: #fbbf24;
    --warn-light: rgba(251,191,36,0.15);
    --bad: #f87171;
    --bad-light: rgba(248,113,113,0.15);
  }
  [data-theme="dark"] th { background: #172033; }
  [data-theme="dark"] tr:hover td,
  [data-theme="dark"] .attach-item:hover,
  [data-theme="dark"] .mat-card:hover { background: rgba(255,255,255,0.04); }
  [data-theme="dark"] .gauge-bar { background: #334155; }
  [data-theme="dark"] .attach-icon.dwg { background: rgba(217,119,6,0.20); color: #fbbf24; }
  [data-theme="dark"] .attach-icon.word { background: rgba(96,165,250,0.18); }
  [data-theme="dark"] .btn-preview { border-color: var(--accent); color: var(--accent); }
  [data-theme="dark"] .btn-preview:hover { background: rgba(96,165,250,0.15); }
  [data-theme="dark"] .btn-save:hover { background: rgba(52,211,153,0.15); }

  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font: 600 17px/1.65 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    letter-spacing: -0.01em;
  }

  /* ── app layout ── */
  .app-layout { display: flex; min-height: 100vh; }

  /* ── icon sidebar ── */
  .icon-sidebar {
    width: var(--iconsidebar-w);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 0;
    gap: 2px;
    z-index: 10;
  }
  /* 로고와 햄버거를 한 줄에 세운다. 아래 여백은 이 줄이 갖는다 */
  .icon-sidebar .sidebar-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
  }
  .icon-sidebar .logo-icon {
    width: 34px; height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .icon-sidebar .logo-icon svg { width: 28px; height: 28px; }
  .icon-sidebar .icon-btn {
    width: 44px; height: 44px;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: background 0.15s, color 0.15s;
    position: relative;
  }
  .icon-sidebar .icon-btn:hover { background: var(--bg); color: var(--fg); }
  .icon-sidebar .icon-btn.active { background: var(--accent-light); color: var(--accent); }
  .icon-sidebar .icon-btn svg { width: 18px; height: 18px; }
  .icon-sidebar .spacer { flex: 1; }

  /* 아이콘 사이드바 펼치기/접기 */
  .icon-sidebar { transition: width 0.22s ease; }
  .nav-toggle {
    width: 44px; height: 44px;
    border: none; border-radius: 8px; background: transparent;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: var(--muted); flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
  }
  .nav-toggle:hover { background: var(--bg); color: var(--fg); }
  .nav-toggle svg { width: 18px; height: 18px; }
  .icon-label { display: none; font-size: 16.5px; font-weight: 700; white-space: nowrap; }
  body.nav-expanded .icon-sidebar .icon-btn:not(.active) { color: var(--fg); }
  .icon-sidebar .icon-badge { display: none; }
  body.nav-expanded .icon-sidebar .icon-badge {
    display: flex; align-items: center; justify-content: center;
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    min-width: 18px; height: 18px; padding: 0 5px;
    background: var(--accent); color: #fff; font-size: 11px; font-weight: 800;
    border-radius: 999px; line-height: 1;
  }
  .icon-sidebar .logo-icon .logo-full { display: none; height: 30px; width: auto; }
  body:not(.nav-expanded) .icon-sidebar .logo-icon { display: none; }
  body.nav-expanded .icon-sidebar { width: 250px; align-items: stretch; padding: 16px 10px; }
  body.nav-expanded .icon-sidebar .sidebar-head { justify-content: space-between; gap: 8px; }
  body.nav-expanded .icon-sidebar .logo-icon { width: auto; height: auto; justify-content: flex-start; margin-left: 6px; }
  body.nav-expanded .icon-sidebar .logo-icon .logo-mark { display: none; }
  body.nav-expanded .icon-sidebar .logo-icon .logo-full { display: block; }
  body.nav-expanded .icon-sidebar .icon-btn { width: 100%; height: auto; justify-content: flex-start; gap: 11px; padding: 11px 12px; }
  body.nav-expanded .icon-sidebar .icon-btn svg { width: 17px; height: 17px; }
  body.nav-expanded .icon-label { display: inline; }
  body.nav-expanded .icon-sidebar .profile-avatar { align-self: flex-start; margin-left: 5px; }
  .icon-sidebar .profile-avatar {
    width: 34px; height: 34px;
    border-radius: 7px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    margin-top: auto;
    cursor: pointer;
  }

  /* ── main area ── */
  .main-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }

  /* ── top bar ── */
  .top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
  }
  /* 상단 유틸리티 바 (검색/알림/프로필) */
  .top-utility {
    display: flex; align-items: center; gap: 14px;
    /* 좌측 47px = 본문 기준선(.content-main 28px + 패널 테두리 1px + .panel-header 18px)
       우측 28px = 패널 우측 테두리 선과 일치 */
    padding: 12px 28px 12px 47px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
  }
  .sb-search { position: relative; flex: 1; max-width: 460px; min-width: 200px; }
  .sb-search > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--accent); width: 16px; height: 16px; pointer-events: none; }
  .sb-search input {
    width: 100%; height: 44px; border: 1.5px solid #c7d2e0; border-radius: 11px;
    padding: 0 14px 0 40px; font: inherit; font-size: 14px; font-weight: 600;
    background: #fff; color: var(--fg); outline: none;
    box-shadow: 0 1px 3px rgba(17,24,39,0.06);
    transition: border-color .15s, box-shadow .15s;
  }
  .sb-search input::placeholder { color: #94a3b8; font-weight: 500; }
  .sb-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(29,78,216,0.13); }
  [data-theme="dark"] .sb-search input { background: #0f172a; border-color: #334155; }
  .util-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
  .u-icon {
    width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 9px;
    background: var(--surface); display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--muted); position: relative; transition: background .15s, color .15s;
  }
  .u-icon:hover { background: var(--bg); color: var(--fg); }
  .u-icon svg { width: 18px; height: 18px; }
  .u-badge {
    position: absolute; top: -4px; right: -5px; min-width: 18px; height: 18px;
    border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px;
    font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 5px; line-height: 1;
  }
  .profile-chip {
    display: flex; align-items: center; gap: 9px; padding: 4px 14px 4px 4px;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
    cursor: pointer; font: inherit; font-size: 14px; font-weight: 700; color: var(--fg); white-space: nowrap;
  }
  .profile-chip:hover { background: var(--bg); }
  .profile-chip img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; object-position: center 20%; }
  /* 알림/프로필 드롭다운 레이어 */
  .util-right { position: relative; }
  .dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 340px;
    max-width: calc(100vw - 24px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(17,24,39,0.16);
    z-index: 300;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
  }
  .dropdown.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
  .dropdown .dd-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
    font-weight: 800; font-size: 15px;
  }
  .dropdown .dd-head .dd-count { font-size: 12px; color: var(--accent); font-weight: 700; }
  .dropdown .dd-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 13px 16px; border-bottom: 1px solid var(--border);
    font-size: 14px; line-height: 1.5; cursor: pointer;
  }
  .dropdown .dd-item:last-child { border-bottom: none; }
  .dropdown .dd-item:hover { background: var(--bg); }
  .dropdown .dd-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
  .dropdown .dd-dot.warn { background: var(--warn); }
  .dropdown .dd-text { flex: 1; min-width: 0; }
  .dropdown .dd-time { font-size: 12px; color: var(--muted); margin-top: 2px; }
  .dropdown .dd-foot { padding: 12px 16px; text-align: center; }
  .dropdown .dd-foot a { color: var(--accent); font-weight: 700; font-size: 13px; text-decoration: none; }
  .dropdown.menu { width: 230px; }
  .dropdown .dd-profile {
    padding: 16px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
  }
  .dropdown .dd-profile .avatar-lg {
    width: 42px; height: 42px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  }
  .dropdown .dd-profile .avatar-lg img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
  .dropdown .dd-profile .p-name { font-weight: 800; font-size: 15px; }
  .dropdown .dd-profile .p-role { font-size: 12px; color: var(--muted); }
  .dropdown .dd-menuitem {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; font-size: 14px; font-weight: 600;
    color: var(--fg); cursor: pointer; border-bottom: 1px solid var(--border);
  }
  .dropdown .dd-menuitem:last-child { border-bottom: none; }
  .dropdown .dd-menuitem:hover { background: var(--bg); }
  .dropdown .dd-menuitem.logout { color: var(--bad); }
  [data-theme="dark"] .dropdown { box-shadow: 0 12px 32px rgba(0,0,0,0.55); }
  [data-theme="dark"] .dropdown .dd-item:hover, [data-theme="dark"] .dropdown .dd-menuitem:hover { background: rgba(255,255,255,0.04); }
  .top-bar .title-section h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--fg);
  }
  .top-bar .title-section { padding-left: 23px; }
  .top-bar .project-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
    color: var(--fg);
    flex-wrap: wrap;
  }
  .top-bar .project-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
  }
  .top-bar .project-meta .meta-label { color: var(--muted); }
  .top-bar .project-meta .meta-value { font-weight: 600; }
  .version-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    background: var(--accent-light);
    color: var(--accent);
  }
  .top-bar .actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
  }
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 17px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--fg);
  }
  .btn:hover { background: var(--bg); }
  .btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
  }
  .btn-primary:hover { background: #1e40af; border-color: #1e40af; }
  .btn-more {
    width: 40px; height: 40px;
    padding: 0;
    justify-content: center;
  }
  .btn svg { width: 15px; height: 15px; }
  .btn-preview { border-color: #6366f1; color: #6366f1; }
  .btn-preview:hover { background: #eef2ff; }
  .btn-save { border-color: var(--good); color: var(--good); }
  .btn-save:hover { background: var(--good-light); }
  .btn-add { background: #0d9488; border-color: #0d9488; color: #fff; }
  .btn-add:hover { background: #0f766e; border-color: #0f766e; }
  [data-theme="dark"] .logo-full { filter: brightness(0) invert(1); }
  #themeToggle .icon-sun { display: none; }
  [data-theme="dark"] #themeToggle .icon-moon { display: none; }
  [data-theme="dark"] #themeToggle .icon-sun { display: block; }

  /* ── content ── */
  .content-row {
    flex: 1;
    display: flex;
    overflow: hidden;
  }
  .content-main {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 22px 28px 32px;
    display: flex;
    flex-direction: column;
    gap: 22px;
  }
  .right-panel {
    width: var(--rightpanel-w);
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    background: var(--surface);
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  /* panels */
  .panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
  }
  .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
  }
  .panel-header h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
  .panel-body { padding: 16px 18px; }

  /* overview grid */
  .overview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
  .overview-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .overview-item .ov-label {
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .overview-item .ov-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--fg);
  }

  /* filter tabs */
  .filter-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
  }
  .filter-tab {
    padding: 8px 17px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: var(--surface);
    color: var(--muted);
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
  }
  .filter-tab:hover { background: var(--bg); color: var(--fg); }
  .filter-tab { display: inline-flex; align-items: center; }
  .filter-tab .tab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tc, #94a3b8); flex-shrink: 0; margin-right: 7px; }
  .filter-tab.active {
    background: var(--tc, var(--accent));
    border-color: var(--tc, var(--accent));
    color: #fff;
  }
  .filter-tab.active .tab-dot { background: #fff; }

  /* 표/카드 보기 아이콘 */
  .tab-actions .view-toggle button { display: inline-flex; align-items: center; gap: 6px; }
  .tab-actions .view-toggle button svg { width: 15px; height: 15px; }

  /* 카드 보기 레이아웃 */
  .mat-cards { display: none; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 16px 18px; }
  #matPanel.card-mode .table-wrap { display: none; }
  #matPanel.card-mode .mat-cards { display: grid; }
  .mat-card { border: 1px solid var(--border); border-radius: 10px; padding: 16px; transition: box-shadow .15s; }
  .mat-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
  .mat-card .mc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
  .mat-card .mc-part { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--accent-light); color: var(--accent); white-space: nowrap; }
  .mat-card .mc-name { font-size: 15px; font-weight: 700; }
  .mat-card .mc-sub { font-size: 12px; color: var(--muted); margin-top: 2px; font-weight: 500; }
  .mat-card .mc-rows { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; font-size: 13px; padding-top: 12px; border-top: 1px solid var(--border); }
  .mat-card .mc-row { display: flex; gap: 8px; }
  .mat-card .mc-label { color: var(--muted); min-width: 52px; flex-shrink: 0; }
  .mat-card .mc-val { color: var(--fg); font-weight: 600; }
  @media (max-width: 640px) { .mat-cards { grid-template-columns: 1fr; } }
  .tab-actions {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .tab-actions .view-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 7px;
    overflow: hidden;
  }
  .tab-actions .view-toggle button {
    padding: 7px 14px;
    border: none;
    background: var(--bg);
    cursor: pointer;
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
  }
  .tab-actions .view-toggle button:first-child { border-right: 1px solid var(--border); }
  .tab-actions .view-toggle button:not(.active):hover { background: var(--border); color: var(--fg); }
  /* 카드 보기 버튼(미선택 상태) 강조색 */
  .tab-actions .view-toggle button[data-view="card"]:not(.active) { background: #2F3640; color: #fff; }
  .tab-actions .view-toggle button[data-view="card"]:not(.active):hover { background: #1E232B; color: #fff; }
  .tab-actions .view-toggle button.active { background: var(--accent); color: #fff; }

  /* table */
  .table-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    gap: 12px;
    flex-wrap: wrap;
  }
  .table-wrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
  th {
    font-size: 13px;
    color: var(--muted);
    letter-spacing: 0.02em;
    font-weight: 700;
    text-align: left;
    padding: 14px 14px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    background: #fafbfc;
  }
  td {
    padding: 16px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    vertical-align: middle;
  }
  /* 표 바깥쪽 여백: 첫 열(부위 칩)이 패널 테두리에 붙어 보여서 좌우를 같은 값으로 벌린다 */
  th:first-child, td:first-child { padding-left: 24px; }
  th:last-child,  td:last-child  { padding-right: 24px; }
  /* 마지막 열(작업)은 내용 폭만 차지하고 우측 끝에 붙인다. 남는 폭은 가운데 열들이 나눠 갖는다 */
  th:last-child,  td:last-child  { width: 1%; white-space: nowrap; text-align: right; }
  tr:hover td { background: #f9fafb; }
  tr:last-child td { border-bottom: none; }
  td .mat-name { font-weight: 700; color: var(--fg); font-size: 15px; }
  td .mat-detail { font-size: 13px; color: var(--muted); margin-top: 3px; font-weight: 500; }
  .tag-sm {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 3px;
    background: var(--bg);
    color: var(--muted);
  }
  .part-chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 11px; border-radius: 999px; }
  /* 부위 칩: 연한 배경 틴트 때문에 글자가 흐려 보여, 배경은 흰색으로 두고 테두리에만 색을 준다.
     색은 각 요소의 인라인 color 값을 currentColor로 그대로 물려받는다.
     (배경도 인라인으로 지정돼 있어 !important가 필요하다) */
  .part-chip,
  .mat-card .mc-part {
    background: #fff !important;
    border: 1px solid currentColor;
  }
  [data-theme="dark"] .part-chip,
  [data-theme="dark"] .mat-card .mc-part { background: transparent !important; }
  .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 700;
  }
  .status-badge.ok { color: var(--good); }
  .status-badge.review { color: var(--accent); }
  .action-icons { display: flex; gap: 4px; }
  .action-icons button {
    width: 32px; height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: background 0.15s;
  }
  .action-icons button:hover { background: var(--bg); color: var(--fg); }

  /* table footer */
  .table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    font-size: 14px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .pagination { display: flex; align-items: center; gap: 2px; }
  .pagination button {
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    cursor: pointer;
    font-size: 13px;
    color: var(--fg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
  }
  .pagination button:hover { background: var(--bg); }
  .pagination button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
  }
  .rows-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--surface);
    color: var(--fg);
    cursor: pointer;
  }

  /* right panel sections */
  .rp-section { margin-bottom: 2px; }
  .rp-section .rp-title {
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fg);
    margin-bottom: 10px;
  }
  .status-draft-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 4px;
    background: var(--warn-light);
    color: var(--warn);
    margin-bottom: 12px;
  }
  .stat-grid-4 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
  }
  .stat-card {
    background: var(--bg);
    border-radius: 8px;
    padding: 15px 14px;
    text-align: center;
  }
  .stat-card .stat-num { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; color: var(--fg); }
  .stat-card .stat-label { font-size: 12px; color: var(--muted); margin-top: 3px; font-weight: 500; }
  .expiry-note {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 14px;
  }
  .gauge-wrap { margin-bottom: 14px; }
  .gauge-bar {
    height: 9px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
  }
  @keyframes gaugeGrow { from { width: 0 !important; } }
  .gauge-bar .fill { height: 100%; border-radius: 999px; background: var(--good); animation: gaugeGrow 1.4s cubic-bezier(.4,0,.2,1) 0.6s both; }
  .gauge-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
  }

  .check-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 0;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
  }
  .check-item:last-child { border-bottom: none; }
  .check-icon {
    width: 22px; height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
    margin-top: 1px;
  }
  .check-icon.done { background: var(--good-light); color: var(--good); }
  .check-icon.warn { background: var(--warn-light); color: var(--warn); }
  .check-icon.pending { background: var(--bg); color: var(--muted); }
  .check-count { font-size: 12px; color: var(--muted); white-space: nowrap; }

  .memo-item {
    padding: 14px 16px;
    border: 1px solid #fde68a;
    background: #fef9c3;
    box-shadow: 0 2px 6px rgba(120,90,0,0.09);
    border-radius: 8px;
    margin-bottom: 8px;
  }
  .memo-item .memo-author { color: #854d0e; }
  .memo-item .memo-time { color: #a16207; }
  .memo-item .memo-text { color: #713f12; }
  .memo-item .memo-link { color: #a16207; }
  [data-theme="dark"] .memo-item { background: rgba(250,204,21,0.10); border-color: rgba(250,204,21,0.28); box-shadow: none; }
  [data-theme="dark"] .memo-item .memo-author,
  [data-theme="dark"] .memo-item .memo-text { color: #fde68a; }
  [data-theme="dark"] .memo-item .memo-time,
  [data-theme="dark"] .memo-item .memo-link { color: #fcd34d; }
  /* 메모 압정 + ⋮ 메뉴 */
  .memo-item { position: relative; }
  .memo-item.pinned { border-color: #fdba74; }
  .memo-pin { position: absolute; bottom: 12px; right: 14px; color: #fdba74; font-size: 16px; }
  .memo-item .memo-header { position: relative; }
  .memo-more-wrap { position: relative; display: flex; }
  .memo-more { background: none; border: none; cursor: pointer; color: var(--muted); padding: 0; line-height: 1; display: flex; }
  .memo-more:hover { color: var(--fg); }
  .memo-menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
    width: 152px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 9px; box-shadow: 0 8px 24px rgba(17,24,39,0.18);
    overflow: hidden; display: none;
  }
  .memo-menu.open { display: block; }
  .mm-item {
    display: flex; align-items: center; gap: 9px; width: 100%;
    padding: 10px 13px; border: none; background: transparent; cursor: pointer;
    font: inherit; font-size: 13px; font-weight: 600; color: var(--fg); text-align: left;
    border-bottom: 1px solid var(--border);
  }
  .mm-item:last-child { border-bottom: none; }
  .mm-item:hover { background: var(--bg); }
  .mm-item i { width: 14px; text-align: center; color: var(--muted); font-size: 12px; }
  .mm-item.danger, .mm-item.danger i { color: var(--bad); }
  [data-theme="dark"] .memo-menu { box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
  [data-theme="dark"] .mm-item:hover { background: rgba(255,255,255,0.05); }
  .memo-item .memo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
  }
  .memo-item .memo-author { font-size: 13px; font-weight: 700; }
  .memo-item .memo-unresolved {
    font-size: 12px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--warn-light);
    color: var(--warn);
  }
  .memo-item .memo-resolved {
    font-size: 12px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--good-light);
    color: var(--good);
  }
  .memo-item .memo-time { font-size: 12px; color: var(--muted); }
  .memo-item .memo-text { font-size: 13px; line-height: 1.6; color: var(--fg); }
  .memo-item .memo-link { font-size: 13px; color: var(--accent); text-decoration: none; font-weight: 700; }

  .attach-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 6px;
    transition: background 0.1s;
  }
  .attach-item:hover { background: var(--bg); }
  .attach-icon {
    width: 34px; height: 34px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
  }
  .attach-icon.dwg { background: #fef3c7; color: #d97706; }
  .attach-icon.xlsx { background: var(--good-light); color: var(--good); }
  .attach-icon.pdf { background: var(--bad-light); color: var(--bad); }
  .attach-icon.word { background: var(--accent-light); color: var(--accent); }
  .attach-icon svg { width: 18px; height: 18px; }
  .attach-icon i { font-size: 18px; line-height: 1; }
  .attach-info { flex: 1; min-width: 0; }
  .attach-name { font-size: 13px; font-weight: 700; color: var(--fg); }
  .attach-size { font-size: 12px; color: var(--muted); }
  .attach-dl {
    width: 32px; height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
  }
  .attach-dl:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

  .export-btns {
    display: grid;
    /* 라벨이 가장 긴 '보고서(워드)'가 줄바꿈되지 않도록 세 번째 칸을 넓게 */
    grid-template-columns: 1fr 1fr 1.4fr;
    gap: 7px;
  }
  .export-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 6px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--fg);
    transition: background 0.15s, border-color 0.15s;
  }
  .export-btn i { margin-right: 5px !important; }
  .export-btn:hover { background: var(--bg); }
  .export-btn.pdf { border-color: var(--bad); color: var(--bad); }
  .export-btn.pdf:hover { background: var(--bad-light); }
  .export-btn.excel { border-color: var(--good); color: var(--good); }
  .export-btn.excel:hover { background: var(--good-light); }
  .export-btn.report { border-color: var(--accent); color: var(--accent); }
  .export-btn.report:hover { background: var(--accent-light); }

  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

  /* ── 우측 요약 패널 접기 (kmat.js가 패널 맨 위에 버튼 주입) ── */
  .right-panel { transition: width 0.2s ease, padding 0.2s ease; }
  .rp-toggle {
    /* 'ㅍ' 글자 위에 오도록 제목과 같은 선에서 시작한다 */
    align-self: flex-start;
    width: 30px; height: 30px;
    margin-bottom: -4px;
    padding: 0;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
  }
  .rp-toggle svg { width: 17px; height: 17px; }
  .rp-toggle:hover { background: var(--bg); color: var(--fg); }

  /* 접기는 PC에서만. 1100px 이하에선 패널이 본문 아래로 내려가 폭을 다투지
     않으므로 접을 이유가 없다 — 되돌리는 규칙을 쓰면 원래 display 값이
     망가지므로 아예 이 범위에서만 선언한다. */
  @media (min-width: 1101px) {
    body.rp-collapsed .right-panel {
      width: 46px;
      padding: 18px 8px;
      overflow: hidden;
    }
    /* 접히면 버튼만 남긴다 */
    body.rp-collapsed .right-panel > *:not(.rp-toggle) { display: none; }
    body.rp-collapsed .rp-toggle { align-self: center; margin-bottom: 0; }
  }
  @media (max-width: 1100px) {
    .rp-toggle { display: none; }
  }

  @media (max-width: 1300px) {
    .right-panel { width: 300px; }
  }
  @media (max-width: 1100px) {
    .content-row { flex-direction: column; }
    .right-panel { width: 100%; border-left: none; border-top: 1px solid var(--border); }
    .overview-grid { grid-template-columns: repeat(2, 1fr); }
  }
  @media (max-width: 768px) {
    .icon-sidebar { display: none; }
    .overview-grid { grid-template-columns: 1fr; }
    .top-bar { padding: 12px 16px; }
    .top-bar .actions { flex-wrap: wrap; }
    .content-main { padding: 14px 16px; }
    .filter-tabs { overflow-x: auto; flex-wrap: nowrap; }
  }
  @media (max-width: 480px) {
    /* 유틸바 좌측 47px는 본문 기준선을 맞추려는 값이라 모바일에선 낭비다.
       AI 검색 버튼이 붙으면서 375px에서 우측이 13px 넘쳐 여기서 회수한다. */
    .top-utility { padding: 12px 14px; gap: 10px; }
    .util-right { gap: 6px; }
  }

  /* 알림 아이콘 배지 (대시보드 공통 스타일) */
  .task-ico { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .task-ico svg { width: 17px; height: 17px; }
  .task-ico.red { background: var(--bad-light); color: var(--bad); }
  .task-ico.blue { background: var(--accent-light); color: var(--accent); }
  .task-ico.indigo { background: #eef2ff; color: #6366f1; }
  .task-ico.green { background: var(--good-light); color: var(--good); }
  .task-ico.amber { background: var(--warn-light); color: var(--warn); }
  .task-ico.gray { background: #f3f4f6; color: #6b7280; }
  [data-theme="dark"] .task-ico.indigo { background: rgba(129,140,248,0.18); color: #818cf8; }
  [data-theme="dark"] .task-ico.gray { background: #334155; color: #cbd5e1; }

  /* ── 토글 스위치 (UI 전용: 클릭 시 좌우 슬라이드) ── */
  .switch {
    width: 42px; height: 24px; flex-shrink: 0;
    display: inline-flex; align-items: center;
    padding: 2px;
    border: none;
    border-radius: 999px;
    background: #cbd5e1;
    cursor: pointer;
    transition: background 0.2s ease;
  }
  .switch .knob {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.18);
    transition: transform 0.2s ease;
  }
  .switch.on { background: var(--good); }
  .switch.on .knob { transform: translateX(18px); }
  [data-theme="dark"] .switch { background: #475569; }
