:root {
  --bg: #f6f3ee; --panel: #ffffff; --ink: #1f1b16; --muted: #6f665c; --line: #e4ddd2;
  --wood: #8a5a2b; --wood-dark: #6b4420; --wood-soft: #f1e6d8;
  --ok: #2f7d4f; --warn: #b26b00; --bad: #b3261e; --me: #8a5a2b; --them: #ffffff;
  --radius: 14px; --shadow: 0 8px 30px rgba(40, 28, 15, .12);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 10px; padding: 8px 14px; }
button:hover { border-color: var(--wood); }
button.primary { background: var(--wood); border-color: var(--wood); color: #fff; }
button.primary:hover { background: var(--wood-dark); }
button.danger { color: var(--bad); }
button.danger.filled { background: var(--bad); border-color: var(--bad); color: #fff; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--wood-soft); border-color: var(--wood); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px;
  background: var(--wood-soft); color: var(--wood-dark); }
.pill.ok { background: #e3f1e8; color: var(--ok); }
.pill.warn { background: #fdf0dc; color: var(--warn); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.hidden { display: none !important; }

/* Chatt */
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 78%; padding: 9px 13px; border-radius: 16px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.msg.mine { align-self: flex-end; background: var(--me); color: #fff; border-bottom-right-radius: 4px; }
.msg.theirs { align-self: flex-start; background: var(--them); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.system { align-self: center; background: transparent; box-shadow: none; color: var(--muted); font-size: 13px; }
.msg .meta { font-size: 11px; opacity: .75; margin-top: 4px; display: flex; gap: 8px; }
.msg .meta button { all: unset; cursor: pointer; text-decoration: underline; }
.msg .orig { font-size: 13px; opacity: .85; border-top: 1px solid rgba(127,127,127,.3); margin-top: 6px; padding-top: 6px; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--panel); }
.composer textarea { flex: 1; resize: none; height: 44px; }
.typing { font-size: 12px; color: var(--muted); padding: 0 16px 6px; min-height: 18px; }

/* Samtal */
.call { background: #15110d; color: #fff; display: grid; gap: 6px; padding: 6px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.call .tile { position: relative; background: #2a231c; border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 10; display: grid; place-items: center; }
.call .tile.big { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.call video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.call .label { position: absolute; left: 8px; bottom: 6px; font-size: 12px; background: rgba(0,0,0,.55); padding: 2px 8px; border-radius: 6px; }
.call .avatar { font-size: 28px; opacity: .8; }
.callbar { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px; background: #15110d; }
.callbar button { background: #2a231c; color: #fff; border-color: #3a3027; }
.callbar button.on { background: var(--wood); border-color: var(--wood); }
.banner { padding: 10px 14px; background: var(--wood-soft); color: var(--wood-dark); font-size: 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.banner.warn { background: #fdf0dc; color: var(--warn); }
.call .avatarimg { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 3px solid var(--wood); }
.modal-back { position: fixed; inset: 0; background: rgba(20,14,8,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); width: min(720px, 100%); max-height: 90vh; overflow: auto; padding: 22px; }
.modal h2 { margin: 0 0 14px; font-size: 20px; }
.modal table { width: 100%; border-collapse: collapse; font-size: 14px; }
.modal td, .modal th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.modal .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--wood-soft); display: inline-grid; place-items: center; font-size: 13px; color: var(--wood-dark); font-weight: 600; flex: none; }
.call .tile .tools { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.call .tile:hover .tools, .call .tile:focus-within .tools { opacity: 1; }
@media (hover: none) { .call .tile .tools { opacity: 1; } }
.call .tile .tools button { background: rgba(0,0,0,.6); color: #fff; border: 0; padding: 4px 8px; border-radius: 7px; font-size: 15px; line-height: 1; }
.call.focus { display: flex; flex-direction: column; grid-template-columns: none; }
.call.focus .tile.big { aspect-ratio: auto; height: min(72vh, 900px); }
.call .strip { display: flex; gap: 6px; overflow-x: auto; }
.call .tile.mini { flex: 0 0 160px; aspect-ratio: 16 / 10; }
.call .tile.mini .avatarimg { width: 44px; height: 44px; }
.call .tile:fullscreen { background: #000; border-radius: 0; }
.call .tile:fullscreen video { width: 100vw; height: 100vh; }
.call .tile:fullscreen .tools { opacity: 1; }
.call { position: relative; }
.call .caption { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); max-width: 92%; background: rgba(0,0,0,.72);
  color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 15px; line-height: 1.35; text-align: center; z-index: 2; pointer-events: none; }
.callbar .xlate { color: #b9e6c6; font-size: 13px; align-self: center; margin-left: auto; }
.callbar .xlate.bad { color: #ffcf8a; }
