/* ═══════════════════════════════════════════════════════════════
   HRD-Net 자동화 — 디자인 시스템 v3
   에듀윌 브랜드(옐로우 액센트 + 네이비 프라이머리) + 모던 대시보드
   라이트/다크 테마: [data-theme="dark"]  (기본 = 라이트)
   ═══════════════════════════════════════════════════════════════ */

/* ── 라이트(기본) 토큰 ── */
:root {
    /* 표면 */
    --bg: #f4f6fa;
    --bg-subtle: #eef1f6;
    --card: #ffffff;
    --card-hover: #f8fafc;
    --border: #e3e8f0;
    --border-strong: #cbd5e1;

    /* 텍스트 */
    --text: #0f172a;
    --text-mid: #4b5769;
    --text-light: #94a3b8;

    /* 에듀윌 브랜드 */
    --brand: #ffd200;          /* 에듀윌 옐로우 (액센트 전용) */
    --brand-strong: #f5c400;
    --brand-ink: #1f2937;      /* 옐로우 위 텍스트 */

    /* 프라이머리 (인터랙션) = 에듀윌 네이비블루 */
    --primary: #2551b5;
    --primary-hover: #1d3f92;
    --primary-bg: #eef3ff;
    --primary-border: #c7d7f5;

    /* 상태 */
    --success: #16a34a;  --success-bg: #f0fdf4;  --success-ink: #166534;
    --error:   #dc2626;  --error-bg:   #fef2f2;  --error-ink:   #b91c1c;
    --warn:    #d97706;  --warn-bg:    #fffbeb;  --warn-ink:    #92400e;
    --purple:  #7c3aed;  --purple-bg:  #f5f3ff;
    --orange:  #ea580c;  --orange-bg:  #fff7ed;

    /* 형태 */
    --radius: 10px;
    --radius-sm: 7px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(15,23,42,0.06);
    --shadow: 0 1px 3px rgba(15,23,42,0.10), 0 1px 2px rgba(15,23,42,0.06);
    --shadow-md: 0 4px 12px rgba(15,23,42,0.08);

    --font: 'Pretendard', 'Pretendard Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
    --mono: 'SF Mono', 'JetBrains Mono', Consolas, 'D2Coding', monospace;
}

/* ── 다크 토큰 ── */
[data-theme="dark"] {
    --bg: #0e1320;
    --bg-subtle: #151c2c;
    --card: #1a2233;
    --card-hover: #212b3f;
    --border: #2b3648;
    --border-strong: #3b4864;

    --text: #e8edf6;
    --text-mid: #a4afc2;
    --text-light: #6c7889;

    --brand: #ffd633;
    --brand-strong: #ffde5c;
    --brand-ink: #1a1a1a;

    --primary: #6493f2;
    --primary-hover: #85aaf6;
    --primary-bg: #1b2740;
    --primary-border: #2f4574;

    --success: #4ade80;  --success-bg: #10241a;  --success-ink: #86efac;
    --error:   #f87171;  --error-bg:   #2a1618;  --error-ink:   #fca5a5;
    --warn:    #fbbf24;  --warn-bg:    #291f0f;  --warn-ink:    #fcd34d;
    --purple:  #a78bfa;  --purple-bg:  #211a3a;
    --orange:  #fb923c;  --orange-bg:  #2a1a10;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
    --shadow: 0 1px 3px rgba(0,0,0,0.45), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 6px 16px rgba(0,0,0,0.45);
}

/* ═══ Reset ═══ */
* { margin:0; padding:0; box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background 0.2s ease, color 0.2s ease;
}
a { color: var(--primary); }
::selection { background: var(--brand); color: var(--brand-ink); }

/* ═══ Login / Auth ═══ */
.login-body { display:flex; align-items:center; justify-content:center; min-height:100vh; padding:20px;
    background:
        radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--brand) 18%, transparent), transparent),
        var(--bg); }
.login-card { background:var(--card); padding:44px 38px; border-radius:var(--radius-lg); border:1px solid var(--border);
    width:100%; max-width:380px; text-align:center; box-shadow:var(--shadow-md); position:relative; overflow:hidden; }
.login-card::before { content:''; position:absolute; top:0; left:0; right:0; height:4px; background:var(--brand); }
.login-card h1 { font-size:21px; font-weight:800; margin-bottom:4px; letter-spacing:-0.02em; }
.login-card .subtitle { color:var(--text-light); font-size:13px; margin-bottom:26px; }
.login-card input { width:100%; padding:11px 14px; border:1px solid var(--border-strong); border-radius:var(--radius-sm);
    font-size:14px; margin-bottom:12px; background:var(--card); color:var(--text); font-family:inherit; transition:border-color 0.15s, box-shadow 0.15s; }
