/* =====================================================================
   솔루션 아키텍트 포털 공용 스타일
   방향: 흰 바탕 + 짙은 남색 머리띠 + 파랑 한 가지를 강조색으로 쓰는 차분한 업무 도구.
   색·글자·간격·모서리·그림자는 아래 :root 변수만 쓴다. 화면별 CSS 도 이 변수를 쓴다.
   ===================================================================== */
:root {
  /* 색: 기존 이름(다른 화면이 사용) */
  --navy: #1b2e4b;          /* 머리띠·짙은 버튼 */
  --navy-dark: #111f35;
  --accent: #2355c4;        /* 브랜드 강조색(주 버튼·링크·선택 표시) */
  --bg: #f4f6f9;            /* 페이지 바탕 */
  --card: #ffffff;          /* 카드·표 바탕 */
  --line: #e0e5ec;          /* 기본 테두리 */
  --text: #17202c;
  --muted: #586678;         /* 보조 글자(흰 바탕 대비 약 5.8:1) */
  --ok: #157347;
  --warn: #8f5400;
  --danger: #b42318;
  --radius: 8px;

  /* 색: 새로 더한 것 */
  --accent-hover: #1b47a8;
  --accent-soft: #ebf1fd;   /* 선택된 줄·안내 상자 바탕 */
  --accent-line: #b9cbf2;
  --text-2: #354254;        /* 라벨·표 머리글 */
  --muted-2: #7d8899;       /* 자리표시자·꺼진 글자(장식용) */
  --line-strong: #c8d0db;   /* 입력칸 테두리 */
  --surface-2: #f8f9fb;     /* 표 머리글·카드 머리 */
  --surface-3: #eef1f5;     /* 마우스 올림·태그 바탕 */
  --ok-soft: #e6f4ec;
  --warn-soft: #fff4dd;
  --warn-line: #ecc879;
  --danger-soft: #fdeceb;
  --danger-line: #efb4ae;
  --ok-line: #a8d8bd;
  --ok-text: #0e4d30;
  --warn-strong: #d89614;
  --warn-text: #5c3a00;
  --danger-text: #7a1a12;
  --line-hover: #aeb8c6;    /* 입력칸 마우스 올림 테두리 */
  --row-hover: #f6f8fc;     /* 표 줄 마우스 올림 */
  --toast-ok-bar: #4ade80;
  --toast-error-bar: #ffb4ab;
  --on-navy: #ffffff;
  --on-navy-muted: #b8c4d6;

  /* 모서리 */
  --radius-sm: 6px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  /* 그림자 */
  --shadow-sm: 0 1px 2px rgba(16, 30, 54, .06);
  --shadow-md: 0 4px 14px rgba(16, 30, 54, .08), 0 1px 3px rgba(16, 30, 54, .06);
  --shadow-lg: 0 18px 48px rgba(16, 30, 54, .22);
  --focus-ring: 0 0 0 3px rgba(35, 85, 196, .28);

  /* 글자 크기 */
  --font: "Pretendard", "Pretendard Variable", "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  --font-mono: "D2Coding", "Consolas", "Menlo", monospace;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;

  /* 간격 (4px 단위) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;

  /* 틀 */
  --page-max: 1320px;
  --topbar-h: 52px;
  --subnav-h: 44px;
  --control-h: 36px;
}

/* ---------- 기본 ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); font-size: var(--fs-base); line-height: 1.55; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { color: var(--text); letter-spacing: -0.01em; }
h1 { font-size: var(--fs-2xl); font-weight: 700; line-height: 1.3; margin: 0 0 var(--sp-1); }
h2 { font-size: var(--fs-lg); font-weight: 700; line-height: 1.35; margin: 0 0 var(--sp-3); }
h3 { font-size: var(--fs-md); font-weight: 650; line-height: 1.4; margin: 0 0 var(--sp-2); }
p { margin: 0 0 var(--sp-3); }
b, strong { font-weight: 650; }
code, .mono { font-family: var(--font-mono); font-size: .95em; }
hr { border: none; border-top: 1px solid var(--line); margin: var(--sp-4) 0; }
::selection { background: var(--accent-soft); }

/* 키보드 포커스: 마우스 클릭에는 나타나지 않고, Tab 으로 움직일 때만 분명히 보인다 */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
.skip-link { position: absolute; left: var(--sp-3); top: -60px; z-index: 200; background: var(--card); color: var(--accent);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); font-weight: 600; }
.skip-link:focus { top: var(--sp-2); }

