* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --blue: #050505;
  --blue-light: #303030;
  --blue-bg: #F1F1F1;
  --dark: #1a1a1a;
  --gray: #555;
  --light-gray: #e0e0e0;
  --bg: #f5f7fa;
  --white: #fff;
  --red: #c0392b;
  /* A very light pink for hover states - warm enough to read as a response,
     pale enough not to compete with the content. */
  --hover-pink: #fdf2f4;
  --hover-pink-border: #f0c8d2;
  --green: #27ae60;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,.1);
}
body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--bg); color: var(--dark); min-height: 100vh; }

/* Tick boxes and radios in the brand black rather than the browser's blue.
   accent-color keeps the control native - so it still looks and behaves the
   way the operating system draws it - and only recolours the fill. */
input[type="checkbox"], input[type="radio"] { accent-color: var(--blue); }

/* Nav */
#topnav { display: grid; grid-template-columns: minmax(260px,1fr) auto minmax(260px,1fr); align-items: center; background: #fff; color: var(--dark); padding: 0 18px; min-height: 76px; border-top: 3px solid #edf1f5; box-shadow: 0 2px 7px rgba(0,0,0,.18); }
#topnav.hidden { display: none; }
.nav-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.nav-logo { display: inline-flex; align-items: center; background: #050505; padding: 7px 12px; height: 56px; }
.nav-logo img { width: 162px; height: auto; display: block; }
.product-name { font-size: 21px; white-space: nowrap; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a { color: #303946; text-decoration: none; padding: 10px 12px; border-radius: 3px; font-size: 14px; transition: all .15s; white-space: nowrap; }
.nav-links a:hover, .nav-links a.active { background: #f0f3f6; color: #111; }
.nav-user { justify-self: end; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.user-avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #e5e5e5; font-weight: 700; }
.logout-button { border: 0; background: transparent; color: #333; cursor: pointer; padding: 7px; }
.admin-only.hidden { display: none; }

/* Main */
main { max-width: none; margin: 0 auto; padding: 10px 28px 20px; }
main.login-main { max-width: none; min-height: 100vh; padding: 0; display: flex; flex-direction: column; background: #fff; }
.login-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.login-panel { width: 452px; border: 1px solid #cfcfcf; padding: 20px; background: #fff; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 13px; margin: 20px 0 42px; }
/* The product wordmark, as on the brochure: a semibold "Hi" with the ELEMENT
   pink line beneath it, then "access hub" in light lower case. Sized by
   font-size alone, so the same markup serves the login page and the menu bar. */
.hi-wordmark { font-weight: 300; letter-spacing: 0.01em; line-height: 1; white-space: nowrap; color: #111; }
.hi-wordmark .hi { font-weight: 700; position: relative; display: inline-block; }
.hi-wordmark .hi::after { content: ""; position: absolute; left: 0.04em; right: 0.06em; bottom: -0.14em; height: 0.08em; min-height: 2px; background: #efa6aa; }
.login-brand .hi-wordmark { font-size: 50px; }
.login-panel input { width: 100%; border: 1px solid #c8c8c8; padding: 10px; font-size: 14px; }
.login-actions { display: flex; margin-top: 24px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.modal-actions .btn { min-width: 110px; }
.login-actions button { width: 100%; border: 0; background: #272929; color: #fff; padding: 11px; font-weight: 700; cursor: pointer; }
.login-link { border: 0; background: transparent; color: #111; text-decoration: underline; cursor: pointer; margin-top: 14px; padding: 4px 0; font-size: 13px; }
.login-error { min-height: 20px; color: var(--red); font-size: 13px; margin-top: 10px; }
/* Shown on the login page after the session times out. */
.login-notice { background: #fff4dc; color: #8a5a00; border-radius: 4px; padding: 9px 11px; font-size: 13px; margin-bottom: 14px; }
/* Countdown before the sign-in lapses. Above dialogs, so it shows over one. */
.session-warning { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 1100; display: flex; align-items: center; gap: 14px;
  background: #fff4dc; color: #6b4600; border: 1px solid #e8c77a; border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.18); padding: 10px 14px; font-size: 14px; max-width: calc(100vw - 32px); }
.session-warning.hidden { display: none; }
.session-warning button { padding: 6px 12px; font-size: 13px; }
.login-footer { border-top: 1px solid #333; padding: 14px 20px; font-size: 12px; display: flex; justify-content: space-between; }
.search-input { width: min(440px,100%); padding: 9px 12px; border: 1px solid #cbd2d9; border-radius: 4px; font-size: 14px; }
.toolbar-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

/* Cards */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-header h2 { font-size: 18px; color: var(--blue); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: none; border-radius: 4px; font-size: 13px; cursor: pointer; font-weight: 600; transition: all .15s; text-decoration: none; color: var(--white); }
.btn-primary { background: var(--blue); }
.btn-primary:hover { background: var(--blue-light); }
.btn-success { background: var(--green); }
.btn-success:hover { background: #219a52; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #a93226; }
.btn-outline { background: transparent; color: var(--blue); border: 1px solid var(--blue); }
.btn-outline:hover { background: var(--hover-pink); border-color: var(--hover-pink-border); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; font-size: 16px; }
.full-width { width: 100%; justify-content: center; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--gray); margin-bottom: 4px; }
.form-group input, .form-group textarea, .form-group select,
.filter-field input, .filter-field select {
  width: 100%; padding: 8px 12px; border: 1px solid var(--light-gray); border-radius: 4px;
  font-size: 14px; font-family: inherit; transition: border-color .15s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus,
.filter-field input:focus, .filter-field select:focus { outline: none; border-color: var(--blue); }
.form-group textarea { min-height: 60px; resize: vertical; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.checkbox-inline { display: inline-flex !important; align-items: center; gap: 8px; min-height: 42px; margin: 0; color: var(--dark) !important; }
.checkbox-inline input[type="checkbox"] { width: auto; margin: 0; flex: 0 0 auto; }
.reset-tabs { display: flex; gap: 8px; margin: 8px 0 16px; }
.reset-tabs .btn { flex: 1; justify-content: center; }
.reset-panel.hidden, .hidden { display: none !important; }
.permission-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.permission-grid h4 { font-size: 13px; margin-bottom: 8px; }
.permission-check { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; }
.permission-check input { width: auto; }
.qr-box { display: flex; justify-content: center; padding: 12px; margin-bottom: 14px; border: 1px solid var(--light-gray); border-radius: 4px; background: #fff; }
.qr-box img { width: 220px; height: 220px; image-rendering: crisp-edges; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { background: var(--blue); color: var(--white); padding: 10px 12px; text-align: left; font-weight: 600; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--light-gray); }
.data-table tbody tr:hover { background: var(--hover-pink); }
.data-table .actions { white-space: nowrap; }
/* Tables inside a card (residents under a unit, companies under a visitor
   type): every card gets the same column widths, so the row edit/delete
   buttons sit in one line down the page, flush right under the card's own
   edit/delete buttons. */
.aligned-table { table-layout: fixed; }
.aligned-table td { overflow: hidden; text-overflow: ellipsis; }
.aligned-table .actions { text-align: right; padding-right: 0; }
.aligned-table .actions .btn-icon + .btn-icon { margin-left: 2px; }

/* Quote detail layout */
.quote-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
.quote-main, .quote-sidebar { min-width: 0; }

/* Section blocks */
.section-block { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.section-header { background: var(--blue); color: var(--white); padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.section-header h3 { font-size: 14px; font-weight: 600; }
.section-body { padding: 12px 16px; }
.section-body .item-row { display: grid; grid-template-columns: 60px 1fr 100px 100px 100px 36px; gap: 8px; align-items: center; margin-bottom: 8px; padding: 6px 0; border-bottom: 1px solid #f0f0f0; }
.section-body .item-row:last-child { border-bottom: none; }
.section-body .item-row input, .section-body .item-row select {
  padding: 5px 8px; border: 1px solid var(--light-gray); border-radius: 3px; font-size: 13px;
}
.section-body .item-row input:focus, .section-body .item-row select:focus { outline: none; border-color: var(--blue); }
.section-totals { text-align: right; padding: 8px 16px; border-top: 2px solid var(--light-gray); }
.section-totals .total-line { margin-bottom: 4px; font-size: 13px; }
.section-totals .total-line.grand { font-weight: 700; font-size: 15px; color: var(--blue); border-top: 2px solid var(--dark); padding-top: 6px; }

/* Product autocomplete */
.autocomplete-wrapper { position: relative; }
.autocomplete-list {
  position: absolute; top: 100%; left: 0; right: 0; background: var(--white);
  border: 1px solid var(--light-gray); border-top: none; max-height: 180px; overflow-y: auto;
  z-index: 100; box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.autocomplete-list .ac-item { padding: 8px 12px; cursor: pointer; font-size: 13px; border-bottom: 1px solid #f5f5f5; }
.autocomplete-list .ac-item:hover { background: var(--blue-bg); }
.autocomplete-list .ac-item .ac-cost { color: var(--gray); font-size: 11px; }

/* Margin indicator */
.margin-badge { display: inline-block; background: #fff3cd; color: #856404; padding: 1px 6px; border-radius: 3px; font-size: 11px; font-weight: 600; }
.internal-note { color: var(--red); font-size: 11px; font-style: italic; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-overlay.hidden { display: none; }
.modal-content {
  background: var(--white); border-radius: var(--radius); max-width: 640px; width: 90%;
  max-height: 85vh; box-shadow: 0 8px 32px rgba(0,0,0,.2);
  display: flex; flex-direction: column;
  /* The scroller lives on .modal-body, so the rounded corners are never
     squared off by the scrollbar sitting flush against the edge. */
  overflow: hidden;
}
.modal-head { padding: 20px 24px 12px; border-bottom: 1px solid var(--light-gray); flex: 0 0 auto; background: var(--white); border-radius: var(--radius) var(--radius) 0 0; }
.modal-head h3 { margin: 0; color: var(--blue); }
.modal-body { padding: 16px 24px 22px; overflow-y: auto; flex: 1 1 auto; }
.modal-body::-webkit-scrollbar { width: 10px; }
.modal-body::-webkit-scrollbar-thumb { background: #cfd4da; border-radius: 999px; border: 2px solid var(--white); }
.modal-body::-webkit-scrollbar-track { background: transparent; margin: 6px 0; }
.modal-content h3 { margin-bottom: 16px; color: var(--blue); }
.modal-content:focus { outline: 2px solid #111; outline-offset: 3px; }

/* Stats cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-filter { border: 1px solid transparent; text-align: left; cursor: pointer; font-family: inherit; transition: border-color .15s, transform .1s, box-shadow .15s; }
.stat-filter:hover { transform: translateY(-1px); border-color: #111; }
.stat-filter.active { border-color: #111; box-shadow: 0 0 0 2px rgba(0,0,0,.08), var(--shadow); }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--blue); }
.stat-card .stat-label { font-size: 13px; color: var(--gray); margin-top: 4px; }

/* Quote list */
.quote-list-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--white); border-radius: var(--radius); margin-bottom: 8px; box-shadow: var(--shadow); transition: transform .1s; cursor: pointer; }
.quote-list-item:hover { transform: translateX(4px); }
.quote-list-item .qli-left { display: flex; flex-direction: column; gap: 2px; }
.quote-list-item .qli-ref { font-size: 14px; font-weight: 700; color: var(--blue); }
.quote-list-item .qli-title { font-size: 13px; color: var(--dark); }
.quote-list-item .qli-client { font-size: 12px; color: var(--gray); }
.quote-list-item .qli-right { display: flex; gap: 6px; }

/* Checkbox grid for T&Cs */
.tc-grid { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow-y: auto; }
.tc-check { display: flex; align-items: flex-start; gap: 8px; padding: 8px; border: 1px solid var(--light-gray); border-radius: 4px; }
.tc-check:hover { background: var(--blue-bg); }
.tc-check input[type="checkbox"] { margin-top: 3px; }
.tc-check .tc-text { font-size: 12px; }
.tc-check .tc-text strong { display: block; margin-bottom: 2px; }
.tc-check .tc-text span { color: var(--gray); }
.tc-check.info-red { border-color: #e7a7a1; background: #fff7f6; }
.tc-check.info-red .tc-text strong, .tc-check.info-red .tc-text span, .text-red { color: var(--red); }
.empty-state.compact { padding: 12px 4px; font-size: 12px; }

/* Status badges */
.status-draft { background: #fff3cd; color: #856404; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.status-sent { background: #d4edda; color: #155724; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.status-accepted { background: #cce5ff; color: #004085; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.status-invoiced { background: #e7dbf0; color: #4b2063; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }

.empty-state { text-align: center; padding: 40px; color: var(--gray); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }

@media (max-width: 1050px) {
  #topnav { grid-template-columns: 1fr; gap: 8px; padding: 10px 14px; }
  .nav-brand, .nav-links, .nav-user { justify-self: center; }
  .nav-links { flex-wrap: wrap; justify-content: center; }
  .nav-logo { height: 46px; }
  .nav-logo img { width: 132px; }
}

/* Hi Logbook additions */
.license-badge { padding: 3px 10px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.license-badge.invalid { background: #f8d7da; color: #721c24; }
.db-banner { position: sticky; top: 0; z-index: 1000; background: #b3261e; color: #fff; padding: 10px 16px; text-align: center; font-size: 13px; font-weight: 600; }
.license-banner { background: #f8d7da; color: #721c24; padding: 10px 16px; text-align: center; font-size: 13px; font-weight: 600; }
.license-banner.hidden { display: none; }
.badge-in { background: #d4edda; color: #155724; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-out { background: #e0e0e0; color: #555; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-auto { background: #fff3cd; color: #856404; padding: 1px 6px; border-radius: 10px; font-size: 10px; font-weight: 600; margin-left: 4px; }
.masked-id { font-family: 'Consolas', monospace; letter-spacing: .5px; }
.unmask-link { border: 0; background: transparent; color: var(--blue); text-decoration: underline; cursor: pointer; font-size: 12px; padding: 0 0 0 6px; }
.token-reveal { background: #fff3cd; border: 1px solid #ffe08a; border-radius: 4px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; word-break: break-all; }
.tabs-row { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--light-gray); }
.tabs-row a { padding: 8px 14px; text-decoration: none; color: var(--gray); font-size: 13px; font-weight: 600; border-bottom: 2px solid transparent; }
.tabs-row a.active { color: var(--blue); border-bottom-color: var(--blue); }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filter-row .form-group { margin-bottom: 0; min-width: 140px; }
/* The search box carries the longest values on the row - a name plus a
   vehicle plus a company - so it gets twice the width of a plain filter, and
   takes any slack left on the row. */
.filter-row .form-group.filter-search { min-width: 320px; flex: 1 1 640px; }
.filter-row .form-group.filter-search input { width: 100%; }

/* Visitor photos */
.entry-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; border: 1px solid var(--light-gray); cursor: pointer; display: block; background: #f0f0f0; }
.entry-thumb:hover { border-color: var(--blue); }
.no-photo { color: #b0b0b0; font-size: 16px; }
.photo-full-wrap { display: flex; justify-content: center; padding: 8px 0 4px; }
.photo-full { max-width: 100%; max-height: 60vh; border-radius: 4px; border: 1px solid var(--light-gray); }

/* Device online indicator */
.dot-online, .dot-offline { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.dot-online { background: var(--green); box-shadow: 0 0 0 2px rgba(39,174,96,.18); }
.dot-offline { background: #c0c0c0; }
.nowrap { white-space: nowrap; }

.last-online { font-size: 11px; color: var(--gray); margin-top: 2px; line-height: 1.35; }

/* Report totals */
.stat-row { display: flex; flex-wrap: wrap; gap: 12px; }
.stat { flex: 1 1 140px; background: #f7f8fa; border: 1px solid #e5e8ec; border-radius: var(--radius); padding: 14px 16px; }
.stat-value { display: block; font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat-label { display: block; font-size: 12px; color: var(--gray); margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }
.data-table th.num, .data-table td.num { text-align: right; }
.data-table tr.total-row td { font-weight: 700; border-top: 2px solid #333; }
.filters-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-field { display: flex; flex-direction: column; gap: 4px; }
.filter-field label { font-size: 12px; color: var(--gray); }
.filter-actions { display: flex; gap: 8px; }

/* Icon buttons (edit / delete) */
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; border-radius: 6px;
  border: 1px solid var(--light-gray); background: transparent; cursor: pointer;
  color: #444; transition: background .12s, border-color .12s, color .12s;
}
.btn-icon + .btn-icon { margin-left: 4px; }
.btn-icon:hover { background: var(--hover-pink); border-color: var(--hover-pink-border); }
.btn-icon.danger:hover { background: #fdeaea; border-color: #f0b4b4; color: var(--red); }
.btn-icon svg { width: 16px; height: 16px; display: block; }

/* Modal action row: buttons read centred */
.modal-actions .btn { text-align: center; justify-content: center; }

/* Live search: a plain form-group so it shares the filter row's baseline;
   only the width differs. */
/* Date and select controls render 38px; a plain text input is 2px shorter,
   which reads as a slightly smaller box next to them. */
/* Roughly twice the width of a plain filter, and it takes whatever is left on
   the row so its right edge lines up with the end of the table below it. */
#f-q { width: 100%; min-width: 320px; height: 38px; }
.search-live input { width: min(320px, 100%); }

/* Dashboard widget picker */
.widget-picker { display: flex; flex-wrap: wrap; gap: 14px; padding: 12px 0 4px; }
.widget-picker label { font-size: 13px; display: flex; align-items: center; gap: 6px; }

/* Collapsible cards (visitor types) */
.collapse-head { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.collapse-caret { transition: transform .15s; color: var(--gray); font-size: 12px; }
.collapse-head.open .collapse-caret { transform: rotate(90deg); }
.count-pill { background: #eef1f4; color: #444; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; }

/* Pager */
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding-top: 12px; }
.pager .page-info { font-size: 13px; color: var(--gray); }

/* Card header actions: the add button sits first and matches the icon
   buttons exactly, so the row reads as one control group. */
.card-actions { display: flex; align-items: center; gap: 6px; }
.card-actions .btn-icon + .btn-icon { margin-left: 0; }
.btn-inline {
  height: 30px; padding: 0 12px; font-size: 12px; line-height: 1;
  display: inline-flex; align-items: center; border-radius: 6px;
}

/* Date field: typed as dd/mm/yyyy, with the native picker hidden behind the
   calendar button so the format never depends on the browser's locale. */
.date-field { position: relative; display: inline-flex; align-items: center; }
.date-field .date-text { width: 150px; height: 38px; padding-right: 34px; }
.date-pick-wrap {
  position: absolute; right: 1px; top: 1px; bottom: 1px; width: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--gray); border-radius: 0 4px 4px 0; cursor: pointer;
}
.date-pick-wrap:hover { background: var(--hover-pink); color: #333; }
.date-pick-wrap svg { width: 16px; height: 16px; pointer-events: none; }
/* The real control sits invisibly over the button and opens on click. */
.date-pick { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; padding: 0; border: 0; }

/* Filter rows: every control the same height and corner radius, so a row of
   mixed inputs, selects and buttons reads as one band. Selects render a pixel
   taller than inputs by default, hence the explicit height. */
.filter-row .form-group input,
.filter-row .form-group select,
.filters-row .filter-field input,
.filters-row .filter-field select,
.filters-row .filter-actions .btn {
  height: 38px;
  box-sizing: border-box;
  border-radius: 4px;
}
.filters-row .filter-actions .btn { padding: 0 16px; display: inline-flex; align-items: center; }
.filters-row .filter-field { margin-bottom: 0; }
.filter-row .form-group { margin-bottom: 0; }

/* Custom site logo on the login page */
.login-logo-wrap { display: none; justify-content: center; margin: 24px 0 6px; }
.login-logo-wrap.visible { display: flex; }
.login-logo-wrap img { max-width: 320px; max-height: 120px; object-fit: contain; }
/* With a site logo present the Hi wordmark becomes the supporting mark. */
.login-brand.with-logo { margin: 6px 0 22px; gap: 9px; }
.login-brand.with-logo .hi-wordmark { font-size: 30px; }

/* Branding card preview */
.logo-preview {
  min-width: 180px; min-height: 90px; padding: 10px;
  border: 1px dashed var(--light-gray); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; background: #fff;
}
.logo-preview img { max-width: 240px; max-height: 80px; object-fit: contain; }

/* The `hidden` attribute has to beat any display rule set elsewhere - the nav
   logos in particular are `display: block`, which would otherwise leave the
   default mark showing behind the custom one. */
[hidden] { display: none !important; }

/* A custom site logo sits on the page's own background rather than inside the
   black ElementC plate, and is free to be any shape. */
.nav-logo.custom { background: transparent; padding: 4px 0; }
.nav-logo.custom img { width: auto; max-width: 180px; max-height: 48px; object-fit: contain; }

/* Our name, stacked under the product wordmark in the nav - shown only once
   the estate's own logo has taken our mark's place on the left. Same family
   and weight as the wordmark, a step down in size so it reads as a byline. */
.nav-title { display: flex; flex-direction: column; line-height: 1.15; gap: 5px; }
.nav-vendor { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: var(--gray); }
/* Sits under the product name so a live site says which build it is running. */
.product-version { display: block; font-size: 10px; font-weight: 600; color: var(--gray); letter-spacing: .3px; }
.product-version:empty { display: none; }

/* Sortable, re-arrangeable table headers.
   The grab cursor is the affordance for dragging; the pointer on a sortable
   header would fight it, so sortable headers keep the grab cursor too and the
   title attribute explains both gestures. */
.data-table th.draggable-col { cursor: grab; user-select: none; touch-action: none; }
.data-table th.draggable-col:active { cursor: grabbing; }
.data-table th.sortable:hover { background: var(--blue-light); }
.data-table th.sorted { background: var(--blue-light); }
.sort-arrow { font-size: 9px; margin-left: 6px; vertical-align: middle; opacity: .9; }
/* The column being dragged fades; the one it would land in front of shows a
   line on its leading edge. */
.data-table th.dragging { opacity: .4; }
.data-table th.drop-target { box-shadow: inset 3px 0 0 var(--hover-pink-border); }
.pager .btn { margin-left: 8px; }

/* The Reports heading doubles as the switch between its two reports, so the
   inactive one reads as a heading that can be clicked rather than a button. */
.report-tab {
  border: 0; background: transparent; cursor: pointer; padding: 0 16px 4px 0;
  font-family: inherit; font-size: 18px; font-weight: 700; color: var(--gray);
  border-bottom: 3px solid transparent;
}
.report-tab:hover { color: var(--dark); }
.report-tab.active { color: var(--blue); border-bottom-color: #e8a3b0; }

/* The estate this sign-in works in, or a switcher for people in several. */
.nav-site { font-weight: 600; color: inherit; opacity: 0.85; }
.nav-site select { font: inherit; font-weight: 600; padding: 3px 6px; border-radius: 6px; border: 1px solid rgba(0,0,0,0.15); background: transparent; color: inherit; max-width: 220px; }
.hint { font-size: 12px; opacity: 0.7; margin: 4px 0 10px; }

/* Settings drop-down in the top bar. */
.nav-menu { position: relative; }
.nav-menu.hidden { display: none; }
.nav-menu-toggle { font: inherit; font-size: 14px; color: #303946; background: none; border: 0; padding: 10px 12px; border-radius: 3px; cursor: pointer; white-space: nowrap; }
.nav-menu-toggle:hover, .nav-menu.active .nav-menu-toggle, .nav-menu.open .nav-menu-toggle { background: #f0f3f6; color: #111; }
.nav-menu .caret { font-size: 10px; margin-left: 2px; }
.nav-menu-list { display: none; position: absolute; top: calc(100% + 4px); left: 0; min-width: 180px; background: #fff; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.16); padding: 6px; z-index: 50; }
.nav-menu.open .nav-menu-list { display: flex; flex-direction: column; }
.nav-menu-list a { display: block; }
.nav-menu-list a.hidden { display: none; }
.support-pill { background: #fdecee; color: #8a1c24; border: 1px solid #efa6aa; border-radius: 12px; padding: 3px 10px; font-weight: 600; font-size: 12px; white-space: nowrap; }
.btn-small { padding: 3px 10px; font-size: 12px; }
.support-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fdecee; color: #5c1218; border-bottom: 1px solid #efa6aa; padding: 8px 18px; font-size: 13px; }
.support-bar .btn-small { background: #fff; flex: none; }

/* Two-factor sign-in (2.02): the code and setup steps on the login card, My
   account, and the 2FA badge in the users lists. */
.nav-account { display: flex; align-items: center; gap: 10px; background: none; border: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.nav-account:hover #nav-user-name { text-decoration: underline; }
.tf-title { margin: 8px 0; }
.tf-text { font-size: 13px; color: var(--gray); margin-bottom: 12px; line-height: 1.45; }
.tf-code { font-size: 20px; letter-spacing: .15em; text-align: center; }
.tf-links { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-top: 12px; }
.tf-steps { font-size: 13px; padding-left: 20px; margin-bottom: 8px; line-height: 1.5; }
.tf-steps li { margin-bottom: 8px; }
.tf-qr { margin: 8px 0; }
.tf-qr img { width: 180px; height: 180px; image-rendering: pixelated; border: 1px solid #e5e5e5; }
.tf-manual { font-size: 12px; color: var(--gray); }
.tf-manual code { font-size: 13px; word-break: break-all; }
.tf-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; padding: 12px; background: #f6f6f6; border: 1px solid #e5e5e5; margin-bottom: 8px; }
.tf-codes code { font-size: 14px; letter-spacing: .05em; }
.tf-code-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tf-section { border-top: 1px solid #e5e5e5; padding-top: 12px; margin-top: 12px; }
.tf-section h4 { margin-bottom: 4px; }
.tf-section p { margin-bottom: 8px; font-size: 13px; }
.tf-on { display: inline-block; padding: 1px 6px; border-radius: 3px; background: rgba(39,174,96,.12); color: var(--green); font-size: 11px; font-weight: 700; }
@media (max-width: 520px) { .login-panel { width: auto; max-width: 100%; } .tf-codes { grid-template-columns: 1fr; } }
/* Show-password eye on every password box. */
.password-wrap { position: relative; display: block; }
.password-wrap input { width: 100%; padding-right: 40px; }
.password-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; background: none; border: none; padding: 0; color: var(--gray); cursor: pointer; }
.password-eye:hover { color: #111; }
.password-eye svg { width: 18px; height: 18px; }