/* shadcn/ui-inspired neutral operations theme. Loaded last as a compatibility
   layer: native tables, source data, form handlers and worksheet columns stay intact. */
:root {
  --background:#fafafa; --foreground:#18181b; --card:#fff;
  --card-foreground:#18181b; --primary:#2563eb; --primary-foreground:#fff;
  --secondary:#f4f4f5; --secondary-foreground:#27272a;
  --muted:#f4f4f5; --muted-foreground:#52525b; --accent:#eff6ff;
  --accent-foreground:#1d4ed8; --border:#e4e4e7; --input:#d4d4d8;
  --ring:#2563eb; --destructive:#b91c1c; --sidebar:#fafafa;
  --radius:8px; --header-height:68px;
  --font-sans:"Pretendard","Noto Sans KR","Malgun Gothic",Arial,sans-serif;
  --color-primary:var(--primary); --color-primary-dark:#1d4ed8;
  --color-secondary:var(--ring); --color-background:var(--background);
  --color-surface:var(--card); --color-foreground:var(--foreground);
  --color-text:#27272a; --color-muted:var(--muted-foreground);
  --color-border:var(--border); --shadow:0 1px 2px #18181b06;
  font-family:var(--font-sans); color:var(--foreground);
}
body { background:var(--background); color:var(--color-text); line-height:1.6; }
body :is(button,input,select,textarea,table,th,td,strong,small,dd,dt,.numeric,.badge,.updated,.component-type) {
  font-family:var(--font-sans)!important;
}
body :is(strong,dd,.numeric,td,input[type=number]) { font-variant-numeric:tabular-nums; letter-spacing:normal; }
:is(button,a,input,select,textarea,summary):focus-visible {
  outline:2px solid var(--ring); outline-offset:3px;
}
button,a,summary { touch-action:manipulation; }
.app-shell { grid-template-columns:240px minmax(0,1fr); background:var(--background); }
.workspace { background:var(--background); min-width:0; }
.sidebar { padding:16px 12px; background:var(--sidebar); color:var(--foreground); border-right:1px solid var(--border); gap:12px; }
.brand { min-height:52px; padding:0 8px 16px; color:var(--foreground); letter-spacing:0; font-weight:700; align-items:center; }
.brand::after { content:'구매 · 재고 · 원가 관리'; left:51px; bottom:3px; color:var(--muted-foreground); font-size:10px; font-weight:400; letter-spacing:0; }
.brand-mark { width:32px; height:32px; border-radius:7px; background:var(--primary); color:var(--primary-foreground); }
.purpose-navigation { gap:6px; }
.purpose-parent { justify-content:flex-start; gap:9px; min-height:40px; padding:9px 10px; border:1px solid transparent; color:var(--color-text); background:transparent; border-radius:6px; font-size:13px; font-weight:600; }
.purpose-parent.active { background:var(--secondary); border-color:transparent; color:var(--foreground); }
.purpose-parent:hover { background:#ededf0; }
.purpose-parent>svg:last-child { margin-left:auto; width:15px; height:15px; color:var(--muted-foreground); }
.purpose-parent .scm-group-icon { width:17px; height:17px; flex:none; color:var(--muted-foreground); }
.purpose-parent .scm-group-icon svg { width:17px; height:17px; stroke-width:1.6; }
.purpose-links { padding:4px 0 6px 9px; margin-left:15px; border-left:1px solid var(--border); }
.purpose-links>p { display:none; }
.purpose-links button { min-height:36px; padding:8px 10px; border-left:0; color:var(--muted-foreground); font-size:12px; border-radius:5px; font-weight:400; }
.purpose-links button:hover { background:var(--secondary); color:var(--foreground); }
.purpose-links button.active { background:var(--accent); color:var(--accent-foreground); box-shadow:inset 2px 0 var(--primary); font-weight:600; }
.sidebar-note { margin-top:12px; padding:12px 8px 0; border-color:var(--border); color:var(--muted-foreground); }
.sidebar-note strong { color:var(--color-text); font-size:12px; font-weight:500; }
.sidebar-note small { color:var(--muted-foreground); font-size:11px; }
.topbar { min-height:68px; padding:12px 24px; background:var(--card); border-color:var(--border); backdrop-filter:none; gap:12px; justify-content:flex-start; position:sticky; top:0; z-index:20; }
.topbar>div:first-of-type { min-width:0; flex:1; }
.topbar .eyebrow { color:var(--muted-foreground); letter-spacing:0; font-size:11px; font-weight:400; }
.topbar h1 { margin:0; color:var(--foreground); font-size:18px; font-weight:600; letter-spacing:-.02em; overflow-wrap:anywhere; }
.top-actions { margin-left:auto; min-width:0; }
.updated { color:var(--muted-foreground); font-size:11px; }
main { padding:24px 24px 48px; }
main:focus { outline:none; }
.view.active { animation:none; }
.view-heading { margin-bottom:20px; }
.view-heading h2,.ip-heading h2 { font-size:24px; font-weight:600; letter-spacing:-.035em; color:var(--foreground); }
.view-heading p { font-size:13px; line-height:1.7; color:var(--muted-foreground); }
.section-label,.eyebrow { letter-spacing:.025em; font-weight:500; color:var(--muted-foreground); }
.panel { border-color:var(--border); border-radius:var(--radius); box-shadow:var(--shadow); padding:20px; }
.panel-heading { gap:12px; flex-wrap:wrap; border-bottom-color:var(--border); padding-bottom:16px; }
.panel-heading :is(h2,h3) { color:var(--foreground); font-weight:600; letter-spacing:-.02em; }
.panel-heading h2 { font-size:17px; }.panel-heading h3 { font-size:16px; }
.purpose-context { border:0; border-left:0; background:transparent; margin:0 0 18px; padding:0; }
.purpose-context>strong { display:none; }
.purpose-context p { margin:0; font-size:13px; color:var(--muted-foreground); }
.purpose-context small { font-size:12px; }
/* Button variants: solid for commit, outline for tools, danger for removal. */
body :is(.button,.text-button),#inventory-plan-view button {
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  min-height:38px; padding:7px 12px; border:1px solid var(--input);
  border-radius:6px; background:var(--card); color:var(--color-text);
  font-size:13px; font-weight:500; line-height:1.4; text-decoration:none;
  box-shadow:0 1px 2px #18181b06; cursor:pointer;
  transition:background-color .15s ease,border-color .15s ease,color .15s ease;
}
body :is(.button,.text-button):hover,#inventory-plan-view button:hover { background:var(--secondary); color:var(--foreground); border-color:#a1a1aa; }
body .button.primary,#inventory-plan-view button.ip-primary { color:var(--primary-foreground); background:var(--primary); border-color:var(--primary); }
body .button.primary:hover,#inventory-plan-view button.ip-primary:hover { background:#1d4ed8; border-color:#1d4ed8; }
body :is(.button,.text-button):disabled,#inventory-plan-view button:disabled { opacity:.5; cursor:not-allowed; pointer-events:none; }
body :is(.remove-component,.button.danger) { color:var(--destructive); border-color:#fecaca; background:#fff; }
label { color:var(--color-text); font-size:13px; font-weight:500; }
input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea,
#inventory-plan-view :is(input:not([type=checkbox]):not([type=radio]),select,textarea) {
  min-height:38px; border:1px solid var(--input); border-radius:6px;
  background:var(--card); color:var(--foreground); font-size:13px;
  box-shadow:0 1px 2px #18181b04; transition:border-color .15s ease,box-shadow .15s ease;
}
input::placeholder,textarea::placeholder { color:#71717a; }
input:focus,select:focus,textarea:focus { border-color:var(--ring); box-shadow:0 0 0 3px #2563eb1a; }
input[type=checkbox],input[type=radio] { accent-color:var(--primary); }
:is(input,select,textarea):disabled { opacity:.55; cursor:not-allowed; background:var(--secondary); }
:is(input,select,textarea)[aria-invalid=true] { border-color:var(--destructive)!important; }
.field-help,.field-help p { color:var(--muted-foreground); font-size:12px; line-height:1.7; }
.badge { border-radius:5px; font-weight:500; letter-spacing:0; }
.kpi-card,.mapping-ledger,.reorder-ledger,.demand-ledger,.inventory-plan-summary,.ip-summary { border-color:var(--border); border-radius:var(--radius); background:var(--card); box-shadow:none; }
:is(.kpi-card,.mapping-ledger,.reorder-ledger,.demand-ledger,.inventory-plan-summary,.ip-summary) strong { color:var(--foreground); font-weight:600; }
.inventory-plan-summary strong { font-size:22px; line-height:1.5; }
.inventory-plan-summary span,.inventory-plan-summary small { color:var(--muted-foreground); font-size:12px; }
/* Preserve real table markup, selection/copy and worksheet-specific state colors. */
.table-wrap { border-color:var(--border); box-shadow:none; }
table { color:var(--color-text); }
th,td { border-color:var(--border)!important; }
thead th { background:var(--secondary)!important; color:var(--muted-foreground)!important; font-weight:500; letter-spacing:0; text-transform:none; }
tbody tr:nth-child(even) td { background:var(--card); }
tbody tr:hover td { background:#f4f4f5!important; }
.catalog-panel .catalog-table th { background:var(--secondary)!important; color:var(--muted-foreground)!important; }
.catalog-panel .catalog-table .master-name-cell { border-right:1px solid var(--border); }
.catalog-panel .catalog-table :is(th,td) { font-size:13px; padding:10px 12px; }
.catalog-panel .catalog-table td { color:var(--color-text); }
.master-column-picker { border-color:var(--border); border-radius:6px; background:var(--card); }
.master-column-picker summary { color:var(--color-text); font-size:13px; font-weight:500; }
.master-column-picker fieldset label { font-size:13px; font-weight:400; }
.master-column-actions .button,.master-toolbar .button { min-height:38px; }
.master-toolbar .button:not(.primary) { color:var(--color-text); border-color:var(--input); }
.catalog-panel table.catalog-table { min-width:100%; }
.master-scroll-top { top:var(--header-height); }
.recipe-browser { background:var(--card); border-color:var(--border); }
.recipe-list-item { border-color:var(--border); border-radius:6px; background:var(--card); }
.recipe-list-item.active,.recipe-list-item:hover { background:var(--accent); border-color:#bfdbfe; }
.recipe-list-item strong { color:var(--foreground); font-weight:500; }
.recipe-list-item b { color:var(--muted-foreground); font-weight:500; }
.recipe-list-item.active strong,.recipe-list-item.active b { color:var(--accent-foreground); }
.recipe-detail-card { border-color:var(--border); border-radius:var(--radius); box-shadow:var(--shadow); }
.recipe-detail-card h3 { font-size:24px; font-weight:600; color:var(--foreground); }
.recipe-detail-card dl { border-color:var(--border); border-radius:6px; }
.recipe-detail-card dd { color:var(--foreground); font-size:22px; font-weight:600; letter-spacing:-.02em; }
.core-recipe-table td { color:var(--color-text); }
.core-recipe-table td strong { color:var(--foreground); font-weight:500; }
.inventory-plan-panel .panel-heading .section-label,.view-heading .eyebrow { display:none; }
.core-recipe-table :is(th,td) { line-height:1.7; }
.core-recipe-table .core-current-value,.core-cost-comparison .core-current-summary { background:#eff6ff; }
.core-source-detail { border-top:1px solid var(--border); padding-top:8px; }
.inventory-plan-table thead th { top:var(--header-height); }
.inventory-plan-table :is(.numeric,.plan-day-cell) { letter-spacing:-.02em; }
.inventory-plan-table .plan-vendor-row th { border-top:1px solid #cbd5e1!important; background:var(--secondary)!important; color:var(--foreground)!important; font-weight:600; }
.inventory-plan-table .plan-data-row.unavailable td { background:#fafafa; }
/* Excel input cells remain amber; no vertical scroll container is introduced. */
#inventory-plan-view { --ip-ink:var(--foreground); --ip-line:var(--border); --ip-blue:var(--primary); font-family:var(--font-sans); color:var(--color-text); }
.ip-panel { border-radius:var(--radius); }
.ip-source { background:var(--secondary); border-color:var(--border); border-left:0; border-radius:6px; }
.ip-heading { gap:16px; }.ip-heading h2 { margin-bottom:4px; }
.ip-grid th { background:var(--secondary)!important; color:var(--muted-foreground)!important; }
.ip-grid td strong { color:var(--foreground); font-weight:500; }
.ip-workflow { border-color:var(--border); gap:6px; }
.ip-workflow a { border-color:var(--border); color:var(--muted-foreground); background:var(--card); padding:7px 12px; border-radius:6px; }
.ip-workflow a[aria-current] { border-color:var(--input); background:var(--secondary); color:var(--foreground); font-weight:600; }
.ip-savebar { border:1px solid var(--border); box-shadow:0 -2px 12px #18181b08; }
dialog.ip-dialog { border:1px solid var(--border); border-radius:10px; color:var(--foreground); box-shadow:0 20px 60px #18181b33; }
dialog.ip-dialog::backdrop { background:#09090b80; }
.toast { background:#18181b; color:#fff; border-radius:8px; box-shadow:0 6px 24px #18181b26; }
.scm-menu-trigger,.scm-nav-close { display:none; }
.scm-nav-dialog { padding:0; margin:0; border:0; width:min(304px,88vw); max-width:none; height:100dvh; max-height:100dvh; background:var(--sidebar); color:var(--foreground); }
.scm-nav-dialog::backdrop { background:#09090b80; }
.scm-nav-dialog .sidebar { display:flex; position:static; height:100%; min-height:0; width:100%; border:0; }
.scm-nav-dialog .scm-nav-close { display:inline-flex; margin-left:auto; align-items:center; justify-content:center; width:36px; height:36px; flex:none; border:1px solid var(--border); border-radius:6px; background:var(--card); color:var(--foreground); }
.scm-nav-close svg,.scm-menu-trigger svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.7; }
@media(max-width:1100px) and (min-width:761px) { .app-shell { grid-template-columns:216px minmax(0,1fr); } main,.topbar { padding-inline:20px; } }
@media(max-width:760px) {
  :root { --header-height:72px; }
  .app-shell { display:block; }
  .app-shell>.sidebar { display:none; }
  body:has(.scm-nav-dialog[open]) { overflow:hidden; }
  .topbar { min-height:72px; padding:12px 14px; flex-wrap:wrap; gap:8px 10px; }
  .topbar h1 { font-size:17px; }.topbar .eyebrow { font-size:11px; }
  .topbar .top-actions { flex-basis:100%; margin:0 0 0 46px; }
  .topbar .updated { font-size:10px; }
  .scm-menu-trigger { display:inline-flex; align-items:center; justify-content:center; min-width:38px; height:38px; border:1px solid var(--border); border-radius:6px; background:var(--card); color:var(--foreground); cursor:pointer; }
  .brand::after { display:block; }
  .purpose-links { display:block; }.purpose-parent,.purpose-links button { min-height:44px; }
  .purpose-links button { font-size:13px; }
  main { padding:18px 14px 32px; }
  .panel { padding:14px; }.panel-heading { align-items:flex-start; }
  .view-heading h2,.ip-heading h2 { font-size:22px; }
  .view-heading p { font-size:13px; }
  body :is(.button,.text-button),#inventory-plan-view button { min-height:44px; }
  input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea,
  #inventory-plan-view :is(input:not([type=checkbox]):not([type=radio]),select,textarea) { min-height:44px; font-size:16px; }
  .inventory-plan-summary { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .inventory-plan-summary>div { padding:12px; }
  .inventory-plan-summary strong { font-size:20px; }
  .recipe-detail-card dd { font-size:20px; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; } }
