/* Flow Browser UI v3 - compact, responsive, theme & i18n ready */
:root {
  --bg: #0e1220;
  --panel: #131a2a;
  --muted: #8c9bb0;
  --text: #e6edf7;
  --line: #22304a;
  --accent: #3f82e0;
  --accent-2: #2b5fb1;
  --good: #33c48d;
  --bad: #f37070;
  --warn: #ffbf4c;
  --info: #5fb3ff;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  --radius: 12px;
  --font: 14px;
  --lh-body: 1.62;    /* 본문 기본 행간 */
  --lh-compact: 1.42; /* 버튼/헤더용 촘촘한 행간 */
  --lh-form: 1.55;    /* 폼/테이블용 행간 */
}
:root.light {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --muted: #5b6b7f;
  --text: #0f1726;
  --line: #e2e8f0;
  --accent: #2563eb;
  --accent-2: #1e40af;
  --good: #16a34a;
  --bad: #dc2626;
  --warn: #ca8a04;
  --info: #3b82f6;
  --shadow: 0 8px 30px rgba(0,0,0,.08);
}
* {
  box-sizing: border-box;
}
html, body {
  height: 100%;
}
/* body { */
/*   margin: 0; */
/*   background: linear-gradient(180deg, #0d1423 0%, var(--bg) 100%); */
/*   color: var(--text); */
/*   font-size: var(--font); */
/*   font-family: system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", Arial, sans-serif; */
/* } */
body {
  margin: 0;
  background: linear-gradient(180deg, #0d1423 0%, var(--bg) 100%);
  color: var(--text);
  font-size: var(--font);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", Arial, sans-serif;
  line-height: var(--lh-body);
  letter-spacing: 0.1px;
}
:root.light body {
  background: var(--bg);
}
a {
  color: #cfe0ff;
  text-decoration: none;
}
:root.light a {
  color: #164ab8;
}
a:hover {
  text-decoration: underline;
}
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
}
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(6px);
  background: rgba(14,18,32,.78);
  border-bottom: 1px solid var(--line);
}
:root.light .header {
  background: #ffffffcc;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: .2px;
  font-size: 12px;
  color: #dbe8ff;
}
:root.light .brand {
  color: #0f1726;
}
.brand img {
  height: 20px;
}
.nav .links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.nav .links a {
  color: #bcd2f5;
  padding: 6px 8px;
  border-radius: 8px;
}
:root.light .nav .links a {
  color: #335585;
}
.nav .links a.active {
  background: #1a2438;
  border: 1px solid #2a3854;
}
:root.light .nav .links a.active {
  background: #edf2fb;
  border-color: #d8e0eb;
  color: #0f1726;
}
.nav .right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn {
  background: #1b2538;
  border: 1px solid #2a3854;
  color: #d7e7ff;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: .15s;
  font-weight: 600;
  font-size: 11px;
}
.btn:hover {
  background: #223150;
}
.btn.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-color: var(--accent-2);
  color: #fff;
}
.btn.danger {
  background: #5b2b2b;
  border-color: #7a3a3a;
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
}
.btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}
.badge {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  color: #cfe0ff;
  background: #1a2438;
}
:root.light .badge {
  color: #0f1726;
  background: #eff5ff;
  border-color: #d8e0eb;
}
.badge.success {
  border-color: #22583f;
  background: #113026;
  color: #9be9c7;
}
.badge.failed {
  border-color: #6b2b2b;
  background: #2a1414;
  color: #ffb3b3;
}
.badge.running {
  border-color: #224a72;
  background: #101e2d;
  color: #9bccff;
}
.badge.scheduled {
  border-color: #67521f;
  background: #251d0d;
  color: #f2dda3;
}
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px;
}
.h1 {
  font-size: 17px;
  font-weight: 800;
  margin: 0 0 8px;
}
.h2 {
  font-size: 14px;
  font-weight: 700;
  margin: 10px 0 8px;
}
.sub {
  color: var(--muted);
}
.field {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #11192b;
  border: 1px solid #253553;
  border-radius: 10px;
  padding: 9px 10px;
}
:root.light .field {
  background: #eef2f7;
  border-color: #d8e0eb;
}
.field input,
.field select,
.field textarea {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 12px;
  flex: 1 1 auto;
  line-height: var(--lh-form);
  padding-top: 10px;
  padding-bottom: 10px;
}
:root.light .field input,
:root.light .field select,
:root.light .field textarea {
  color: #0f1726;
  line-height: var(--lh-form);
}
.field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(63,130,224,.18);
}
.input-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 10px;
}
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }
.col-12 { grid-column: span 12; }
@media (max-width: 960px) {
  .col-6, .col-4, .col-3 { grid-column: span 12; }
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.table th,
.table td {
  border-bottom: 1px solid #24324c;
  padding: 10px 8px;     /* 상하 공간 소폭 확대 */
  text-align: left;
  line-height: var(--lh-form);
}
:root.light .table th,
:root.light .table td {
  border-bottom-color: #e2e8f0;
}
.table th {
  color: #a7bddf;
  font-weight: 700;
}
:root.light .table th {
  color: #334155;
}
.table tr:hover td {
  background: #0f1728;
}
:root.light .table tr:hover td {
  background: #f3f6fb;
}
.grid {
  display: grid;
  gap: 12px;
}
.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 960px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.toast-wrap {
  position: fixed;
  right: 14px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast {
  background: #131a2a;
  border: 1px solid #2a3854;
  color: #d7e7ff;
  padding: 8px 10px;
  border-radius: 10px;
  min-width: 220px;
  box-shadow: var(--shadow);
  font-size: 11px;
}
.toast.good { border-color: #1f6a49; }
.toast.bad { border-color: #6a1f1f; }
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  width: min(700px, 92vw);
  background: #101726;
  border: 1px solid #273554;
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
}
:root.light .modal {
  background: #ffffff;
  border-color: #e2e8f0;
}
.modal .title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 8px;
}
.modal .footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.block-preview {
  background: #0c1322;
  border: 1px dashed #2a3854;
  border-radius: 10px;
  padding: 10px;
  /* 변경: 동적 높이 반영을 위해 고정 max-height 제거 */
  max-height: none;
  overflow: auto;
  font-size: 12px;
}
:root.light .block-preview {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.block-preview h2 {
  margin: 8px 0 6px;
  font-size: 13px;
}
.block-preview p {
  margin: 8px 0;          /* 문단 간격 확대 */
  color: #cfe0ff;
  line-height: 1.6;
}
:root.light .block-preview p {
  color: #0f1726;
}
.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 12px;
  align-items: center;
}
.kv .k {
  color: #97adcc;
  font-size: 11px;
}
.kv .v {
  color: var(--text);
  font-size: 11px;
}
/* Block editor */
.block-editor {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  padding: 10px;
}
.block-item {
  border: 1px dashed #2a3854;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
  background: #0f1728;
}
:root.light .block-item {
  background: #f6f9fe;
  border-color: #e2e8f0;
}
.block-item .top {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}
.block-item .controls {
  display: flex;
  gap: 6px;
}
.block-item .content {
  margin-top: 6px;
  display: grid;
  gap: 6px;
}

:root {
--mask-bg: rgba(0, 0, 0, 0.35);
--modal-card-bg: #ffffff;
--modal-card-text: #1b2b3c;
--modal-border: #e5eef5;
}
[data-theme="dark"],
body.dark {
--mask-bg: rgba(255, 255, 255, 0.08);
--modal-card-bg: #151e28;
--modal-card-text: #d7e2ee;
--modal-border: #2a3a4a;
}
.modal-mask {
display: none;
position: fixed;
left: 0; top: 0; right: 0; bottom: 0;
background: var(--mask-bg);
z-index: 1000;
align-items: center;
justify-content: center;
}
.modal-card {
width: 720px;
max-width: 92%;
padding: 16px;
background: var(--modal-card-bg);
color: var(--modal-card-text);
border: 1px solid var(--modal-border);
border-radius: 8px;
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}


/* THEMED CONTROLS (검색 인풋/페이지 크기 콤보 등) */
.control,
#q,
#pageSize {
background: #11192b;
border: 1px solid #253553;
color: var(--text);
border-radius: 10px;
padding: 9px 10px;
font-size: 12px;
outline: none;
}
:root.light .control,
:root.light #q,
:root.light #pageSize {
background: #eef2f7;
border-color: #d8e0eb;
color: #0f1726;
}
#q::placeholder { color: #8c9bb0; }
:root.light #q::placeholder { color: #5b6b7f; }
#q:focus, #pageSize:focus, .control:focus {
border-color: var(--accent);
box-shadow: 0 0 0 3px rgba(63,130,224,.18);
}
#pageSize { padding-right: 28px; }

