:root {
  --cf-orange: #f6821f;
  --cf-orange-dark: #d96f15;
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #e3e6eb;
  --text: #1d1f23;
  --muted: #6b7280;
  --danger: #e03131;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  transition: background 0.15s, opacity 0.15s;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--cf-orange); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--cf-orange-dark); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: #f0f1f3; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid #f5c2c2; }
.btn-danger:hover:not(:disabled) { background: #fff0f0; }

input {
  font: inherit;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 100%;
}
input:focus { outline: 2px solid var(--cf-orange); border-color: transparent; }
input[type="checkbox"] {
  width: 16px; height: 16px; padding: 0; margin: 0;
  cursor: pointer; accent-color: var(--cf-orange); vertical-align: middle;
}
.check-cell { width: 1%; text-align: center; }

.batch-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; padding: 10px 14px;
  background: #fff7ef; border: 1px solid #f6d7b8; border-radius: 8px;
  font-size: 14px; color: var(--text);
}
.batch-bar button { padding: 5px 12px; font-size: 13px; }

/* ---- Login ---- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
}
.login-logo .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--cf-orange); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.error { color: var(--danger); font-size: 13px; margin-bottom: 12px; }

/* ---- App shell ---- */
.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--cf-orange); }
.brand img.logo { width: 24px; height: 24px; border-radius: 5px; object-fit: cover; }
.login-logo img.logo { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; }
.user-area { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }

.container { max-width: 1000px; margin: 24px auto; padding: 0 24px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}
.panel h2 { margin: 0 0 14px; font-size: 16px; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  transition: border-color 0.15s, background 0.15s;
}
.dropzone.drag { border-color: var(--cf-orange); background: #fff7ef; }
.dropzone .pick { color: var(--cf-orange); font-weight: 600; cursor: pointer; }

.progress { height: 8px; background: #eee; border-radius: 4px; margin-top: 12px; overflow: hidden; }
.progress > div { height: 100%; background: var(--cf-orange); transition: width 0.2s; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
td.actions { white-space: nowrap; display: flex; gap: 6px; }
td.actions button { padding: 5px 9px; font-size: 13px; }
.key-cell { font-family: 'SF Mono', Menlo, Consolas, monospace; word-break: break-all; }
.empty { text-align: center; color: var(--muted); padding: 30px; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1d1f23; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,0.2); z-index: 50;
}

.modal-overlay {
  position: fixed; inset: 0; background: rgba(17, 19, 23, 0.5);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 60; padding: 20px;
  animation: overlay-in 0.18s ease;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--panel); border-radius: 14px;
  width: 100%; max-width: 460px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.1);
  animation: modal-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--border);
}
.modal-title { display: flex; align-items: center; gap: 10px; }
.modal-title h3 { margin: 0; font-size: 16px; }
.modal-icon {
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 8px; background: #fff1e3; color: var(--cf-orange); font-size: 15px;
}
.modal-icon.danger { background: #fdecec; color: var(--danger); }
.modal-msg { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text); word-break: break-all; }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover:not(:disabled) { background: #c92a2a; }
.modal-close {
  background: transparent; border: none; color: var(--muted);
  font-size: 22px; line-height: 1; padding: 2px 8px; border-radius: 6px;
}
.modal-close:hover { background: #f0f1f3; color: var(--text); }
.modal-body { padding: 20px 22px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px; background: #fafbfc; border-top: 1px solid var(--border);
}
.src-row {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 18px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}
.src-label {
  flex: none; font-size: 11px; font-weight: 600; color: var(--cf-orange);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.src-path {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px; color: var(--text); word-break: break-all;
}
.select {
  font: inherit; width: 100%; padding: 9px 11px; background: #fff;
  border: 1px solid var(--border); border-radius: 6px;
}
.select:focus { outline: 2px solid var(--cf-orange); border-color: transparent; }
.fp-row {
  display: block; padding: 10px 14px; font-size: 14px; color: var(--text);
  text-decoration: none; border-bottom: 1px solid var(--border); word-break: break-all;
}
.fp-row:last-child { border-bottom: none; }
.fp-row:hover { background: var(--bg); color: var(--cf-orange); }