.login-card input:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-bg); }
.login-card button { width:100%; padding:11px; background:var(--primary); color:#fff; border:none;
    border-radius:var(--radius-sm); font-size:14px; font-weight:600; cursor:pointer; transition:background 0.15s; }
.login-card button:hover { background:var(--primary-hover); }
.login-card a { text-decoration:none; }
.login-card a:hover { text-decoration:underline; }

/* ═══ Topbar ═══ */
.topbar { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:0 24px; height:56px;
    background:var(--card); border-bottom:1px solid var(--border); border-top:3px solid var(--brand);
    position:sticky; top:0; z-index:20; box-shadow:var(--shadow-sm); }
.topbar h1 { font-size:15px; font-weight:800; letter-spacing:-0.02em; white-space:nowrap; }
.topbar-left { display:flex; align-items:center; gap:10px; }
.topbar-left h1::before { content:''; display:inline-block; width:9px; height:9px; border-radius:50%;
    background:var(--brand); margin-right:8px; vertical-align:middle; box-shadow:0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent); }
.topbar-nav { display:flex; gap:2px; flex:1; overflow-x:auto; scrollbar-width:none; }
.topbar-nav::-webkit-scrollbar { display:none; }
.topbar-right { display:flex; align-items:center; gap:10px; }
.time { font-size:13px; color:var(--text-mid); font-variant-numeric:tabular-nums; white-space:nowrap; }

/* Nav links */
.nav-link { padding:7px 13px; font-size:13px; color:var(--text-mid); text-decoration:none; border-radius:var(--radius-sm);
    font-weight:500; white-space:nowrap; transition:all 0.15s; position:relative; }
.nav-link:hover { background:var(--bg-subtle); color:var(--text); }
.nav-link.active { background:var(--primary-bg); color:var(--primary); font-weight:600; }
.nav-link.active::after { content:''; position:absolute; left:13px; right:13px; bottom:-1px; height:2px;
    background:var(--brand); border-radius:2px; }

/* Theme toggle */
.theme-toggle { width:34px; height:34px; border-radius:var(--radius-sm); border:1px solid var(--border);
    background:var(--card); color:var(--text-mid); cursor:pointer; display:inline-flex; align-items:center;
    justify-content:center; transition:all 0.15s; flex-shrink:0; }
.theme-toggle:hover { background:var(--bg-subtle); color:var(--text); border-color:var(--border-strong); }
.theme-toggle .icon-sun { display:none; }
.theme-toggle .icon-moon { display:block; }
[data-theme="dark"] .theme-toggle .icon-sun { display:block; }
[data-theme="dark"] .theme-toggle .icon-moon { display:none; }

/* ═══ Container ═══ */
.container { max-width:1160px; margin:0 auto; padding:24px; }

/* ═══ Section ═══ */
.section { margin-bottom:24px; }
.section h2 { font-size:15px; font-weight:700; margin-bottom:12px; color:var(--text); letter-spacing:-0.01em; }
.section-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; gap:12px; }
.section-header h2 { margin-bottom:0; }

/* ═══ Summary Grid ═══ */
.summary-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; }
.summary-card { background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:18px;
    display:flex; align-items:center; gap:14px; box-shadow:var(--shadow-sm); transition:box-shadow 0.15s, transform 0.15s; }
.summary-card:hover { box-shadow:var(--shadow-md); transform:translateY(-1px); }
.summary-icon { width:42px; height:42px; border-radius:11px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.summary-icon.blue { background:var(--primary-bg); color:var(--primary); }
.summary-icon.green { background:var(--success-bg); color:var(--success); }
.summary-icon.orange { background:var(--orange-bg); color:var(--orange); }
.summary-icon.purple { background:var(--purple-bg); color:var(--purple); }
.summary-data { display:flex; flex-direction:column; }
.summary-num { font-size:23px; font-weight:800; line-height:1.1; color:var(--text); font-variant-numeric:tabular-nums; }
.summary-label { font-size:12px; color:var(--text-mid); }

/* ═══ Pipeline ═══ */
.pipeline { display:flex; align-items:center; background:var(--card); border:1px solid var(--border);
    border-radius:var(--radius); padding:20px 24px; box-shadow:var(--shadow-sm); }
.pipe-step { display:flex; align-items:center; gap:10px; flex:1; }
.pipe-dot { width:12px; height:12px; border-radius:50%; border:2px solid var(--border-strong); background:var(--card); flex-shrink:0; transition:all 0.3s; }
.pipe-step.done .pipe-dot { background:var(--success); border-color:var(--success); box-shadow:0 0 0 3px color-mix(in srgb, var(--success) 20%, transparent); }
.pipe-step.running .pipe-dot { background:var(--primary); border-color:var(--primary); box-shadow:0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); animation:pulse 1.5s infinite; }
.pipe-step.waiting .pipe-dot { background:var(--bg-subtle); border-color:var(--text-light); }
.pipe-info { display:flex; flex-direction:column; }
.pipe-title { font-size:13px; font-weight:600; }
.pipe-desc { font-size:11px; color:var(--text-light); }
.pipe-line { flex:0 0 40px; height:2px; background:var(--border); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

/* ═══ Cards ═══ */
.card { background:var(--card); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow-sm); }
.card-header { display:flex; justify-content:space-between; align-items:center; padding:14px 16px; border-bottom:1px solid var(--border); gap:10px; }
.card-header h3 { font-size:14px; font-weight:700; }
.card-body { padding:16px; }
.card-footer { padding:12px 16px; border-top:1px solid var(--border); display:flex; gap:8px; }
.card-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:14px; }

