/* mailhub.css — shared minimal styling for the add-in core (Fluent-ish). */
:root {
  --mih-accent: #0078d4;
  --mih-accent-hover: #106ebe;
  --mih-border: #edebe9;
  --mih-text: #201f1e;
  --mih-muted: #605e5c;
  --mih-danger: #a4262c;
  --mih-success: #107c10;
  --mih-radius: 4px;
}
* { box-sizing: border-box; }
body {
  margin: 0; padding: 12px;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px; color: var(--mih-text); background: #faf9f8;
}
.mih-card {
  background: #fff; border: 1px solid var(--mih-border);
  border-radius: var(--mih-radius); padding: 12px; margin-bottom: 12px;
}
.mih-label { display: block; font-weight: 600; margin: 8px 0 4px; }
.mih-muted { color: var(--mih-muted); font-size: 12px; }
.title { font-weight: 600; }
.meta { font-size: 12px; color: var(--mih-muted); }
hr { border: none; border-top: 1px solid var(--mih-border); margin: 10px 0; }

select, input[type="text"] {
  width: 100%; padding: 8px; border: 1px solid var(--mih-border);
  border-radius: var(--mih-radius); font: inherit; background: #fff;
}
select:focus, input:focus { outline: none; border-color: var(--mih-accent); }

.mih-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border: 1px solid transparent; border-radius: var(--mih-radius);
  font: inherit; cursor: pointer; background: var(--mih-accent); color: #fff;
}
.mih-btn:hover { background: var(--mih-accent-hover); }
.mih-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.mih-btn.block { width: 100%; }

#record-search-results { margin-top: 6px; }
.mih-record {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; text-align: left; padding: 8px; border: 1px solid var(--mih-border);
  border-radius: var(--mih-radius); margin-bottom: 6px; background: #fff;
  font: inherit; cursor: default;
}
button.mih-result { cursor: pointer; }
button.mih-result:hover { background: #f3f2f1; }

.mih-status {
  padding: 8px; border-radius: var(--mih-radius); font-size: 13px;
  margin-bottom: 8px; display: none;
}
.mih-status.show { display: block; }
.mih-status.error { background: #fde7e9; color: var(--mih-danger); }
.mih-status.success { background: #dff6dd; color: var(--mih-success); }
.mih-status.info, .mih-status.loading { background: #eff6fc; color: var(--mih-accent); }

.mih-spinner {
  border: 2px solid var(--mih-border); border-top-color: var(--mih-accent);
  border-radius: 50%; width: 14px; height: 14px; display: inline-block;
  vertical-align: middle; animation: mih-spin 0.8s linear infinite;
}
@keyframes mih-spin { to { transform: rotate(360deg); } }

/* ---- advanced UI (model/record lists, smart buttons, contact) ---- */
.mih-btn.secondary { background: #fff; color: var(--mih-text); border-color: var(--mih-border); }
.mih-btn.secondary:hover { background: #f3f2f1; }
.mih-row { display: flex; gap: 8px; }
.mih-row > * { flex: 1; }

/* Scrollable searchable lists (models, records). */
.mih-scroll { max-height: 180px; overflow-y: auto; margin-top: 6px; border: 1px solid var(--mih-border); border-radius: var(--mih-radius); }
.mih-scroll:empty { border: none; }
.mih-listitem {
  display: block; width: 100%; text-align: left; padding: 7px 9px;
  border: none; border-bottom: 1px solid var(--mih-border);
  background: #fff; font: inherit; cursor: pointer;
}
.mih-listitem:last-child { border-bottom: none; }
.mih-listitem:hover { background: #f3f2f1; }
.mih-listitem.active { background: #eff6fc; color: var(--mih-accent); font-weight: 600; }
.mih-listitem .meta { float: right; }

/* Small "open in Odoo" link button. */
.mih-link-btn {
  border: 1px solid var(--mih-border); background: #fff; color: var(--mih-accent);
  border-radius: var(--mih-radius); padding: 3px 8px; font: inherit; font-size: 12px;
  cursor: pointer; white-space: nowrap;
}
.mih-link-btn:hover { background: #eff6fc; }

/* Odoo-style smart buttons: count over label. */
.mih-smartbtns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mih-smartbtns:empty { margin: 0; }
.mih-smartbtn {
  display: flex; flex-direction: column; align-items: flex-start;
  border: 1px solid var(--mih-border); border-radius: var(--mih-radius);
  background: #fff; padding: 6px 12px; cursor: pointer; min-width: 84px;
}
.mih-smartbtn:hover { background: #f3f2f1; border-color: var(--mih-accent); }
.mih-smartbtn .count { font-size: 18px; font-weight: 700; color: var(--mih-accent); line-height: 1.1; }
.mih-smartbtn .label { font-size: 12px; color: var(--mih-muted); }

.mih-contact .title { font-weight: 600; }
.mih-contact .mih-link-btn { margin-top: 6px; }

/* Multi-company selector. */
.mih-company { margin-bottom: 10px; }
.mih-company select { width: 100%; }

/* Odoo login/account line. */
.mih-account { margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mih-account:empty { margin: 0; }

/* Record-scoping toggles above the record list. */
.mih-filters { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 8px; }
.mih-filters label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--mih-muted); cursor: pointer;
}
.mih-filters input { width: auto; margin: 0; }

/* Explains an empty/short record list ("sender is not a contact in Odoo"). */
#filter-notice { margin-top: 6px; }
#filter-notice:empty { margin: 0; }

/* Records the mail CHAIN resolved to, offered for one-click linking. */
#thread-suggestions { margin-top: 8px; }
#thread-suggestions:empty { margin: 0; }
