/* ─────────── ARGOS design tokens ─────────── */
:root {
  --text-primary: #1D2023;
  --text-secondary: #4D535A;
  --text-tertiary: #697079;
  --text-muted: #9AA4B1;
  --surface: #FFFFFF;
  --surface-alt: #F2F4F5;
  --border: #E6E8EB;
  --border-strong: #CACFD6;

  --brand: #FF5E00;
  --brand-strong: #BC3500;
  --brand-soft: #FF8842;
  --brand-bg: #FFF2DF;
  --brand-bg-2: #FBEED8;
  --brand-deep: #7A4A0F;

  --success: #39B159;
  --danger: #EB5147;
  --danger-bg: #F8DAD8;
  --info: #1B3A6B;
  --info-bg: #EAF2FB;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --shadow-card: 0 1px 2px rgba(29, 32, 35, .04);
  --shadow-pop: 0 8px 24px rgba(29, 32, 35, .08);

  --sidebar-w: 232px;
  --sidebar-w-collapsed: 60px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Arial", "Apple SD Gothic Neo", "맑은 고딕", sans-serif;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
input { font: inherit; }
code { font-family: var(--mono); background: var(--surface-alt); padding: 1px 5px; border-radius: 4px; font-size: .92em; }

.hidden { display: none !important; }
.muted { color: var(--text-tertiary); }
.small { font-size: 12px; }
.center { text-align: center; }
.pad { padding: 16px 12px; }

/* 통일 아이콘: 18px / stroke 2 */
.icon { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn .icon { width: 16px; height: 16px; }

/* ─────────── brand ─────────── */
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--brand); flex-shrink: 0; position: relative; }
.brand-mark::after {
  content: ""; position: absolute; left: 5px; top: 6px; width: 12px; height: 10px;
  background:
    linear-gradient(#fff, #fff) 0 0 / 12px 2px no-repeat,
    linear-gradient(#fff, #fff) 0 4px / 9px 2px no-repeat,
    linear-gradient(#fff, #fff) 0 8px / 6px 2px no-repeat;
  border-radius: 1px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-eyebrow { font-size: 9px; letter-spacing: .12em; color: var(--text-tertiary); font-weight: 700; }
.brand-name { font-size: 14px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }

/* ─────────── login ─────────── */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--surface-alt); padding: 32px 16px; }
.login-wrap { display: flex; flex-direction: column; align-items: center; gap: 28px; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .brand-mark { width: 34px; height: 34px; border-radius: 9px; }
.login-brand .brand-mark::after { left: 8px; top: 10px; width: 18px; height: 15px; background:
    linear-gradient(#fff, #fff) 0 0 / 18px 3px no-repeat,
    linear-gradient(#fff, #fff) 0 6px / 14px 3px no-repeat,
    linear-gradient(#fff, #fff) 0 12px / 9px 3px no-repeat; }
.login-brand .brand-eyebrow { font-size: 11px; }
.login-brand .brand-name { font-size: 22px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 32px; width: 340px; box-shadow: var(--shadow-pop); }
.login-fields { display: flex; flex-direction: column; gap: 12px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field input { padding: 11px 13px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border-strong); outline: none; transition: border-color .15s, box-shadow .15s; }
.login-field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 94, 0, .15); }
.login-submit { width: 100%; margin-top: 18px; padding: 12px; }
.login-error { color: var(--danger); margin-top: 12px; min-height: 18px; font-size: 13px; text-align: center; }

/* ─────────── buttons ─────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-primary); font-weight: 700; transition: background .15s, border-color .15s, color .15s; }
.btn:hover { background: var(--surface-alt); border-color: var(--text-tertiary); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.btn-primary:disabled { background: var(--surface-alt) !important; border-color: var(--border) !important; color: var(--text-muted) !important; cursor: not-allowed; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--r-sm); color: var(--text-tertiary); flex-shrink: 0; }
.icon-btn:hover { background: var(--surface-alt); color: var(--text-primary); }
.link-btn { color: var(--text-tertiary); text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: var(--brand-strong); }

/* ─────────── layout ─────────── */
.app { display: flex; height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--surface-alt);
  border-right: 1px solid var(--border);
  transition: width .16s ease;
  overflow: hidden;
}
.app.collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.app.collapsed .nav-label { display: none; }
.app.collapsed .sidebar-header { justify-content: center; gap: 0; }
.app.collapsed .brand { display: none; }
.app.collapsed .nav-item { justify-content: center; padding: 8px 0; }
.app.collapsed .section-label { display: none; }
/* 접힌 상태에서는 그룹마다 아이콘이 똑같아 구분이 안 되므로 이니셜을 보여준다. */
.app.collapsed .sidebar-groups .nav-ico { display: none; }
.app.collapsed .me-bar { display: none; }

.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 12px; border-bottom: 1px solid var(--border); }
.section-label { padding: 14px 14px 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--text-muted); text-transform: uppercase; }
.sidebar-groups { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.sidebar-footer { border-top: 1px solid var(--border); padding: 8px; display: flex; flex-direction: column; gap: 6px; }

.nav-item {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--text-secondary); text-align: left;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: #E7EAEC; color: var(--text-primary); }
.nav-item.active { background: var(--brand-bg); color: var(--brand-deep); font-weight: 700; }
.nav-item.active .nav-ico { color: var(--brand); }
.nav-ico { display: inline-flex; color: var(--text-muted); }
.nav-item .nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-initial { display: none; font-size: 11px; font-weight: 700; }
.app.collapsed .nav-initial { display: inline; }
.app.collapsed .nav-ico { color: inherit; }

.me-bar { display: flex; align-items: center; justify-content: space-between; padding: 2px 8px 4px; }

/* ─────────── main / view ─────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.view-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 18px 24px 14px; border-bottom: 1px solid var(--border); }
.view-title { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.view-title h1 { font-size: 23px; font-weight: 700; letter-spacing: -.01em; }
.view-sub { font-size: 12px; color: var(--text-tertiary); }
code.view-sub { background: none; padding: 0; }
.view-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.live-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--success); background: #E6F5EA; border-radius: 999px; padding: 4px 10px; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ─────────── log list ─────────── */
.log-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: auto; background: var(--surface); }
.log-top-status { padding: 10px; }
.log-empty { padding: 48px 16px; }
.log-lines { font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }

.log-line { display: flex; gap: 10px; padding: 2px 24px; border-left: 3px solid transparent; white-space: pre-wrap; word-break: break-word; }
.log-line:hover { background: var(--surface-alt); }
.log-line .lt { color: var(--text-muted); flex-shrink: 0; white-space: nowrap; }
.log-line .ll { flex-shrink: 0; width: 46px; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding-top: 1px; }
.log-line .lg { flex-shrink: 0; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--info); }
.log-line .lm { flex: 1; min-width: 0; color: var(--text-primary); }

.log-line.lv-error { border-left-color: var(--danger); background: #FEF7F6; }
.log-line.lv-error .ll { color: var(--danger); }
.log-line.lv-error:hover { background: var(--danger-bg); }
.log-line.lv-warn { border-left-color: var(--brand-soft); }
.log-line.lv-warn .ll { color: var(--brand-strong); }
.log-line.lv-info .ll { color: var(--text-secondary); }
.log-line.lv-debug .ll,
.log-line.lv-debug .lm { color: var(--text-tertiary); }
.log-line.is-new { animation: flash-in .8s ease-out; }
@keyframes flash-in { from { background: var(--brand-bg); } to { background: transparent; } }

.jump-btn {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 13px;
  box-shadow: var(--shadow-pop);
  transition: background .15s;
}
.jump-btn:hover { background: var(--brand-strong); }

/* ─────────── settings ─────────── */
.settings-body { flex: 1; min-height: 0; overflow-y: auto; padding: 24px; }
.group-table { width: 100%; max-width: 860px; border-collapse: collapse; }
.group-table th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); padding: 0 8px 8px; }
.group-table td { padding: 4px 8px 4px 0; border-bottom: 1px solid var(--border); }
.group-table input { width: 100%; padding: 8px 10px; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; outline: none; transition: border-color .15s, background .15s; }
.group-table input:hover { background: var(--surface-alt); }
.group-table input:focus { background: var(--surface); border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 94, 0, .15); }
.group-table input.pattern { font-family: var(--mono); font-size: 12.5px; }
.row-del { color: var(--text-muted); padding: 6px; border-radius: var(--r-sm); }
.row-del:hover { color: var(--danger); background: var(--danger-bg); }
.settings-hint { margin-top: 14px; }
.settings-msg { margin-top: 10px; font-size: 13px; min-height: 18px; }
.settings-msg.ok { color: var(--success); }
.settings-msg.err { color: var(--danger); }

@media (max-width: 720px) {
  :root { --sidebar-w: 180px; }
  .view-header { padding: 14px 16px 12px; }
  /* 좁은 화면에서 컬럼을 유지하면 메시지가 한 줄에 서너 글자밖에 안 들어간다.
     메타(시각·레벨)를 윗줄로 올리고 메시지에 폭을 전부 준다. */
  .log-line { display: block; padding: 5px 12px; }
  .log-line .lt, .log-line .ll { display: inline; width: auto; font-size: 11px; margin-right: 8px; }
  .log-line .lg { display: inline; max-width: none; font-size: 11px; }
  .log-line .lm { display: block; margin-top: 1px; }
}