/* Center card specifics */
.center-title { display:flex; align-items:center; gap:8px; }
.center-code { font-size:11px; color:var(--text-light); font-family:var(--mono); }
.center-stats { display:flex; gap:16px; justify-content:center; padding:8px 0; }
.center-stat { text-align:center; }
.cs-num { display:block; font-size:18px; font-weight:700; color:var(--text); }
.cs-label { font-size:11px; color:var(--text-mid); }
.next-run { text-align:center; font-size:12px; color:var(--text-mid); padding:6px 0 2px; border-top:1px dashed var(--border); }
.divider { height:1px; background:var(--border); margin:8px 0; }
.empty-state { text-align:center; color:var(--text-light); padding:16px; font-size:13px; }
.empty-state.mini { padding:8px 0; font-size:12px; }

/* Status dot */
.status-dot { width:8px; height:8px; border-radius:50%; display:inline-block; }
.status-dot.active { background:var(--success); box-shadow:0 0 0 3px color-mix(in srgb, var(--success) 20%, transparent); }
.status-dot.inactive { background:var(--text-light); }

/* KV pair */
.kv { display:flex; justify-content:space-between; padding:3px 0; font-size:12px; }
.kv .k { color:var(--text-mid); }
.kv .v { font-weight:500; }

/* ═══ Two Column Layout ═══ */
.two-col { display:grid; grid-template-columns:1fr 1fr; gap:14px; }

/* ═══ Action List ═══ */
.action-list { display:flex; flex-direction:column; }
.action-item { display:flex; align-items:center; gap:12px; padding:12px 16px; text-decoration:none; color:var(--text); border-bottom:1px solid var(--border); transition:background 0.1s; }
.action-item:last-child { border-bottom:none; }
.action-item:hover { background:var(--bg-subtle); }
.action-icon { font-size:20px; flex-shrink:0; width:28px; text-align:center; }
.action-text { flex:1; }
.action-text strong { display:block; font-size:13px; font-weight:600; }
.action-text span { font-size:11px; color:var(--text-mid); }
.action-arrow { font-size:20px; color:var(--text-light); font-weight:300; }

/* ═══ Buttons ═══ */
.btn { padding:8px 15px; border:none; border-radius:var(--radius-sm); font-size:13px; cursor:pointer; font-weight:600;
    transition:all 0.15s; text-decoration:none; display:inline-flex; align-items:center; gap:5px; font-family:inherit; line-height:1.2; }
