:root {
  --bg: #f4f5f7; --panel: #ffffff; --line: #e3e5ea; --text: #1f2430; --muted: #6b7280; --accent: #2f6fd6;
  --accent-ink: #ffffff; --danger: #c53030; --ok: #1f9d55; --hover: #eef1f6; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --radius: 10px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15171c; --panel: #1e2128; --line: #2d313a; --text: #e6e8ec; --muted: #9aa1ad; --accent: #5b93f0;
    --hover: #262a33; --shadow: none; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; min-height: 36px; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 4px 9px; min-height: 30px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: transparent; padding: 6px; border-radius: 8px; cursor: pointer; line-height: 0; min-width: 36px; min-height: 36px; }
.icon-btn:hover { background: var(--hover); }
input[type=text], input[type=search], input[type=number], select { border: 1px solid var(--line); background: var(--panel);
  border-radius: 8px; padding: 7px 10px; min-height: 36px; width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top); }
.top .wrap { display: flex; align-items: center; gap: 10px; height: 56px; }
.logo { font-weight: 700; font-size: 18px; letter-spacing: -.2px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.logo i { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg,#2f6fd6,#6b46c1); display: inline-block; }
.top .search { flex: 1; max-width: 420px; margin-left: auto; }

/* tool grid */
.section-title { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; font-weight: 650; font-size: 15px; }
.section-title .grow { flex: 1; }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tool { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; color: var(--text); min-width: 0; }
.tool:hover { background: var(--hover); }
.tool .ico { width: 38px; height: 38px; border-radius: 9px; flex: none; display: grid; place-items: center; color: #fff;
  font-weight: 700; font-size: 15px; overflow: hidden; }
.tool .ico img { width: 100%; height: 100%; object-fit: cover; }
.tool b { display: block; font-size: 14px; }
.tool span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool.off { opacity: .55; }

/* files */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; flex: 1; min-width: 0; font-weight: 600; }
.crumbs a { color: var(--text); padding: 4px 6px; border-radius: 6px; }
.crumbs a:hover { background: var(--hover); }
.crumbs .sep { color: var(--muted); }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--hover); }
.row .fi { width: 34px; height: 34px; border-radius: 8px; flex: none; display: grid; place-items: center; font-size: 11px;
  font-weight: 700; color: #fff; background: #8a94a6; text-transform: uppercase; }
.row .fi.dir { background: #f0b429; color: #5c3d00; }
.row .nm { flex: 1; min-width: 0; }
.row .nm b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .nm span { font-size: 12px; color: var(--muted); }
.row .meta { font-size: 13px; color: var(--muted); white-space: nowrap; }
@media (max-width: 600px) { .row .meta { display: none; } }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.drop-hint { position: fixed; inset: 0; background: rgba(47,111,214,.12); border: 3px dashed var(--accent); z-index: 50;
  display: none; place-items: center; font-size: 20px; font-weight: 600; color: var(--accent); pointer-events: none; }
body.dragging .drop-hint { display: grid; }

/* menu, dialog, toast */
.menu { position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 5px; min-width: 190px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 7px; cursor: pointer; }
.menu button:hover { background: var(--hover); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.dlg-back { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 70; display: grid; place-items: center; padding: 16px; }
.dlg { background: var(--panel); border-radius: 12px; padding: 18px; width: min(440px, 100%); box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.dlg h3 { margin: 0 0 12px; font-size: 16px; }
.dlg .act { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dlg .list { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
#toasts { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80;
  display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(520px, calc(100% - 32px)); }
.toast { background: #1f2430; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.25); font-size: 14px; }
.toast.err { background: var(--danger); }
.progress { height: 3px; background: var(--accent); width: 0; transition: width .2s; }

/* cards (settings) */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 16px; margin: 0 0 4px; }
.card > p { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; }
.item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.item:first-of-type { border-top: 0; }
.item .grow { flex: 1; min-width: 160px; }
.tag { font-size: 12px; padding: 2px 7px; border-radius: 99px; background: var(--hover); color: var(--muted); }
.tag.ok { background: rgba(31,157,85,.12); color: var(--ok); }
.tag.err { background: rgba(197,48,48,.12); color: var(--danger); }
.code { font: 600 22px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 1px; padding: 10px 12px;
  background: var(--hover); border-radius: 8px; word-break: break-all; user-select: all; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; user-select: all; }
ol.steps { margin: 6px 0 0; padding-left: 20px; font-size: 14px; }
ol.steps li { margin: 4px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }
label.f { display: block; font-size: 13px; color: var(--muted); }
label.f > input, label.f > select { margin-top: 3px; }