/* 페이지네이션 영역(select)에 테마 자동 적용 - control 미지정 시에도 적용 */
.pager .size-select select,
#pager .size-select select,
#selSize {
background: #11192b;
border: 1px solid #253553;
color: var(--text);
border-radius: 10px;
padding: 9px 10px;
font-size: 12px;
outline: none;
}
:root.light .pager .size-select select,
:root.light #pager .size-select select,
:root.light #selSize {
background: #eef2f7;
border-color: #d8e0eb;
color: #0f1726;
}
.pager .size-select select:focus,
#pager .size-select select:focus,
#selSize:focus {
border-color: var(--accent);
box-shadow: 0 0 0 3px rgba(63,130,224,.18);
}

.field select.control {
background: #11192b;
border: 1px solid #253553;
color: var(--text);
border-radius: 10px;
padding: 9px 10px;
font-size: 12px;
outline: none;
min-height: 32px;
/* .field 안에서 가득 차도록 */
width: 100%;
}
:root.light .field select.control {
background: #eef2f7;
border-color: #d8e0eb;
color: #0f1726;
}
.field select.control:focus {
border-color: var(--accent);
box-shadow: 0 0 0 3px rgba(63,130,224,.18);
}

.pager {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
margin-top: 8px;
}
.pager .left,
.pager .right {
display: flex;
align-items: center;
gap: 8px;
}
.pager .size-select span {
font-size: 13px;
color: var(--muted);
}
/* 페이지크기 콤보(테마는 .control 규칙이 적용되며, 여기서 글자크기만 13으로 보정) */
.pager .size-select select.control {
font-size: 13px;
min-width: 80px;
}

