:root {
  /* фирменные цвета Lazerhouse (laserhouse.com.ua) */
  --bg: #ffffff; --bg2: #f7f7f8; --text: #131313; --muted: #6e6e80;
  --border: #e6e3e5; --accent: #ff2a59; --accent2: #e72e5c;
  --brand-yellow: #fdcd00;
  --sidebar-bg: #221419; --sidebar-text: #f5e9ee; --sidebar-muted: #b99aa8;
  --user-bubble: #ffeff3; --err: #b3261e;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: var(--bg);
}
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

/* ---------- login ---------- */
.login-wrap { min-height: 100%; display: flex; align-items: center; justify-content: center; background: var(--bg2); }
.login-card { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 36px 32px; width: 360px; max-width: calc(100vw - 32px); box-shadow: 0 8px 30px rgba(0,0,0,.06); }
.login-card h1 { margin: 0 0 4px; font-size: 22px; text-align: center; }
.login-card .sub { color: var(--muted); margin: 0 0 22px; font-size: 13.5px; text-align: center; }
.login-logo { display: block; width: 240px; max-width: 100%; margin: 0 auto 18px; }
.brand-chip { display: block; background: #fff; border-radius: 10px; padding: 8px 10px; }
.brand-chip img { display: block; width: 100%; height: auto; }
.hint-logo { width: 240px; max-width: 70vw; height: auto; margin-bottom: 6px; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 10px 16px; }
.btn:hover { background: var(--accent2); }
.btn.full { width: 100%; margin-top: 18px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--bg2); }
.btn.danger { background: transparent; color: var(--err); border: 1px solid var(--border); }
.error-line { color: var(--err); font-size: 13.5px; min-height: 18px; margin-top: 10px; }

