:root{
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border:#e5e7eb;
  --shadow: 0 14px 40px rgba(2,6,23,.10);
  --radius: 18px;
  --accent:#5b7cfa;
  --accent2:#22c3ee;
  --danger:#ef4444;
  --warn:#f59e0b;
  --ok:#16a34a;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: var(--text);
  background:
    radial-gradient(900px 600px at 10% 10%, rgba(91,124,250,.18), transparent 55%),
    radial-gradient(900px 600px at 90% 20%, rgba(34,195,238,.12), transparent 55%),
    var(--bg);
}

/* Header */
.topbar{
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 14px 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.brand{display:flex; align-items:center; gap:12px;}
.logo{
  width:42px; height:42px; border-radius:14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 14px 30px rgba(91,124,250,.25);
}
.brandText h1{margin:0; font-size: 18px; font-weight: 850; letter-spacing:.2px;}
.brandText p{margin:4px 0 0; font-size: 12.5px; color: var(--muted);}

.topActions{display:flex; gap:10px;}
.iconBtn{
  width:44px; height:44px;
  border-radius: 14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.75);
  cursor:pointer;
  box-shadow: 0 8px 18px rgba(2,6,23,.06);
  transition: transform .12s ease, background .12s ease;
}
.iconBtn:hover{transform: translateY(-1px); background:#fff}

/* Layout */
.wrap{
  max-width:1100px;
  margin: 0 auto;
  padding: 10px 14px 70px;
  display:grid;
  grid-template-columns: 1.15fr .85fr;
  gap:14px;
}
@media (max-width: 900px){
  .wrap{grid-template-columns: 1fr;}
}

.panel{
  background: var(--card);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.panelHead{
  padding: 14px 16px;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.panelHead h2{margin:0; font-size: 15.5px;}
.muted{color: var(--muted); font-size: 12.5px; margin: 4px 0 0;}
.status{display:flex; gap:8px; align-items:center; flex-wrap:wrap;}
.panelBody{padding: 14px 16px;}

textarea{
  width:100%;
  min-height: 190px;
  resize: vertical;
  padding: 12px 12px;
  border-radius: 16px;
  border:1px solid var(--border);
  background: #fbfbfe;
  color: var(--text);
  outline:none;
  font-size: 14.5px;
  line-height: 1.5;
}
textarea:focus{
  border-color: rgba(91,124,250,.55);
  box-shadow: 0 0 0 4px rgba(91,124,250,.16);
}

.row{
  margin-top: 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}
.rowLeft,.rowRight{display:flex; gap:10px; align-items:center; flex-wrap:wrap;}

.btn{
  border:1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
  cursor:pointer;
  font-weight: 750;
  box-shadow: 0 8px 16px rgba(2,6,23,.06);
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.btn:hover{transform: translateY(-1px); background:#fff;}
.btn.primary{
  border-color: rgba(91,124,250,.55);
  background: linear-gradient(135deg, rgba(91,124,250,.16), rgba(34,195,238,.12));
}
.btn.danger{
  border-color: rgba(239,68,68,.45);
  background: rgba(239,68,68,.07);
}

.pill{
  padding: 7px 10px;
  border-radius: 999px;
  border:1px solid var(--border);
  background: #fff;
  font-size: 12.5px;
  color: var(--muted);
}
.pill.subtle{background:#fbfbfe;}
.pill.warn{border-color: rgba(245,158,11,.45); color: #b45309; background: rgba(245,158,11,.12);}
.pill.ok{border-color: rgba(22,163,74,.35); color: #166534; background: rgba(22,163,74,.10);}

/* Results */
.results{
  margin-top: 12px;
  display:grid;
  gap: 10px;
}
.result{
  border:1px solid var(--border);
  background: #fbfbfe;
  border-radius: 16px;
  padding: 12px 12px;
  cursor:pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.result:hover{
  transform: translateY(-1px);
  border-color: rgba(91,124,250,.45);
  background: #ffffff;
}
.resultTop{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}
.resultText{
  font-size: 14.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* History */
.historyList{
  display:flex;
  flex-direction:column;
  gap:10px;
  max-height: 560px;
  overflow:auto;
  padding-right: 4px;
}
.histItem{
  border:1px solid var(--border);
  background: #fbfbfe;
  border-radius: 16px;
  padding: 10px 12px;
  cursor:pointer;
  transition: transform .12s ease, background .12s ease;
}
.histItem:hover{transform: translateY(-1px); background:#fff;}
.histTop{display:flex; justify-content:space-between; gap:10px; margin-bottom:6px;}
.histTop strong{font-size: 13px;}
.time{font-size: 12px; color: var(--muted);}
.snip{
  font-size: 13px;
  color: rgba(15,23,42,.9);
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

/* Modal */
.modalWrap{
  position:fixed; inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding: 16px;
  background: rgba(2,6,23,.35);
  z-index: 50;
}
.modal{
  width:min(720px, 96vw);
  border-radius: 22px;
  background:#fff;
  border:1px solid var(--border);
  box-shadow: 0 30px 80px rgba(2,6,23,.25);
  overflow:hidden;
}
.modalHead{
  padding: 14px 16px;
  border-bottom:1px solid var(--border);
  display:flex;
  justify-content:space-between;
  gap:10px;
}
.modalHead h3{margin:0; font-size: 16px;}
.modalBody{padding: 14px 16px;}
.field{display:flex; flex-direction:column; gap:6px; margin: 8px 0 12px;}
.field span{font-size: 12.5px; color: var(--muted);}
.field input{
  border-radius: 14px;
  border:1px solid var(--border);
  padding: 10px 12px;
  outline:none;
  font-size: 14px;
  background:#fbfbfe;
}
.field input:focus{
  border-color: rgba(91,124,250,.55);
  box-shadow: 0 0 0 4px rgba(91,124,250,.16);
}
.modalRow{display:flex; gap:10px; align-items:center; flex-wrap:wrap;}
.link{color: var(--accent); font-weight: 700; text-decoration:none;}
.link:hover{text-decoration:underline;}
.note{font-size: 12.5px; color: var(--muted); margin-top: 10px; line-height: 1.4;}

/* Toast */
.toast{
  position:fixed;
  left:50%;
  bottom: 16px;
  transform: translateX(-50%);
  display:none;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(15,23,42,.90);
  color: white;
  border:1px solid rgba(255,255,255,.18);
  z-index: 60;
}