.btn:disabled { opacity:0.45; cursor:not-allowed; }
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover:not(:disabled) { background:var(--primary-hover); }
.btn-brand { background:var(--brand); color:var(--brand-ink); }
.btn-brand:hover:not(:disabled) { background:var(--brand-strong); }
.btn-danger { background:var(--error); color:#fff; }
.btn-danger:hover:not(:disabled) { filter:brightness(0.92); }
.btn-ghost { background:transparent; color:var(--text-mid); border:1px solid var(--border-strong); }
.btn-ghost:hover:not(:disabled) { background:var(--bg-subtle); color:var(--text); }
.btn-sm { padding:6px 11px; font-size:12px; }
/* 무클래스 .btn (users.html '추가/저장' 등) = 프라이머리로 */
.btn:not(.btn-primary):not(.btn-brand):not(.btn-danger):not(.btn-ghost):not(.btn-delete) { background:var(--primary); color:#fff; }

/* ═══ Badge ═══ */
.badge { font-size:11px; padding:3px 9px; border-radius:999px; font-weight:600; display:inline-block; background:var(--bg-subtle); color:var(--text-mid); }
.badge.success { background:var(--success-bg); color:var(--success-ink); }
.badge.error { background:var(--error-bg); color:var(--error-ink); }
.badge.warn { background:var(--warn-bg); color:var(--warn-ink); }
/* topbar 브랜드 배지 */
.topbar-left .badge { background:color-mix(in srgb, var(--brand) 22%, transparent); color:var(--brand-ink); }
[data-theme="dark"] .topbar-left .badge { color:var(--brand); }

/* ═══ Table ═══ */
.table { width:100%; border-collapse:collapse; font-size:13px; }
.table th { text-align:left; padding:9px 12px; font-weight:600; color:var(--text-mid); font-size:11px; text-transform:uppercase; letter-spacing:0.5px; border-bottom:1px solid var(--border); background:var(--bg-subtle); }
.table td { padding:9px 12px; border-bottom:1px solid var(--border); vertical-align:top; }
.table tr:last-child td { border-bottom:none; }
.table tbody tr:hover td { background:var(--card-hover); }
.table-wrap { overflow-x:auto; }
.preview-table th:first-child, .preview-table td:first-child { width:80px; white-space:nowrap; }
.preview-table th:nth-child(2), .preview-table td:nth-child(2) { min-width:130px; }
.preview-table th:nth-child(3), .preview-table td:nth-child(3) { min-width:130px; }
.preview-table th:nth-child(4), .preview-table td:nth-child(4) { min-width:170px; }
.preview-table th:nth-child(5), .preview-table td:nth-child(5) { min-width:220px; }

/* ═══ Forms (공통) ═══ */
input, select, textarea, button { font-family:inherit; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
    color:var(--text); background:var(--card); border:1px solid var(--border-strong); border-radius:var(--radius-sm); }
input:focus, select:focus, textarea:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-bg); }

/* ═══ Toast (공통) ═══ */
.toast { position:fixed; bottom:24px; right:24px; background:var(--text); color:var(--card); padding:11px 20px;
    border-radius:var(--radius-sm); font-size:13px; z-index:100; opacity:0; transform:translateY(8px);
    transition:opacity 0.25s, transform 0.25s; pointer-events:none; box-shadow:var(--shadow-md); }
.toast.show { opacity:1; transform:translateY(0); }

/* ═══ Log ═══ */
.log-card { max-height:280px; overflow-y:auto; }
.log-list { padding:4px; }
.log-entry { padding:4px 8px; font-size:12px; border-radius:4px; display:flex; gap:8px; align-items:baseline; }
.log-entry:hover { background:var(--bg-subtle); }
.log-entry.error { color:var(--error); }
.log-time { color:var(--text-light); font-variant-numeric:tabular-nums; white-space:nowrap; font-family:var(--mono); font-size:11px; }
.log-level { font-weight:600; font-size:10px; min-width:36px; }
.log-center { background:var(--bg-subtle); padding:1px 6px; border-radius:3px; font-size:10px; }
.log-msg { flex:1; }

/* ═══ Result ═══ */
.result-summary { display:flex; gap:20px; padding:12px 0; flex-wrap:wrap; }
.stat { text-align:center; min-width:70px; }
.stat-num { display:block; font-size:26px; font-weight:800; color:var(--primary); line-height:1.1; }
.stat-label { font-size:11px; color:var(--text-mid); }

/* ═══ Utility ═══ */
.mono { font-family:var(--mono); font-size:12px; }
.muted { color:var(--text-light); font-size:12px; }
.center { text-align:center; }
.alert { padding:11px 14px; border-radius:var(--radius-sm); font-size:13px; margin-bottom:12px; background:var(--primary-bg); color:var(--primary); border:1px solid var(--primary-border); }
.alert.error { background:var(--error-bg); color:var(--error-ink); border-color:color-mix(in srgb, var(--error) 35%, transparent); }
.alert.warn { background:var(--warn-bg); color:var(--warn-ink); border-color:color-mix(in srgb, var(--warn) 35%, transparent); }
.loading { color:var(--primary); }
.loading::after { content:''; animation:dots 1.5s infinite; }
@keyframes dots { 0%{content:''} 33%{content:'.'} 66%{content:'..'} 100%{content:'...'} }

/* ═══ Responsive ═══ */
@media (max-width:900px) {
    .card-grid { grid-template-columns:1fr; }
    .summary-grid { grid-template-columns:repeat(2,1fr); }
    .two-col { grid-template-columns:1fr; }
    .topbar { padding:0 14px; }
    .topbar-left .badge { display:none; }
}
@media (max-width:600px) {
    .container { padding:14px; }
    .summary-grid { grid-template-columns:1fr 1fr; }
    .pipeline { flex-direction:column; gap:8px; }
    .pipe-line { width:2px; height:16px; flex:0 0 16px; }
}
