:root {
  --accent: #1A6AFF;
  --accent-soft: rgba(26, 106, 255, 0.25);
  --bg: #0b1220;
  --bg-grad-from: #1a2a4a;
  --panel: #121a2b;
  --text: #e8eefc;
  --muted: #8b9bb8;
  --ok: #22c55e;
  --off: #64748b;
  --danger: #ef4444;
  --border: #243049;
  --input-bg: #0e1626;
  --topbar-bg: rgba(18, 26, 43, 0.85);
  --tab-active-bg: #13233f;
  --banner-bg: #13233f;
  --code-bg: #0e1626;
  --code-fg: #c6d4f0;
  --md-body: #d5def0;
  --md-th-bg: #13233f;
  --chat-thread-bg: #0a1220;
  --chat-msg-bg: #152038;
  --chat-msg-mine-bg: #1a3a6e;
  --chat-msg-mine-border: #2a5cb0;
  --chat-msg-assistant-bg: #13233f;
  --chat-mine-author: #9ec1ff;
  --chat-body-fg: #e2eaf8;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-card: 14px;
  --font: "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Segoe UI Mono", Menlo, Consolas, monospace;
  --space: 1.25rem;
  --card-gap: 1rem;
  --card-min: 260px;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  font-family: var(--font);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 10% -10%, var(--bg-grad-from) 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  font-family: var(--font);
}
.hidden { display: none !important; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space);
}
.login-panel {
  max-width: 400px;
  margin: 8vh auto;
  text-align: center;
}

/* Login: white page (independent of dark admin theme) */
body:has(#login-view:not(.hidden)) {
  background: #ffffff;
  color: #1a2332;
}
body:has(#login-view:not(.hidden)) #login-view.login-panel {
  background: #ffffff;
  border: 1px solid #e5e9f0;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
  color: #1a2332;
}
body:has(#login-view:not(.hidden)) #login-view .tagline,
body:has(#login-view:not(.hidden)) #login-view label {
  color: #64748b;
}
body:has(#login-view:not(.hidden)) #login-view input {
  background: #ffffff;
  color: #1a2332;
  border-color: #d0d7e2;
}
body:has(#login-view:not(.hidden)) #login-view input:focus {
  outline: 2px solid rgba(26, 106, 255, 0.35);
  border-color: #1A6AFF;
}
body:has(#login-view:not(.hidden)) #login-view button[type="submit"] {
  background: #1A6AFF;
  color: #ffffff;
  border-color: transparent;
  width: 100%;
  margin-top: 0.5rem;
}
.logo { max-width: 280px; width: 100%; height: auto; }
.logo-sm { height: 36px; width: auto; }
.tagline { color: var(--muted); margin-top: 0; }
label { display: block; text-align: left; margin: 0.75rem 0; font-size: 0.9rem; color: var(--muted); }
input, select, button {
  font: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  padding: 0.6rem 0.8rem;
}
input, select { width: 100%; margin-top: 0.35rem; }
button {
  background: var(--accent);
  border-color: transparent;
  cursor: pointer;
  font-weight: 600;
}
button.ghost { background: transparent; border-color: var(--border); color: var(--muted); }
button:hover { filter: brightness(1.08); }
.error { color: var(--danger); min-height: 1.2em; }
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem var(--space); border-bottom: 1px solid var(--border);
  background: var(--topbar-bg); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.spacer { flex: 1; }
.tabs { display: flex; gap: 0.5rem; padding: 1rem var(--space) 0; flex-wrap: wrap; }
.tabs button { background: transparent; color: var(--muted); border: 1px solid transparent; }
.tabs button.active { color: var(--text); border-color: var(--accent); background: var(--tab-active-bg); }
.tab { padding: 1rem var(--space) 2rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; }
.inline { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.inline input[type="file"], .inline input:not([type="checkbox"]) { width: auto; margin: 0; }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
  gap: var(--card-gap);
  margin-top: 1rem;
}
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 1rem;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.meta { color: var(--muted); font-size: 0.85rem; }
.badge {
  display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
}
.badge.online { background: rgba(34,197,94,0.2); color: var(--ok); }
.badge.offline, .badge.pending { background: rgba(100,116,139,0.25); color: #cbd5e1; }
.banner {
  margin-top: 1rem; padding: 0.9rem 1rem; border-radius: 12px;
  background: var(--banner-bg); border: 1px dashed var(--accent); word-break: break-all;
}
.list { margin: 0.75rem 0; display: flex; flex-direction: column; gap: 0.4rem; }
.list .item {
  display: flex; gap: 0.5rem; align-items: center; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.5rem 0.7rem;
}
.list .item span { flex: 1; }
.check { display: flex; align-items: center; gap: 0.5rem; color: var(--text); }
.check input { width: auto; margin: 0; }
.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.75rem; }
.actions button { font-size: 0.85rem; padding: 0.4rem 0.65rem; }

/* Docs / markdown */
.docs-stamp { color: var(--muted); font-size: 0.8rem; }
.docs-panel p { color: var(--text); line-height: 1.5; }
.code-hint {
  margin-top: 1rem; padding: 0.85rem 1rem; border-radius: var(--radius-sm);
  background: var(--code-bg); border: 1px solid var(--border);
  color: var(--code-fg); font-size: 0.8rem; overflow-x: auto; white-space: pre-wrap;
}
.markdown-body {
  line-height: 1.55; max-width: 920px;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  color: var(--text); margin: 1.25rem 0 0.5rem; border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
}
.markdown-body h1 { font-size: 1.45rem; border-color: var(--accent); }
.markdown-body h2 { font-size: 1.2rem; }
.markdown-body h3 { font-size: 1.05rem; border: none; }
.markdown-body p, .markdown-body li { color: var(--md-body); }
.markdown-body a { color: var(--accent); }
.markdown-body code {
  background: var(--code-bg); padding: 0.1rem 0.35rem; border-radius: 6px;
  font-size: 0.88em; border: 1px solid var(--border);
}
.markdown-body pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.85rem 1rem; overflow-x: auto;
}
.markdown-body pre code { border: none; padding: 0; background: transparent; }
.markdown-body table {
  width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.9rem;
}
.markdown-body th, .markdown-body td {
  border: 1px solid var(--border); padding: 0.45rem 0.6rem; text-align: left;
}
.markdown-body th { background: var(--md-th-bg); color: var(--text); }
.markdown-body blockquote {
  margin: 0.75rem 0; padding: 0.4rem 0.9rem; border-left: 3px solid var(--accent);
  color: var(--muted); background: var(--code-bg); border-radius: 0 8px 8px 0;
}
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.markdown-body ul, .markdown-body ol { padding-left: 1.35rem; }