/* THEMED MODAL (auto_posts / sites 공통) */
:root {
/* 오버레이/모달 카드 변수: 다크 기본 */
--mask-bg: rgba(0, 0, 0, 0.55);
--modal-card-bg: #101726;
--modal-card-text: var(--text);
--modal-border: #273554;
}
:root.light {
/* 라이트 테마*/
--mask-bg: rgba(0, 0, 0, 0.35);
--modal-card-bg: #ffffff;
--modal-card-text: #0f1726;
--modal-border: #e2e8f0;
}
/* 오버레이 */
.modal-mask {
display: none;
position: fixed;
inset: 0;
background: var(--mask-bg);
z-index: 1000;
align-items: center;
justify-content: center;
}
/* 모달 카드 */
.modal-card {
width: min(720px, 92vw);
background: var(--modal-card-bg);
color: var(--modal-card-text);
border: 1px solid var(--modal-border);
border-radius: 12px;
padding: 16px;
box-shadow: var(--shadow);
}
.modal-card .h1 { margin-top: 0; }


/* THEMED MODAL: 강제 오버라이드(다크/라이트 공통) */
:root {
--mask-bg: rgba(0,0,0,0.55);
--modal-card-bg: #101726;
--modal-card-text: var(--text);
--modal-border: #273554;
}
:root.light {
--mask-bg: rgba(0,0,0,0.35);
--modal-card-bg: #ffffff;
--modal-card-text: #0f1726;
--modal-border: #e2e8f0;
}
.modal-mask {
display: none;
position: fixed;
inset: 0;
background: var(--mask-bg) !important;
z-index: 1000;
align-items: center;
justify-content: center;
}
.modal-card,
.modal,
.card.modal-card {
width: min(720px, 92vw);
background: var(--modal-card-bg) !important;
color: var(--modal-card-text) !important;
border: 1px solid var(--modal-border) !important;
border-radius: 12px;
padding: 16px;
box-shadow: var(--shadow);
}
/* .modal .title { color: var(--modal-card-text) !important; } */
.modal .title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 10px;
  line-height: var(--lh-compact);
}

