/* Agency Ops — aligned with docs/platform-ui-design-mockup.html */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap');

:root {
  --bg-app: #e8edf5;
  --bg-panel: #f4f6fb;
  --surface: #ffffff;
  --sidebar-from: #141b2d;
  --sidebar-to: #1c2742;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: rgba(99, 102, 241, 0.35);
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --accent: #6366f1;
  --accent-soft: #eef2ff;
  --accent-2: #06b6d4;
  --success: #059669;
  --success-bg: #d1fae5;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --draft: #64748b;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --topbar-h: 64px;
  --sidebar-w: 268px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body.ao-theme {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
}

body.ao-theme a { color: var(--accent); text-decoration: none; }
body.ao-theme a:hover { text-decoration: underline; }

/* Auth (login) */
.ao-auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(99, 102, 241, 0.35), transparent),
    radial-gradient(800px 400px at -10% 100%, rgba(6, 182, 212, 0.25), transparent),
    linear-gradient(160deg, #0f172a 0%, #1e293b 50%, #312e81 100%);
}
.ao-login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2.25rem;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
}
.ao-login-card h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.65rem;
  margin: 0 0 0.35rem;
  color: var(--text);
}
.ao-login-card .ao-sub { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.75rem; }
.ao-brand-mark {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 1.1rem;
  margin-bottom: 1.25rem;
}

/* App shell */
.ao-app-body { display: flex; min-height: 100vh; }

.ao-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar-from), var(--sidebar-to));
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.ao-sidebar-brand {
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.75rem;
}
.ao-sidebar-brand strong {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  display: block;
  color: #fff;
}
.ao-sidebar-brand span { font-size: 0.75rem; color: #94a3b8; }
.ao-nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #64748b;
  padding: 1rem 1.25rem 0.4rem;
}
.ao-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.15rem 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  border: none;
  background: transparent;
  width: calc(100% - 1.3rem);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ao-nav-item:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.ao-nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.4);
}
.ao-nav-item svg { flex-shrink: 0; opacity: 0.85; }

.ao-sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.ao-user-chip { display: flex; align-items: center; gap: 0.65rem; }
.ao-avatar {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #818cf8, #22d3ee);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #0f172a; font-size: 0.85rem;
}
.ao-user-chip div small { display: block; color: #94a3b8; font-size: 0.72rem; }

.ao-main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-panel);
}

.ao-topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}
.ao-topbar-left { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.ao-breadcrumb {
  font-size: 0.88rem;
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ao-breadcrumb b { color: var(--text); font-weight: 600; }
.ao-global-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.85rem;
  width: min(320px, 28vw);
}
.ao-global-search input {
  border: none; background: none; font: inherit; flex: 1; min-width: 0; outline: none;
}
.ao-topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

.ao-content-scroll {
  flex: 1;
  overflow: auto;
  padding: 1.5rem;
}

@media (max-width: 900px) {
  .ao-sidebar { display: none; }
  :root { --sidebar-w: 0; }
  .ao-global-search { display: none; }
}

/* Page structure */
.ao-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.ao-page-header h1, .ao-page-header h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.65rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}
.ao-page-header p { margin: 0; color: var(--text-muted); max-width: 42rem; font-size: 0.95rem; }

.ao-grid { display: grid; gap: 1.25rem; }
.ao-grid-4 { grid-template-columns: repeat(4, 1fr); }
.ao-grid-3 { grid-template-columns: repeat(3, 1fr); }
.ao-grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1200px) {
  .ao-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .ao-grid-3, .ao-grid-2 { grid-template-columns: 1fr; }
}

.ao-stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.ao-stat-card .ao-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.ao-stat-card .ao-value { font-size: 1.75rem; font-weight: 700; margin-top: 0.25rem; font-family: "Fraunces", serif; }
.ao-stat-card .ao-hint { font-size: 0.82rem; color: var(--accent); margin-top: 0.35rem; }
.ao-stat-card .ao-hint a { color: inherit; font-weight: 600; text-decoration: none; }
.ao-stat-card .ao-hint a:hover { text-decoration: underline; }

