/* ==========================================================================
   Up2uFormFlow — application styles
   Brand: green #2A9F45 · blue #0259AB · type: Archivo (variable width)
   ========================================================================== */

:root {
  --ink: #12261A;
  --ink-2: #3B5043;
  --ink-3: #66796C;
  --paper: #F4F7F3;
  --surface: #FFFFFF;
  --line: #D9E3DB;
  --line-2: #EAF0EB;
  --green: #2A9F45;
  --green-ink: #1C7A33;
  --green-wash: #E7F4EA;
  --blue: #0259AB;
  --blue-ink: #024A8E;
  --blue-wash: #E6EFF8;
  --amber: #9A6408;
  --amber-wash: #FCF2DF;
  --red: #BE3A2E;
  --red-wash: #FBEAE7;
  --primary: var(--green);
  --primary-ink: var(--green-ink);
  --primary-wash: var(--green-wash);
  --accent: var(--blue);
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --shadow-pop: 0 12px 32px -12px rgba(18, 38, 26, .28), 0 2px 6px rgba(18, 38, 26, .06);
  --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --sidebar: 248px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5;
  color: var(--ink); background: var(--paper); font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--blue-ink); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 .75em; }
p:last-child { margin-bottom: 0; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
code { background: var(--line-2); padding: .1em .35em; border-radius: 4px; }
pre { background: var(--ink); color: #E7F4EA; padding: 14px 16px; border-radius: var(--r); overflow-x: auto; }
pre code { background: none; padding: 0; color: inherit; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
::selection { background: var(--green-wash); }

:focus-visible { outline: 2.5px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

.ic { width: 18px; height: 18px; flex: none; }
.ic-sm { width: 15px; height: 15px; flex: none; }
.ic-lg { width: 22px; height: 22px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ── App shell ─────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px 12px;
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; text-decoration: none; color: var(--ink); }
.sidebar__brand img { height: 34px; width: auto; }
.sidebar__brand .ws-logo { max-height: 40px; max-width: 180px; object-fit: contain; }
.sidebar__ws { margin: 0 4px 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); }
.sidebar__ws strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__ws span { font-size: 12px; color: var(--ink-3); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__group { margin: 14px 10px 4px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 14.5px;
}
.nav a:hover { background: var(--paper); color: var(--ink); }
.nav a.is-active { background: var(--green-wash); color: var(--green-ink); font-weight: 650; }
.nav a.is-active .ic { color: var(--green); }
.nav .count { margin-left: auto; font-size: 12px; font-weight: 700; background: var(--green); color: #fff; border-radius: 999px; padding: 1px 8px; }
.sidebar__foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line-2); }
.usercard { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r); text-decoration: none; color: var(--ink); }
.usercard:hover { background: var(--paper); }
.usercard__meta { min-width: 0; flex: 1; }
.usercard__meta strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usercard__meta span { font-size: 12px; color: var(--ink-3); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--blue-wash); color: var(--blue);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; overflow: hidden; flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 72px; height: 72px; font-size: 24px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: 28px 36px 64px; max-width: 1240px; width: 100%; }
.content--wide { max-width: none; }

.banner { display: flex; align-items: center; gap: 12px; padding: 10px 36px; font-size: 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.banner--warn { background: var(--amber-wash); color: #5E3D05; }
.banner--info { background: var(--blue-wash); color: var(--blue-ink); }
.banner form { margin-left: auto; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-pop); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(18, 38, 26, .35); z-index: 50; }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
  .topbar img { height: 28px; width: auto; }
  .content { padding: 20px 16px 56px; }
  .banner { padding: 10px 16px; }
}

/* ── Page header ───────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 750; font-variation-settings: "wdth" 112; letter-spacing: -.02em; }
.page-head p { color: var(--ink-3); margin: 6px 0 0; max-width: 62ch; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-3); margin-bottom: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.section-title { font-size: 17px; font-weight: 700; margin-bottom: 12px; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 14px/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { border-color: #BFCDC2; background: #FAFCFA; color: var(--ink); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-ink); border-color: var(--primary-ink); color: #fff; }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-ink); border-color: var(--blue-ink); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); border-color: transparent; }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-wash); border-color: #EBC2BC; color: var(--red); }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover { background: #A22F24; color: #fff; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; gap: 6px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15.5px; }
.btn-icon { width: 34px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn-block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.linkbtn.danger { color: var(--red); }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.card__head { padding: 16px 20px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card__head h2, .card__head h3 { font-size: 16px; font-weight: 700; }
.card__head p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-3); }
.card__body { padding: 20px; }
.card__foot { padding: 14px 20px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; background: #FBFCFB; border-radius: 0 0 var(--r) var(--r); }
.card + .card { margin-top: 20px; }
.grid-2 > .card, .grid-3 > .card { margin-top: 0; }
.grid-2 + .card, .grid-3 + .card, .card + .grid-2, .card + .grid-3 { margin-top: 20px; }
.card--flush .card__body { padding: 0; }

/* ── Stats ─────────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); margin-bottom: 20px; }
.stat { padding: 16px 20px; border-left: 1px solid var(--line-2); text-decoration: none; color: inherit; }
.stat:first-child { border-left: 0; }
a.stat:hover { background: #FBFCFB; }
.stat__label { font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.stat__value { font-size: 30px; font-weight: 700; font-variation-settings: "wdth" 115; letter-spacing: -.02em; margin-top: 4px; line-height: 1.1; }
.stat__note { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, 1fr); } .stat:nth-child(3) { border-left: 0; } .stat:nth-child(n+3) { border-top: 1px solid var(--line-2); } }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--ink-3); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FBFCFB; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FAFCFA; }
.table .is-new td { font-weight: 650; }
.table .is-new td:first-child { box-shadow: inset 3px 0 0 var(--green); }
.table a.rowlink { color: var(--ink); text-decoration: none; font-weight: 600; }
.table a.rowlink:hover { color: var(--green-ink); text-decoration: underline; }
.table .actions { text-align: right; white-space: nowrap; }
.table .check { width: 36px; }

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge--plain::before { display: none; }
.badge--green { background: var(--green-wash); color: var(--green-ink); }
.badge--blue { background: var(--blue-wash); color: var(--blue-ink); }
.badge--amber { background: var(--amber-wash); color: var(--amber); }
.badge--red { background: var(--red-wash); color: var(--red); }

/* ── Forms (app inputs) ────────────────────────────────────────────────── */
.field { display: block; }
.field + .field { margin-top: 16px; }
.label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.label .opt { font-weight: 400; color: var(--ink-3); }
.hint { font-size: 13px; color: var(--ink-3); margin-top: 5px; }
.error { font-size: 13px; color: var(--red); margin-top: 5px; font-weight: 500; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid #C9D6CC; border-radius: var(--r-sm);
  background: #fff; color: var(--ink); font: 400 15px/1.4 var(--font); transition: border-color .12s, box-shadow .12s;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2366796C' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(42, 159, 69, .18); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--red); }
.input-sm, .select.input-sm { height: 34px; font-size: 14px; }
.input-group { display: flex; }
.input-group .input { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group .btn { border-radius: 0 var(--r-sm) var(--r-sm) 0; border-left: 0; height: 40px; }
.input-affix { display: flex; align-items: stretch; border: 1px solid #C9D6CC; border-radius: var(--r-sm); background: #fff; overflow: hidden; }
.input-affix:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(42, 159, 69, .18); }
.input-affix span { display: flex; align-items: center; padding: 0 10px; background: var(--paper); color: var(--ink-3); font-size: 14px; white-space: nowrap; }
.input-affix input { border: 0; flex: 1; min-width: 0; height: 38px; padding: 0 10px; font: inherit; outline: none; }
.checkline { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14.5px; }
.checkline input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--green); flex: none; }
.checkline small { display: block; color: var(--ink-3); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .field + .field { margin-top: 0; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
input[type="color"] { width: 44px; height: 40px; padding: 3px; border: 1px solid #C9D6CC; border-radius: var(--r-sm); background: #fff; cursor: pointer; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14.5px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { width: 38px; height: 22px; border-radius: 999px; background: #C9D6CC; position: relative; transition: background .15s; flex: none; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .switch__track { background: var(--green); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { outline: 2.5px solid var(--blue); outline-offset: 2px; }

/* ── Tabs / segmented ──────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; color: var(--ink-3); font: 600 14px var(--font); text-decoration: none; border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs .is-active { color: var(--green-ink); border-bottom-color: var(--green); }
.tabs .n { font-size: 12px; background: var(--line-2); color: var(--ink-2); padding: 0 7px; border-radius: 999px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: #fff; }
.seg button, .seg a { border: 0; background: none; padding: 7px 12px; font: 600 13px var(--font); color: var(--ink-3); cursor: pointer; text-decoration: none; }
.seg button + button, .seg a + a { border-left: 1px solid var(--line); }
.seg .is-active { background: var(--green-wash); color: var(--green-ink); }

/* ── Alerts / flash ────────────────────────────────────────────────────── */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); border: 1px solid; font-size: 14.5px; margin-bottom: 18px; }
.alert .ic { margin-top: 2px; }
.alert--success { background: var(--green-wash); border-color: #BFE3C8; color: #17562A; }
.alert--error { background: var(--red-wash); border-color: #EFC6C0; color: #84261D; }
.alert--warning { background: var(--amber-wash); border-color: #EFD9AE; color: #5E3D05; }
.alert--info { background: var(--blue-wash); border-color: #BED4EC; color: var(--blue-ink); }
.alert__close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; padding: 0; opacity: .7; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* ── Empty state ───────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 48px 24px; }
.empty__art { width: 56px; height: 56px; border-radius: 14px; background: var(--green-wash); color: var(--green); display: grid; place-items: center; margin: 0 auto 14px; }
.empty__art .ic { width: 26px; height: 26px; }
.empty h3 { font-size: 18px; margin-bottom: 6px; }
.empty p { color: var(--ink-3); max-width: 46ch; margin: 0 auto 18px; }

/* ── Lists ─────────────────────────────────────────────────────────────── */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 20px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 12px; }
.list > li:last-child { border-bottom: 0; }
.list a.item { color: var(--ink); text-decoration: none; font-weight: 600; }
.list a.item:hover { color: var(--green-ink); }
.kv { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 0; margin: 0; }
.kv dt { color: var(--ink-3); font-size: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-2); padding-right: 16px; }
.kv dd { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--line-2); word-break: break-word; }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; } .kv dt { border-bottom: 0; padding-bottom: 0; } }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li a { display: flex; align-items: center; gap: 12px; padding: 11px 20px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line-2); }
.checklist li:last-child a { border-bottom: 0; }
.checklist li a:hover { background: #FBFCFB; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #BFCDC2; display: grid; place-items: center; flex: none; color: #fff; }
.checklist .done .tick { background: var(--green); border-color: var(--green); }
.checklist .done span:last-child { color: var(--ink-3); text-decoration: line-through; }

.progress { height: 8px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.progress.is-full > span { background: var(--amber); }

/* bar chart */
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; align-items: end; height: 140px; padding: 0 4px; }
.bars__col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bars__bar { width: 100%; max-width: 28px; background: var(--green); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars__bar.is-zero { background: var(--line); }
.bars__bar:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 12px; padding: 3px 7px; border-radius: 4px; white-space: nowrap; }
.bars__label { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.bars__col:nth-child(even) .bars__label { visibility: hidden; }

/* ── Dropdown (details) ───────────────────────────────────────────────── */
.dd { position: relative; display: inline-block; }
.dd > summary { list-style: none; }
.dd > summary::-webkit-details-marker { display: none; }
.dd__menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 6px; z-index: 30; }
.dd__menu a, .dd__menu button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font: 500 14px var(--font); background: none; border: 0; cursor: pointer; text-align: left; }
.dd__menu a:hover, .dd__menu button:hover { background: var(--paper); }
.dd__menu .danger { color: var(--red); }
.dd__menu hr { margin: 6px 0; }