/* Team / project chat — thread + bubbles */
/* Team chat fills remaining viewport — single scrollbar on .chat-messages */
#main-view {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
#main-view.team-fill {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
body.team-fill {
  overflow: hidden;
  height: 100dvh;
}
#main-view > .topbar,
#main-view > .ui-design-switcher {
  flex: 0 0 auto;
}
#main-view.team-fill .tabs {
  flex: 0 0 auto;
}
#tab-team:not(.hidden) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}
#tab-team > .row {
  flex: 0 0 auto;
  margin-bottom: 0.5rem;
}
.chat-panel {
  max-width: none;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  margin: 0;
}
.chat-intro { margin: 0; flex: 0 0 auto; }
.chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 0.85rem;
  background: var(--chat-thread-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  scroll-behavior: smooth;
}
.chat-msg {
  max-width: min(92%, 920px);
  width: fit-content;
  min-width: min(60%, 280px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.85rem 0.65rem;
  background: var(--chat-msg-bg);
  box-shadow: var(--shadow);
  position: relative;
}
.chat-msg.theirs { align-self: flex-start; border-bottom-left-radius: 6px; }
.chat-msg.mine {
  align-self: flex-end;
  background: var(--chat-msg-mine-bg);
  border-color: var(--chat-msg-mine-border);
  border-bottom-right-radius: 6px;
}
.chat-msg.assistant {
  align-self: flex-start;
  border-color: var(--accent);
  background: var(--chat-msg-assistant-bg);
  box-shadow: inset 3px 0 0 var(--accent);
  border-bottom-left-radius: 6px;
}
.chat-msg .chat-meta {
  display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: baseline;
  font-size: 0.75rem; color: var(--muted); margin-bottom: 0.25rem;
}
.chat-msg.assistant .chat-author { color: var(--accent); font-weight: 700; }
.chat-msg.mine .chat-author { color: var(--chat-mine-author); }
.chat-msg .chat-author { font-weight: 600; color: var(--text); }
.chat-msg .chat-time { opacity: 0.85; }
.chat-msg .chat-body {
  white-space: pre-wrap; word-break: break-word; line-height: 1.45; color: var(--chat-body-fg);
  font-size: 0.95rem;
}

/* Messenger-style reactions */
.chat-rx-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-top: 0.45rem;
}
.chat-rx-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.chat-rx-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  color: var(--chat-body-fg);
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1.2;
}
.chat-rx-pill.mine {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.chat-rx-pill .chat-rx-count { font-size: 0.75rem; opacity: 0.9; font-weight: 600; }
.chat-rx-picker {
  display: none;
  gap: 0.15rem;
  padding: 0.15rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.chat-msg:hover .chat-rx-picker,
.chat-msg:focus-within .chat-rx-picker,
.chat-rx-picker:focus-within {
  display: inline-flex;
}
.chat-rx-pick {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.05rem;
  padding: 0.15rem 0.25rem;
  border-radius: 6px;
  line-height: 1;
}
.chat-rx-pick:hover { background: var(--accent-soft); }

.chat-composer {
  flex: 0 0 auto;
  margin-top: 0.15rem;
  padding-top: 0.65rem;
  background: var(--panel);
  border-top: 1px solid var(--border);
}
.chat-composer textarea {
  width: 100%;
  resize: none;
  min-height: 4.2rem;
  max-height: 8rem;
  margin: 0;
  font: inherit;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  padding: 0.7rem 0.85rem;
  line-height: 1.4;
}
.chat-composer textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.chat-composer .row { margin-top: 0.5rem; align-items: center; }
#chat-status.chat-status-error { color: var(--danger); }

/* Team unread indicator */
.tabs button { position: relative; }
.tab-unread-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-left: 0.4rem;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34,197,94,0.25), 0 0 8px rgba(34,197,94,0.55);
  vertical-align: middle;
}
.tab-unread-dot[hidden] { display: none !important; }
.tabs button.has-unread { color: var(--text); }
.chat-unread-banner {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  background: rgba(34,197,94,0.15);
  border: 1px solid rgba(34,197,94,0.45);
  color: #86efac;
  font-size: 0.85rem;
  font-weight: 600;
}
.chat-unread-banner.hidden { display: none; }
.chat-msg.unread-sep {
  align-self: stretch;
  background: transparent;
  border: none;
  padding: 0.35rem 0;
  margin: 0.25rem 0;
  text-align: center;
  color: #86efac;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.chat-msg.unread-sep::before,
.chat-msg.unread-sep::after {
  content: "";
  display: inline-block;
  width: 18%;
  height: 1px;
  background: rgba(34,197,94,0.45);
  vertical-align: middle;
  margin: 0 0.5rem;
}

/* Klanten / Gebruikers */
.customer-form { margin-top: 1rem; }
.customer-form h3, .customer-form h4 { margin: 0.4rem 0 0.75rem; }
.customer-form h4 { font-size: 0.95rem; color: var(--muted); font-weight: 600; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.form-grid label { margin: 0; }
.form-grid textarea {
  width: 100%;
  margin-top: 0.35rem;
  font: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  padding: 0.6rem 0.8rem;
  resize: vertical;
}
.customer-card .customer-users {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.customer-card .add-user-form { margin-bottom: 0.75rem; }
.customer-card .add-user-form input,
.customer-card .add-user-form select { width: auto; min-width: 8rem; margin: 0; }
.assign-customer { display: block; margin: 0.5rem 0; }
.assign-customer select { margin-top: 0.25rem; max-width: 100%; }
.tabs button.platform-only.hidden,
.tabs button.customer-only.hidden { display: none !important; }

/* Design switcher (platform only) */
.ui-design-switcher {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 0.35rem var(--space);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  font-size: 0.8rem;
  z-index: 6;
  position: sticky;
  top: 0;
}
.ui-design-switcher.hidden { display: none !important; }
.ui-design-label {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-right: 0.15rem;
}
.ui-design-switcher button {
  min-width: 1.85rem;
  padding: 0.2rem 0.45rem;
  font-size: 0.8rem;
  font-weight: 700;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.ui-design-switcher button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.ui-design-switcher button:hover { filter: brightness(1.1); }

/* When switcher is sticky, push topbar below it */
#main-view:has(.ui-design-switcher:not(.hidden)) .topbar {
  top: 2.1rem;
}

/* Menus integration model switcher (platform A–E prototypes) */
.menus-model-switcher .ui-design-label { margin-right: 0.35rem; }
.menus-model-switcher button { min-width: auto; padding: 0.2rem 0.55rem; font-weight: 600; }
.device-showing-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: baseline;
  padding: 0.65rem 0.85rem;
  margin: 0.5rem 0 0.25rem;
  border-radius: 10px;
  border: 1px solid var(--accent, #1A6AFF);
  background: color-mix(in srgb, var(--accent, #1A6AFF) 10%, transparent);
}
.device-showing-banner.hidden { display: none !important; }
.menu-studio-preview-wrap.hidden,
.menu-studio-bolton-wrap.hidden { display: none !important; }
.menu-studio-bolton-wrap {
  padding: 1.25rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  margin-top: 0.75rem;
}
a.ms-nav-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  font: inherit;
  border: none;
  background: transparent;
  cursor: pointer;
}
a.ms-nav-link:hover { background: var(--ms-sidebar-accent, rgba(0,0,0,0.05)); }
a.ms-nav-link.hidden { display: none !important; }
a.button-like {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  background: var(--accent, #1A6AFF);
  color: #fff !important;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}
#device-edit-board-btn.hidden { display: none !important; }


/* ---- Design upload (platform) ---- */
.design-drop {
  border: 2px dashed var(--border, #334155);
  border-radius: 10px;
  padding: 1.4rem 1rem;
  text-align: center;
  cursor: pointer;
  background: color-mix(in srgb, var(--panel, #1e293b) 90%, transparent);
  margin: 0.75rem 0;
  transition: border-color 0.15s, background 0.15s;
}
.design-drop:hover,
.design-drop.dragover {
  border-color: var(--accent, #38bdf8);
  background: color-mix(in srgb, var(--accent, #38bdf8) 12%, transparent);
}
.design-drop-label { margin: 0; }
.design-note-label {
  display: block;
  margin: 0.5rem 0 0.75rem;
  font-size: 0.9rem;
}
.design-note-label input {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  box-sizing: border-box;
}
.design-upload-summary {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}
.design-file-list {
  max-height: 10rem;
  overflow: auto;
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
}
.design-preview-wrap {
  margin-top: 1rem;
}
.design-preview-frame {
  width: 100%;
  min-height: 28rem;
  border: 1px solid var(--border, #334155);
  border-radius: 8px;
  background: #fff;
}
a.btn-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding: 0.35rem 0.7rem;
}
button.ghost.danger,
.ghost.danger {
  color: var(--danger, #ef4444);
}
.shell-sec-nav button.platform-only.hidden {
  display: none !important;
}

/* Light login page (veyosign.com apex) */
body:has(#login-view:not(.hidden)) {
  background: #f4f6fa;
  color: #0f172a;
}
#login-view.login-panel,
#login-view {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
}
#login-view .tagline,
#login-view label {
  color: #64748b;
}
#login-view input {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}
#login-view input:focus {
  outline: 2px solid rgba(26, 106, 255, 0.35);
  border-color: #1A6AFF;
}
#login-view button:not(.ghost) {
  background: #1A6AFF;
  color: #ffffff;
}
#login-view .error {
  color: #dc2626;
}


/* Media library previews */
.media-card .media-preview {
  margin: 0 0 0.65rem;
  border-radius: var(--radius-sm, 8px);
  overflow: hidden;
  background: var(--code-bg, #eef1f7);
  border: 1px solid var(--border);
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
.media-card .media-preview img,
.media-card .media-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #0a0a0a;
}
.media-card .media-preview video {
  object-fit: contain;
}
.media-card .media-preview-empty {
  padding: 1.25rem;
  text-align: center;
}
html[data-ui="11"] .media-card .media-preview {
  background: #eef1f7;
}