/* ---------- 글자·배치 도우미 ---------- */
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.xsmall { font-size: var(--fs-xs); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden, [hidden] { display: none !important; }
.strong { font-weight: 650; }
.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: var(--sp-2) !important; }
.mt-3 { margin-top: var(--sp-3) !important; }
.mt-4 { margin-top: var(--sp-4) !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: var(--sp-2) !important; }
.mb-4 { margin-bottom: var(--sp-4) !important; }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.grow { flex: 1 1 auto; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* =====================================================================
   머리띠(위쪽 메뉴): 1줄 = 회사·포털 전환·사용자, 2줄 = 지금 포털의 메뉴
   ===================================================================== */
.topbar { background: var(--navy); color: var(--on-navy); position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow-sm); }
.topbar-main { display: flex; align-items: center; gap: var(--sp-5); height: var(--topbar-h); padding: 0 var(--sp-6); }
.topbar .brand { display: flex; align-items: center; gap: var(--sp-2); color: var(--on-navy); font-weight: 700; font-size: var(--fs-md); white-space: nowrap; }
.topbar .brand:hover { text-decoration: none; }
.topbar .brand small { font-weight: 400; color: var(--on-navy-muted); font-size: var(--fs-xs); margin-left: var(--sp-1); }
.brand-mark { width: 26px; height: 26px; border-radius: var(--radius-sm); background: var(--accent); color: var(--on-navy);
  display: inline-flex; align-items: center; justify-content: center; flex: none; }
.brand-mark svg { width: 16px; height: 16px; }

/* 포털 전환: 지금 포털이 흰 칸으로 표시된다 */
.portal-switch { flex: none; display: flex; gap: 2px; padding: 3px; background: rgba(255, 255, 255, .08); border-radius: var(--radius); }
.portal-switch a { color: var(--on-navy-muted); padding: 5px 14px; border-radius: var(--radius-sm); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.portal-switch a:hover { color: var(--on-navy); background: rgba(255, 255, 255, .1); text-decoration: none; }
.portal-switch a.active { background: var(--card); color: var(--navy); }
.portal-switch a:focus-visible, .topbar .user a:focus-visible, .topbar .linkbtn:focus-visible { outline-color: var(--on-navy); }

.topbar .user { margin-left: auto; display: flex; align-items: center; gap: var(--sp-4); font-size: var(--fs-sm); white-space: nowrap; }
.topbar .user a { color: var(--on-navy-muted); }
.topbar .user a:hover { color: var(--on-navy); text-decoration: none; }
.topbar .user .who { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--on-navy); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 255, 255, .16); color: var(--on-navy);
  display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-xs); font-weight: 700; }
.topbar .user form { margin: 0; }
.topbar .linkbtn { background: none; border: 1px solid rgba(255, 255, 255, .3); color: var(--on-navy); border-radius: var(--radius-sm);
  padding: 4px 10px; cursor: pointer; font: inherit; font-size: var(--fs-xs); }
.topbar .linkbtn:hover { background: rgba(255, 255, 255, .1); }

/* 2줄: 포털 메뉴 */
.subnav { background: var(--card); border-bottom: 1px solid var(--line); }
.subnav-inner { display: flex; align-items: stretch; gap: var(--sp-6); height: var(--subnav-h); padding: 0 var(--sp-6); }
.subnav .portal-name { display: flex; align-items: center; font-weight: 700; color: var(--text); font-size: var(--fs-sm); white-space: nowrap;
  padding-right: var(--sp-6); border-right: 1px solid var(--line); margin: var(--sp-2) 0; }
