/*
 * AI 4 All — Central Unified Stylesheet
 * Consolidates layout, theme tokens, SDG accessibility configurations, and page-specific styles.
 */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;
  --text: #0f172a;
  --text-muted: #475569;
  --text-faint: #64748b;
  --border: rgba(15, 23, 42, 0.08);
  --primary: #4f46e5;
  --primary-strong: #3730a3;
  --primary-soft: #e0e7ff;
  --accent: #10b981;
  --accent-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

html[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --surface-3: #475569;
  --text: #f8fafc;
  --text-muted: #cbd5e1;
  --text-faint: #94a3b8;
  --border: rgba(255, 255, 255, 0.08);
  --primary: #6366f1;
  --primary-strong: #818cf8;
  --primary-soft: rgba(99, 102, 241, 0.15);
  --accent: #34d399;
  --accent-soft: rgba(52, 211, 153, 0.15);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.15);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}

a {
  color: var(--primary-strong);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

/* Header & Brand Components */
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}
header .sp {
  flex: 1;
}
header a, header button {
  color: var(--text-muted);
  font-size: 0.86rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
}
header a:hover, header button:hover {
  color: var(--text);
  border-color: var(--primary);
  text-decoration: none;
}

.logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #7d6ff0);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  flex: none;
}
.brand b {
  font-weight: 600;
}
.brand small {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1;
}
.who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--text-muted);
}
.who .ava {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-strong);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 0.75rem;
}
.demo {
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.8rem;
  text-align: center;
  padding: 6px 12px;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 18px 80px;
}
h1 {
  font-size: 1.5rem;
  margin: 0 0 4px;
}
.lead {
  color: var(--text-muted);
  margin: 0 0 18px;
}

/* Button & Form Components */
.btn {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color 0.15s, background-color 0.15s;
}
.btn:hover {
  border-color: var(--primary);
}
.btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn.primary:hover {
  background: var(--primary-strong);
}
.btn.sm {
  height: 30px;
  padding: 0 10px;
  font-size: 0.82rem;
}
.btn.ghost {
  color: var(--text-muted);
  border: none;
  background: none;
}
.btn.ghost:hover {
  background: var(--surface-2);
}

.ms-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 11px;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.ms-btn:hover {
  background: var(--primary-strong);
}
.ms-btn svg {
  width: 18px;
  height: 18px;
}

/* Table Configurations */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 10px;
}
th, td {
  text-align: left;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
th {
  background: var(--surface-2);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 700;
}
tr:last-child td {
  border-bottom: none;
}

.sub {
  color: var(--text-faint);
  font-size: 0.8rem;
}
.pill {
  display: inline-block;
  font-size: 0.76rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-muted);
}
.pill.power, .pill.platform_admin, .pill.super_admin {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--text-muted);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot.active, .dot.connected {
  background: var(--accent);
}
.dot.suspended, .dot.deactivated, .dot.expired {
  background: var(--warn);
}
.dot.soft_deleted, .dot.error {
  background: var(--danger);
}
.dot.not_connected {
  background: var(--text-faint);
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Toast System */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 9px;
  font-size: 0.86rem;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 9999;
}
.toast.show {
  opacity: 0.95;
}

/* Access Gate Setup */
.gate {
  max-width: 440px;
  margin: 14vh auto;
  text-align: center;
  padding: 24px;
}
.gate .logo {
  width: 56px;
  height: 56px;
  font-size: 20px;
  margin: 0 auto 16px;
}
.gate h1 {
  font-size: 1.9rem;
  margin: 0.2em 0;
  font-weight: 700;
}
.err {
  color: var(--danger);
  font-size: 0.86rem;
  margin-top: 12px;
  min-height: 1em;
}

