/* app.css — LinkedIn → Odoo Contact Bridge
   Self-hosted, no webfonts, no CDN. Works offline on the Pi. */

:root {
  --bg:        #0f1115;
  --surface:   #171a21;
  --surface-2: #1e222b;
  --line:      #2a2f3a;
  --text:      #e6e8ec;
  --muted:     #98a0ae;
  --accent:    #4a8cff;
  --ok:        #3fbf7f;
  --warn:      #e0a02e;
  --danger:    #e2564d;
  --radius:    10px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:        #f5f6f8;
    --surface:   #ffffff;
    --surface-2: #f0f2f5;
    --line:      #dde1e7;
    --text:      #1b1f27;
    --muted:     #5d6673;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }
.muted  { color: var(--muted); }
.small  { font-size: 13px; }
.error  { color: var(--danger); font-weight: 500; }

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

/* ------------------------------------------------------------- topbar */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 16px; margin: 0 0 0 6px; font-weight: 600; }
.mark {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px;
  padding: 0 7px; border-radius: 6px; font-size: 12px; font-weight: 700;
  background: #0a66c2; color: #fff;
}
.mark.odoo { background: #714b67; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.badge {
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--line);
}
.badge-muted { color: var(--muted); }
.badge-read  { color: var(--ok);     border-color: var(--ok); }
.badge-write { color: var(--danger); border-color: var(--danger); }

/* --------------------------------------------------------------- layout */

main, .view { max-width: 1080px; margin: 20px auto; padding: 0 20px; }
.centred { max-width: 460px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
}
.card h2 { margin: 0 0 6px; font-size: 17px; }
.card h3 { margin: 20px 0 8px; font-size: 14px; text-transform: uppercase;
           letter-spacing: .05em; color: var(--muted); }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  padding: 7px 14px; border-radius: var(--radius); cursor: pointer; font-size: 14px;
}
.tab.active { background: var(--surface); color: var(--text); border-color: var(--accent); }
.panel { display: none; }
.panel.active { display: block; }

/* --------------------------------------------------------------- forms */

label { display: block; margin: 12px 0 5px; font-size: 13px; font-weight: 600; }
input[type=text], input[type=password], input[type=number], input[type=file], select {
  width: 100%; max-width: 420px; padding: 9px 11px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-weight: 400; }
.check input { width: auto; margin-top: 3px; flex: none; }

.btn {
  display: inline-block; margin-top: 14px; margin-right: 8px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger  { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost   { background: transparent; }

/* --------------------------------------------------------------- tables */

.scroll { max-height: 460px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
  text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line);
  vertical-align: top; white-space: nowrap;
}
.table th { position: sticky; top: 0; background: var(--surface-2); z-index: 1; font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.table td.wrap { white-space: normal; max-width: 320px; }

.pill { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pill-create { background: rgba(63,191,127,.16); color: var(--ok); }
.pill-update { background: rgba(74,140,255,.16); color: var(--accent); }
.pill-skip   { background: rgba(152,160,174,.16); color: var(--muted); }
.pill-failed { background: rgba(226,86,77,.16); color: var(--danger); }

/* ------------------------------------------------------------- statgrid */

.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 12px 0; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.stat .v { font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat .k { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* --------------------------------------------------------------- notices */

.notice {
  background: rgba(224,160,46,.10); border: 1px solid rgba(224,160,46,.4);
  border-left-width: 3px; border-radius: 6px; padding: 11px 13px; font-size: 14px;
}
.warnings { list-style: none; padding: 0; margin: 10px 0; }
.warnings li {
  background: rgba(224,160,46,.10); border-left: 3px solid var(--warn);
  padding: 7px 11px; margin-bottom: 5px; border-radius: 4px; font-size: 13px;
}
.gate {
  margin-top: 22px; padding: 16px; border-radius: 8px;
  border: 1px solid var(--danger); background: rgba(226,86,77,.07);
}
.gate h3 { margin-top: 0; color: var(--danger); }

/* --------------------------------------------------------------- spinner */

.spinner {
  display: inline-block; width: 15px; height: 15px; margin-right: 8px;
  vertical-align: -2px; border: 2px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

pre {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px; overflow: auto; max-height: 400px;
}

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 18px; }
.foot a { color: var(--muted); }

/* ------------------------------------------------- rev 3 additions */

.badge-ok { color: var(--ok); border-color: var(--ok); }

/* numbered step chips in the card headings */
.step {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; margin-right: 8px;
  border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700; vertical-align: 1px;
}

/* a card that cannot be used yet */
.card.locked { opacity: .55; }
.card.locked .step { background: var(--muted); }

/* two-up form fields on wide screens, stacked on narrow */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; }
.grid2 input { max-width: none; }

/* key/value summary table */
.table.kv th {
  position: static; width: 120px; background: transparent;
  color: var(--muted); font-weight: 500;
}
.table.kv td { white-space: normal; word-break: break-all; }

details {
  margin: 16px 0 4px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2);
}
details summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
details[open] summary { margin-bottom: 6px; color: var(--text); }

#conn-progress { margin-left: 10px; font-size: 14px; color: var(--muted); }
#import-progress { margin-top: 14px; }
.gate p { margin-top: 0; }
