@font-face { font-family: ui-sans; src: local("Inter"), local("Segoe UI"), local("system-ui"); }

:root {
  --bg: #0b0f14;
  --surface: #0f141b;
  --surface-2: #131a23;
  --border: #1f2a36;
  --text: #e6e9ee;
  --muted: #9aa6b2;
  --accent: #5b7cfa;
  --danger: #ef5350;
  --ring: #7aa2ff40;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: ui-sans, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  background-image: url("background.png");
  background-size:     cover;                      /* <------ */
  background-repeat:   no-repeat;
  background-position: center center;
}
.bg { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: rgba(15,20,27,.8); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.brand { color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: .3px; font-size: 18px; }
.brand-icon { width: 36px; height: 36px; vertical-align: -9px; margin-right: 8px; filter: drop-shadow(0 1px 0 rgba(0,0,0,.2)); }
nav a { color: var(--muted); text-decoration: none; margin-left: 14px; }
nav a:hover { color: var(--text); }
nav a.btn { margin-left: 16px; }

.container { max-width: 980px; margin: 24px auto 64px; padding: 0 16px; }
.hero { text-align: center; padding: 64px 0 24px; }
.title { font-size: clamp(28px, 5.5vw, 48px); margin: 0 0 6px; letter-spacing: -0.02em; }
.subtitle { color: var(--muted); margin-top: 8px; font-size: 16px; }
.cta { margin-top: 22px; display:flex; gap:10px; justify-content:center; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
  margin-top: 22px;
}
.panel.center { text-align: center; }

.btn {
  appearance: none; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); padding: 10px 14px; border-radius: 10px;
  cursor: pointer; transition: background .15s ease, transform .06s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover { background: #17202b; border-color: #223142; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #0b0f14; border-color: transparent; }
.btn.primary:hover { background: #6a88ff; }
.btn.danger { background: var(--danger); color: #0b0f14; border-color: transparent; }

label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 13px; }
input[type=text], input[type=password], input[type=number], textarea, input.mono {
  width: 100%; padding: 12px 12px; border-radius: 10px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); outline: none; transition: box-shadow .15s, border-color .15s;
}
input:focus, textarea:focus { border-color: #28415f; box-shadow: 0 0 0 6px var(--ring); }
textarea { min-height: 160px; resize: vertical; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .grid.two { grid-template-columns: 1fr; } }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.hint { padding: 10px 12px; background: #0f1a27; border: 1px solid #1e2a39; border-radius: 10px; margin: 8px 0 16px; color: #bdd2ff; }

.footer { display: flex; justify-content: space-between; align-items: center; opacity: .65; font-size: 12px; padding: 20px; border-top: 1px solid var(--border); }

.list { display: grid; gap: 10px; }
.item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.item-title { font-weight: 600; margin-bottom: 4px; }

.switch { display: inline-flex; align-items: center; gap: 8px; }

.token-box { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-family: ui-monospace, monospace; word-break: break-all; }
.hidden { display: none; }

/* Fancy dropzone */
.dropzone { position: relative; display: block; border: 1.5px dashed var(--border); border-radius: 12px; background: var(--surface-2); padding: 18px; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone:focus { border-color: #2a3a4d; background: #131b25; outline: none; }
.dropzone.dragover { border-color: var(--accent); background: #131e2e; }
.dz-inner { display: flex; align-items: center; gap: 12px; }
.dz-icon { font-size: 20px; opacity: .9; }
.dz-text { color: var(--muted); }
.dz-file { margin-left: auto; }

/* Fancy datetime input */
.dt-field { position: relative; }
.dt-input { padding-left: 36px; }
.dt-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); opacity: .8; pointer-events: none; }

/* Chat layout */
.chat-layout { display: grid; grid-template-columns: 280px 1fr; height: 70vh; }
.panel .chat-layout { height: 70vh; }
@media (max-width: 920px) { .chat-layout { grid-template-columns: 1fr; } .chat-sidebar { position: absolute; width: 260px; z-index:11; transform: translateX(-100%); transition: transform .2s; } .chat-sidebar.open { transform: translateX(0); } }
.chat-sidebar { border-right: 1px solid var(--border); background: var(--surface-2); display:flex; flex-direction:column; min-height: 0; }
.chat-sidebar-head, .chat-sidebar-foot { padding: 12px; border-bottom: 1px solid var(--border); }
.chat-sidebar-foot { border-top: 1px solid var(--border); border-bottom: 0; margin-top: auto; }
.chat-list { overflow-y: auto; height: 100%; }
.chat-item { display:flex; align-items:center; gap:10px; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.chat-item:hover { background: #0f141c; }
.chat-avatar { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); }
.chat-find { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.find-row { display:flex; gap:8px; align-items:center; }
.find-results { max-height: 160px; overflow-y:auto; padding-top: 8px; }
.find-item { display:flex; align-items:center; gap:8px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.pending-box { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.pending-item { display:flex; align-items:center; gap:8px; padding:6px 0; }
.chat-main { display:flex; flex-direction:column; height: 100%; min-height: 0; }
.chat-top { display:flex; align-items:center; justify-content:space-between; gap:10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.chat-tools { display:flex; gap:8px; align-items:center; }
.chat-messages { flex:1; overflow-y:auto; padding: 12px 14px; display: grid; gap: 8px; min-height: 0; }
.msg { max-width: 68%; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--border); }
.msg.me { justify-self: end; background: #1c2836; }
.msg.them { justify-self: start; background: #141c26; }
.msg .time { color: var(--muted); font-size: 12px; margin-top: 4px; }
.chat-input { border-top: 1px solid var(--border); padding: 10px 12px; }

/* Global chat drawer */
.chat-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 80; display: none; }
.chat-overlay.show { display: block; }
.chat-drawer { position: fixed; z-index: 90; left: 0; top: 0; bottom: 0; width: 320px; max-width: 90vw; background: var(--surface-2); border-right: 1px solid var(--border); transform: translateX(-100%); transition: transform .2s ease; display:flex; flex-direction:column; }
.chat-drawer.open { transform: translateX(0); }
.chat-mini { display: flex; flex-direction: column; }