.subnav nav { display: flex; gap: var(--sp-1); flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.subnav nav a { display: flex; align-items: center; color: var(--muted); padding: 0 var(--sp-3); font-weight: 500; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav nav a:hover { color: var(--text); text-decoration: none; border-bottom-color: var(--line-strong); }
.subnav nav a.active { color: var(--accent); font-weight: 700; border-bottom-color: var(--accent); }
.subnav nav a:focus-visible { outline-offset: -2px; }
.subnav .tools { display: flex; align-items: center; gap: var(--sp-3); white-space: nowrap; }
.cart-link { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--text-2); font-size: var(--fs-sm); font-weight: 600;
  padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.cart-link:hover { background: var(--surface-3); text-decoration: none; }
.cart-badge { background: var(--accent); color: var(--on-navy); border-radius: var(--radius-pill); min-width: 22px; padding: 1px 7px;
  font-weight: 700; font-size: var(--fs-xs); text-align: center; font-variant-numeric: tabular-nums; }

.banner { background: var(--warn-soft); border-bottom: 1px solid var(--warn-line); color: var(--warn); padding: var(--sp-2) var(--sp-6); font-size: var(--fs-sm); }
.banner a { font-weight: 600; }

/* ---------- 본문 틀 ---------- */
.page { width: 100%; max-width: var(--page-max); margin: 0 auto; padding: var(--sp-6) var(--sp-6) var(--sp-8); flex: 1 0 auto; }
.page.wide { max-width: none; }                       /* 폭 제한 없음(여백은 유지) */
.page.full { max-width: none; padding: 0; }           /* 여백도 없음(캔버스 화면) */
.page.narrow { max-width: 880px; }
footer.foot { text-align: center; color: var(--muted); font-size: var(--fs-xs); padding: var(--sp-4) 0 var(--sp-6); }
body.no-foot footer.foot { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head h1 + .muted, .page-head h1 + div { margin-top: var(--sp-1); }
.page-head > .row { flex-wrap: wrap; justify-content: flex-end; }
.eyebrow { font-size: var(--fs-xs); font-weight: 700; color: var(--accent); letter-spacing: .04em; margin-bottom: var(--sp-1); }

/* ---------- 카드 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-5); margin-bottom: var(--sp-4); box-shadow: var(--shadow-sm); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .table-wrap { margin: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card.flush > .card-head { padding: var(--sp-4) var(--sp-5); margin: 0; border-bottom: 1px solid var(--line); }
.card-foot { margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.card.flush > .card-foot { margin: 0; padding: var(--sp-3) var(--sp-5); }
.count { color: var(--muted); font-weight: 600; font-size: var(--fs-sm); margin-left: var(--sp-1); font-variant-numeric: tabular-nums; }

.grid { display: grid; gap: var(--sp-4); }
.grid > .card { margin-bottom: 0; }
.grid + .card, .grid + .grid, .card + .grid, .notice + .grid { margin-top: var(--sp-4); }
.grid + .card { margin-top: var(--sp-4); }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.tight { gap: var(--sp-3); }
.grid.form-grid { gap: 0 var(--sp-4); }
.side-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.side-layout > .card:first-child { position: sticky; top: calc(var(--topbar-h) + var(--subnav-h) + var(--sp-4)); }

/* 숫자 요약 */
.stat { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.2; margin-top: var(--sp-1); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
#stats .card, .stat-card { padding: var(--sp-4) var(--sp-5); }
.stat-card .muted.small:first-child, #stats .card .muted.small:first-child { font-weight: 600; color: var(--text-2); }
.stat-card .stat-sub, #stats .card .stat + .muted { margin-top: var(--sp-1); font-size: var(--fs-xs); }
a.stat-card { display: block; color: var(--text); }
a.stat-card:hover { text-decoration: none; border-color: var(--accent-line); }

/* =====================================================================
   폼
   ===================================================================== */
label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
label .muted, label .opt { font-weight: 400; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=search],
input[type=url], input[type=tel], select, textarea {
  width: 100%; min-height: var(--control-h); padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font: inherit; font-size: var(--fs-base); background: var(--card); color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:hover, select:hover, textarea:hover { border-color: var(--line-hover); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
select { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23586678' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 11px center; }
textarea { resize: vertical; min-height: 76px; line-height: 1.55; }
input[type=file] { font: inherit; font-size: var(--fs-sm); color: var(--text-2); max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-size: var(--fs-sm); margin-right: var(--sp-3); padding: 6px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--card); color: var(--text); cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--surface-3); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

/* 오류 표시: 칸에 aria-invalid="true" 또는 .field.error, 사용자가 건드린 뒤 규칙에 맞지 않는 칸 */
input[aria-invalid=true], select[aria-invalid=true], textarea[aria-invalid=true], .field.error input, .field.error select, .field.error textarea,
input:user-invalid, textarea:user-invalid { border-color: var(--danger); }
input[aria-invalid=true]:focus, .field.error input:focus, input:user-invalid:focus { box-shadow: 0 0 0 3px rgba(180, 35, 24, .2); }

h2 > label, h3 > label { display: inline; font: inherit; color: inherit; margin: 0; }
.field { margin-bottom: var(--sp-4); }
.field:last-child { margin-bottom: 0; }
.help { display: block; margin-top: 6px; font-size: var(--fs-xs); color: var(--muted); line-height: 1.45; }
.field-error { display: block; margin-top: 6px; font-size: var(--fs-xs); color: var(--danger); font-weight: 600; }
.req { color: var(--danger); margin-left: 2px; }
.row { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.check { display: flex; align-items: center; gap: var(--sp-2); color: var(--text); font-weight: 400; font-size: var(--fs-base); margin: 0; cursor: pointer; }
.check input { width: 16px; }
.form-actions { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.fieldset-title { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); letter-spacing: .03em; margin: var(--sp-2) 0 var(--sp-3); }

/* =====================================================================
   버튼: 주 버튼(primary) 1개 · 짙은 버튼(navy) · 기본(흰) · 위험(danger) · 작게(sm)
   ===================================================================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--control-h);
  border: 1px solid var(--line-strong); background: var(--card); color: var(--text); border-radius: var(--radius-sm);
  padding: 6px 14px; font: inherit; font-size: var(--fs-base); font-weight: 600; line-height: 1.3; cursor: pointer; white-space: nowrap;
  transition: background-color .12s, border-color .12s, box-shadow .12s; box-shadow: var(--shadow-sm); }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-navy); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.primary:focus-visible, .btn.navy:focus-visible { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }
.btn.navy { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }
.btn.navy:hover { background: var(--navy-dark); border-color: var(--navy-dark); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { color: var(--danger); border-color: var(--danger-line); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.primary.danger { background: var(--danger); border-color: var(--danger); color: var(--on-navy); }
.btn.sm { min-height: 28px; padding: 3px 10px; font-size: var(--fs-sm); }
.btn.lg { min-height: 44px; padding: 10px 20px; font-size: var(--fs-md); }
.btn.block { display: flex; width: 100%; }
.btn .small { font-weight: 400; opacity: .85; }
.btn:disabled, .btn[aria-disabled=true] { opacity: .5; cursor: not-allowed; transform: none; }
.btn:disabled:hover { background: inherit; }
.btn.primary:disabled:hover { background: var(--accent); }
.btn.navy:disabled:hover { background: var(--navy); }
.btn .ico { width: 16px; height: 16px; flex: none; }
.btn-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 var(--sp-1); }

/* =====================================================================
   표
   ===================================================================== */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-base); }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: var(--fs-xs); color: var(--text-2); font-weight: 700; background: var(--surface-2); white-space: nowrap; letter-spacing: .01em; }
thead th { border-bottom-color: var(--line-strong); }
tbody tr { transition: background-color .08s; }
tbody tr:hover > td { background: var(--row-hover); }
tbody tr:last-child > td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .muted.small, td .small.muted { margin-top: 2px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.table-wrap > table th:first-child, .table-wrap > table td:first-child { padding-left: var(--sp-4); }
.table-wrap > table th:last-child, .table-wrap > table td:last-child { padding-right: var(--sp-4); }
.card.flush > .table-wrap { border: none; border-radius: 0; }
table.plain td, table.plain th { padding: 8px 0; }
table.plain tbody tr:hover > td { background: none; }
.list-table td { padding: 10px 0; }
.list-table tbody tr:hover > td { background: none; }
.list-table td + td { padding-left: var(--sp-3); }
tr.empty-row td, td.empty-cell, tbody td[colspan].muted { text-align: center; color: var(--muted); padding: var(--sp-6) var(--sp-4); }

/* 빈 상태: "아직 ~가 없습니다" + 할 일 버튼 */
.empty { text-align: center; padding: var(--sp-8) var(--sp-4); color: var(--muted); }
.empty .empty-icon { width: 40px; height: 40px; margin: 0 auto var(--sp-3); border-radius: var(--radius); background: var(--surface-3); color: var(--muted);
  display: flex; align-items: center; justify-content: center; }
.empty .empty-icon svg { width: 20px; height: 20px; }
.empty .empty-title { color: var(--text); font-weight: 650; font-size: var(--fs-md); margin-bottom: var(--sp-1); }
.empty p { margin: 0 auto var(--sp-4); max-width: 420px; font-size: var(--fs-sm); }
.empty.compact { padding: var(--sp-5) var(--sp-3); }
.empty.compact p { margin-bottom: var(--sp-3); }

/* ---------- 태그 ---------- */
.tag { display: inline-flex; align-items: center; gap: 4px; border-radius: var(--radius-pill); padding: 1px 9px; font-size: var(--fs-xs); font-weight: 600;
  line-height: 1.6; background: var(--surface-3); color: var(--text-2); margin: 0 4px 4px 0; white-space: nowrap; vertical-align: middle; border: 1px solid transparent; }
td .tag { margin-bottom: 0; }
.tag:empty { display: none; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.blue { background: var(--accent-soft); color: var(--accent-hover); }
.tag.outline { background: transparent; border-color: var(--line-strong); }
h2 .tag, h3 .tag { margin: 0 0 0 var(--sp-1); vertical-align: 2px; }

/* ---------- 안내 상자 ---------- */
.notice { position: relative; border: 1px solid var(--accent-line); border-left: 4px solid var(--accent); background: var(--accent-soft); color: var(--text);
  padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: var(--sp-4); font-size: var(--fs-sm); line-height: 1.6; }
.notice b, .notice strong { color: inherit; }
.notice .btn { margin-left: var(--sp-2); }
.notice.warn { border-color: var(--warn-line); border-left-color: var(--warn-strong); background: var(--warn-soft); color: var(--warn-text); }
.notice.error { border-color: var(--danger-line); border-left-color: var(--danger); background: var(--danger-soft); color: var(--danger-text); }
.notice.ok { border-color: var(--ok-line); border-left-color: var(--ok); background: var(--ok-soft); color: var(--ok-text); }
.notice .spinner { margin-right: var(--sp-2); }

/* =====================================================================
   로그인 · 오류 화면
   ===================================================================== */
.login-wrap { flex: 1; min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: var(--sp-5); }
.login-shell { width: 100%; max-width: 880px; display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md); }
.login-side { background: var(--navy); color: var(--on-navy); padding: var(--sp-10) var(--sp-8); display: flex; flex-direction: column; gap: var(--sp-6); }
.login-side .brand-mark { width: 36px; height: 36px; border-radius: var(--radius); }
.login-side .brand-mark svg { width: 20px; height: 20px; }
.login-side h2 { color: var(--on-navy); font-size: var(--fs-xl); margin: 0; line-height: 1.4; }
.login-side .company { color: var(--on-navy-muted); font-size: var(--fs-sm); margin-top: var(--sp-1); }
.login-side ul { list-style: none; margin: auto 0 0; padding: 0; display: grid; gap: var(--sp-4); }
.login-side li { border-left: 2px solid rgba(255, 255, 255, .25); padding-left: var(--sp-3); }
.login-side li b { display: block; color: var(--on-navy); font-size: var(--fs-sm); }
.login-side li span { color: var(--on-navy-muted); font-size: var(--fs-xs); }
.login-card { background: var(--card); padding: var(--sp-10) var(--sp-8); width: 100%; }
.login-wrap > .login-card { max-width: 400px; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.login-card h1 { font-size: var(--fs-xl); margin-bottom: var(--sp-1); }
.login-card .sub { color: var(--muted); margin-bottom: var(--sp-6); font-size: var(--fs-sm); }
.login-card .version { margin: var(--sp-6) 0 0; text-align: center; color: var(--muted); font-size: var(--fs-xs); }
.error-code { font-size: 56px; font-weight: 800; color: var(--accent); line-height: 1; letter-spacing: -0.03em; margin-bottom: var(--sp-3); font-variant-numeric: tabular-nums; }

/* =====================================================================
   인트로(포털 선택)
   ===================================================================== */
.intro-hero { padding: var(--sp-8) 0 var(--sp-6); max-width: 960px; margin: 0 auto; }
.intro-hero h1 { font-size: var(--fs-3xl); letter-spacing: -0.02em; }
.intro-hero p { color: var(--muted); font-size: var(--fs-md); margin: var(--sp-2) 0 0; }
.intro-grid { max-width: 960px; margin: 0 auto; }
.portal-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--sp-6);
  color: var(--text); box-shadow: var(--shadow-sm); transition: box-shadow .15s, border-color .15s, transform .15s; height: 100%; }
.portal-card:hover { text-decoration: none; box-shadow: var(--shadow-md); border-color: var(--accent-line); transform: translateY(-1px); }
.portal-card:focus-visible { outline: none; box-shadow: var(--focus-ring), var(--shadow-md); border-color: var(--accent); }
.portal-card .icon { width: 44px; height: 44px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: var(--fs-md); margin-bottom: var(--sp-4); flex: none; }
.portal-card .icon svg { width: 24px; height: 24px; }
.portal-card.disabled .icon { background: var(--surface-3); color: var(--muted); }
.portal-card h2 { margin-bottom: var(--sp-2); }
.portal-card h3 { margin-bottom: var(--sp-1); }
.portal-card p { color: var(--muted); }
.portal-card ul { margin: var(--sp-2) 0 0; padding: 0; list-style: none; color: var(--text-2); display: grid; gap: var(--sp-2); font-size: var(--fs-sm); }
.portal-card ul li { padding-left: 18px; position: relative; }
.portal-card ul li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-line); }
.portal-card .go { margin-top: auto; padding-top: var(--sp-5); color: var(--accent); font-weight: 650; font-size: var(--fs-sm); display: flex; align-items: center; gap: 6px; }
.portal-card:hover .go .arrow { transform: translateX(3px); }
.portal-card .go .arrow { transition: transform .15s; }
.intro-foot { max-width: 960px; margin: var(--sp-6) auto 0; display: flex; gap: var(--sp-4); flex-wrap: wrap; justify-content: center; font-size: var(--fs-sm); }

/* 작은 바로가기 카드(홈 화면의 할 일·양식) */
.action-card { display: flex; gap: var(--sp-3); align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--sp-4); color: var(--text); transition: border-color .12s, box-shadow .12s; box-shadow: var(--shadow-sm); }
.action-card:hover { text-decoration: none; border-color: var(--accent-line); box-shadow: var(--shadow-md); }
.action-card:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.action-card .step { flex: none; width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: var(--fs-sm); }
.action-card .step svg { width: 16px; height: 16px; }
.action-card h3 { margin: 2px 0 var(--sp-1); font-size: var(--fs-md); }
.action-card p { margin: 0; color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }
.action-card .meta { margin-top: var(--sp-2); }

.template-group + .template-group { margin-top: var(--sp-5); }
.template-group-title { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); font-weight: 700; color: var(--text-2); margin-bottom: var(--sp-3); }
.template-group-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* =====================================================================
   제품 카탈로그·장비 추천 결과(JS 가 그림)
   ===================================================================== */