/* ── Modal (dialog) ────────────────────────────────────────────────────── */
dialog.modal { border: 0; padding: 0; border-radius: var(--r-lg); width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-pop); color: var(--ink); }
dialog.modal::backdrop { background: rgba(18, 38, 26, .45); }
.modal__head { padding: 18px 22px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal__head h2 { font-size: 18px; }
.modal__body { padding: 20px 22px; max-height: 70vh; overflow-y: auto; }
.modal__foot { padding: 14px 22px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; }
dialog.modal-wide { width: min(860px, calc(100vw - 32px)); }

/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast-host { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r); font-size: 14px; font-weight: 500; display: flex; gap: 8px; align-items: center; box-shadow: var(--shadow-pop); animation: toast-in .18s ease-out; pointer-events: auto; }
.toast.is-error { background: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ── Pagination ────────────────────────────────────────────────────────── */
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; gap: 12px; font-size: 13.5px; color: var(--ink-3); border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.pager__links { display: flex; gap: 4px; }
.pager__links a, .pager__links span { min-width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0 8px; border-radius: var(--r-sm); border: 1px solid var(--line); color: var(--ink); text-decoration: none; background: #fff; }
.pager__links .is-current { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.pager__links .is-disabled { color: #B8C4BB; }

/* ── Filters bar ───────────────────────────────────────────────────────── */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.filters .input, .filters .select { height: 36px; font-size: 14px; width: auto; }
.filters .search { position: relative; flex: 1 1 220px; }
.filters .search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.filters .search .input { padding-left: 34px; width: 100%; }
.bulkbar { display: none; align-items: center; gap: 8px; padding: 10px 16px; background: var(--green-wash); border-bottom: 1px solid #CDE7D3; font-size: 14px; flex-wrap: wrap; }
.bulkbar.is-on { display: flex; }

/* ── Answers (submission detail) ──────────────────────────────────────── */
.answers { margin: 0; }
.answer { padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.answer:last-child { border-bottom: 0; }
.answer--group { background: var(--paper); }
.answer--group dt { color: var(--ink); font-size: 14px; }
.answer--child { padding-left: 36px; }
.filechips { display: flex; flex-wrap: wrap; gap: 6px; }
.answer dt { font-size: 13px; color: var(--ink-3); font-weight: 600; margin-bottom: 3px; }
.answer dd { margin: 0; font-size: 15.5px; white-space: pre-wrap; word-break: break-word; }
.answer dd.empty-val { color: #A9B6AD; }
.answer img.sig { max-width: 320px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); }
.filechip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); text-decoration: none; color: var(--ink); background: #fff; font-size: 14px; }
.filechip:hover { border-color: var(--green); color: var(--green-ink); }

.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 17px; bottom: -2px; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.warn::before { background: var(--amber); }
.timeline li.error::before { background: var(--red); }
.timeline time { display: block; font-size: 12px; color: var(--ink-3); }

/* ── Auth / guest pages ────────────────────────────────────────────────── */
.guest { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: var(--paper); }
.guest__card { width: min(440px, 100%); }
.guest__logo { display: block; width: 210px; margin: 0 auto 24px; }
.guest__card .card__body { padding: 28px; }
.guest__card h1 { font-size: 23px; font-variation-settings: "wdth" 110; margin-bottom: 6px; }
.guest__foot { text-align: center; font-size: 14px; color: var(--ink-3); margin-top: 18px; }

/* ── Help center ───────────────────────────────────────────────────────── */
.prose { max-width: 70ch; font-size: 16px; line-height: 1.65; }
.prose h2 { font-size: 21px; margin: 1.6em 0 .5em; scroll-margin-top: 20px; }
.prose h3 { font-size: 17px; margin: 1.4em 0 .4em; scroll-margin-top: 20px; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li + li { margin-top: .3em; }
.prose table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 15px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.prose th { background: var(--paper); }
.toc { position: sticky; top: 20px; font-size: 14px; }
.toc a { display: block; padding: 4px 0 4px 12px; border-left: 2px solid var(--line); color: var(--ink-3); text-decoration: none; }
.toc a:hover { color: var(--ink); border-left-color: var(--green); }
.topic { display: flex; gap: 14px; padding: 18px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.topic:hover { border-color: var(--green); }
.topic__emoji { font-size: 24px; line-height: 1; }
.topic strong { display: block; margin-bottom: 2px; }
.topic span { font-size: 13.5px; color: var(--ink-3); }

/* ── Template picker ──────────────────────────────────────────────────── */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tpl { text-align: left; padding: 18px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; cursor: pointer; font: inherit; color: var(--ink); display: flex; flex-direction: column; gap: 6px; min-height: 128px; }
.tpl:hover { border-color: var(--green); }
.tpl:focus-visible { outline-offset: 0; }
.tpl strong { font-size: 15.5px; }
.tpl span { font-size: 13.5px; color: var(--ink-3); }
.tpl .ic-lg { color: var(--green); margin-bottom: 4px; }
.tpl small { margin-top: auto; color: var(--ink-3); font-size: 12.5px; }

/* ── Branding preview ─────────────────────────────────────────────────── */
.logo-drop { border: 1.5px dashed #BFCDC2; border-radius: var(--r); padding: 18px; display: flex; align-items: center; gap: 18px; background: var(--paper); flex-wrap: wrap; }
.logo-drop__img { width: 180px; height: 70px; border-radius: var(--r-sm); background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.logo-drop__img img { max-width: 160px; max-height: 56px; object-fit: contain; }
.logo-drop__img.square { width: 70px; }
.logo-drop__img.square img { max-width: 40px; max-height: 40px; }
.swatch { width: 40px; height: 40px; border-radius: var(--r-sm); border: 1px solid rgba(0,0,0,.08); }

/* misc */
.copybox { display: flex; gap: 8px; }
.copybox .input { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--paper); }
.qr { width: 180px; height: 180px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 10px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; font-family: ui-monospace, Menlo, monospace; font-size: 14px; background: var(--paper); padding: 14px; border-radius: var(--r); }
.preview-frame { border: 1px solid var(--line); border-radius: var(--r); background: #fff; padding: 22px; }
.sms-bubble { max-width: 320px; background: var(--line-2); padding: 10px 14px; border-radius: 18px 18px 18px 4px; white-space: pre-wrap; font-size: 15px; }
.steps-list { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps-list li { counter-increment: s; position: relative; padding-left: 36px; margin-bottom: 14px; }
.steps-list li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--green-wash); color: var(--green-ink); font-weight: 700; font-size: 13px; display: grid; place-items: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Billing */
.seg [aria-checked="true"] { background: var(--green-wash); color: var(--green-ink); }
.plan-card.is-current { border-color: var(--green); box-shadow: inset 0 3px 0 var(--green); }
.plan-card__price { font-size: 30px; font-weight: 750; font-variation-settings: 'wdth' 112; margin: 8px 0 2px; }
.plan-card__price .small { font-weight: 400; }
[data-billing-plans][data-interval="month"] [data-show="year"],
[data-billing-plans][data-interval="year"] [data-show="month"] { display: none; }

/* Language switcher */
.lang-switch > summary { gap: 6px; color: var(--ink-2); }
.lang-switch .dd__menu { min-width: 170px; }
.lang-switch .dd__menu a[aria-checked="true"] { font-weight: 650; color: var(--green-ink); }
.guest__lang { position: fixed; top: 14px; right: 16px; z-index: 20; }
.topbar__lang { margin-left: auto; }
@media (min-width: 961px) {
  .topbar { display: flex; justify-content: flex-end; padding: 10px 32px 0; background: none; border: 0; position: static; }
  .topbar > :not(.topbar__lang) { display: none; }
}
@media (max-width: 480px) { .lang-switch__name { display: none; } }

/* Korean: wrap between words, not inside them */
html[lang="ko"] body { word-break: keep-all; overflow-wrap: anywhere; }
