/* ═══════════════════════════════════════════════════════════════
   Admin shell · shared by all /admin/* pages
   ADR-0027 Phase 2a polish · audit Phase 1.2

   Imports the design tokens via cascade from catlaxy-ds.css (loaded
   first by base.html). This file is deliberately small · only the
   shell chrome (topbar + page-head + body bg) goes here.

   Page-specific styles (table, form fields, color picker rows) stay
   inline in each template's {% block head %}.
   ═══════════════════════════════════════════════════════════════ */

html, body { height: 100%; margin: 0; }

body.page-admin {
  font-family: var(--f-cn);
  color: var(--c-primary);
  background:
    radial-gradient(ellipse 900px 500px at 12% -10%, var(--c-blue-ghost), transparent 55%),
    radial-gradient(ellipse 700px 400px at 90% 110%, var(--c-rose-ghost), transparent 55%),
    #FAFBFD;
  background-attachment: fixed;
}

/* ═══ TOPBAR — slim 56px, sticky at top ═══ */
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 var(--s-7);
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--c-divider);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar .logo {
  color: var(--c-blue);
  line-height: 0;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.topbar .logo svg { width: 108px; height: auto; display: block; }

.topbar .divider {
  width: 1px;
  height: 22px;
  background: var(--c-divider);
  margin: 0 var(--s-5);
}

.topbar .nav-link {
  font-size: 13px;
  color: var(--c-secondary);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  margin-right: 4px;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.topbar .nav-link:hover { background: var(--c-blue-ghost); color: var(--c-blue); }
.topbar .nav-link.active { color: var(--c-blue); font-weight: 700; }

.topbar .section-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--c-title);
  letter-spacing: -0.2px;
}

.topbar .spacer { flex: 1; }

.topbar .who {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 10px 6px 6px;
  background: var(--c-card);
  border-radius: var(--r-pill);
  font-size: 13px;
  color: var(--c-secondary);
}
.topbar .who .avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c-blue);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-en);
  font-size: 11px;
  font-weight: 700;
}

/* ═══ TOPBAR INLINE CONTROLS · search + tenant select + new btn ═══
   Live in the right side of topbar between spacer and user pill. */
.topbar .topbar-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px 0 0;
}
.topbar .tb-select {
  padding: 7px 30px 7px 12px;
  background: #fff;
  border: 1.5px solid var(--c-divider);
  border-radius: var(--r-sm);
  font-family: var(--f-cn);
  font-size: 13px;
  color: var(--c-title);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  height: 34px;
  transition: border-color var(--dur-fast) var(--ease);
}
.topbar .tb-select:hover { border-color: var(--c-blue-40); }
.topbar .tb-select:focus { outline: none; border-color: var(--c-blue); }
.topbar .tb-search {
  position: relative;
  width: 240px;
}
.topbar .tb-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 12px 7px 32px;
  border: 1.5px solid var(--c-divider);
  border-radius: var(--r-sm);
  font-family: var(--f-cn);
  font-size: 13px;
  color: var(--c-title);
  background: #fff;
  height: 34px;
  transition: border-color var(--dur-fast) var(--ease);
}
.topbar .tb-search input:focus { outline: none; border-color: var(--c-blue); }
.topbar .tb-search i {
  position: absolute;
  left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--c-muted);
  font-size: 14px;
  pointer-events: none;
}
.topbar .tb-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 34px;
  background: var(--c-blue);
  color: #fff;
  border-radius: var(--r-sm);
  font-family: var(--f-cn);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  margin: 0 12px 0 4px;
  transition: background var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
.topbar .tb-new-btn:hover {
  background: var(--c-blue-60);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 0 var(--c-title);
}
.topbar .tb-new-btn .plus {
  position: relative;
  width: 12px; height: 12px;
}
.topbar .tb-new-btn .plus::before,
.topbar .tb-new-btn .plus::after {
  content: ''; position: absolute; background: #fff;
}
.topbar .tb-new-btn .plus::before { left: 5px; top: 0; bottom: 0; width: 2px; }
.topbar .tb-new-btn .plus::after { top: 5px; left: 0; right: 0; height: 2px; }

@media (max-width: 1100px) {
  .topbar .tb-search { width: 180px; }
}
@media (max-width: 880px) {
  .topbar .tb-search { display: none; }   /* hide on narrow · room only for select */
  .topbar .tb-new-btn span:last-child { display: none; }  /* + only */
  .topbar .tb-new-btn { padding: 0 10px; }
}
@media (max-width: 720px) {
  .topbar .tb-select { display: none; }
  .topbar .who span:last-child { display: none; }   /* hide email · keep avatar */
}

.topbar form { display: inline-block; margin-left: var(--s-3); }
.topbar .logout {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--c-divider);
  border-radius: var(--r-pill);
  font-family: var(--f-cn);
  font-size: 13px;
  font-weight: 600;
  color: var(--c-secondary);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.topbar .logout:hover {
  background: #fff;
  border-color: var(--c-blue-40);
  color: var(--c-blue);
}

/* ═══ MAIN container ═══ */
.main {
  max-width: 1200px;
  margin: var(--s-9) auto var(--s-11);
  padding: 0 var(--s-7);
}
.main--wide { max-width: 1300px; }
.main--narrow { max-width: 880px; }

/* ═══ PAGE HEAD ═══ */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-7);
  margin-bottom: var(--s-9);
  padding-bottom: var(--s-6);
  border-bottom: 1px solid var(--c-divider);
}
.page-head h1 {
  font-size: 36px;
  font-weight: 900;
  color: var(--c-title);
  letter-spacing: -0.8px;
  line-height: 1.15;
  margin: 0 0 var(--s-2);
}
.page-head .sub {
  font-size: 14px;
  color: var(--c-muted);
  margin: 0;
  display: flex;
  gap: var(--s-3);
  align-items: center;
}
.page-head .sub .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--c-divider);
}

/* ═══ NEW BUTTON · primary action on page-head right ═══ */
.new-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 10px 18px;
  background: var(--c-blue);
  color: #fff;
  border: none;
  border-radius: var(--r-pill);
  font-family: var(--f-cn);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 120, 252, 0.25);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  text-decoration: none;
}
.new-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 120, 252, 0.35);
}
.new-btn .plus {
  position: relative;
  width: 14px;
  height: 14px;
}
.new-btn .plus::before,
.new-btn .plus::after {
  content: '';
  position: absolute;
  background: #fff;
}
.new-btn .plus::before { left: 50%; top: 0; bottom: 0; width: 2px; transform: translateX(-50%); }
.new-btn .plus::after { top: 50%; left: 0; right: 0; height: 2px; transform: translateY(-50%); }

/* ═══ Breadcrumb (optional, used in form pages) ═══ */
.breadcrumb {
  font-size: 13px;
  color: var(--c-muted);
  margin-bottom: var(--s-3);
}
.breadcrumb a {
  color: var(--c-blue);
  text-decoration: none;
}
.breadcrumb code {
  font-family: var(--f-mono, monospace);
  font-size: 12px;
  background: rgba(0, 0, 0, 0.04);
  padding: 1px 6px;
  border-radius: 3px;
}

/* ═══ Error banner (form-level error) ═══ */
.err-banner {
  padding: 14px 18px;
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  border-radius: 8px;
  color: #B91C1C;
  margin-bottom: var(--s-6);
  font-size: 14px;
}

/* ═══ Responsive: collapse page-head on narrow ═══ */
@media (max-width: 760px) {
  .page-head {
    flex-direction: column;
    align-items: stretch;
  }
}