.series-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin-bottom: var(--sp-4); box-shadow: var(--shadow-sm); }
.series-card > header { padding: var(--sp-4) var(--sp-5); display: flex; gap: var(--sp-4); justify-content: space-between; align-items: flex-start; }
.series-card > header h3 { margin: 0 0 var(--sp-2); font-size: var(--fs-lg); }
.series-card > header p { color: var(--text-2); }
.series-card .body { padding: 0 var(--sp-5) var(--sp-4); }
.series-card table { font-size: var(--fs-sm); }
.series-card .table-wrap { border-radius: var(--radius-sm); }
.series-card td b { font-family: var(--font-mono); font-weight: 600; font-size: var(--fs-sm); }
.features { margin: var(--sp-2) 0 0; padding-left: 18px; color: var(--text-2); font-size: var(--fs-sm); }
.features li + li { margin-top: 2px; }
.features li::marker { color: var(--muted-2); }
.filter-bar .grid { align-items: end; }
.result-count { font-variant-numeric: tabular-nums; margin-left: auto; }

/* =====================================================================
   견적 편집
   ===================================================================== */
.items-table { font-size: var(--fs-sm); }
.items-table th { padding: 8px 6px; }
.items-table td { padding: 6px 4px; vertical-align: middle; }
.items-table input { min-height: 32px; padding: 5px 8px; font-size: var(--fs-sm); border-color: var(--line); }
.items-table input:hover { border-color: var(--line-strong); }
.items-table input.right { text-align: right; font-variant-numeric: tabular-nums; }
.items-table input[data-f=sku] { font-family: var(--font-mono); }
.items-table td[data-amount] { font-weight: 600; padding-right: var(--sp-2); }
.items-table td:last-child { width: 40px; text-align: center; }
.items-table .w-s { width: 76px; } .items-table .w-m { width: 116px; } .items-table .w-l { width: 180px; }
.items-table tbody tr:hover > td { background: var(--surface-2); }
.totals { margin-left: auto; width: 360px; max-width: 100%; font-size: var(--fs-base); }
.totals td { border: none; padding: 5px 0; }
.totals td:first-child { color: var(--muted); }
.totals tbody tr:hover > td, .totals tr:hover > td { background: none; }
.totals tr.grand td { border-top: 1px solid var(--line-strong); font-weight: 700; font-size: var(--fs-lg); padding-top: var(--sp-3); color: var(--text); }
.bom-foot { display: flex; gap: var(--sp-6); align-items: flex-start; margin-top: var(--sp-4); }
.bom-foot > p { flex: 1; margin: 0; }
.autocomplete { position: relative; }
.autocomplete .list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-md); max-height: 340px; overflow-y: auto; }
.autocomplete .list button { display: block; width: 100%; text-align: left; border: none; background: none; padding: 9px 12px; font: inherit; color: var(--text);
  cursor: pointer; border-bottom: 1px solid var(--line); }