/* Cards — bridge legacy .card */
.card, .ao-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
}
.card.ao-card-flush, .ao-card.ao-card-flush { padding: 0; }
.ao-card-h {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.ao-card-h h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.ao-card-b { padding: 1.25rem; }

.ao-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 1rem;
}

/* Form controls */
.input, body.ao-theme input[type="text"], body.ao-theme input[type="email"],
body.ao-theme input[type="password"], body.ao-theme input[type="search"],
body.ao-theme input[type="number"], body.ao-theme select, body.ao-theme textarea {
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  background: #fff;
  color: var(--text);
  width: 100%;
  max-width: 100%;
}
body.ao-theme input[type="checkbox"],
body.ao-theme input[type="radio"] {
  width: auto;
}
body.ao-theme input:focus, body.ao-theme select:focus, body.ao-theme textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
body.ao-theme textarea { min-height: 100px; resize: vertical; width: 100%; }
.form-row { margin-bottom: 0.85rem; }
body.ao-theme label { display: block; margin-bottom: 0.25rem; color: var(--text-muted); font-size: 0.8rem; font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
  text-decoration: none;
}
.btn:link,
.btn:visited {
  text-decoration: none;
}
body.ao-theme a.btn {
  color: inherit;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}
body.ao-theme a.btn-primary,
body.ao-theme a.btn-primary:visited,
body.ao-theme a.btn-primary:hover,
body.ao-theme a.btn-primary:focus {
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.05); color: #fff; text-decoration: none; }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
body.ao-theme a.btn-secondary,
body.ao-theme a.btn-secondary:visited {
  color: var(--text);
}
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid transparent; }
.btn-ghost:hover { background: var(--bg-panel); color: var(--text); }
body.ao-theme a.btn-ghost,
body.ao-theme a.btn-ghost:visited {
  color: var(--text-muted);
}
.btn-danger, .btn-danger-outline {
  background: #fff;
  color: var(--danger);
  border: 1px solid #fecaca;
}
body.ao-theme a.btn-danger,
body.ao-theme a.btn-danger-outline,
body.ao-theme a.btn-danger:visited,
body.ao-theme a.btn-danger-outline:visited {
  color: var(--danger);
}
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data th {
  text-align: left;
  padding: 0.65rem 1rem;
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
table.data td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tr:hover td { background: #fafbff; }
table.data tr.ao-clickable { cursor: pointer; }

/* Pagination (DataTables-like, Laravel paginator view override) */
body.ao-theme .ao-dt-pagination {
  width: 100%;
  max-width: 100%;
}
body.ao-theme .ao-dt-pagination__inner {
  display: flex;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  flex-wrap: nowrap;
  min-width: 0;
}
body.ao-theme .ao-dt-pagination__info {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.35;
  white-space: nowrap;
  flex: 0 1 auto;
}
body.ao-theme .ao-dt-pagination__info-strong {
  color: var(--text);
  font-weight: 600;
}
body.ao-theme ul.ao-dt-pagination__list {
  list-style: none;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap;
  align-items: center !important;
  justify-content: flex-end;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
body.ao-theme .ao-dt-pagination__item {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  flex: 0 0 auto;
}
body.ao-theme .ao-dt-pagination__link {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box;
  min-width: 34px;
  min-height: 34px;
  max-height: 34px;
  height: 34px;
  padding: 0 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  user-select: none;
  flex: 0 0 auto;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s;
}
body.ao-theme .ao-dt-pagination__link:hover {
  text-decoration: none;
  background: #f8fafc;
  border-color: #dbe3ef;
}
body.ao-theme .ao-dt-pagination__item.is-active .ao-dt-pagination__link {
  background: var(--accent-soft);
  border-color: rgba(99, 102, 241, 0.45);
  color: #4338ca;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
body.ao-theme .ao-dt-pagination__item.is-disabled .ao-dt-pagination__link {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}
body.ao-theme .ao-dt-pagination__item.is-ellipsis .ao-dt-pagination__link {
  min-width: 34px;
  padding: 0 0.35rem;
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
}

body.ao-theme .ao-dt-pagination__link--chev {
  min-width: 34px;
  max-width: 40px;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

/* Prev/next glyphs (‹ ›): text, not SVG, so global svg rules cannot blow them up */
body.ao-theme .ao-pagination-char {
  display: inline-block;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1;
  width: 0.65em;
  height: 1em;
  text-align: center;
  overflow: hidden;
  flex-shrink: 0;
}

@media (max-width: 520px) {
  body.ao-theme .ao-dt-pagination__inner {
    flex-wrap: wrap;
    justify-content: center;
  }
  body.ao-theme .ao-dt-pagination__info {
    width: 100%;
    text-align: center;
    white-space: normal;
    flex: 1 1 100%;
  }
  body.ao-theme ul.ao-dt-pagination__list {
    flex: 1 1 100%;
    justify-content: center;
  }
}

body.ao-theme .ao-pagination {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* If any SVG remains in paginator/DataTables controls, cap size (beats most theme rules) */
body.ao-theme .ao-dt-pagination svg,
body.ao-theme .ao-pagination svg,
body.ao-theme .dataTables_wrapper .dataTables_paginate svg,
body.ao-theme .dataTables_wrapper .paginate_button svg {
  width: 1rem !important;
  height: 1rem !important;
  max-width: 1.25rem !important;
  max-height: 1.25rem !important;
  flex: 0 0 auto !important;
}

/* Laravel bootstrap-5 paginator: if both mobile + desktop blocks show, keep one clean row */
body.ao-theme .ao-pagination nav.d-flex > div.d-sm-none {
  display: none !important;
}
body.ao-theme .ao-pagination nav.d-flex > div.d-none.d-sm-flex {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap;
  align-items: center !important;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  width: 100%;
  min-width: 0;
}
body.ao-theme .ao-pagination nav.d-flex > div.d-none.d-sm-flex ul.pagination {
  flex-wrap: nowrap;
  overflow-x: auto;
  margin-bottom: 0;
}
body.ao-theme .ao-pagination nav.d-flex > div.d-none.d-sm-flex .page-link {
  min-height: 34px;
  max-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: none;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning, .badge-warn { background: var(--warning-bg); color: var(--warning); }
.badge-draft { background: #f1f5f9; color: var(--draft); }
.badge-info { background: #cffafe; color: #0e7490; }
.badge-accent { background: var(--accent-soft); color: #4338ca; }

.head-bedge{
  width: 100%;
    text-align: right;
    display: flex;
    justify-content: end;
}
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: #f1f5f9;
  border-radius: 6px;
  color: #475569;
}

.ao-split {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 1024px) {
  .ao-split { grid-template-columns: 1fr; }
}

.ao-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.ao-tab {
  padding: 0.6rem 1rem;
  border: none;
  background: none;
  font: inherit;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  margin-bottom: -1px;
}
.ao-tab:hover { color: var(--text); background: #f8fafc; }
.ao-tab.active {
  color: var(--accent);
  font-weight: 600;
  border: 1px solid var(--border);
  border-bottom-color: var(--surface);
  background: var(--surface);
}

.ao-timeline {
  border-left: 2px solid var(--border);
  margin-left: 0.5rem;
  padding-left: 1rem;
}
.ao-timeline-item { margin-bottom: 1rem; position: relative; }
.ao-timeline-item::before {
  content: "";
  position: absolute;
  left: -1.35rem;
  top: 0.35rem;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.ao-timeline-item small { color: var(--text-muted); }

.ao-env-pill {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: var(--warning-bg);
  color: var(--warning);
}

.proposal-draft-banner, .ao-proposal-draft-banner {
  background: linear-gradient(90deg, #fef3c7, #fff7ed);
  border: 1px solid #fcd34d;
  color: #92400e;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.grounding-box, .ao-grounding-box {
  background: #f8fafc;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: 0.88rem;
}
.grounding-box h4, .ao-grounding-box h4 { margin: 0 0 0.5rem; font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.grounding-box ul, .ao-grounding-box ul { margin: 0; padding-left: 1.1rem; color: #475569; }

.prose { max-width: 860px; line-height: 1.6; white-space: pre-wrap; color: #334155; }

/* Bootstrap-like grid compatibility (scoped to AO theme) */
body.ao-theme .container,
body.ao-theme .container-fluid {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}
body.ao-theme .container { max-width: 1140px; }
body.ao-theme .container-fluid { max-width: none; }

body.ao-theme .row {
  --ao-gutter-x: 0.75rem;
  --ao-gutter-y: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-left: calc(var(--ao-gutter-x) * -0.5);
  margin-right: calc(var(--ao-gutter-x) * -0.5);
  margin-top: calc(var(--ao-gutter-y) * -1);
}
body.ao-theme .row > * {
  width: 100%;
  max-width: 100%;
  padding-left: calc(var(--ao-gutter-x) * 0.5);
  padding-right: calc(var(--ao-gutter-x) * 0.5);
  margin-top: var(--ao-gutter-y);
}

/* gap utilities */
body.ao-theme .g-0, body.ao-theme .gx-0 { --ao-gutter-x: 0; }
body.ao-theme .g-1, body.ao-theme .gx-1 { --ao-gutter-x: 0.25rem; }
body.ao-theme .g-2, body.ao-theme .gx-2 { --ao-gutter-x: 0.5rem; }
body.ao-theme .g-3, body.ao-theme .gx-3 { --ao-gutter-x: 1rem; }
body.ao-theme .g-4, body.ao-theme .gx-4 { --ao-gutter-x: 1.5rem; }
body.ao-theme .g-5, body.ao-theme .gx-5 { --ao-gutter-x: 3rem; }
body.ao-theme .g-0, body.ao-theme .gy-0 { --ao-gutter-y: 0; }
body.ao-theme .g-1, body.ao-theme .gy-1 { --ao-gutter-y: 0.25rem; }
body.ao-theme .g-2, body.ao-theme .gy-2 { --ao-gutter-y: 0.5rem; }
body.ao-theme .g-3, body.ao-theme .gy-3 { --ao-gutter-y: 1rem; }
body.ao-theme .g-4, body.ao-theme .gy-4 { --ao-gutter-y: 1.5rem; }
body.ao-theme .g-5, body.ao-theme .gy-5 { --ao-gutter-y: 3rem; }

/* base columns */
body.ao-theme .col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
body.ao-theme .col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
body.ao-theme .col-3 { flex: 0 0 25%; max-width: 25%; }
body.ao-theme .col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
body.ao-theme .col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
body.ao-theme .col-6 { flex: 0 0 50%; max-width: 50%; }
body.ao-theme .col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
body.ao-theme .col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
body.ao-theme .col-9 { flex: 0 0 75%; max-width: 75%; }
body.ao-theme .col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
body.ao-theme .col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
body.ao-theme .col-12 { flex: 0 0 100%; max-width: 100%; }

/* breakpoints */
@media (min-width: 576px) {
  body.ao-theme .col-sm-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
  body.ao-theme .col-sm-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
  body.ao-theme .col-sm-3 { flex: 0 0 25%; max-width: 25%; }
  body.ao-theme .col-sm-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
  body.ao-theme .col-sm-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
  body.ao-theme .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
  body.ao-theme .col-sm-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
  body.ao-theme .col-sm-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
  body.ao-theme .col-sm-9 { flex: 0 0 75%; max-width: 75%; }
  body.ao-theme .col-sm-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
  body.ao-theme .col-sm-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
  body.ao-theme .col-sm-12 { flex: 0 0 100%; max-width: 100%; }
}
@media (min-width: 768px) {
  body.ao-theme .col-md-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
  body.ao-theme .col-md-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
  body.ao-theme .col-md-3 { flex: 0 0 25%; max-width: 25%; }
  body.ao-theme .col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
  body.ao-theme .col-md-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
  body.ao-theme .col-md-6 { flex: 0 0 50%; max-width: 50%; }
  body.ao-theme .col-md-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
  body.ao-theme .col-md-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
  body.ao-theme .col-md-9 { flex: 0 0 75%; max-width: 75%; }
  body.ao-theme .col-md-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
  body.ao-theme .col-md-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
  body.ao-theme .col-md-12 { flex: 0 0 100%; max-width: 100%; }
}
@media (min-width: 992px) {
  body.ao-theme .col-lg-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
  body.ao-theme .col-lg-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
  body.ao-theme .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
  body.ao-theme .col-lg-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
  body.ao-theme .col-lg-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
  body.ao-theme .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
  body.ao-theme .col-lg-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
  body.ao-theme .col-lg-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
  body.ao-theme .col-lg-9 { flex: 0 0 75%; max-width: 75%; }
  body.ao-theme .col-lg-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
  body.ao-theme .col-lg-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
  body.ao-theme .col-lg-12 { flex: 0 0 100%; max-width: 100%; }
}
@media (min-width: 1200px) {
  body.ao-theme .col-xl-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
  body.ao-theme .col-xl-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
  body.ao-theme .col-xl-3 { flex: 0 0 25%; max-width: 25%; }
  body.ao-theme .col-xl-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
  body.ao-theme .col-xl-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
  body.ao-theme .col-xl-6 { flex: 0 0 50%; max-width: 50%; }
  body.ao-theme .col-xl-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
  body.ao-theme .col-xl-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
  body.ao-theme .col-xl-9 { flex: 0 0 75%; max-width: 75%; }
  body.ao-theme .col-xl-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
  body.ao-theme .col-xl-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
  body.ao-theme .col-xl-12 { flex: 0 0 100%; max-width: 100%; }
}
.form-control-sm {
  padding: 0.35rem 0.6rem !important;
  font-size: 0.86rem !important;
}
.form-control{
  font: inherit;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    background: #fff;
    color: var(--text);
    width: 100%;
    max-width: 100%;
}
.compact-form .form-row { margin-bottom: 0.65rem; }
.compact-form label { margin-bottom: 0.2rem; }
.checkbox-list {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem;
  background: #fff;
}
.skill-map-row {
  border-bottom: 1px solid #eef2f7;
  margin-bottom: 0.45rem;
  padding-bottom: 0.45rem;
}
.skill-map-row:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}
.skill-map-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0;
  color: var(--text);
}
.skill-meta-label {
  margin-bottom: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.table-responsive { overflow-x: auto; }
.table-responsive table { min-width: 720px; }

@media (max-width: 640px) {
  body.ao-theme .row.stack-sm > * { flex: 0 0 100%; max-width: 100%; }
  body.ao-theme .row.stack-sm .btn { width: 100%; justify-content: center; }
}

@media (max-width: 900px) {
  .ao-content-scroll {
    padding: 1rem 0.75rem;
  }
  .card, .ao-card {
    padding: 0.85rem 0.95rem;
  }
  .ao-topbar {
    padding: 0 0.75rem;
  }
  .ao-topbar-actions .btn {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

.error { color: var(--danger); font-size: 0.9rem; margin-top: 0.25rem; }

/* Flash / toast */
.ao-flash-stack {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 360px;
}
.flash, .ao-flash {
  padding: 0.85rem 1.15rem;
  border-radius: 12px;
  font-size: 0.88rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  animation: ao-slideUp 0.3s ease;
}
@keyframes ao-slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.flash-success, .ao-flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #6ee7b7; }
.flash-error, .ao-flash-error { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }

.kb-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
@media (max-width: 1024px) {
  .kb-card-grid { grid-template-columns: 1fr; }
}
.kb-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: box-shadow 0.15s, transform 0.1s;
}
.kb-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; color: inherit; }
.kb-card.restricted { opacity: 0.88; }

.ao-kb-preview-panel {
  position: sticky;
  top: 1rem;
}
