/* LUQO 업무 포털 — 업무용 SaaS(Fiori 계열) 스타일. 색·간격은 토큰으로, 다크 모드는 시스템 설정 따라감 */
:root {
  --bg: #f5f6f7; --surface: #ffffff; --surface-2: #f7f8fa; --shell: #ffffff;
  --text: #1d2d3e; --text-2: #556b82; --text-3: #758ca4; --line: #e5e7eb; --line-2: #d5dadd;
  --brand: #0a6ed1; --brand-strong: #0057b8; --brand-soft: #e8f2fe; --focus: #0a6ed1;
  --good: #188918; --good-soft: #eaf6e9; --warn: #b65a00; --warn-soft: #fef3e6; --crit: #d20a0a; --crit-soft: #fdebeb;
  --info: #0a6ed1; --info-soft: #e8f2fe; --neutral-soft: #eff1f2;
  --r-s: 8px; --r-m: 12px; --r-l: 16px;
  --sh-1: 0 0 0 1px rgba(34, 53, 72, .06), 0 1px 2px rgba(34, 53, 72, .08);
  --sh-2: 0 0 0 1px rgba(34, 53, 72, .06), 0 6px 18px rgba(34, 53, 72, .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --a-blue: #0a6ed1; --a-teal: #07838f; --a-indigo: #5b4bdb; --a-green: #1f8a3b; --a-orange: #c35500;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171c; --surface: #1b2128; --surface-2: #222a32; --shell: #1b2128;
    --text: #eef1f4; --text-2: #a9b4be; --text-3: #8396a8; --line: #2c3540; --line-2: #3a4552;
    --brand: #4db1ff; --brand-strong: #7cc4ff; --brand-soft: #16304a; --focus: #4db1ff;
    --good: #5dc122; --good-soft: #1d3320; --warn: #ffab1d; --warn-soft: #3a2c14; --crit: #ff6a6a; --crit-soft: #3d1d1d;
    --info: #4db1ff; --info-soft: #16304a; --neutral-soft: #262f39;
    --sh-1: 0 0 0 1px rgba(255, 255, 255, .06); --sh-2: 0 0 0 1px rgba(255, 255, 255, .08), 0 8px 24px rgba(0, 0, 0, .4);
    --a-blue: #4db1ff; --a-teal: #3cc9d6; --a-indigo: #9b8cff; --a-green: #5dc17a; --a-orange: #ff9a4d;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 700; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 700; color: var(--text); }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- 셸 바 */
.shell { position: sticky; top: 0; z-index: 20; height: 52px; display: flex; align-items: center; gap: 24px;
  padding: 0 max(16px, env(safe-area-inset-left)); background: var(--shell); box-shadow: 0 1px 0 var(--line), 0 2px 6px rgba(34, 53, 72, .05); }
.shell-brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; white-space: nowrap; }
.shell-brand:hover { text-decoration: none; }
.mark { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.mark.lg { width: 40px; height: 40px; border-radius: 11px; font-size: 20px; }
.shell-nav { display: flex; gap: 4px; height: 100%; }
.shell-nav a { display: flex; align-items: center; padding: 0 12px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; }
.shell-nav a:hover { color: var(--text); text-decoration: none; }
.shell-nav a.on { color: var(--brand); border-bottom-color: var(--brand); }
.shell-end { margin-left: auto; position: relative; }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--brand-soft); color: var(--brand); font-weight: 800; cursor: pointer; font-size: 14px; }
.menu { position: absolute; right: 0; top: 44px; min-width: 220px; background: var(--surface); border-radius: var(--r-m); box-shadow: var(--sh-2); padding: 6px; }
.menu-head { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; }
.menu-head span { color: var(--text-2); font-size: 12px; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: none; color: var(--text); font: inherit; border-radius: var(--r-s); cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-2); text-decoration: none; }

/* ---------- 페이지 */
.page { max-width: 1240px; margin: 0 auto; padding: 28px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left)); }
.page-head { margin-bottom: 20px; }
.page-head.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.crumbs { display: flex; gap: 8px; color: var(--text-3); font-size: 13px; margin-bottom: 8px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.hero p { margin: 4px 0 0; }
.section { margin-bottom: 32px; }
.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.count { background: var(--neutral-soft); color: var(--text-2); border-radius: 10px; padding: 0 8px; font-size: 12px; font-weight: 700; }
.section.two, .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 { align-items: start; margin-bottom: 16px; }
.span2 { grid-column: 1 / -1; }

/* ---------- 타일 */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 16px; }
.tile { margin: 0; --accent: var(--a-blue); }
.accent-teal { --accent: var(--a-teal); } .accent-indigo { --accent: var(--a-indigo); }
.accent-green { --accent: var(--a-green); } .accent-orange { --accent: var(--a-orange); } .accent-blue { --accent: var(--a-blue); }
.tile-btn { all: unset; box-sizing: border-box; display: flex; flex-direction: column; width: 100%; min-height: 176px; padding: 18px;
  background: var(--surface); border-radius: var(--r-l); box-shadow: var(--sh-1); cursor: pointer; transition: box-shadow .15s, transform .15s; }
