/* ============================================================
   mputraramadhani agents — Remote
   Editorial layout, menyelaraskan dengan style.css halaman unduhan.
   Ink + paper, flat, tanpa gradient/glow.
   ============================================================ */

:root {
  --paper: #f7f5f0;
  --paper-2: #efece4;
  --paper-3: #e7e3d8;
  --ink: #1c1a17;
  --ink-2: #3d3a34;
  --ink-3: #6b675e;
  --ink-4: #9a958a;
  --rule: #d8d3c6;
  --rule-strong: #b9b3a3;
  --navy: #1e3a5f;
  --navy-2: #2c5078;
  --navy-wash: #e6ebf0;
  --rust: #8a3b1c;
  --radius: 3px;
  --error: #8a3b1c;
  --ok: #2f6b3f;
  --wait: #8a6d1c;
  --font-serif: 'Iowan Old Style', 'Palatino Linotype', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171614;
    --paper-2: #1f1e1b;
    --paper-3: #272521;
    --ink: #ece8e0;
    --ink-2: #c8c3b8;
    --ink-3: #948e82;
    --ink-4: #6b665c;
    --rule: #35322c;
    --rule-strong: #4a463e;
    --navy: #7ba3cc;
    --navy-2: #9bbadd;
    --navy-wash: #20262e;
    --rust: #d08a63;
    --error: #d08a63;
    --ok: #7dbb8d;
    --wait: #d0b25f;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background .25s, color .25s;
}

#app { height: 100dvh; display: flex; flex-direction: column; }

.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small-text { font-size: 12px; }
.error { color: var(--error); font-size: 13px; }

/* ---- Header situs (mirror .nav index.html) ---- */

.remote-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 32px; height: 56px;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

.remote-brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none; font-weight: 600;
  font-family: var(--font-serif); font-size: 16px; letter-spacing: -.01em;
  min-width: 0;
}

.remote-brand img { width: 26px; height: 26px; border-radius: 2px; object-fit: cover; border: 1px solid var(--rule); }

.remote-brand em {
  font-style: italic; font-weight: 600; font-size: 15px;
  color: var(--rust); margin-left: 1px;
}

.remote-back {
  font-size: 13px; font-weight: 500;
  color: var(--navy); text-decoration: none;
  white-space: nowrap; margin-right: 8px;
}

.remote-back:hover { color: var(--rust); text-decoration: underline; }

/* ---- Panel (login / pairing / kicked) ---- */

.view { width: 100%; }

.glass {
  max-width: 420px;
  height: fit-content;
  margin: auto;
  padding: 32px 30px;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0 var(--rule);
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}

.brand h1 { margin: 10px 0 2px; font-size: 22px; font-family: var(--font-sans); font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.brand h2 { margin: 10px 0 2px; font-size: 18px; font-weight: 600; color: var(--ink); letter-spacing: -.015em; }
.brand .sub {
  margin: 0; color: var(--ink-4); font-size: 10px;
  font-family: var(--font-mono); letter-spacing: .18em; text-transform: uppercase;
  margin-top: 4px;
}

.brand-logo {
  width: 52px; height: 52px;
  margin: 0 auto;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-weight: 700; font-size: 20px;
  border: 1px solid var(--ink);
}

#login-form { display: flex; flex-direction: column; gap: 6px; text-align: left; }
#login-form label { font-size: 12px; color: var(--ink-3); margin-top: 6px; }

input, textarea {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  color: var(--ink-2);
  padding: 10px 12px;
  font: inherit;
  outline: none;
  transition: border-color .15s;
}

input:focus, textarea:focus { border-color: var(--ink); }

#code-input {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 26px;
  letter-spacing: 10px;
  text-transform: uppercase;
  padding: 12px 4px 12px 14px;
}

button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }

button.primary, button.secondary, button.link { border-radius: var(--radius); }

button.primary {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: 11px 18px;
  font-weight: 600;
  transition: background .15s, border-color .15s;
}

button.primary:hover { background: var(--navy); border-color: var(--navy); }
button.primary:disabled { opacity: .55; cursor: default; }

button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  padding: 10px 16px;
  font-weight: 500;
  transition: background .15s, border-color .15s;
}

button.secondary:hover { background: var(--paper-3); border-color: var(--ink); }
button.secondary.small { padding: 6px 12px; font-size: 12px; }

button.link {
  background: none; border: none; color: var(--navy);
  padding: 4px; font-size: 13px; font-weight: 500;
}

button.link:hover { color: var(--rust); text-decoration: underline; }

/* ---- Tampilan chat ---- */

#view-chat {
  display: flex; flex-direction: column;
  max-width: 860px; margin: 0 auto;
  width: 100%;
  flex: 1;
  min-height: 0;
}

#chat-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
  background: var(--paper-2);
}

.brand-inline { font-family: var(--font-serif); font-weight: 600; font-size: 16px; color: var(--ink); letter-spacing: -.01em; }
.brand-inline span { color: var(--rust); font-weight: 600; font-size: 15px; }
.head-left { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.head-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.status { font-size: 12px; font-family: var(--font-mono); }
.status::before { content: "●"; margin-right: 5px; }
.status.online { color: var(--ok); }
.status.offline { color: var(--ink-4); }
.status.waiting { color: var(--wait); }

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 32px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: var(--radius);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
}

.msg.user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--paper);
}

.msg.assistant {
  align-self: flex-start;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  color: var(--ink-2);
}

.msg.pending { opacity: .55; }
.msg .meta { display: block; margin-top: 5px; font-size: 10px; opacity: .75; font-family: var(--font-mono); }

.tool-line { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.tool-chip {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-4);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.msg.user .tool-chip { border-color: rgba(255, 255, 255, .35); color: rgba(255, 255, 255, .85); }

.empty-note { margin: auto; color: var(--ink-4); text-align: center; padding: 30px; font-size: 14px; }

#composer {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 12px 32px calc(14px + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: 1px solid var(--ink);
}

#compose { resize: none; max-height: 130px; }

@media (max-width: 768px) {
  .remote-top { padding: 0 18px; height: 54px; }
  .remote-brand { font-size: 14px; }
  #chat-header { padding: 10px 18px; }
  #messages { padding: 16px 18px 8px; }
  #composer { padding: 10px 18px calc(12px + env(safe-area-inset-bottom)); }
}

@media (max-width: 480px) {
  .glass { margin: 14px; padding: 24px 18px; }
  .msg { max-width: 92%; }
  .remote-brand { font-size: 13px; }
  .remote-brand em { font-size: 13px; }
  .remote-back { font-size: 12px; }
}