:root{
  --bg:#f6f8fb;
  --card:#ffffff;
  --accent:#0b63d6;
  --muted:#6b7280;
  --radius:10px;
}

/* Base */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:Inter,system-ui,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg);
  color:#0f172a;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

/* Container */
.container{
  max-width:980px;
  margin:28px auto;
  padding:20px;
  background:var(--card);
  border-radius:var(--radius);
  box-shadow:0 8px 30px rgba(2,6,23,0.06);
}

/* Header */
.header h1{margin:0;font-size:20px}
.subtitle{margin:6px 0 18px;color:var(--muted);font-size:13px}

/* Controls */
.controls{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:12px}
.file-label{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:8px;
  background:#f1f5f9;
  cursor:pointer;
  border:1px dashed #e6eef8;
}
.file-label input[type=file]{display:none}
.file-text{font-size:14px;color:#0f172a}

/* Buttons */
.buttons{display:flex;gap:8px;flex-wrap:wrap}
.btn{
  border:0;
  padding:8px 12px;
  border-radius:8px;
  cursor:pointer;
  background:#e6eef8;
  color:#0b1724;
  font-weight:600;
}
.btn.primary{background:var(--accent);color:#fff}
.btn:disabled{opacity:.6;cursor:not-allowed}

/* Status row */
.status-row {
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
  margin-top:12px;
  flex-wrap:wrap;
}

.progress-wrap {
  display:flex;
  gap:10px;
  align-items:center;
  flex:1 1 420px;
  min-width:220px;
}

.progress {
  flex:1;
  height:12px;
  background:linear-gradient(180deg,#eef6ff,#f8fbff);
  border-radius:999px;
  border:1px solid rgba(11,99,214,0.08);
  overflow:hidden;
  box-shadow:inset 0 1px 0 rgba(255,255,255,0.6);
}

.progress-bar {
  height:100%;
  width:0%;
  background:linear-gradient(90deg,#0b63d6,#0a58c7);
  transition:width 280ms ease;
  border-radius:999px;
}

.progress-label {
  min-width:120px;
  font-size:13px;
  color:#0b1724;
  font-weight:600;
}

.persistent-status {
  background:#f1f5f9;
  padding:8px 12px;
  border-radius:8px;
  border:1px solid #e6eef8;
  color:#0b1724;
  font-size:13px;
  flex:0 0 auto;
}

/* Output */
.output{margin-top:8px}
.label{display:block;margin-bottom:6px;font-weight:700}
textarea#md{
  width:100%;
  min-height:56vh;
  max-height:78vh;
  padding:12px;
  border-radius:8px;
  border:1px solid #e6eef8;
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;
  font-size:13px;
  line-height:1.5;
  resize:vertical;
  background:#fbfdff;
  color:#0b1724;
}

/* Toasts */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0b63d6;
  color: #fff;
  padding: 10px 12px;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(11,99,214,0.18);
  font-size: 14px;
  line-height: 1.2;
  opacity: 0;
  transform: translateY(8px);
  animation: toast-in .18s ease-out forwards;
}

.toast.success { background: linear-gradient(90deg,#0b63d6,#0a58c7); }
.toast.info    { background: linear-gradient(90deg,#0b63d6,#0a58c7); }
.toast.warn    { background: linear-gradient(90deg,#d97706,#b45309); }

.toast .msg { flex: 1; }
.toast .close {
  background: transparent;
  border: 0;
  color: rgba(255,255,255,0.95);
  font-weight: 700;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(.995); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Responsive */
@media(max-width:640px){
  .controls{flex-direction:column;align-items:stretch}
  .buttons{width:100%}
  .btn{flex:1}
  .status-row { flex-direction:column; align-items:stretch; gap:8px; }
  .progress-label { min-width:unset; }
  .persistent-status { width:100%; text-align:left; }
}
