/* Staff portal — builds on site.css tokens and form styles */
body.portal { background: var(--panel); font-size: 16px; }
.p-top { background: var(--navy-deep); color: #fff; position: sticky; top: 0; z-index: 30; }
.p-top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; }
.p-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; font-size: 18px; }
.p-brand .brand-mark { width: 38px; height: 38px; font-size: 14px; }
.p-brand small { display: block; font-family: var(--body); text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13px; color: var(--on-navy-muted); }
.p-top-actions { display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap; font-size: 15px; }
.p-top-actions a, .p-top-actions button { color: #fff; font-weight: 600; }
.p-top-actions form { margin: 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.p-menu-btn { display: none; }

.p-shell { display: flex; align-items: flex-start; max-width: 1360px; margin: 0 auto; }
.p-side { width: 240px; flex: none; padding: 20px 12px 40px; position: sticky; top: 58px; max-height: calc(100vh - 58px); overflow-y: auto; }
.p-side h4 { margin: 18px 12px 6px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.p-side a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; min-height: 44px; }
.p-side a:hover { background: #E6EAF2; }
.p-side a.on { background: var(--navy); color: #fff; }
.badge { background: var(--gold); color: var(--navy); border-radius: 99px; font-size: 13px; font-weight: 700; padding: 1px 9px; min-width: 24px; text-align: center; }
.p-main { flex: 1; min-width: 0; padding: 24px 28px 64px; }

.p-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.p-head h1 { font-size: clamp(28px, 4vw, 36px); color: var(--navy); }
.p-head p { color: var(--muted); margin-top: 6px; max-width: 640px; }
.back { display: inline-block; margin-bottom: 10px; font-weight: 600; font-size: 15px; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.panel + .panel { margin-top: 16px; }
.panel h2 { font-size: 22px; margin-bottom: 12px; }
.panel-tight { padding: 0; overflow: hidden; }

.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 20px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 4px; min-height: 108px; }
.tile:hover { border-color: var(--navy); color: var(--ink); box-shadow: 0 2px 10px rgba(19,40,75,.08); }
.tile strong { font-family: var(--display); font-size: 34px; font-weight: 600; color: var(--navy); line-height: 1; }
.tile.alert { background: var(--cream); border-color: #EBD9A6; }
.tile span { color: var(--muted); font-size: 15px; }
.quick { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.quick a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--navy); font-weight: 700; text-decoration: none; min-height: 56px; }
.quick a:hover { border-color: var(--navy); }
.quick svg { flex: none; }

.p-msg { border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; font-weight: 600; }
.p-msg.success { background: var(--ok-bg); color: var(--ok); }
.p-msg.error { background: var(--err-bg); color: var(--err); }
.hint { background: #EEF2F9; border-radius: 8px; padding: 12px 14px; color: var(--navy); font-size: 15px; }
.helptext { font-size: 14px; color: var(--muted); }

/* Lists */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.rows > li:last-child { border-bottom: 0; }
.rows .main { min-width: 0; flex: 1 1 260px; }
.rows .main strong { display: block; color: var(--navy); font-size: 17px; }
.rows .main span { color: var(--muted); font-size: 15px; }
.rows .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.rows .off { opacity: .55; }
.btn-sm { min-height: 40px; padding: 8px 14px; font-size: 15px; }
.btn-light { background: #fff; border: 1px solid var(--line-strong); color: var(--navy); }
.btn-light:hover { border-color: var(--navy); color: var(--navy); }
.btn-danger { background: #fff; border: 2px solid var(--err); color: var(--err); }
.btn-danger:hover { background: var(--err-bg); color: var(--err); }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }
.pill { display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 9px; border-radius: 99px; background: var(--panel); color: var(--muted); }
.pill.new { background: var(--gold); color: var(--navy); }
.pill.contacted { background: #E7ECF7; color: var(--navy); }
.pill.done { background: var(--ok-bg); color: var(--ok); }
.pill.on { background: var(--ok-bg); color: var(--ok); }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tabs a { padding: 9px 14px; border-radius: 8px; background: #fff; border: 1px solid var(--line); color: var(--navy); font-weight: 600; text-decoration: none; display: inline-flex; gap: 8px; align-items: center; min-height: 42px; }
.tabs a.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.subtabs a { background: transparent; border-color: transparent; font-size: 15px; }
.subtabs a.on { background: #E6EAF2; color: var(--navy); border-color: #E6EAF2; }

/* Forms */
.p-form { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.p-form .field.wide { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 20px; }
.form-actions .spacer { flex: 1; }
.field input[type=file] { font: inherit; padding: 10px; border: 1px dashed var(--line-strong); border-radius: 6px; background: var(--panel); width: 100%; }
.field .clearable-file-input, .field a { word-break: break-all; }
.field select { appearance: auto; }

.fs-table { width: 100%; border-collapse: collapse; }
.fs-table th { text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 8px; }
.fs-table td { padding: 6px 8px; vertical-align: top; border-top: 1px solid var(--line); }
.fs-table input[type=text], .fs-table input[type=number], .fs-table input[type=date], .fs-table textarea, .fs-table select {
  font: inherit; padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 6px; width: 100%; min-height: 44px; background: #fff;
}
.fs-table .del { white-space: nowrap; font-size: 14px; color: var(--err); }
.fs-table .del label { display: flex; gap: 6px; align-items: center; min-height: 44px; cursor: pointer; }
.fs-table .errorlist { margin-top: 4px; }
.fs-table tr.new-row td { background: #FBFCFE; }

.photo-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.photo-grid a { display: block; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; text-decoration: none; color: var(--ink); }
.photo-grid img { width: 100%; height: 150px; object-fit: cover; }
.photo-grid span { display: block; padding: 8px 10px; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.detail { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; margin: 0; }
.detail dt, .detail dd { padding: 10px 0; border-bottom: 1px solid var(--line); margin: 0; }
.detail dt { color: var(--muted); padding-right: 16px; }
.detail dd { font-weight: 600; white-space: pre-line; overflow-wrap: anywhere; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--navy); }
.login-card { background: #fff; border-radius: 14px; padding: 32px 28px; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 18px; }
.login-card h1 { color: var(--navy); font-size: 30px; }

@media (max-width: 900px) {
  .p-menu-btn { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 2px solid rgba(255,255,255,.5); color: #fff; border-radius: 6px; min-height: 40px; padding: 6px 12px; font: inherit; font-weight: 700; cursor: pointer; }
  .p-top-actions .hide-sm { display: none; }
  .p-shell { display: block; }
  .p-side { display: none; position: fixed; inset: 58px 0 0 0; width: auto; max-height: none; background: #fff; z-index: 25; padding: 12px 16px 40px; }
  .p-side.open { display: block; }
  .p-main { padding: 18px 16px 56px; }
  .panel { padding: 18px 16px; }
  /* Formset tables become stacked cards on phones */
  .fs-table thead { display: none; }
  .fs-table, .fs-table tbody, .fs-table tr, .fs-table td { display: block; width: 100%; }
  .fs-table tr { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 12px; background: #fff; }
  .fs-table td { border: 0; padding: 4px; }
  .fs-table td[data-label]::before { content: attr(data-label); display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
  .detail { grid-template-columns: 1fr; }
  .detail dt { border-bottom: 0; padding-bottom: 0; }
}