/* FIELD 내부의 select.control 강제 적용(투명/무테 덮어쓰기) */
.field select.control {
background: #11192b !important;
border: 1px solid #253553 !important;
color: var(--text) !important;
border-radius: 10px !important;
padding: 9px 10px !important;
font-size: 12px !important;
outline: none !important;
}
:root.light .field select.control {
background: #eef2f7 !important;
border-color: #d8e0eb !important;
color: #0f1726 !important;
}
.field select.control:focus {
border-color: var(--accent) !important;
box-shadow: 0 0 0 3px rgba(63,130,224,.18) !important;
}

/* 페이저 페이지 크기 콤보: 글자크기 13px */
.pager .size-select select.control { font-size: 13px !important; }

/* 버튼 가독성 개선(다크/라이트) */
.btn { color: #d7e7ff; }
:root.light .btn { color: #0f1726; }
.btn.ghost, .btn.secondary {
background: transparent;
border: 1px solid var(--line);
color: var(--text);
}
:root.light .btn.ghost, :root.light .btn.secondary {
background: transparent;
border: 1px solid #d8e0eb;
color: #0f1726;
}
/* primary/danger 라이트 대비 강화 */
:root.light .btn.primary {
background: linear-gradient(180deg, var(--accent), var(--accent-2)) !important;
border-color: var(--accent-2) !important;
color: #fff !important;
}
:root.light .btn.danger {
background: #dc2626 !important;
border-color: #b91c1c !important;
color: #fff !important;
}
/* 헤더/인덱스 상단 'open'류 버튼 대비(가정: ghost 사용) */
.header .btn, .header a.btn {
color: var(--text) !important;
border-color: var(--line) !important;
background: transparent;
}

/* ===== Autofill background fix (Chrome/Safari/Firefox) ===== */
/* WebKit 계열: -webkit-autofill 상태의 기본 배경(흰색/노란색 등)을 필드 배경으로 덮어쓰기 */
.field input:-webkit-autofill,
.field textarea:-webkit-autofill,
.field select:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field textarea:-webkit-autofill:hover,
.field select:-webkit-autofill:hover,
.field input:-webkit-autofill:focus,
.field textarea:-webkit-autofill:focus,
.field select:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #11192b inset !important; /* 다크 테마 필드 배경 */
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text) !important;
  transition: background-color 99999s ease-in-out 0s !important; /* 배경 전환 방지 트릭 */
  border-radius: 10px; /* .field 내부 라운딩과 일치(필요 시 조정) */
}

/* 라이트 테마용(같은 규칙, 배경색과 글자색만 다름) */
:root.light .field input:-webkit-autofill,
:root.light .field textarea:-webkit-autofill,
:root.light .field select:-webkit-autofill,
:root.light .field input:-webkit-autofill:hover,
:root.light .field textarea:-webkit-autofill:hover,
:root.light .field select:-webkit-autofill:hover,
:root.light .field input:-webkit-autofill:focus,
:root.light .field textarea:-webkit-autofill:focus,
:root.light .field select:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #eef2f7 inset !important; /* 라이트 테마 필드 배경 */
  -webkit-text-fill-color: #0f1726 !important;
  caret-color: #0f1726 !important;
}