.autocomplete .list button:last-child { border-bottom: none; }
.autocomplete .list button:hover, .autocomplete .list button:focus-visible { background: var(--accent-soft); outline: none; }
.search-input { position: relative; }
.item-search { width: 380px; max-width: 100%; }
.search-input input { padding-left: 34px; }
.search-input .ico { position: absolute; left: 11px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

/* =====================================================================
   알림(toast) · 창(dialog) · 돌아가는 표시
   ===================================================================== */
#toast { position: fixed; right: var(--sp-5); bottom: var(--sp-5); z-index: 300; display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-end; pointer-events: none; }
#toast div { pointer-events: auto; background: var(--navy-dark); color: var(--on-navy); padding: 11px 16px 11px 14px; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-width: 440px; font-size: var(--fs-sm); line-height: 1.5; border-left: 4px solid var(--toast-ok-bar); animation: toast-in .18s ease-out; }
#toast div.error { background: var(--danger-text); border-left-color: var(--toast-error-bar); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite; vertical-align: -3px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--sp-6); width: 460px; max-width: calc(100vw - 32px);
  box-shadow: var(--shadow-lg); color: var(--text); background: var(--card); }
dialog[open] { animation: dialog-in .16s ease-out; }
dialog::backdrop { background: rgba(14, 24, 40, .5); }
dialog h2 { font-size: var(--fs-lg); margin-bottom: var(--sp-4); padding-bottom: var(--sp-3); border-bottom: 1px solid var(--line); }
dialog form > .row:last-child, dialog .dialog-actions { margin-top: var(--sp-5); justify-content: flex-end; }
dialog.wide { width: 720px; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =====================================================================
   화면 폭에 따른 조정 (기준 1280~1920, 1024 와 좁은 화면도 깨지지 않게)
   ===================================================================== */
@media (max-width: 1200px) {
  .items-table { min-width: 900px; }
  .items-table .w-s { width: 64px; } .items-table .w-m { width: 100px; } .items-table .w-l { width: 150px; }
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-layout { grid-template-columns: 300px minmax(0, 1fr); }
}
@media (max-width: 1100px) {
  .topbar .brand .brand-text small { display: none; }
  .topbar .user .who .name-suffix { display: none; }
}
@media (max-width: 960px) {
  .grid.c2, .grid.c3, .side-layout { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .side-layout > .card:first-child { position: static; }
  .topbar { position: static; }
  .topbar-main { height: auto; flex-wrap: wrap; padding: var(--sp-2) var(--sp-4); gap: var(--sp-3); }
  .topbar .user { gap: var(--sp-3); }
  .subnav-inner { padding: 0 var(--sp-4); gap: var(--sp-3); }
  .subnav .portal-name { display: none; }
  .page { padding: var(--sp-4) var(--sp-4) var(--sp-6); }
  .login-shell { grid-template-columns: 1fr; max-width: 420px; }
  .login-side { display: none; }
  .bom-foot { flex-direction: column; }
  .bom-foot .totals { width: 100%; }
}
@media (max-width: 640px) {
  .grid.c4 { grid-template-columns: minmax(0, 1fr); }
  .topbar .brand .brand-text { display: none; }
  .portal-switch a { padding: 5px 10px; }
  .login-card { padding: var(--sp-8) var(--sp-5); }
  h1 { font-size: var(--fs-xl); }
  .intro-hero h1 { font-size: var(--fs-2xl); }
  .page-head > .row { justify-content: flex-start; }
}
@media print {
  .topbar, .subnav, .banner, footer.foot, #toast { display: none !important; }
  body { background: var(--card); }
  .card { box-shadow: none; }
}


/* =====================================================================
   v0.3 공통 부품 (common.js 의 SA.menu / SA.saveState / SA.projectChip 이 쓴다)
   편집 화면 머리줄은 세 편집기(견적·구성도·문서)가 같은 모양을 쓴다:
     <div class="editor-bar">
       <div class="editor-bar-left">  ← 목록 · 제목 · 저장 상태 · 안건 표시 </div>
       <div class="editor-bar-right"> [돌아가기] [다음 단계 ▾] [내려받기 ▾] [저장] </div>
     </div>
   ===================================================================== */
.editor-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.editor-bar-left, .editor-bar-right { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; min-width: 0; }
.editor-bar-left { flex: 1 1 320px; }
.editor-bar-right { justify-content: flex-end; }
.editor-bar h1 { margin: 0; font-size: var(--fs-xl); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.editor-bar .back-link { color: var(--muted); text-decoration: none; font-size: var(--fs-sm); white-space: nowrap; }
.editor-bar .back-link:hover { color: var(--accent); }
.save-state { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.save-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.save-state:empty { display: none; }
.save-state.saved::before { background: var(--ok); }
.save-state.dirty::before, .save-state.new::before { background: var(--warn-strong); }
.save-state.saving::before { background: var(--accent); animation: save-pulse 1s ease-in-out infinite; }
.save-state.error { color: var(--danger); font-weight: 600; }
.save-state.error::before { background: var(--danger); }
@keyframes save-pulse { 50% { opacity: .3; } }

.chip { display: inline-flex; align-items: center; gap: 6px; max-width: 280px; padding: 2px 10px 2px 3px; border: 1px solid var(--accent-line); border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--accent-hover); font-size: var(--fs-xs); font-weight: 600; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .chip-label { background: var(--accent); color: #fff; border-radius: var(--radius-pill); padding: 0 7px; font-weight: 600; }
.chip.empty { padding: 2px 10px; background: transparent; border-style: dashed; border-color: var(--line-strong); color: var(--muted); cursor: pointer; font-family: inherit; }
.chip.empty:hover { border-color: var(--accent); color: var(--accent); }
a.chip:hover { border-color: var(--accent); }
.project-chip { display: inline-flex; align-items: center; gap: var(--sp-1); min-width: 0; }
.project-chip .linkbtn { font-size: var(--fs-xs); padding: 2px 4px; border: 0; background: none; color: var(--accent); cursor: pointer; font-family: inherit; white-space: nowrap; }
.project-chip .linkbtn:hover { text-decoration: underline; }

.menu-pop { position: absolute; z-index: 250; min-width: 220px; max-width: 340px; padding: var(--sp-1); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-md); display: flex; flex-direction: column; }
.menu-pop a, .menu-pop button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 7px 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); font: inherit; font-size: var(--fs-sm); text-align: left; text-decoration: none; cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover:not(:disabled), .menu-pop a:focus-visible, .menu-pop button:focus-visible { background: var(--accent-soft); outline: none; }
.menu-pop button:disabled { color: var(--muted-2); cursor: not-allowed; }
.menu-pop small { color: var(--muted); font-size: var(--fs-xs); font-weight: 400; }
.menu-pop .danger { color: var(--danger); }
.menu-pop .menu-sep { height: 1px; margin: var(--sp-1) 0; background: var(--line); }

.project-picker input[type="search"] { width: 100%; }
.picker-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow: auto; margin: var(--sp-3) 0; }
.picker-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); padding: 8px 10px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; font: inherit; text-align: left; cursor: pointer; }
.picker-row:hover, .picker-row:focus-visible { background: var(--accent-soft); outline: none; }
.picker-row.current { border-color: var(--accent-line); background: var(--accent-soft); }
.picker-new { padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.picker-new .row { margin-top: var(--sp-2); flex-wrap: wrap; }
.picker-new input { flex: 1 1 180px; }

/* =====================================================================
   v0.3 빠른 찾기(Ctrl+K): 머리띠 버튼 + 가운데 위쪽에 뜨는 창 (quickfind.js)
   ===================================================================== */
.quickfind-btn { margin-left: auto; display: inline-flex; align-items: center; gap: var(--sp-2); height: 32px; padding: 0 6px 0 10px; min-width: 180px;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: var(--radius-sm); background: rgba(255, 255, 255, .08); color: var(--on-navy-muted);
  font: inherit; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; }
.quickfind-btn:hover { background: rgba(255, 255, 255, .14); color: var(--on-navy); }
.quickfind-btn:focus-visible { outline: 2px solid var(--on-navy); outline-offset: 2px; }
.quickfind-btn .ico { width: 14px; height: 14px; flex: none; }
.quickfind-btn span { flex: 1; text-align: left; }
.quickfind-btn kbd { font-family: inherit; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: rgba(255, 255, 255, .12); color: var(--on-navy-muted); }
.quickfind-btn + .user { margin-left: 0; }

dialog.quickfind { width: 640px; padding: 0; margin: 10vh auto auto; overflow: hidden; }
.quickfind-head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); }
.quickfind-ico { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; }
.quickfind-head input.quickfind-input { border: 0; box-shadow: none; padding: 6px 4px; font-size: var(--fs-md); min-height: 36px; }
.quickfind-head input.quickfind-input:focus { box-shadow: none; }
.quickfind kbd { font-family: inherit; font-size: 11px; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px;
  background: var(--surface-2); color: var(--text-2); }
