/* ===================== WICL Portal — design system =====================
   Academic monochrome + Ajou deep-blue accent. Serif titles (WICL echo),
   sans UI, mono for technical info, hairline-framed panels. Light + dark.
   Tokens are the single source of truth; components below only use tokens. */

@font-face { font-family: "NanumSquare"; font-weight: 400; font-display: swap;
  src: url("/static/fonts/nanumsquare-regular.woff2") format("woff2"); }
@font-face { font-family: "NanumSquare"; font-weight: 700; font-display: swap;
  src: url("/static/fonts/nanumsquare-bold.woff2") format("woff2"); }
@font-face { font-family: "NanumSquare"; font-weight: 800; font-display: swap;
  src: url("/static/fonts/nanumsquare-extrabold.woff2") format("woff2"); }

:root {
  /* type — NanumSquare (lab standard) unified; weight carries the hierarchy */
  --font-sans: "NanumSquare", system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-serif: var(--font-sans);
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;

  /* shape / rhythm */
  --radius: 12px;
  --radius-sm: 8px;
  --pill: 999px;
  --hair: 1px;

  /* light theme (default) */
  --bg: #f5f5f2;
  --surface: #ffffff;
  --surface-2: #eeeeea;
  --text: #17181c;
  --text-muted: #6a6c72;
  --border: #e0e0db;
  --border-strong: #c9c9c2;
  --accent: #173f8a;           /* Ajou deep royal blue (tune to exact brand hex) */
  --accent-hover: #10305f;
  --on-accent: #ffffff;
  --ok:  #1a7f4b; --ok-soft:  #1a7f4b18;
  --warn:#a86a12; --warn-soft:#a86a1218;
  --off: #8b8d93; --off-soft: #8b8d9318;
  --err: #b23a3a; --err-soft: #b23a3a18;
  --shadow: 0 1px 2px #0000000d, 0 1px 3px #0000000a;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101116;
    --surface: #191b22;
    --surface-2: #22242c;
    --text: #e9e9e6;
    --text-muted: #9a9ca3;
    --border: #2e313b;
    --border-strong: #3a3d48;
    --accent: #7aa0ee;
    --accent-hover: #93b2f2;
    --on-accent: #0b1020;
    --ok:  #39c07d; --ok-soft:  #39c07d1f;
    --warn:#e0a83a; --warn-soft:#e0a83a1f;
    --off: #7a7c84; --off-soft: #7a7c841f;
    --err: #e06a6a; --err-soft: #e06a6a1f;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font-family: var(--font-sans); font-size: 15px; line-height: 1.55;
       -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* logo variant swap by theme (declared with the same specificity as their sizing rules) */
.logo-light { display: inline-block; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { .logo-light { display: none; } .logo-dark { display: inline-block; } }

/* ---- topbar ---- */
.topbar { display: flex; align-items: center; gap: 1.25rem; padding: .7rem 1.5rem;
          background: var(--surface); border-bottom: var(--hair) solid var(--border);
          position: sticky; top: 0; z-index: 10; }
.topbar .brand img { height: 24px; vertical-align: middle; }
.topbar nav { display: flex; gap: 1.1rem; }
.topbar nav a { color: var(--text-muted); font-weight: 500; font-size: .92rem; }
.topbar nav a:hover, .topbar nav a.active { color: var(--text); text-decoration: none; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--text-muted); font-size: .9rem; }
.topbar .who b { color: var(--text); font-weight: 600; }
.topbar .notif { color: var(--text-muted); font-size: .9rem; }
.topbar .notif:hover { color: var(--text); text-decoration: none; }
.ndot { display: inline-flex; align-items: center; justify-content: center; min-width: 1.05rem;
        height: 1.05rem; padding: 0 .3rem; margin-left: .25rem; font-size: .7rem; font-weight: 700;
        line-height: 1; color: #fff; background: var(--err); border-radius: var(--pill); }
.topbar .logout { color: var(--text-muted); font-size: .9rem; }
.topbar .logout:hover { color: var(--err); text-decoration: none; }

/* ---- layout ---- */
main { max-width: 900px; margin: 0 auto; padding: 2rem 1.5rem 2.5rem; }
.page-title { font-family: var(--font-serif); font-size: 1.6rem; font-weight: 800;
              letter-spacing: -.01em; margin: 0 0 .25rem; }
.page-sub { color: var(--text-muted); font-size: .95rem; margin: 0 0 1.6rem; }
footer { max-width: 900px; margin: 0 auto; padding: 1.4rem 1.5rem 2rem;
         display: flex; align-items: center; gap: .8rem; color: var(--text-muted);
         font-size: .8rem; border-top: var(--hair) solid var(--border); }
footer img { height: 18px; opacity: .75; }

/* ---- panels / workload cards ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.1rem; align-items: start; }
.panel { background: var(--surface); border: var(--hair) solid var(--border);
         border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card .card-head { display: flex; align-items: center; justify-content: space-between;
                   gap: .5rem; padding: .8rem 1.1rem; border-bottom: var(--hair) solid var(--border); }
.card .card-head h3 { margin: 0; font-size: 1.02rem; font-weight: 700; }
.card .card-body { padding: 1rem 1.1rem; }
.card.is-running { box-shadow: inset 0 3px 0 var(--accent), var(--shadow); }

/* ---- status badge ---- */
.badge { display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem;
         font-weight: 600; padding: .16rem .6rem; border-radius: var(--pill); white-space: nowrap; }
.badge::before { content: ""; width: .48rem; height: .48rem; border-radius: 50%; background: currentColor; }
.badge.running,
.badge.succeeded { color: var(--ok);   background: var(--ok-soft); }
.badge.starting,
.badge.pending,
.badge.queued   { color: var(--warn); background: var(--warn-soft); }
.badge.failed   { color: var(--err);  background: var(--err-soft); }
.badge.off      { color: var(--off);  background: var(--off-soft); }
.note { color: var(--warn); font-size: .85rem; margin: 0 0 .7rem; }

/* ---- buttons ---- */
.btn { appearance: none; font: inherit; font-weight: 600; font-size: .92rem;
       padding: .5rem 1.05rem; border-radius: var(--radius-sm);
       border: var(--hair) solid transparent; cursor: pointer;
       transition: background .12s ease, border-color .12s ease; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }

/* ---- technical connection block (mono) ---- */
.connect { margin-top: .9rem; }
.connect .label { font-size: .72rem; font-weight: 700; color: var(--text-muted);
                  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .35rem; }
.connect .cguide { font-size: .82rem; color: var(--text-muted); margin: 0 0 .5rem; }
.connect .cguide code { font-family: var(--font-mono); font-size: .85em; background: var(--surface-2);
                        padding: .05rem .3rem; border-radius: 5px; }
.connect .cfg { font-family: var(--font-mono); font-size: .82rem; background: var(--surface-2);
                border: var(--hair) solid var(--border); border-radius: var(--radius-sm);
                padding: .55rem .7rem; margin: 0 0 .55rem; white-space: pre; overflow-x: auto; }
.connect a.btn { text-decoration: none; }
.connect .btn + .btn { margin-left: .4rem; }
.btn-sm { padding: .32rem .7rem; font-size: .82rem; }

/* ---- forms ---- */
label { display: block; font-size: .88rem; font-weight: 600; margin: .9rem 0 .3rem; }
input[type=text], input[type=password], textarea {
  width: 100%; font-family: inherit; font-size: .95rem; color: var(--text);
  background: var(--surface); border: var(--hair) solid var(--border-strong);
  border-radius: var(--radius-sm); padding: .55rem .7rem; }
textarea { font-family: var(--font-mono); font-size: .85rem; }
/* password mask char (•, U+2022) — NanumSquare has no glyph for it, so the dots render
   blank; force a system font that includes the bullet for the password field only. */
input[type=password] { font-family: system-ui, -apple-system, "Segoe UI", "Malgun Gothic", Arial, sans-serif; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.msg { color: var(--ok); font-weight: 600; font-size: .9rem; }
.err { color: var(--err); font-size: .9rem; }
.field-err { color: var(--err); font-size: .82rem; text-align: left; margin: -.15rem 0 .2rem; }
input[aria-invalid="true"] { border-color: var(--err); }
input[aria-invalid="true"]:focus { outline-color: var(--err); border-color: transparent; }
select { font-family: inherit; font-size: .95rem; color: var(--text); background: var(--surface);
  border: var(--hair) solid var(--border-strong); border-radius: var(--radius-sm); padding: .5rem .7rem; }
.logs { max-height: 62vh; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.muted { color: var(--text-muted); }
ol.steps { padding-left: 1.2rem; } ol.steps li { margin: .3rem 0; }
ol.steps code, p code { font-family: var(--font-mono); background: var(--surface-2);
  padding: .1rem .35rem; border-radius: 5px; font-size: .85em; }

/* ---- cluster status (P2.2) ---- */
.section { margin-bottom: 1.1rem; }
.section-head { padding: .8rem 1.1rem; border-bottom: var(--hair) solid var(--border); }
.section-head h3 { margin: 0; font-size: 1.02rem; font-weight: 700; }
.section-body { padding: 1rem 1.1rem; }
.section-sub { font-size: .85rem; margin: .8rem 0 0; }
.mono { font-family: var(--font-mono); font-size: .9em; }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { text-align: left; padding: .45rem .6rem; border-bottom: var(--hair) solid var(--border); }
.tbl th { color: var(--text-muted); font-weight: 700; font-size: .8rem; }
.tbl tr:last-child td { border-bottom: none; }
.chip { display: inline-block; font-size: .78rem; background: var(--surface-2);
        border: var(--hair) solid var(--border); border-radius: var(--pill);
        padding: .1rem .55rem; margin: .25rem .3rem 0 0; }
.qlabel { font-size: .72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase;
          letter-spacing: .05em; margin: .9rem 0 .4rem; }
.qlabel:first-child { margin-top: 0; }
.qrow { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; margin-bottom: .4rem;
        border: var(--hair) solid var(--border); border-radius: var(--radius-sm); }
.qrow.mine { border-color: var(--accent); border-left-width: 3px; background: var(--surface-2); }
.qpos { font-weight: 700; color: var(--text-muted); min-width: 2rem; }
.qowner { font-weight: 700; }
.qjob { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qres { font-size: .82rem; color: var(--text-muted); white-space: nowrap; }
.admin-actions { display: flex; gap: .3rem; flex-wrap: wrap; }
.admin-actions form { display: inline; margin: 0; }
.admin-actions .reset-form { display: inline-flex; gap: .25rem; align-items: center; }
input.reset-pw { width: 8.5rem; padding: .3rem .5rem; font-size: .82rem; }

/* ---- file browser modal (batch script picker) ---- */
.modal { position: fixed; inset: 0; background: #0006; display: flex; align-items: center;
         justify-content: center; z-index: 100; padding: 1rem; }
.modal.hidden { display: none; }
.modal-card { background: var(--surface); border: var(--hair) solid var(--border);
              border-radius: var(--radius); width: 100%; max-width: 560px; max-height: 72vh;
              display: flex; flex-direction: column; box-shadow: 0 8px 30px #0004; }
.modal-head { display: flex; align-items: center; justify-content: space-between;
              padding: .8rem 1.1rem; border-bottom: var(--hair) solid var(--border); }
.modal-body { padding: .6rem 1.1rem 1rem; overflow: auto; }
.browse-bar { font-size: .85rem; color: var(--text-muted); padding: .3rem 0 .5rem;
              border-bottom: var(--hair) solid var(--border); margin-bottom: .4rem; }
.browse-up { margin-left: .6rem; }
.browse-list { display: flex; flex-direction: column; }
.browse-item { padding: .35rem .4rem; border-radius: var(--radius-sm); color: var(--text); font-size: .92rem; }
.browse-item:hover { background: var(--surface-2); text-decoration: none; }
.browse-item.dir { font-weight: 700; }
.browse-item.file { font-family: var(--font-mono); font-size: .85rem; }

/* ---- login ---- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 380px; text-align: center; background: var(--surface);
              border: var(--hair) solid var(--border); border-radius: var(--radius);
              box-shadow: var(--shadow); padding: 2.2rem 1.9rem; }
.login-card .logo { height: 38px; margin-bottom: 1.2rem; }
.login-card h1 { font-family: var(--font-serif); font-weight: 800; font-size: 1.25rem; margin: 0 0 .25rem; }
.login-card .sub { color: var(--text-muted); font-size: .9rem; margin: 0 0 1.3rem; }
.login-card form { text-align: left; }
.login-card label:first-of-type { margin-top: 0; }
.login-card .ajou { height: 20px; margin-top: 1.7rem; opacity: .5; }