.tile-btn:hover { box-shadow: var(--sh-2); transform: translateY(-1px); }
.tile-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tile-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); margin-bottom: 14px; }
.tile-icon .ico { width: 22px; height: 22px; }
.tile-icon.sm { width: 34px; height: 34px; border-radius: 10px; margin: 0; }
.tile-title { font-size: 16px; font-weight: 700; color: var(--text); }
.tile-desc { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.tile-foot { margin-top: auto; padding-top: 16px; display: flex; align-items: center; justify-content: space-between; }
.port { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--text-3); }
.open { display: flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 700; font-size: 13px; }
.open .ico { width: 16px; height: 16px; }
.tile.busy .tile-btn { opacity: .6; pointer-events: none; }
.tile.busy .open::after { content: "…"; }
.empty { text-align: center; padding: 64px 16px; color: var(--text-2); }
.empty .ico { width: 40px; height: 40px; }

/* ---------- 카드·목록·표 */
.card { background: var(--surface); border-radius: var(--r-l); box-shadow: var(--sh-1); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); }
.pad { padding: 16px 18px; margin: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.list { list-style: none; margin: 0; padding: 4px 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list time { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--text-2); padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table.compact td { padding: 8px 16px; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.app-cell { display: flex; align-items: center; gap: 12px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; border-top: 1px solid var(--line); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi { background: var(--surface); border-radius: var(--r-l); box-shadow: var(--sh-1); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; border-left: 4px solid var(--brand); }
.kpi span { color: var(--text-2); font-size: 12.5px; }
.kpi b { font-size: 26px; line-height: 1; }
.kpi.warn { border-left-color: var(--warn); } .kpi.crit { border-left-color: var(--crit); }

/* ---------- 배지·칩 */
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.crit { background: var(--crit-soft); color: var(--crit); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.neutral { background: var(--neutral-soft); color: var(--text-2); }
.chip { display: inline-block; margin: 2px 4px 2px 0; padding: 1px 8px; border: 1px solid var(--line-2); border-radius: 10px; font-size: 12px; color: var(--text-2); }

/* ---------- 폼·버튼 */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
input, select { font: inherit; color: var(--text); }
.field input, input.slim, select, .copyrow input { height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-s); background: var(--surface); width: 100%; }
input.slim { height: 34px; }
select { width: auto; min-width: 140px; }
.field input:focus, input.slim:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field input[readonly] { background: var(--surface-2); color: var(--text-2); }
input.code { font-size: 22px; letter-spacing: .3em; text-align: center; font-family: ui-monospace, Consolas, monospace; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check input, td input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
.search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 20px; background: var(--surface); color: var(--text-3); min-width: 240px; }
.search input { border: 0; outline: 0; background: transparent; height: 100%; width: 100%; }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--r-s);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--brand); font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--crit); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; height: 44px; }
.btn .ico { width: 16px; height: 16px; }
.link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; }
.actions { display: flex; gap: 8px; }
.hint { margin: 0; padding-left: 18px; color: var(--text-3); font-size: 12px; }
.copyrow { display: flex; gap: 8px; margin-top: 10px; }
.copyrow input { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 12px; transition: .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }

/* ---------- 알림 */
.msg { border-radius: var(--r-m); padding: 12px 14px; margin: 0 0 16px; font-size: 13.5px; }
.msg.error { background: var(--crit-soft); color: var(--crit); }
.msg.info { background: var(--info-soft); color: var(--text); border-left: 4px solid var(--info); }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 30; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1d2d3e; color: #fff; padding: 12px 16px; border-radius: var(--r-m); box-shadow: var(--sh-2); transition: opacity .4s; }
.toast.hide { opacity: 0; pointer-events: none; }

/* ---------- 로그인 화면 */
body.auth { min-height: 100vh; background:
  radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--a-teal) 12%, transparent), transparent 60%), var(--bg); }
body.auth .page { max-width: 440px; padding-top: max(10vh, 32px); }
.auth-card { background: var(--surface); border-radius: 20px; box-shadow: var(--sh-2); padding: 32px; }
.auth-card h1 { font-size: 21px; margin-top: 4px; }
.auth-card .sub { color: var(--text-2); margin: 6px 0 20px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-brand div { display: flex; flex-direction: column; }
.auth-brand span { color: var(--text-2); font-size: 12.5px; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--text-3); font-size: 12px; margin-top: 16px; }
.auth-foot .ico { width: 14px; height: 14px; }
.alt { margin-top: 14px; text-align: center; }
.otp-setup { display: grid; grid-template-columns: 164px 1fr; gap: 18px; align-items: center; margin-bottom: 18px; }
.qr { background: #fff; border-radius: var(--r-m); padding: 6px; box-shadow: var(--sh-1); }
.qr svg { display: block; width: 100%; height: auto; }
.otp-steps ol { margin: 0 0 10px; padding-left: 18px; color: var(--text-2); font-size: 13px; }
.secret { display: block; font-size: 12.5px; background: var(--surface-2); border-radius: var(--r-s); padding: 8px 10px; word-break: break-all; }

/* ---------- 휴대폰 */
@media (max-width: 760px) {
  .shell { gap: 12px; }
  .shell-title { display: none; }
  .shell-nav { overflow-x: auto; }
  .shell-nav a { padding: 0 8px; }
  .section.two, .grid2, .kpis { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 12px; }
  .tile-btn { min-height: 150px; padding: 14px; }
  .search { min-width: 0; width: 100%; }
  .hero { margin-bottom: 20px; }
  .auth-card { padding: 24px 20px; }
  .otp-setup { grid-template-columns: 1fr; justify-items: center; }
  .qr { width: 180px; }
  .table th, .table td { padding: 10px 12px; }
}
@media (max-width: 380px) { .tiles { grid-template-columns: 1fr; } }