/* Tabs & Toolbar Components */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.tab {
  padding: 8px 16px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.toolbar input, .toolbar select {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
  font-size: 0.9rem;
  outline: none;
}
.toolbar input {
  min-width: 220px;
  flex: 1;
}
.toolbar input:focus, .toolbar select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Custom Dialog / Modal Layouts */
.a4m-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(13, 12, 23, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease-out;
}
.a4m-modal-overlay.show {
  opacity: 1;
}
.a4m-modal-container {
  background: var(--surface, #fff);
  border: 1px solid var(--border, rgba(0,0,0,.12));
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.15), 0 10px 10px -5px rgba(0,0,0,0.06);
  width: 92%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  color: var(--text, #1a1830);
}
.a4m-modal-overlay.show .a4m-modal-container {
  transform: scale(1);
}
.a4m-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, rgba(0,0,0,.1));
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.a4m-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text, #1a1830);
}
.a4m-modal-close {
  background: none;
  border: none;
  color: var(--text-muted, #5b5870);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.a4m-modal-close:hover {
  background: var(--surface-2, #f0f0f7);
  color: var(--text, #1a1830);
}
.a4m-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.a4m-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border, rgba(0,0,0,.1));
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface-2, #f0f0f7);
}

.a4m-form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.a4m-form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted, #5b5870);
}
.a4m-form-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text, #1a1830);
}
.a4m-form-desc {
  font-size: 0.76rem;
  color: var(--text-muted, #5b5870);
  margin-top: -2px;
}
.a4m-form-input, .a4m-input {
  height: 38px;
  border: 1px solid var(--border, rgba(0,0,0,.12));
  border-radius: 8px;
  background: var(--bg, #f6f6fb);
  color: var(--text, #1a1830);
  padding: 0 12px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.a4m-form-input:focus, .a4m-input:focus {
  border-color: var(--primary, #5b4ad6);
  box-shadow: 0 0 0 3px var(--primary-soft, rgba(91,74,214,0.15));
}
.a4m-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border, rgba(0,0,0,.12));
  border-radius: 8px;
  padding: 10px;
  background: var(--bg, #f6f6fb);
}

/* Chat Layout & Sidebar (index.html) */
.a4m-chat-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 53px);
}
.a4m-chat-sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.2s ease-in-out;
}
.a4m-chat-sidebar.hidden {
  display: none !important;
}
.a4m-sidebar-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}
.a4m-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}
.a4m-sidebar-item {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.86rem;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  border: none;
  background: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.a4m-sidebar-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.a4m-sidebar-item.active {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 600;
}
.a4m-new-chat-btn {
  margin: 10px;
  height: 38px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: none;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color 0.15s, color 0.15s;
}
.a4m-new-chat-btn:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
}

/* Chat Assistant panel */
main {
  flex: 1;
  overflow-y: auto;
  padding: 22px 0;
}
.msg {
  display: flex;
  gap: 12px;
  margin: 0 0 20px;
}
.av {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}
.msg.user .av {
  background: var(--surface-2);
  color: var(--text-muted);
}
.msg.bot .av {
  background: var(--primary-soft);
  color: var(--primary-strong);
}
.bubble {
  flex: 1;
  min-width: 0;
}
.bubble .lbl {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 3px;
  font-weight: 600;
}
.bubble .body {
  white-space: pre-wrap;
  word-wrap: break-word;
}
.bubble .body code {
  font-family: var(--mono);
  background: var(--surface-2);
  padding: 0.1em 0.4em;
  border-radius: 5px;
  font-size: 0.9em;
}
.meta {
  font-size: 0.72rem;
  color: var(--accent);
  margin-top: 6px;
}
.notice {
  font-size: 0.82rem;
  padding: 10px 12px;
  border-radius: 8px;
  margin-top: 6px;
}
.notice.block {
  background: var(--warn-soft);
  color: var(--warn);
}
.notice.err {
  background: var(--danger-soft);
  color: var(--danger);
}
.empty {
  color: var(--text-muted);
  text-align: center;
  margin-top: 6vh;
}
.empty h2 {
  font-weight: 600;
  color: var(--text);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}
