/* Staff application */
body.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--ink); color: #d0d0d0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side .brand { display: flex; justify-content: center; padding: 18px 16px 16px; font-size: 25px; text-decoration: none; border-bottom: 1px solid #2a2a2a; box-shadow: inset 0 -2px 0 var(--accent); }
.side nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.side nav a { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 6px; color: #d0d0d0; text-decoration: none; font-weight: 600; font-size: 14px; }
.side nav a:hover { background: #1f1f1f; color: #fff; }
.side nav a.active { background: #2b2b2b; color: var(--accent); }
.side nav .count { margin-left: auto; background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: 11px; font-weight: 800; padding: 1px 7px; }
.side nav .sep { margin: 10px 12px 4px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #777777; }
.side .me { padding: 14px 16px; border-top: 1px solid #2a2a2a; font-size: 13px; }
.side .me b { color: #fff; display: block; }
.side .me .row { margin-top: 8px; gap: 12px; }
.side .me a, .side .me button { color: #d0d0d0; font-size: 13px; }
.main { padding: 24px 28px 60px; min-width: 0; }
@media (max-width: 900px) {
  body.app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .side nav .sep { display: none; }
  .main { padding: 18px 14px 50px; }
}

.page-title { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title h1 { font-size: 24px; margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.card > h2 { font-size: 16px; margin: 0 0 14px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 14px 18px; margin: 0; border-bottom: 1px solid var(--line); }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .layout-2 { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: inherit; border-left: 4px solid var(--line); }
.stat:hover { box-shadow: var(--shadow); }
.stat b { display: block; font-size: 28px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat.hot { border-left-color: var(--accent); }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #faf9f8; white-space: nowrap; }
table.data td { padding: 10px 14px; border-bottom: 1px solid #efedea; vertical-align: middle; }
/* Sortable column headings */
table.data .th-sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; text-transform: inherit; letter-spacing: inherit; }
table.data .th-sort:hover, table.data .th-sort.on { color: var(--ink); }
table.data .th-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
table.data .th-sort .arrow { font-size: 10px; opacity: .45; }
table.data .th-sort.on .arrow { opacity: 1; color: var(--accent-dark); }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.link { cursor: pointer; }
table.data tbody tr.link:hover { background: #faf9f8; }
table.data .thumb { width: 56px; min-width: 56px; max-width: none; height: 42px; border-radius: 4px; object-fit: cover; background: #e8e7e5; display: block; }
.table-scroll { overflow-x: auto; }
.empty-row { padding: 28px; text-align: center; color: var(--muted); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 300px; }
.toolbar select { width: auto; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 9px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
.tabs button .n { font-weight: 500; color: var(--muted); margin-left: 4px; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.media-item { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.media-item .pic { aspect-ratio: 4 / 3; background: #141414; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; }
.media-item .pic img, .media-item .pic video { width: 100%; height: 100%; object-fit: cover; }
.media-item .bar { display: flex; gap: 2px; padding: 4px; justify-content: space-between; }
.media-item .bar button { border: 0; background: none; cursor: pointer; padding: 3px 6px; border-radius: 4px; font-size: 13px; }
.media-item .bar button:hover { background: var(--bg); }
.media-item.primary { outline: 2px solid var(--accent); }
.drop { border: 2px dashed #cfcdca; border-radius: 8px; padding: 18px; text-align: center; color: var(--muted); margin-bottom: 12px; }
.drop.over { border-color: var(--accent); background: #fdf3ea; }

/* Equipment status card: the machine's public web address, wrapped to fit the narrow column */
.web-address { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.web-address a { display: block; margin: 3px 0 8px; font-size: 13px; overflow-wrap: anywhere; color: var(--accent-dark); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; }
.timeline .what { font-weight: 600; font-size: 14px; }
.timeline .who { color: var(--muted); font-size: 12.5px; }
.timeline .detail-line { font-size: 13px; color: var(--ink-3); }

.doc-preview { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 34px 38px; font-family: Georgia, "Times New Roman", serif; font-size: 13.5px; line-height: 1.55; max-height: 78vh; overflow: auto; }
.doc-preview h1 { font-size: 19px; text-align: center; margin: 14px 0; font-family: var(--font); }
.doc-preview h2 { font-size: 14px; margin: 16px 0 6px; font-family: var(--font); }
.doc-preview .co { font-family: var(--font); border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 8px; }
.doc-preview .co b { font-size: 16px; }
.doc-preview table { border-collapse: collapse; width: 100%; margin: 8px 0; font-family: var(--font); font-size: 13px; }
.doc-preview td { border: 1px solid #cfcdca; padding: 5px 8px; }
.doc-preview td:nth-child(odd) { background: #f5f4f2; font-weight: 600; width: 20%; }
.doc-preview .sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; margin-top: 44px; font-family: var(--font); font-size: 12.5px; }
.doc-preview .sigs div { border-top: 1px solid var(--ink); padding-top: 5px; }
.doc-preview .blank { background: #fff3c4; padding: 0 4px; border-radius: 2px; }
.doc-preview .terms { border-top: 2px dashed #c9d0d8; margin-top: 40px; padding-top: 4px; font-size: 12px; line-height: 1.45; }
.doc-preview .terms h1 { font-size: 15px; }
.doc-preview .terms h2 { font-size: 12.5px; margin: 12px 0 3px; }
.doc-preview .terms p { margin: 0 0 6px; }
.doc-preview .clauses { margin: 0 0 8px; }
.doc-preview .cl { display: grid; grid-template-columns: 2.7em minmax(0, 1fr); margin-bottom: 3px; }
.doc-preview .cl.l2 { margin-left: 2.7em; grid-template-columns: 3.1em minmax(0, 1fr); }
.doc-preview .cl.l3 { margin-left: 5.8em; grid-template-columns: 3.6em minmax(0, 1fr); }
.doc-preview .ack { max-width: 300px; margin-top: 40px; font-family: var(--font); font-size: 12.5px; line-height: 1.9; }
.doc-preview .ack div { border-top: 1px solid var(--ink); color: var(--muted); }
.doc-preview .lh { display: flex; align-items: center; gap: 16px; font-family: var(--font); font-size: 12px; line-height: 1.5; color: var(--muted); }
.doc-preview .lh img { width: 150px; height: auto; flex: none; }
.doc-preview .lh b { font-size: 16px; color: var(--ink); }
.doc-preview .lh-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 16px; padding: 8px 12px; background: #14171c; border-bottom: 3px solid #e07a2c; color: #fff; font-family: var(--font); font-size: 12px; }
.doc-preview .lh-bar b { font-size: 17px; text-transform: uppercase; letter-spacing: .02em; }
.doc-preview .fg { margin: 0 0 12px; font-family: var(--font); }
.doc-preview .fg-h { background: #33393f; color: #fff; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 8px; }
.doc-preview .fg-r { display: grid; }
.doc-preview .fg-r > div { border: 1px solid #c9d0d8; margin: 0 -1px -1px 0; padding: 3px 6px 4px; font-size: 13px; line-height: 1.35; min-height: 38px; overflow-wrap: anywhere; }
.doc-preview .fg-r.fg-th > div { min-height: 0; background: #f4f5f7; font-size: 9.5px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .03em; padding: 2px 6px; }
.doc-preview .fg-r.fg-t > div { min-height: 0; }
.form-section { grid-column: 1 / -1; font-size: 15px; margin: 6px 0 -4px; padding-top: 14px; border-top: 1px solid var(--line); }
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.readonly-value { padding: 9px 11px; border: 1px dashed #cfcdca; border-radius: 6px; background: #f7f6f4; color: var(--muted); min-height: 40px; }
.commission-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 14px; }
.unit-input { display: flex; align-items: center; gap: 6px; margin: 0; }
.unit-input input { flex: 1; min-width: 70px; }
.unit-input span { flex: none; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.att-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px; gap: 8px 10px; padding: 10px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 6px; background: #faf9f7; }
.att-row label { margin: 0; font-size: 12px; }
.att-row input { margin-top: 3px; }
.att-row .att-name { grid-area: 1 / 1; }
.att-row .att-serial { grid-area: 1 / 2; }
.att-row .att-details { grid-area: 2 / 1 / 3 / 3; }
.att-row .btn { grid-area: 1 / 3; align-self: end; padding: 0; height: 38px; }
.doc-preview .fg-r small { display: block; font-size: 9.5px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .03em; }

.perm-table th, .perm-table td { text-align: center; }
.perm-table th:first-child, .perm-table td:first-child { text-align: left; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
code.field { background: #eef1f4; padding: 1px 5px; border-radius: 3px; font-size: 12px; }

dialog { border: 0; border-radius: 10px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(20, 20, 20, .55); }
dialog form { padding: 22px; }
dialog h2 { font-size: 18px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 6px; box-shadow: var(--shadow); max-width: 380px; font-size: 14px; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

body.auth { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(ellipse 55% 60% at 100% 100%, rgba(224, 122, 44, .22), transparent 60%), radial-gradient(ellipse 45% 50% at 0% 0%, rgba(224, 122, 44, .14), transparent 60%), linear-gradient(160deg, #1d1d1d, #111); padding: 20px; }
body.auth .auth-logo { display: flex; justify-content: center; font-size: 40px; margin-bottom: 24px; }
.auth-card { background: #fff; border-radius: 10px; padding: 30px; width: min(420px, 100%); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.auth-card { border-top: 4px solid var(--accent); }
.auth-card h1 { font-size: 20px; margin: 0 0 4px; }
.auth-card .btn { width: 100%; padding: 11px; }
.auth-card .links { margin-top: 14px; display: flex; justify-content: space-between; font-size: 13px; }
.auth-card .links .btn-link { font-size: 13px; }
.auth-card .otp-input { font-size: 24px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; font-family: Consolas, Menlo, monospace; }
.code-input { font-size: 26px !important; letter-spacing: 10px; text-align: center; font-weight: 700; }

/* Website enquiries: photos sent with a consignment request */
.enquiry-photos { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.enquiry-photos img { width: 120px; height: 90px; object-fit: cover; border-radius: 5px; display: block; background: #e8e7e5; }

/* Equipment: additional specifications editor */
.label-row { margin-bottom: 6px; font-size: 13px; color: var(--ink-3); }
.spec-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.spec-tools { display: inline-flex; gap: 4px; }
.spec-tools .btn { padding: 4px 8px; }
@media (max-width: 640px) { .spec-row { grid-template-columns: 1fr; } }
.eq-att-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, .9fr) auto; gap: 8px; align-items: center; margin-bottom: 8px; }
@media (max-width: 640px) { .eq-att-row { grid-template-columns: 1fr; } }

/* Equipment form: what buyers see vs. what stays in the office */
.zone { border-radius: 8px; padding: 14px 16px 16px; margin-bottom: 18px; }
.zone-public { background: #fff8f1; border: 1px solid #f1cfb0; border-left: 5px solid var(--accent); }
.zone-internal { background: #f1f1f0; border: 1px dashed #b8b6b3; border-left: 5px solid #4d4d4d; }
.zone-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 14px; }
.zone-note { font-size: 13px; color: var(--ink-3); }
.zone-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.zone-tag.public { background: var(--accent); color: var(--accent-ink); }
.zone-tag.internal { background: #3a3a3a; color: #fff; }
.zone-tag.small-tag { font-size: 10px; padding: 2px 8px; vertical-align: middle; margin-left: 6px; }
.zone-internal input, .zone-internal select, .zone-internal textarea { background: #fff; }
.internal-input { background: #f1f1f0 !important; border-style: dashed !important; }

/* Equipment list: featured on the home page */
.title-cell { display: flex; align-items: flex-start; gap: 8px; min-width: 210px; }
.star { all: unset; cursor: pointer; font-size: 18px; line-height: 1.1; color: #b9b6b2; padding: 0 2px; border-radius: 4px; }
.star:hover, .star:focus-visible { color: var(--accent); }
.star:focus-visible { outline: 2px solid var(--accent); }
.star.on { color: var(--accent); }
.star:disabled { opacity: .5; cursor: wait; }
.home-note { margin-top: 2px; color: var(--muted); }
.home-note.on { color: var(--accent-dark); font-weight: 700; }
.featured-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 14px; padding: 12px 16px; border: 1px solid #f1cfb0; border-left: 5px solid var(--accent); border-radius: 8px; background: #fff8f1; font-size: 14px; }
.featured-bar .slots { display: inline-flex; gap: 4px; }
.featured-bar .slots span { width: 18px; height: 18px; border-radius: 4px; border: 2px solid #e2c3a6; background: #fff; }
.featured-bar .slots span.on { background: var(--accent); border-color: var(--accent); }
.featured-bar.full { border-left-color: var(--ok); }

/* Equipment record: price box and price history */
.small-head { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 4px 0 6px; }
table.data.price-history td { padding: 7px 8px; }
.price-history .down { color: var(--danger); font-weight: 700; margin-left: 4px; }
.price-history .up { color: var(--ok); font-weight: 700; margin-left: 4px; }
.reduced-tag { color: #b42318; font-weight: 700; white-space: nowrap; }