/* Firefox: -moz-autofill 상태 덮어쓰기 */
.field input:-moz-autofill,
.field textarea:-moz-autofill,
.field select:-moz-autofill {
  box-shadow: 0 0 0 1000px #11192b inset !important;   /* 다크 테마 */
  -moz-text-fill-color: var(--text) !important;
  caret-color: var(--text) !important;
  border-radius: 10px;
}
:root.light .field input:-moz-autofill,
:root.light .field textarea:-moz-autofill,
:root.light .field select:-moz-autofill {
  box-shadow: 0 0 0 1000px #eef2f7 inset !important;   /* 라이트 테마 */
  -moz-text-fill-color: #0f1726 !important;
  caret-color: #0f1726 !important;
}

/* 일부 크롬 계열에서 내부 선택 상태 대응(무시해도 무방, 가능하면 함께 적용) */
.field input:-internal-autofill-selected,
.field textarea:-internal-autofill-selected,
.field select:-internal-autofill-selected {
  background-color: transparent !important;
  color: var(--text) !important;
}
:root.light .field input:-internal-autofill-selected,
:root.light .field textarea:-internal-autofill-selected,
:root.light .field select:-internal-autofill-selected {
  background-color: transparent !important;
  color: #0f1726 !important;
}

/* === Credit CTA (banner/dialog) === */
.credit-cta-banner {
  position: sticky;
  top: 0; /* header가 sticky면 header 아래 삽입용: header 바로 뒤에 붙입니다 */
  z-index: 50;
  border-bottom: 1px solid var(--warn);
  background: rgba(245, 158, 11, 0.12);
  backdrop-filter: blur(6px);
}
.credit-cta-banner .inner {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  max-width: 1280px; margin: 0 auto; padding: 10px 16px;
  color: #f2dda3;
}
:root.light .credit-cta-banner { background: #fff7ed; }
:root.light .credit-cta-banner .inner { color: #7c2d12; }
.credit-cta-banner .btns { display:flex; gap:8px; flex-wrap:wrap; }
.credit-cta-banner .btn.link { background: transparent; border: 1px solid var(--warn); color: var(--text); }
.credit-cta-banner .close {
  background: transparent; border: 1px solid var(--warn);
  color: var(--text); border-radius: 8px; padding: 4px 8px; cursor: pointer;
}

.credit-cta-dialog-mask {
  display:none; position:fixed; inset:0; background: rgba(0,0,0,.45); z-index:1000;
  align-items:center; justify-content:center;
}
.credit-cta-dialog {
  width:min(640px, 92vw); background: var(--panel); border:1px solid var(--line);
  border-radius:12px; padding:16px; box-shadow: var(--shadow);
}
.credit-cta-dialog .title { font-size:16px; font-weight:900; margin-bottom:8px; }
.credit-cta-dialog .msg { font-size:13px; color: var(--text); }
.credit-cta-dialog .actions { display:flex; justify-content:flex-end; gap:8px; margin-top:12px; }



/* Global scrollbar (WebKit) */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: #0f1728; }
*::-webkit-scrollbar-thumb { background: #273554; border-radius: 8px; border: 2px solid #0f1728; }
*::-webkit-scrollbar-thumb:hover { background: #35507a; }
/* Firefox */
html {
  scrollbar-width: thin;
  scrollbar-color: #273554 #0f1728; /* thumb track */
}
/* 라이트 테마 대비 */
:root.light *::-webkit-scrollbar-track { background: #eef2f7; }
:root.light *::-webkit-scrollbar-thumb { background: #b9c6d8; border-color: #eef2f7; }
:root.light html { scrollbar-color: #b9c6d8 #eef2f7; }