.chip {
  font-size: 0.84rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-muted);
}
.chip:hover {
  border-color: var(--primary);
  color: var(--text);
}
footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 12px 0;
}
.composer {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 18px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  padding: 11px 14px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  max-height: 160px;
  outline: none;
}
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.send {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.send:hover {
  background: var(--primary-strong);
}
.send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.send svg {
  width: 20px;
  height: 20px;
}
.hint {
  max-width: 760px;
  margin: 6px auto 0;
  padding: 0 18px;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}
.typing {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: blink 1s infinite;
}
@keyframes blink {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

.bubble .body h3 { font-size: 1.05rem; margin: 0.6em 0 0.3em; }
.bubble .body h4 { font-size: 0.95rem; margin: 0.55em 0 0.3em; }
.bubble .body p { margin: 0.5em 0; }
.bubble .body ul, .bubble .body ol { margin: 0.4em 0; padding-left: 1.4em; }
.bubble .body li { margin: 0.2em 0; }
.bubble .body pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  margin: 0.5em 0;
}
.bubble .body pre code { background: none; padding: 0; }
.qbanner {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--warn-soft);
  color: var(--warn);
  padding: 9px 18px;
  font-size: 0.84rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.copybtn {
  font: inherit;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.copybtn:hover {
  color: var(--text);
}

/* Settings Modal Layout (menu.js / admin.html) */
.a4m-settings-layout {
  display: flex;
  height: 70vh;
  min-height: 480px;
}
@media(max-width: 560px) {
  .a4m-settings-layout {
    flex-direction: column;
    height: auto;
  }
  .a4m-settings-sidebar {
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
  }
}
.a4m-settings-sidebar {
  width: 220px;
  background: var(--surface-2, #f0f0f7);
  border-right: 1px solid var(--border, rgba(0,0,0,.1));
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  gap: 16px;
  flex-shrink: 0;
}
.a4m-settings-avatar-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border, rgba(0,0,0,.08));
}
.a4m-settings-ava {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  font-weight: 700;
  background: var(--primary-soft, #eeecff);
  color: var(--primary-strong, #4636bd);
  margin-bottom: 8px;
  border: 2px solid var(--border, rgba(0,0,0,.08));
}
.a4m-settings-name {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.a4m-settings-email {
  font-size: 0.74rem;
  color: var(--text-muted, #5b5870);
  word-break: break-all;
}
.a4m-settings-badge {
  margin-top: 4px;
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-soft, #eeecff);
  color: var(--primary-strong, #4636bd);
}
.a4m-settings-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.a4m-settings-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.86rem;
  color: var(--text-muted, #5b5870);
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
}
.a4m-settings-nav-item:hover {
  background: var(--surface-3, #e9e9f2);
  color: var(--text, #1a1830);
}
.a4m-settings-nav-item.active {
  background: var(--surface, #fff);
  color: var(--primary, #5b4ad6);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  font-weight: 600;
}
.a4m-settings-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 500;
  border: 1px solid var(--border, rgba(0,0,0,.12));
  background: var(--surface, #fff);
  color: var(--danger, #b32d2d);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.a4m-settings-logout-btn:hover {
  background: var(--danger-soft, rgba(163,45,45,.08));
  border-color: var(--danger, #b32d2d);
}

.a4m-settings-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}
.a4m-settings-tab-panel[hidden] {
  display: none !important;
}
.a4m-settings-h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text, #1a1830);
}

/* Workspace cards */
.a4m-app-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media(max-width: 480px) {
  .a4m-app-grid {
    grid-template-columns: 1fr;
  }
}
.a4m-app-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(0,0,0,.12));
  background: var(--surface, #fff);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-align: left;
  text-decoration: none;
  color: var(--text, #1a1830);
}
.a4m-app-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary, #5b4ad6);
  box-shadow: 0 4px 12px rgba(20,15,60,0.06);
  text-decoration: none;
}
.a4m-app-card.active {
  background: var(--primary-soft, #eeecff);
  border-color: var(--primary, #5b4ad6);
}
.a4m-app-card b {
  font-size: 0.9rem;
  font-weight: 600;
}
.a4m-app-card span {
  font-size: 0.76rem;
  color: var(--text-muted, #5b5870);
  line-height: 1.3;
}

.a4m-settings-pref-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.a4m-settings-pref-label {
  font-size: 0.88rem;
  font-weight: 600;
}
.a4m-settings-pref-desc {
  font-size: 0.78rem;
  color: var(--text-muted, #5b5870);
  margin-top: -4px;
}

.a4m-settings-about {
  font-size: 0.78rem;
  color: var(--text-muted, #5b5870);
  line-height: 1.5;
  background: var(--bg, #f6f6fb);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(0,0,0,.06));
}
.a4m-settings-about a {
  color: var(--primary-strong, #4636bd);
  font-weight: 600;
  text-decoration: none;
}
.a4m-settings-about a:hover {
  text-decoration: underline;
}

.a4m-profile-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 10px 0;
}
.a4m-btn-save {
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--primary, #5b4ad6);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  align-self: flex-start;
  transition: background 0.15s;
}
.a4m-btn-save:hover {
  background: var(--primary-strong, #4636bd);
}
.a4m-prof-status {
  font-size: 0.8rem;
  min-height: 1.2em;
}
.a4m-prof-status.success {
  color: var(--accent, #0f9e75);
}
.a4m-prof-status.error {
  color: var(--danger, #b32d2d);
}
.a4m-profile-section-title {
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint, #8a87a0);
  margin-top: 14px;
  border-bottom: 1px solid var(--border, rgba(0,0,0,.12));
  padding-bottom: 6px;
}
.a4m-permissions-summary, .a4m-entra-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface-2, #f0f0f7);
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border, rgba(0,0,0,.12));
}
.a4m-perm-item, .a4m-entra-field {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
}
.a4m-perm-label, .a4m-entra-lbl {
  color: var(--text-muted, #5b5870);
  font-weight: 500;
}
.a4m-perm-value, .a4m-entra-val {
  font-weight: 600;
  color: var(--text, #1a1830);
}

/* Usage tracker elements */
.a4m-usage-card {
  background: var(--surface-2, #f0f0f7);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  border: 1px solid var(--border, rgba(0,0,0,.12));
}
.a4m-usage-metric-title {
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text, #1a1830);
}
.a4m-progress-container {
  width: 100%;
  height: 12px;
  background: var(--surface-3, #e9e9f2);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
  border: 1px solid var(--border, rgba(0,0,0,.08));
}
.a4m-progress-bar {
  height: 100%;
  background: var(--primary, #5b4ad6);
  border-radius: 6px;
  transition: width 0.3s ease;
}
.a4m-usage-quota-text {
  font-size: 0.76rem;
  color: var(--text-muted, #5b5870);
  font-weight: 500;
}
.a4m-usage-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media(max-width: 480px) {
  .a4m-usage-stats-grid {
    grid-template-columns: 1fr;
  }
}
.a4m-usage-stat-box {
  background: var(--surface, #fff);
  border: 1px solid var(--border, rgba(0,0,0,.12));
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.a4m-usage-stat-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary, #5b4ad6);
}
.a4m-usage-stat-lbl {
  font-size: 0.72rem;
  color: var(--text-faint, #8a87a0);
  margin-top: 4px;
  font-weight: 500;
  text-transform: uppercase;
}

/* Claude menu container placement */
.a4m {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 60;
  font-family: var(--font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}
.a4m-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 230px;
  padding: 7px 10px;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(0,0,0,.12));
  background: var(--surface, #fff);
  color: var(--text, #1a1830);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(20,15,60,.10);
}
.a4m-btn:hover {
  border-color: var(--primary, #5b4ad6);
}
.a4m-ava {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--primary-soft, #eeecff);
  color: var(--primary-strong, #4636bd);
}
.a4m-id {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
  text-align: left;
}
.a4m-id b {
  font-size: 0.84rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.a4m-id small {
  font-size: 0.68rem;
  color: var(--text-muted, #5b5870);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.a4m-cv {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--text-muted, #5b5870);
  transition: transform 0.15s;
}
.a4m.open .a4m-cv {
  transform: rotate(180deg);
}
.a4m-pop {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: 262px;
  max-height: 70vh;
  overflow: auto;
  background: var(--surface, #fff);
  border: 1px solid var(--border, rgba(0,0,0,.12));
  border-radius: 14px;
  box-shadow: 0 10px 34px rgba(20,15,60,.20);
  padding: 8px;
}
.a4m-pop[hidden] {
  display: none;
}
.a4m-sec {
  padding: 6px 4px;
  border-top: 1px solid var(--border, rgba(0,0,0,.08));
}
.a4m-sec:first-child {
  border-top: none;
}
.a4m-h {
  margin: 2px 6px 6px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--text-faint, #8a87a0);
}
.a4m-pop a, .a4m-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  padding: 8px 9px;
  border-radius: 99px;
  font-size: 0.88rem;
  color: var(--text, #1a1830);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.a4m-pop a:hover, .a4m-item:hover {
  background: var(--surface-2, #f0f0f7);
  text-decoration: none;
}
.a4m-pop a.active {
  background: var(--primary-soft, #eeecff);
  color: var(--primary-strong, #4636bd);
  font-weight: 600;
}
.a4m-acct {
  padding: 6px 9px;
  font-size: 0.82rem;
}
.a4m-acct b {
  display: block;
  font-weight: 600;
}
.a4m-acct small {
  color: var(--text-muted, #5b5870);
}
.a4m-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-soft, #eeecff);
  color: var(--primary-strong, #4636bd);
}
.a4m-seg {
  display: flex;
  gap: 4px;
  padding: 2px 5px;
}
.a4m-seg button {
  flex: 1;
  padding: 6px 0;
  font-size: 0.76rem;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(0,0,0,.12));
  background: var(--surface, #fff);
  color: var(--text-muted, #5b5870);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.a4m-seg button.on {
  background: var(--primary, #5b4ad6);
  color: #fff;
  border-color: var(--primary, #5b4ad6);
}
.a4m-about {
  padding: 4px 9px;
  font-size: 0.68rem;
  color: var(--text-faint, #8a87a0);
}
@media(max-width: 560px) {
  .a4m-btn .a4m-id {
    display: none;
  }
}

/* Dashboard, KPI Cards & Table Styling in Bot responses */
.table-container {
  width: 100%;
  overflow-x: auto;
  margin: 14px 0;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.a4m-kpi-card {
  display: inline-block;
  vertical-align: top;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 8px;
  min-width: 160px;
  flex: 1;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}
.a4m-kpi-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.a4m-kpi-val {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  margin: 6px 0;
}
.a4m-kpi-sub {
  font-size: 0.76rem;
  color: var(--text-faint);
}
.a4m-kpi-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 14px 0;
}
.a4m-prog-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  font-size: 0.82rem;
}
.a4m-prog-bar-track {
  flex: 1;
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.a4m-prog-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}
.a4m-prog-lbl {
  font-weight: 500;
  min-width: 80px;
}
.a4m-prog-pct {
  font-weight: 600;
  color: var(--text-muted);
  min-width: 35px;
  text-align: right;
}

/* User Manual Documentation specific styles */
.searchbox {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 340px;
  flex: 1;
}
.searchbox input {
  width: 100%;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 0 12px 0 36px;
  font-size: 0.92rem;
  outline: none;
}
.searchbox input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.searchbox svg {
  position: absolute;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--text-faint);
}
.iconbtn {
  height: 38px;
  min-width: 38px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.85rem;
}
.iconbtn:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}
.iconbtn svg {
  width: 17px;
  height: 17px;
}
.appcta {
  font-weight: 600;
  color: var(--primary-strong);
  border-color: var(--primary-soft);
  background: var(--primary-soft);
}
.appcta:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
@media(max-width:620px) {
  .appcta-t { display: none; }
}
figure.shot {
  margin: 16px 0;
}
figure.shot figcaption {
  font-size: 0.82rem;
  color: var(--text-faint);
  margin-top: 6px;
  text-align: center;
}
.hero {
  max-width: var(--maxw, 1180px);
  margin: 0 auto;
  padding: 64px 24px 30px;
  text-align: center;
}
.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary-strong);
  background: var(--primary-soft);
  padding: 6px 14px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
}
.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.3rem);
  margin: 0.5em auto 0.2em;
  max-width: 14ch;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.hero .tag {
  font-size: 1.12rem;
  color: var(--text-muted);
  max-width: 54ch;
  margin: 0 auto;
}
.hero .pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 26px 0 8px;
}
.hero .pills span {
  font-size: 0.84rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 26px;
  flex-wrap: wrap;
}
.layout {
  max-width: var(--maxw, 1180px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar, 264px) 1fr;
  gap: 38px;
  padding: 18px 24px 80px;
  align-items: start;
}
nav.side {
  position: sticky;
  top: 78px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding-right: 6px;
}
nav.side .group {
  margin-bottom: 18px;
}
nav.side .group-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-faint);
  font-weight: 700;
  margin: 0 0 8px 10px;
}
nav.side a {
  display: block;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.91rem;
  border-left: 2px solid transparent;
}
nav.side a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
nav.side a.active {
  background: var(--primary-soft);
  color: var(--primary-strong);
  border-left-color: var(--primary);
  font-weight: 600;
}
nav.side a.hidden {
  display: none;
}
.no-results {
  display: none;
  color: var(--text-faint);
  font-size: 0.86rem;
  padding: 8px 12px;
}
section.doc {
  scroll-margin-top: 78px;
  padding: 18px 0 10px;
  border-top: 1px solid var(--border);
  margin-top: 14px;
}
section.doc:first-of-type {
  border-top: none;
  margin-top: 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 14px);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.grid {
  display: grid;
  gap: 14px;
}
.grid.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.grid.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.step-list {
  counter-reset: s;
  display: grid;
  gap: 12px;
  margin: 16px 0;
}
.step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.step .n {
  counter-increment: s;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 700;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
}
.step .n::before {
  content: counter(s);
}
.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--info, #2563eb);
  background: var(--info-soft, #dbeafe);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 13px 16px;
  margin: 16px 0;
  font-size: 0.95rem;
}
.callout.tip {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}
.callout.warn {
  border-left-color: var(--warn);
  background: var(--warn-soft);
}
.callout.danger {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}
.callout b {
  display: block;
  margin-bottom: 2px;
}
.badge.v {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}
.badge.p {
  background: var(--primary-soft);
  color: var(--primary-strong);
  border-color: transparent;
}
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 14px 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table.tbl th, table.tbl td {
  text-align: left;
  padding: 10px 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.tbl th {
  background: var(--surface-2);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-muted);
}
table.tbl tr:last-child td {
  border-bottom: none;
}
table.tbl td .yes {
  color: var(--accent);
  font-weight: 600;
}
table.tbl td .no {
  color: var(--text-faint);
}
.wrap-x {
  overflow-x: auto;
}
.roletabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 16px;
}
.roletab {
  padding: 9px 15px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.roletab:hover {
  border-color: var(--border-strong, rgba(15, 23, 42, 0.16));
}
.roletab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.roletab .ri {
  width: 16px;
  height: 16px;
}
.rolepanel {
  display: none;
}
.rolepanel.active {
  display: block;
  animation: fade 0.25s ease;
}
@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.agl {
  display: grid;
  grid-template-columns: minmax(0, 260px) 1fr;
  gap: 18px;
  margin: 16px 0;
}
.agl .stages {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.agl .stg {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.88rem;
}
.agl .stg:hover {
  border-color: var(--border-strong, rgba(15, 23, 42, 0.16));
}
.agl .stg.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-strong);
  font-weight: 600;
}
.agl .stg .sn {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.78rem;
  flex: none;
}
.agl .stg.active .sn {
  background: var(--primary);
  color: #fff;
}
.agl .detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 14px);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.agl .detail h4 {
  margin-top: 0;
}
.acc {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 10px 0;
  background: var(--surface);
}
.acc summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 0.96rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.acc summary::-webkit-details-marker {
  display: none;
}
.acc summary .chev {
  transition: transform 0.2s;
  flex: none;
}
.acc[open] summary .chev {
  transform: rotate(90deg);
}
.acc .body {
  padding: 0 16px 15px;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.acc summary:hover {
  background: var(--surface-2);
}
.diagram {
  width: 100%;
  height: auto;
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 14px);
  background: var(--surface);
  padding: 8px;
}
.diagram text {
  font-family: var(--font);
}
footer.foot {
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.foot-in {
  max-width: var(--maxw, 1180px);
  margin: 0 auto;
  padding: 26px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.toplink {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: none;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 30;
}
.toplink svg {
  width: 20px;
  height: 20px;
}
@media(max-width: 880px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  nav.side {
    position: fixed;
    inset: var(--header-h, 60px) 0 auto 0;
    z-index: 35;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    max-height: 70vh;
    padding: 16px 20px;
    display: none;
    box-shadow: var(--shadow);
  }
  nav.side.open {
    display: block;
  }
  #menuToggle {
    display: inline-flex;
  }
  .searchbox {
    max-width: none;
  }
}


