/* Lift admin (src/admin.js is its API). Phone first: the homes table turns into cards under 760px. */
:root {
  --ink: #2c2a28; --muted: #77706a; --line: #e2ded7; --soft: #f5f3ef; --bg: #faf9f6; --card: #fff;
  --dark: #231f20; --accent: #36656f; --warn: #a2462f; --ok: #3c6e47; --focus: #36656f55;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.boot { padding: 40px 16px; color: var(--muted); text-align: center; }
.muted { color: var(--muted); }
.err { color: var(--warn); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
.btn.danger { color: var(--warn); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.field { height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); min-width: 0; }
textarea.field { height: auto; padding: 8px 10px; }
label.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
label.check input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }

/* sign-in */
.signin { max-width: 380px; margin: 12vh auto 40px; padding: 0 16px; }
.signin .box { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 26px 24px; box-shadow: 0 6px 24px rgba(0,0,0,.05); }
.signin h1 { font-size: 21px; margin: 0 0 4px; }
.signin p { margin: 0 0 16px; }
.signin form { display: grid; gap: 10px; }
.signin .field { height: 44px; font-size: 16px; }
.signin .code { letter-spacing: 6px; font-size: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.signin .btn { height: 44px; }
.signin .link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; }
.mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--dark); color: #fff; font-weight: 800; }

/* top bar */
header.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
header.top .brand { display: flex; align-items: center; gap: 9px; font-weight: 700; white-space: nowrap; }
header.top select { max-width: 280px; font-weight: 600; }
header.top .who { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); min-width: 0; }
header.top .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav.tabs { display: flex; gap: 4px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto; }
nav.tabs button { border: 0; background: none; padding: 11px 12px 10px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
nav.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--dark); }
main { max-width: 1180px; margin: 0 auto; padding: 16px 16px 120px; }
.menu { position: relative; }
.menu .pop { position: absolute; right: 0; top: 40px; z-index: 10; display: none; min-width: 210px; padding: 6px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.menu.open .pop { display: grid; }
.menu .pop button { text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.menu .pop button:hover { background: var(--soft); }

/* status chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 13px; }
.chip[aria-pressed="true"] { border-color: var(--dark); background: var(--dark); color: #fff; }
.chip b { font-weight: 650; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* homes toolbar and table */
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.bar .grow { flex: 1 1 200px; }
.bar .spacer { flex: 1; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table th { font-size: 12px; font-weight: 650; color: var(--muted); background: var(--soft); text-transform: uppercase; letter-spacing: .04em; }
.table td.num { font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table td.sel, .table th.sel { width: 38px; }
.table tr.dirty td { background: #fffbea; }
.table tr.picked td { background: #eef4f5; }
.table select.field { max-width: 190px; }
.price { display: inline-flex; align-items: center; gap: 4px; }
.price .field { width: 120px; text-align: right; font-variant-numeric: tabular-nums; }
.price small { color: var(--muted); }
.hidden-note { font-size: 12px; color: var(--muted); }
.when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.empty { padding: 30px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: 14px; }

/* the save bar */
.savebar { position: fixed; left: 50%; bottom: 16px; z-index: 20; transform: translateX(-50%); display: none; align-items: center; gap: 10px; flex-wrap: wrap;
  width: min(760px, calc(100% - 24px)); padding: 10px 12px 10px 16px; background: var(--dark); color: #fff; border-radius: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.25); }
.savebar.show { display: flex; }
.savebar .txt { flex: 1 1 180px; font-weight: 600; }
.savebar .btn { border-color: #ffffff40; background: transparent; color: #fff; }
.savebar .btn.primary { background: #fff; color: var(--dark); border-color: #fff; }
.savebar select.field { background: #ffffff14; color: #fff; border-color: #ffffff40; }
.savebar select.field option { color: var(--ink); }

/* panels: statuses, editors, log, import */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.panel h2 { font-size: 16px; margin: 0 0 4px; }
.panel > p { margin: 0 0 12px; }
.strow { display: grid; grid-template-columns: 34px 46px minmax(140px, 1fr) auto auto auto auto auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.strow:first-of-type { border-top: 0; }
.strow input[type="color"] { width: 40px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.strow .order { display: grid; gap: 2px; }
.strow .order button { height: 16px; width: 30px; padding: 0; font-size: 10px; line-height: 1; border: 1px solid var(--line); background: var(--card); border-radius: 4px; cursor: pointer; }
.strow .uses { font-size: 12px; color: var(--muted); white-space: nowrap; }
.stuck { margin-top: 12px; padding: 12px; border-radius: 10px; background: #fff4ef; border: 1px solid #efc9bb; }
.stuck div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list li .grow { flex: 1 1 200px; min-width: 0; }
.addform { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.addform .field { flex: 1 1 180px; }
.log li { display: block; }
.log .what { font-weight: 600; }
.diff { max-height: 360px; overflow: auto; margin: 10px 0; border: 1px solid var(--line); border-radius: 10px; }
.diff table { width: 100%; border-collapse: collapse; font-size: 13px; }
.diff td, .diff th { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.notice { padding: 10px 12px; border-radius: 10px; background: #eef4f0; color: var(--ok); margin-bottom: 12px; font-weight: 600; }
.notice.err { background: #fff4ef; color: var(--warn); }

@media (max-width: 760px) {
  header.top { flex-wrap: wrap; gap: 8px 12px; }
  header.top .who { margin-left: auto; }
  header.top .who span { display: none; }
  header.top select { order: 3; flex: 1 1 100%; max-width: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table { border: 0; background: none; border-radius: 0; }
  .table tr { position: relative; margin-bottom: 10px; padding: 10px 12px 10px 46px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
  .table tr.dirty, .table tr.picked { background: inherit; }
  .table tr.dirty { border-color: #e6c95c; }
  .table tr.picked { border-color: var(--accent); }
  .table td { padding: 3px 0; border: 0; background: none !important; }
  .table td.sel { position: absolute; left: 12px; top: 12px; width: auto; }
  .table td.num { font-size: 16px; }
  .table select.field { max-width: none; width: 100%; height: 40px; }
  .price .field { height: 40px; width: 100%; }
  .price { display: flex; }
  .strow { grid-template-columns: 34px 46px 1fr; }
  .strow .flags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 14px; }
  .strow .uses, .strow .rm { grid-column: span 1; }
}
@media (min-width: 761px) { .strow .flags { display: contents; } }
