:root { --ink:#0f172a; --muted:#64748b; --line:#e2e8f0; --panel:#f8fafc; --accent:#1e3a8a; --bg:#f1f5f9;
        --ok:#166534; --ok-bg:#dcfce7; --warn:#92400e; --warn-bg:#fef3c7; --err:#991b1b; --err-bg:#fee2e2; }
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; }
a { color: var(--accent); }
.admin-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--ink); }
.admin-bar .brand { color: #fff; font-weight: 700; text-decoration: none; }
.admin-bar button { background: none; border: 1px solid #475569; color: #e2e8f0; border-radius: 6px; padding: 6px 12px; cursor: pointer; font: inherit; }
.admin-main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 1.6rem; margin: 0 0 16px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.card.narrow { max-width: 420px; margin: 40px auto; }
label { display: block; font-weight: 700; font-size: .9rem; margin: 14px 0 6px; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #93c5fd; border-color: #60a5fa; }
button { font: inherit; cursor: pointer; }
button.primary { margin-top: 18px; width: 100%; padding: 11px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; }
button.primary:hover { background: #172e6e; }
.small { font-size: .85rem; color: var(--muted); margin-top: 16px; }
.notice { padding: 10px 12px; border-radius: 8px; font-size: .92rem; }
.notice.info { background: #e0e7ff; color: #1e3a8a; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.error { background: var(--err-bg); color: var(--err); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.tile { display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px; text-decoration: none; color: inherit; }
.tile:hover { border-color: #94a3b8; }
.tile strong { display: block; margin-bottom: 4px; }
.tile span { color: var(--muted); font-size: .9rem; }

/* Inside the admin menu's frame: the shell already shows the top bar. */
.framed .admin-bar { display: none; }
.framed .admin-main { padding-top: 16px; }
/* The admin home: tools down the left, the open one beside them. */
body.shell { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.shell-body { flex: 1; display: flex; min-height: 0; }
.side-menu { width: 240px; flex: none; background: #fff; border-right: 1px solid var(--line); padding: 12px 8px; overflow-y: auto; }
.side-menu a { display: block; padding: 9px 12px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: .95rem; }
.side-menu a:hover { background: var(--panel); }
.side-menu a.on { background: #e0e7ff; color: var(--accent); font-weight: 700; }
/* A count when something in that tool needs Stephen; grey "off" when it can't be reached. */
.side-menu a { display: flex; align-items: center; gap: 8px; }
.side-menu .count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 11px; background: #dc2626; color: #fff; font-size: .8rem; font-weight: 700; text-align: center; }
.side-menu .count.off { background: #e5e7eb; color: #6b7280; font-weight: 500; }
/* While the menu is hidden, the menu button carries the total. */
body.menu-hidden #menuToggle[data-count]:not([data-count=""])::after { content: attr(data-count); margin-left: 6px; padding: 0 6px; border-radius: 9px; background: #dc2626; color: #fff; font-size: .75rem; font-weight: 700; }
.tool-area { flex: 1; min-width: 0; display: flex; }
.tool-area iframe { flex: 1; width: 100%; border: 0; background: var(--bg); }
.tool-welcome { padding: 24px; overflow-y: auto; max-width: 760px; }
.tool-welcome dt { font-weight: 700; margin-top: 12px; }
.tool-welcome dd { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }
[hidden] { display: none !important; }
.bar-left { display: flex; align-items: center; gap: 14px; }
body.menu-hidden .side-menu { display: none; }
/* The menu by website: websites fold open and shut; a customer or site with
   several tools opens its own list (with Back). */
.side-menu.tree { width: 270px; }
.menu-head { display: flex; align-items: center; gap: 8px; padding: 0 4px 10px; }
.menu-label { font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding-left: 8px; }
.menu-back, .menu-hide { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; font-size: .85rem; color: var(--accent); }
.menu-hide { margin-left: auto; color: var(--muted); }
.menu-back:hover, .menu-hide:hover { background: var(--panel); }
.menu-trail { margin: 0 12px; font-size: .8rem; color: var(--muted); }
.menu-title { margin: 0 12px 8px; font-size: 1.1rem; }
details.menu-site { margin-bottom: 4px; }
details.menu-site > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 6px; font-weight: 700; cursor: pointer; }
details.menu-site > summary::-webkit-details-marker { display: none; }
details.menu-site > summary::before { content: '▸'; width: 12px; color: var(--muted); }
details.menu-site[open] > summary::before { content: '▾'; }
details.menu-site > summary:hover { background: var(--panel); }
.menu-items { margin: 0 0 6px 14px; padding-left: 6px; border-left: 2px solid var(--line); }
.menu-group { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 12px; border: 0; border-radius: 6px; background: none; color: var(--ink); text-align: left; font-size: .95rem; }
.menu-group:hover { background: var(--panel); }
.menu-group .chev { margin-left: auto; color: var(--muted); font-size: 1.1rem; line-height: 1; }
.menu-group .count:not([hidden]) + .chev { margin-left: 4px; }
.side-menu .ext { color: var(--muted); font-size: .85rem; }
@media (max-width: 760px) {
  .side-menu.tree { display: block; width: auto; max-height: 45vh; overflow-y: auto; }
  .side-menu.tree a { white-space: normal; }
  .shell-body { flex-direction: column; }
  .side-menu { width: auto; border-right: 0; border-bottom: 1px solid var(--line); display: flex; gap: 4px; overflow-x: auto; padding: 8px; }
  .side-menu a { white-space: nowrap; flex: none; }
}
