/* The signed-in area, on top of styles.css: its own bar, and the sections of an account down the side.
   dashboard.html and rules.html carry it. A page shows it once someone is signed in (body.signed-in),
   in place of the public bar. */
body.signed-in > header.nav { display: none; }
.app { min-height: 100vh; }
.app-bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px; height: 56px; padding: 0 24px; background: rgba(11,24,49,.96); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(255,255,255,.1); }
.app-bar .brand { font-size: 17px; flex: none; }
.app-bar-links { margin-left: auto; display: flex; align-items: center; gap: 18px; min-width: 0; }
.app-bar-links a { color: #c7cfe6; font-size: 14px; white-space: nowrap; }
.app-bar-links a:hover { color: #fff; text-decoration: none; }
.app-bar-links a:focus-visible, .app-side a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.app-who { color: #93a0c4; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.app-who .chip { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.15); color: #fff; margin-left: 6px; }
.app-who .chip:empty { display: none; }

.app-body { display: grid; grid-template-columns: 208px minmax(0, 1fr); max-width: 1280px; margin: 0 auto; }
.app-side { position: sticky; top: 56px; align-self: start; display: flex; flex-direction: column; gap: 2px; padding: 28px 8px 28px 20px; }
.app-side a { display: block; padding: 8px 12px; border-radius: 8px; border-left: 3px solid transparent; color: var(--ink); font: 600 14.5px var(--sans); white-space: nowrap; }
.app-side a:hover { background: rgba(20,39,80,.06); text-decoration: none; }
.app-side a[aria-current] { background: #fff; border-left-color: var(--accent); box-shadow: 0 0 0 1px var(--line); }
.app-side a#admin-link { margin-top: 14px; color: var(--muted); }
.app-main { padding: 28px 24px 96px; min-width: 0; }
.app-head { margin-bottom: 22px; }
.app-head h1 { font-size: 28px; letter-spacing: -.5px; margin: 0 0 4px; }
.app-head p { margin: 0; }
.app-main .panel .muted.small { font-size: 13px; margin: 0 0 12px; }
.app-main .form-error:empty { display: none; }

/* Home */
.app-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.app-tiles .tile-value { font-size: 28px; }
.app-list { list-style: none; margin: 0; padding: 0; }
.app-list li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.app-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.app-list li:first-child { padding-top: 0; }
.app-list li > span { flex: 1 1 260px; }
.app-list .btn { margin-left: auto; }
.app-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.app-main pre.app-code { background: var(--navy-900); color: #e8ecf7; padding: 14px 16px; border-radius: 8px; overflow-x: auto; font-size: 12.5px; margin: 0; }

/* Decisions */
.dec-bars { display: flex; align-items: flex-end; gap: 2px; height: 170px; border-top: 1px dashed var(--line); border-bottom: 1px solid #c9d0e2; }
.dec-col { flex: 1; height: 100%; display: flex; flex-direction: column-reverse; cursor: default; }
.dec-col span { display: block; width: 100%; min-height: 0; }
.dec-col span:last-child { border-radius: 4px 4px 0 0; }
.dec-col .rules, .app-key.rules { background: var(--sat); }
.dec-col .reused, .app-key.reused { background: #3b5bdb; }
.dec-col .model, .app-key.model { background: var(--accent); }
.dec-col:hover span { filter: brightness(.9); }
.app-legend { display: flex; gap: 6px 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.app-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.app-table { font-size: 14px; margin: 0; }
.app-table th { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.app-table td { vertical-align: middle; }
.app-table tr:last-child td { border-bottom: 0; }
.app-table tr.app-open td { background: #fff7f3; }
.app-table td.act { text-align: right; white-space: nowrap; }
.app-table td.act > * + * { margin-left: 6px; }
.app-table td.app-facts { font: 12.5px var(--mono); color: var(--ink); word-break: break-word; }
#dec-a-rules { margin-top: 14px; }
.app-main .btn-xs { padding: 4px 9px; font-size: 12.5px; line-height: 1.4; border-radius: 7px; box-shadow: none; white-space: nowrap; }
.app-main select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); font: 14px var(--sans); }

@media (max-width: 1000px) {
  .app-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* narrow: the sections become a row to swipe along, under the bar */
@media (max-width: 860px) {
  .app-body { grid-template-columns: minmax(0, 1fr); }
  .app-side { top: 56px; z-index: 5; flex-direction: row; overflow-x: auto; gap: 4px; padding: 8px 12px; background: var(--wash); border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .app-side::-webkit-scrollbar { display: none; }
  .app-side a { flex: none; border-left: 0; padding: 7px 11px; font-size: 14px; }
  .app-side a[aria-current] { box-shadow: 0 0 0 1px var(--line), inset 0 -2px 0 var(--accent); }
  .app-side a#admin-link { margin-top: 0; }
  .app-main { padding: 20px 16px 72px; }
  .app-bar { padding: 0 16px; gap: 12px; }
  .app-who { display: none; }
  .app-head h1 { font-size: 24px; }
}
@media (max-width: 640px) {
  .app-tiles { grid-template-columns: minmax(0, 1fr); }
  .app-table thead { display: none; }
  .app-table, .app-table tbody, .app-table tr, .app-table td { display: block; width: 100%; }
  .app-table tr { border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; margin-bottom: 10px; }
  .app-table td, .app-table tr:last-child td { border: 0; padding: 3px 0; }
  .app-table td[data-l] { display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .app-table td[data-l]::before { content: attr(data-l); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; flex: none; }
  .app-table td.lead { font-size: 15px; padding-bottom: 6px; }
  .app-table td.act { text-align: left; padding-top: 8px; white-space: normal; }
}
