@import url("pages.css");
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, sans-serif; background: #1f1e1e; color: #faf9f5; }
.hidden { display: none !important; }

.login { display: flex; align-items: center; justify-content: center; height: 100vh; }
.loginbox { background: #262624; padding: 32px; border-radius: 12px; width: 320px; display: flex; flex-direction: column; gap: 10px; }
.loginbox h1 { margin: 0 0 4px; font-size: 22px; }
.sub { color: #a8a29e; margin: 0 0 8px; font-size: 13px; }

input, textarea, select, button {
  font: inherit; background: #35342f; color: #faf9f5; border: 1px solid #4a4843;
  border-radius: 8px; padding: 8px 10px; width: 100%;
}
textarea { font-family: ui-monospace, monospace; font-size: 12px; min-height: 80px; resize: vertical; }
button { cursor: pointer; background: #d97757; border-color: #d97757; font-weight: 600; }
button:hover { filter: brightness(1.1); }
button:disabled { opacity: .5; cursor: default; filter: none; }
button.ghost { background: transparent; border: 1px solid #4a4843; color: #a8a29e; }
button.mini { padding: 3px 8px; font-size: 12px; width: auto; }
button.danger { background: #7c3a3a; border-color: #7c3a3a; }
button.ok { background: #3f6d4e; border-color: #3f6d4e; }
.row { display: flex; gap: 8px; }
.err { color: #e5989a; font-size: 13px; min-height: 16px; }

.app { display: flex; height: 100vh; }

main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.modelbar { display: flex; gap: 8px; padding: 10px 16px; background: #262624; }
.modelbar select { width: 160px; }
.modelbar input { flex: 1; }
#pendingbar { padding: 6px 16px; background: #3a2f22; font-size: 13px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pending { display: flex; gap: 6px; align-items: center; }
.pending code { font-size: 12px; }

#chat { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 76ch; line-height: 1.5; white-space: pre-wrap; font-size: 14px; }
.msg.user { align-self: flex-end; background: #3a3937; padding: 10px 14px; border-radius: 14px 14px 4px 14px; }
.msg.assistant { align-self: flex-start; }
.tool { align-self: stretch; max-width: 100%; background: #232220; border: 1px solid #3a3937; border-left: 3px solid #d97757; border-radius: 8px; overflow: hidden; }
.toolhead { display: flex; gap: 10px; align-items: center; padding: 8px 12px; background: #2b2a27; font-size: 13px; flex-wrap: wrap; }
.toolname { color: #d97757; font-family: ui-monospace, monospace; }
.toolhead code { font-family: ui-monospace, monospace; color: #e8e3da; overflow-wrap: anywhere; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #4a4843; text-transform: uppercase; }
.badge.ok { background: #3f6d4e; }
.badge.error { background: #7c3a3a; }
.badge.pending { background: #a3762c; }
.badge.denied { background: #55524d; }
.tool pre { margin: 0; padding: 10px 12px; font-size: 12.5px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; max-height: 340px; overflow-y: auto; }
.whotag { font-size: 11px; font-weight: 700; color: #d97757; margin-right: 8px; text-transform: uppercase; letter-spacing: .5px; }
.wbtns { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.wtable { border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.wtable th, .wtable td { border: 1px solid #3a3937; padding: 4px 10px; text-align: left; }
.wtable th { background: #2b2a27; color: #a8a29e; text-transform: uppercase; font-size: 11px; }
.thinking { color: #a8a29e; font-style: italic; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.formerr { color: #e5989a; font-size: 13px; }

#chatform { display: flex; gap: 8px; padding: 12px 16px; background: #262624; }
#chatform input { flex: 1; }
#chatform button { width: auto; padding: 8px 18px; }

.pwwrap { position: relative; display: block; }
.pwwrap input { padding-right: 30px; }
.eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; padding: 0; background: transparent; border: none;
  color: #a8a29e; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.eye:hover { color: #e8e3da; }
.eye svg { width: 15px; height: 15px; display: block; }

.item { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.healthbox { display: flex; gap: 10px; align-items: center; font-size: 12.5px;
  color: #a8a29e; padding: 8px 4px; border-bottom: 1px solid #323130; flex-wrap: wrap; }
.item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 800px) {
  .msg { max-width: 92%; }
  #chat { padding: 12px; }
  .tool pre { font-size: 12px; }
  .loginbox { width: min(88vw, 320px); }
}