.quickfind-list { max-height: min(60vh, 480px); overflow-y: auto; padding: var(--sp-2); }
.quickfind-list.loading { opacity: .6; }
.quickfind-group + .quickfind-group { margin-top: var(--sp-2); }
.quickfind-group-title { padding: var(--sp-1) var(--sp-2); font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.quickfind-row { display: flex; align-items: center; gap: var(--sp-3); padding: 7px var(--sp-2); border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.quickfind-row:hover { text-decoration: none; }
.quickfind-row[aria-selected=true] { background: var(--accent-soft); }
.quickfind-kind { flex: none; width: 26px; height: 26px; border-radius: var(--radius-sm); background: var(--surface-3); color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-xs); font-weight: 700; }
.quickfind-row[aria-selected=true] .quickfind-kind { background: var(--accent); color: var(--on-navy); }
.quickfind-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.quickfind-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quickfind-sub { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quickfind-meta { flex: none; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.quickfind-empty { padding: var(--sp-6) var(--sp-3); text-align: center; color: var(--muted); font-size: var(--fs-sm); }
.quickfind-foot { display: flex; gap: var(--sp-4); padding: var(--sp-2) var(--sp-4); border-top: 1px solid var(--line); background: var(--surface-2);
  font-size: var(--fs-xs); color: var(--muted); }
.quickfind-foot kbd + kbd { margin-left: 2px; }
@media (max-width: 1100px) {
  .quickfind-btn { min-width: 0; }
  .quickfind-btn kbd { display: none; }
}
@media (max-width: 640px) {
  .quickfind-btn span { display: none; }
}
