/* AUTO FLEX staff area */
:root {
  --red: #e60023; --red-dark: #b8001c; --ink: #1d1f20; --muted: #6b7076; --line: #e3e4e6;
  --bg: #f3f4f5; --card: #fff; --dark: #141616;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--red-dark); }
code { font: 13px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; background: #f1f2f3; padding: 2px 6px; border-radius: 4px; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--red-dark); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 700; color: var(--ink); text-decoration: none; }
.strong:hover { color: var(--red-dark); text-decoration: underline; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* top bar */
.topbar { display: flex; align-items: center; gap: 24px; padding: 10px 24px; background: var(--dark); color: #fff; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: 12px; }
.brand img { height: 38px; }
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a { color: #cfd2d6; text-decoration: none; padding: 8px 12px; border-radius: 6px; font-weight: 600; }
.topbar nav a:hover, .topbar nav a.on { color: #fff; background: rgba(255,255,255,.1); }
.logout { display: flex; align-items: center; gap: 12px; }
.logout .who { color: #cfd2d6; font-size: 14px; }
.logout button { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; padding: 6px 12px; cursor: pointer; font: inherit; font-size: 14px; }
.logout button:hover { border-color: #fff; }

.page { max-width: 1280px; margin: 0 auto; padding: 24px 20px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.count { font-size: 14px; font-weight: 600; color: var(--muted); background: #e7e8ea; border-radius: 999px; padding: 2px 10px; vertical-align: middle; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.back { display: inline-block; margin-bottom: 12px; text-decoration: none; font-weight: 600; }

/* flashes, errors */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash-ok { background: #e9f6ec; border-color: #9fd3ab; color: #1b5e20; }
.flash-info { background: #eef3fb; border-color: #b9cdea; color: #1d3f72; }
.flash-error { background: #fdecea; border-color: #f2b8b5; color: #b3261e; }
.error { background: #fdecea; color: #b3261e; padding: 10px 12px; border-radius: 6px; }
.notice { background: #fff8e6; border-color: #f0d58a; }
.notice-ok { background: #e9f6ec; border-color: #9fd3ab; margin-bottom: 20px; }

/* forms */
input, select, textarea { font: inherit; color: var(--ink); width: 100%; padding: 9px 11px; border: 1px solid #c4c8cd; border-radius: 6px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(230,0,35,.15); }
input[type=file] { padding: 6px; }
label { display: block; font-size: 13px; font-weight: 600; color: #3a3d40; }
label input, label select, label textarea { margin-top: 5px; font-weight: 400; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 6px; border: 1px solid #c4c8cd; background: #fff; color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #8d9298; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-danger { background: #b3261e; border-color: #b3261e; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-block { width: 100%; padding: 12px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--red-dark); font: inherit; font-size: 14px; cursor: pointer; text-decoration: underline; }
.link-btn.danger { color: #b3261e; }
.inline-form { display: inline; }

/* list page */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: 14px; font-weight: 600; }
.chip b { color: var(--muted); font-weight: 600; margin-left: 4px; }
.chip.on { background: var(--dark); border-color: var(--dark); color: #fff; }
.chip.on b { color: #cfd2d6; }
.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filters input[type=search] { flex: 1 1 320px; width: auto; }
.filters select { width: auto; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.card .table-wrap { border: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fafafb; }
.table td { padding: 12px 14px; border-bottom: 1px solid #eef0f1; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.row-link:hover { background: #fafafb; }
tr.inactive td { opacity: .55; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 999px; background: #eef0f1; color: #4a4d51; }
.tag-business { background: #e7eefc; color: #1d3f72; }
.tag-personal { background: #f1f2f3; }
.status { display: inline-block; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.status-new { background: #fff1f3; color: var(--red-dark); }
.status-in-review { background: #fff6e0; color: #8a5a00; }
.status-sent-to-lender { background: #e7eefc; color: #1d3f72; }
.status-approved { background: #e9f6ec; color: #1b5e20; }
.status-declined { background: #f1f2f3; color: #4a4d51; }
.status-closed { background: #f1f2f3; color: #8a8f95; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; }
.empty { text-align: center; padding: 48px; background: #fff; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); }

/* application page */
.app-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.app-head p { margin: 6px 0 0; }
.app-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.status-form { display: flex; gap: 8px; }
.status-form select { width: auto; }
.app-grid { display: grid; gap: 20px; }
@media (min-width: 1100px) { .app-grid { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; } }
.edit-form { display: flex; flex-direction: column; gap: 16px; }
fieldset.card { margin: 0; }
legend { font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--red-dark); padding: 0 6px; }
.fields { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.save-bar { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 -6px 20px rgba(0,0,0,.06); }
.app-side { display: flex; flex-direction: column; gap: 16px; }
.docs { list-style: none; margin: 0 0 16px; padding: 0; }
.docs li { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-bottom: 1px solid #eef0f1; }
.doc-title { font-weight: 600; font-size: 14px; word-break: break-word; }
.doc-links { display: flex; gap: 12px; font-size: 14px; }
.upload { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.sig { margin: 0 0 12px; }
.sig img { max-width: 100%; height: 70px; object-fit: contain; object-position: left; background: #fff; border: 1px solid #eef0f1; border-radius: 6px; padding: 6px; }
#notes form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.note { padding: 10px 0; border-top: 1px solid #eef0f1; }
.note p { margin: 0 0 4px; white-space: pre-wrap; }
.events { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; }
.events li { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid #eef0f1; font-size: 14px; }
.events .detail { color: #3a3d40; word-break: break-word; }
.danger-zone { border-color: #f2b8b5; }
.danger-zone form { display: flex; gap: 8px; }

/* users */
.users-grid { display: grid; gap: 20px; }
@media (min-width: 1000px) { .users-grid { grid-template-columns: 340px minmax(0, 1fr); align-items: start; } }
.actions { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.creds { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 12px 0; }
.creds dt { font-weight: 600; }
.creds dd { margin: 0; }
code.big { font-size: 18px; padding: 4px 10px; }
.narrow { max-width: 480px; }

/* sign-in */
body.auth { background: radial-gradient(ellipse at 50% 0%, #3a0a12 0%, var(--dark) 60%); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-wrap .flash { width: 100%; max-width: 400px; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; padding: 32px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.4); display: flex; flex-direction: column; gap: 16px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .inline-form { display: block; }
.auth-logo { height: 54px; align-self: center; background: var(--dark); border-radius: 8px; padding: 6px 12px; }
.auth-card h1 { text-align: center; }
.auth-card p { margin: 0; }
.code-input { font-size: 26px; letter-spacing: .35em; text-align: center; font-family: ui-monospace, Menlo, monospace; }
.auth-card .remember { font-size: 14px; }
.auth-card .remember-note { margin-top: -8px; padding-left: 30px; }
.device-list { list-style: none; margin: 0 0 16px; padding: 0; }
.device-list li { padding: 10px 0; border-bottom: 1px solid #eceeef; }
.device-list li:last-child { border-bottom: 0; }
.reveal { position: relative; display: block; margin-top: 5px; }
.reveal input { margin-top: 0; padding-right: 56px; }
.reveal .link-btn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 13px; }
.stack-cards { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
/* nav badges, sell + message pages */
.topbar nav a .badge { display: inline-block; min-width: 20px; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 12px; text-align: center; }
.facts { display: grid; grid-template-columns: 110px 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; word-break: break-word; }
h2.spaced { margin-top: 24px; }
.photos { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.photo { margin: 0; }
.photo a { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 8px; background: #eef0f1; border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.photo a:hover img { transform: scale(1.04); }
.photo-fallback { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; text-align: center; font-size: 13px; color: var(--muted); }
.photo.broken img { display: none; }
.licenses { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; margin-bottom: 12px; }
.license { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.license .photo { width: 100%; }
.license-empty { width: 100%; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px dashed #c4c8cd; color: var(--muted); font-size: 13px; background: #fafafa; }
.license-name { margin: 0; font-size: 13px; }
.license-upload .btn { padding: 6px 12px; font-size: 13px; }
.license-upload input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.license-upload.busy .btn { opacity: .6; pointer-events: none; }
.photo.broken .photo-fallback { display: flex; }
.photo figcaption { margin-top: 6px; font-size: 14px; }
.message-body { margin: 0; white-space: pre-wrap; font-size: 16px; line-height: 1.65; }
.preview { max-width: 420px; color: #3a3d40; }
/* gallery manager */
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.collage { display: grid; gap: 3px; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 8px; background: #e7e8ea; }
.collage .cell { position: relative; overflow: hidden; min-height: 0; }
.collage img { width: 100%; height: 100%; object-fit: cover; display: block; }
.collage .more { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.5); color: #fff; font-weight: 800; font-size: 20px; }
.collage .empty-cell { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.l-single { grid-template: 1fr / 1fr; }
.l-duo { grid-template: 1fr / 1fr 1fr; }
.l-trio { grid-template: 1fr 1fr / 2fr 1fr; }
.l-trio .cell:first-child { grid-row: span 2; }
.l-quad { grid-template: 1fr 1fr / 1fr 1fr; }
.gposts { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.gpost { display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; gap: 20px; align-items: center; }
.gpost.is-hidden .gpost-preview { opacity: .45; }
.gpost-title { font-size: 18px; text-transform: none; letter-spacing: 0; margin: 0 0 4px; }
.gpost-title a { color: var(--ink); text-decoration: none; }
.gpost-info p { margin: 4px 0; }
.gpost-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.gpost-actions button[disabled] { opacity: .3; cursor: default; text-decoration: none; }
.tag-sample { background: #fff6e0; color: #8a5a00; }
@media (max-width: 760px) { .gpost { grid-template-columns: 1fr; } .gpost-actions { flex-direction: row; flex-wrap: wrap; align-items: center; } }
.gedit { display: grid; gap: 20px; }
@media (min-width: 1100px) { .gedit { grid-template-columns: minmax(0, 520px) minmax(0, 1fr); align-items: start; } }
.layouts { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.layouts legend { font-size: 13px; font-weight: 600; color: #3a3d40; text-transform: none; letter-spacing: 0; padding: 0; margin-bottom: 6px; }
.layout-opt { position: relative; cursor: pointer; }
.layout-opt input { position: absolute; opacity: 0; }
.layout-card { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 10px; border: 1.5px solid var(--line); border-radius: 8px; font-weight: 400; }
.layout-card strong { font-size: 14px; }
.layout-opt input:checked + .layout-card { border-color: var(--red); background: #fff3f5; }
.layout-opt input:focus-visible + .layout-card { outline: 2px solid var(--red); outline-offset: 2px; }
.mini { display: grid; gap: 2px; width: 64px; aspect-ratio: 4 / 3; margin-bottom: 4px; }
.mini i { background: #c4c8cd; border-radius: 2px; }
.mini.l-trio i:first-child { grid-row: span 2; }
.mini.l-auto { display: flex; align-items: center; justify-content: center; border: 1.5px dashed #c4c8cd; border-radius: 4px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 10px; font-size: 15px; }
label.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--red); }
.gpreview { max-width: 520px; }
.gpreview-cap { margin: 10px 0 0; }
.gphotos { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.gphoto { margin: 0; }
.gphoto img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; border: 1px solid var(--line); }
.collage .cell-note, .gphoto-note { display: flex; align-items: center; justify-content: center; text-align: center; height: 100%; padding: 8px; font-size: 12px; color: var(--muted); background: #f1f2f3; }
.gphoto-note { aspect-ratio: 4 / 3; height: auto; border-radius: 6px; border: 1px dashed #c4c8cd; }
.collage .play, .gphoto-video .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; padding-left: 3px; pointer-events: none; }
.gphoto-video { position: relative; display: block; }
.gphoto-video .dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.7); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.upload-progress { display: flex; flex-direction: column; gap: 6px; }
.upload-progress[hidden] { display: none; }
.upload-progress .bar { height: 8px; background: #eceeef; border-radius: 999px; overflow: hidden; }
.upload-progress .bar span { display: block; height: 100%; width: 0; background: var(--red); transition: width .3s; }
.upload-progress p { margin: 0; }
.gphoto figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; font-size: 13px; }