/* ---------- chat layout ---------- */
.app { display: flex; height: 100dvh; }
.sidebar { width: 264px; flex: 0 0 264px; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; }
.sidebar .top { padding: 12px; }
.new-chat { width: 100%; background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 10px; text-align: left; font-weight: 600; }
.new-chat:hover { background: var(--accent2); }
.conv-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
.conv-item { display: flex; align-items: center; gap: 6px; padding: 9px 10px; border-radius: 8px; color: var(--sidebar-text); font-size: 13.5px; cursor: pointer; white-space: nowrap; overflow: hidden; }
.conv-item .t { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.conv-item:hover { background: #33202a; }
.conv-item.active { background: #432935; }
.conv-item .del { visibility: hidden; background: none; border: 0; color: var(--sidebar-muted); padding: 2px 4px; border-radius: 4px; }
.conv-item:hover .del { visibility: visible; }
.conv-item .del:hover { color: #fff; background: #5a3242; }
.sidebar .bottom { border-top: 1px solid #3a2530; padding: 10px 12px; font-size: 13px; }
.sidebar .bottom .who { color: var(--sidebar-muted); margin-bottom: 8px; }
.sidebar .bottom a, .sidebar .bottom button.linkish { color: var(--sidebar-text); background: none; border: 0; padding: 4px 0; display: block; text-decoration: none; font-size: 13px; }
.sidebar .bottom a:hover, .sidebar .bottom button.linkish:hover { color: #fff; text-decoration: underline; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: none; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.burger { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; }
.chat-scroll { flex: 1; overflow-y: auto; }
.chat-inner { max-width: 780px; margin: 0 auto; padding: 24px 18px 10px; }
.empty-hint { text-align: center; color: var(--muted); margin-top: 18vh; }
.empty-hint .logo { font-size: 40px; }
.empty-hint h2 { font-weight: 600; color: var(--text); }

.msg { margin: 0 0 18px; }
.msg .role { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.msg.user .body { background: var(--user-bubble); border-radius: 12px; padding: 10px 14px; display: inline-block; max-width: 100%; white-space: pre-wrap; }
.msg.user { text-align: right; }
.msg.user .role { display: none; }
.msg.assistant .body { padding: 2px 0; }
.msg.assistant .body > *:first-child { margin-top: 0; }
.msg .body pre { background: #f4f4f6; border: 1px solid var(--border); border-radius: 8px; padding: 10px; overflow-x: auto; font-size: 13px; }
.msg .body code { background: #f4f4f6; border-radius: 4px; padding: 1px 4px; font-size: 13px; }
.msg .body pre code { background: none; padding: 0; }
.msg .body table { border-collapse: collapse; display: block; overflow-x: auto; }
.msg .body th, .msg .body td { border: 1px solid var(--border); padding: 5px 9px; }
.msg .body img { max-width: 100%; }
.msg .body a { color: var(--accent); }
.msg.error .body { color: var(--err); background: #fdeceb; border-radius: 10px; padding: 10px 14px; }
.status-line { color: var(--muted); font-size: 13.5px; padding: 4px 0 14px; display: flex; gap: 8px; align-items: center; }
.status-line .dots::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.yt-embed { margin: 10px 0; }
.yt-embed iframe { width: 100%; max-width: 560px; aspect-ratio: 16/9; border: 0; border-radius: 10px; }

.composer { border-top: 1px solid var(--border); background: var(--bg); }
.composer-inner { max-width: 780px; margin: 0 auto; padding: 12px 18px 6px; }
.composer-box { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--border); border-radius: 14px; padding: 8px 10px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.composer-box textarea { flex: 1; border: 0; resize: none; outline: none; max-height: 180px; background: transparent; padding: 4px; }
.send-btn { background: var(--accent); border: 0; color: #fff; border-radius: 9px; width: 36px; height: 36px; font-size: 16px; flex: 0 0 36px; }
.send-btn:disabled { background: #f5b9c8; cursor: default; }
.composer .note { text-align: center; color: var(--muted); font-size: 11.5px; padding: 6px 0 8px; }

/* ---------- admin ---------- */
.admin-wrap { max-width: 900px; margin: 0 auto; padding: 24px 18px 80px; }
.admin-wrap h1 { font-size: 22px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-wrap h1 .spacer { flex: 1; }
.card { border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin: 14px 0; }
.card h2 { font-size: 16px; margin: 0 0 10px; }
.section-block { border: 1px solid var(--border); border-radius: 10px; margin: 10px 0; }
.section-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--bg2); border-radius: 10px 10px 0 0; }
.section-head .name { font-weight: 600; flex: 1; }
.kind-title { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 10px 14px 2px; }
.item-row { display: flex; align-items: center; gap: 8px; padding: 5px 14px; font-size: 14px; }
.item-row .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-row a { color: var(--accent); font-size: 12.5px; }
.item-row .x { background: none; border: 0; color: var(--muted); font-size: 15px; padding: 1px 6px; border-radius: 5px; }
.item-row .x:hover { color: var(--err); background: #fdeceb; }
.add-forms { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px 14px; border-top: 1px dashed var(--border); margin-top: 8px; }
.add-forms input[type=text], .add-forms input[type=url] { padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; min-width: 240px; }
.mini-btn { background: var(--bg2); border: 1px solid var(--border); border-radius: 7px; padding: 7px 12px; font-size: 13.5px; }
.mini-btn:hover { background: #ececf1; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select, .inline-form textarea { padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; }
table.users { width: 100%; border-collapse: collapse; font-size: 14px; }
table.users th, table.users td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); }
.tag { font-size: 11.5px; border-radius: 20px; padding: 2px 9px; background: var(--bg2); border: 1px solid var(--border); }
.tag.admin { background: #fff6d6; border-color: var(--brand-yellow); color: #8a6d00; }
.tag.off { color: var(--err); }
.flash { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: #1f1f24; color: #fff; border-radius: 10px; padding: 10px 18px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s; max-width: 90vw; z-index: 50; }
.flash.on { opacity: .96; }
textarea.wide { width: 100%; min-height: 80px; }

@media (max-width: 760px) {
  .sidebar { position: fixed; z-index: 30; height: 100dvh; left: -270px; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .topbar { display: flex; }
}
