/* True Table — shared application header
   One header for every page. The LEFT zone is contextual (greeting on the
   dashboard, breadcrumb on an editor); the RIGHT cluster (search, theme,
   notifications, optional Create, profile) is identical everywhere.
   Everything is namespaced under .appbar so it never collides with a page's
   own global classes. Relies only on the shared design tokens (--bg, --text,
   --accent, …) that every page already defines, so it is theme-aware. */

.appbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px var(--appbar-px, 24px);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background 0.18s, border-color 0.18s;
  min-height: 60px;
  box-sizing: border-box;
}
.appbar.scrolled {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom-color: var(--border);
}

/* ── Contextual left zone ── */
.appbar-context { flex: 1; min-width: 0; display: flex; align-items: center; }
.appbar-context h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--text);
}
.appbar-context p {
  margin: 2px 0 0;
  color: var(--text-2);
  font-size: 13px;
}
/* Breadcrumb variant used by editors */
.appbar-crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-3);
}
.appbar-crumbs a {
  color: var(--text-2);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.appbar-crumbs a:hover { color: var(--text); }
.appbar-crumbs a svg { width: 13px; height: 13px; }
.appbar-crumbs .sep { color: var(--border-2); }
.appbar-crumbs .here { color: var(--text); font-weight: 600; }

/* ── Right tools zone ── */
.appbar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.appbar-div {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}

/* Search */
.appbar .ah-search {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 1 240px;
  min-width: 0;
  color: var(--text-3);
  font-size: 13px;
}
.appbar .ah-search svg { width: 15px; height: 15px; flex-shrink: 0; }
.appbar .ah-search input {
  border: 0;
  background: transparent;
  outline: none;
  font: inherit;
  color: var(--text);
  width: 100%;
}
.appbar .ah-search input::placeholder { color: var(--text-3); }
.appbar .ah-search kbd {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--text-2);
  flex-shrink: 0;
}

/* Icon buttons (theme, notifications) */
.appbar .ah-icon-btn {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--card);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--text-2);
  position: relative;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.15s;
}
.appbar .ah-icon-btn:hover { color: var(--text); background: var(--bg-2); border-color: var(--border-2); transform: translateY(-1px); }
.appbar .ah-icon-btn svg { width: 17px; height: 17px; }
.appbar .ah-icon-btn .ah-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--alert);
  border: 2px solid var(--bg);
}

/* Create button */
.appbar .ah-create {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: var(--accent);
  color: var(--accent-on, #fff);
  border: 0;
  border-radius: 11px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-soft);
  transition: transform 0.15s, filter 0.15s;
}
.appbar .ah-create:hover { transform: translateY(-1px); }
.appbar .ah-create svg { width: 15px; height: 15px; }

/* Profile pill */
.appbar .ah-profile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 9px 4px 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.appbar .ah-profile:hover, .appbar .ah-profile.open { background: var(--bg-2); border-color: var(--border-2); }
.appbar .ah-profile .ah-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2, var(--accent)));
  color: #fff;
  display: grid; place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
}
.appbar .ah-profile .ah-pname { font-size: 13px; font-weight: 600; color: var(--text); }
/* Custom avatar node (e.g. a tone-coloured dashboard avatar) */
.appbar .ah-profile .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  font-size: 11.5px; font-weight: 700; flex-shrink: 0;
}
.appbar .ah-profile .ah-caret { width: 13px; height: 13px; color: var(--text-3); transition: transform 0.18s; }
.appbar .ah-profile.open .ah-caret { transform: rotate(180deg); }

/* Dropdown shell (host for page-supplied menu content) */
.ah-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  padding: 6px;
  min-width: 220px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
}
.ah-trigger-wrap { position: relative; display: inline-flex; }

/* Responsive: shed the wide search, then the profile name, on tighter bars */
@media (max-width: 1180px) {
  .appbar .ah-search { display: none; }
}
@media (max-width: 1024px) {
  .appbar .ah-profile .ah-pname { display: none; }
}
