/* ─────────────────────────────────────────────────────────────
   mailWarmer — API status dashboard.
   Gmail-inspired light theme; tokens mirror sidepanel.css so the
   dashboard and the extension feel like one product.
   ───────────────────────────────────────────────────────────── */

:root {
  --gm-bg:            #f6f8fc;
  --gm-surface:       #ffffff;
  --gm-surface-alt:   #f1f3f4;
  --gm-hover:         #e8eaed;
  --gm-row-hover:     #f2f6fc;

  --gm-border:        #dadce0;
  --gm-divider:       #e0e0e0;

  --gm-text:          #202124;
  --gm-text-muted:    #5f6368;
  --gm-text-faint:    #80868b;

  --gm-blue:          #1a73e8;
  --gm-blue-hover:    #1765cc;
  --gm-blue-bg:       #e8f0fe;
  --gm-green:         #137333;
  --gm-green-bg:      #e6f4ea;
  --gm-yellow:        #b06000;
  --gm-yellow-bg:     #feefc3;
  --gm-red:           #c5221f;
  --gm-red-bg:        #fce8e6;

  /* Layered Material elevation shadows. */
  --gm-shadow-1: 0 1px 2px 0 rgba(60,64,67,.30), 0 1px 3px 1px rgba(60,64,67,.15);
  --gm-shadow-2: 0 1px 3px 0 rgba(60,64,67,.30), 0 4px 8px 3px rgba(60,64,67,.15);
  --gm-shadow-card: 0 1px 2px rgba(60,64,67,.10), 0 2px 6px 2px rgba(60,64,67,.08);

  --gm-font: 'Google Sans', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--gm-font);
  font-size: 14px;
  color: var(--gm-text);
  background: var(--gm-bg);
  -webkit-font-smoothing: antialiased;
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'opsz' 20;
}

/* ── Top bar ───────────────────────────────────────────────── */
.gm-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 8px 24px;
  background: var(--gm-surface);
  border-bottom: 1px solid var(--gm-border);
}

.gm-brand { display: flex; align-items: center; gap: 10px; }

.gm-logo {
  font-size: 28px;
  color: var(--gm-red);
}

.gm-brand-text {
  font-size: 20px;
  font-weight: 500;
  color: var(--gm-text-muted);
  letter-spacing: -0.01em;
}

.gm-version {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gm-text-faint);
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--gm-surface-alt);
}

.gm-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gm-text-muted);
  padding: 6px 14px;
  border-radius: 16px;
  background: var(--gm-surface-alt);
}
.gm-status .dot { font-size: 8px; color: var(--gm-text-faint); }
.gm-status.online { background: var(--gm-green-bg); color: var(--gm-green); }
.gm-status.online .dot { color: var(--gm-green); }
.gm-status.offline { background: var(--gm-red-bg); color: var(--gm-red); }
.gm-status.offline .dot { color: var(--gm-red); }

/* ── Layout ────────────────────────────────────────────────── */
.gm-main {
  max-width: 940px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.gm-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

h1 {
  font-size: 22px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
}

/* ── Buttons ───────────────────────────────────────────────── */
.gm-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  background: var(--gm-surface);
  border: 1px solid var(--gm-border);
  border-radius: 18px;
  color: var(--gm-blue);
  font-family: var(--gm-font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
}
.gm-btn-secondary:hover { background: var(--gm-blue-bg); box-shadow: var(--gm-shadow-1); }
.gm-btn-secondary:active { transform: translateY(1px); }
.gm-btn-secondary .material-symbols-outlined { font-size: 18px; }

/* ── Stat cards ────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.card {
  background: var(--gm-surface);
  border: 1px solid var(--gm-border);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--gm-shadow-card);
  transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: var(--gm-shadow-2); transform: translateY(-1px); }

.card .card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gm-text-faint);
  margin-bottom: 8px;
}
.card .card-top .material-symbols-outlined { font-size: 18px; }
.card .label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.card .value {
  font-size: 24px;
  font-weight: 500;
  color: var(--gm-text);
  word-break: break-word;
}
.card .value.small { font-size: 15px; font-weight: 500; }

/* ── Panel (table container) ───────────────────────────────── */
.gm-panel {
  background: var(--gm-surface);
  border: 1px solid var(--gm-border);
  border-radius: 12px;
  box-shadow: var(--gm-shadow-card);
  overflow: hidden;
}

.gm-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--gm-divider);
}

.gm-list-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
}
.gm-list-title .material-symbols-outlined { font-size: 20px; color: var(--gm-text-muted); }

.gm-count {
  font-size: 12px;
  font-weight: 400;
  color: var(--gm-text-faint);
  font-variant-numeric: tabular-nums;
}

/* ── Search field ──────────────────────────────────────────── */
.gm-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  background: var(--gm-surface-alt);
  border: 1px solid transparent;
  border-radius: 19px;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.gm-search:focus-within {
  background: var(--gm-surface);
  border-color: var(--gm-blue);
  box-shadow: 0 0 0 1px var(--gm-blue);
}
.gm-search .material-symbols-outlined { font-size: 20px; color: var(--gm-text-faint); }
.gm-search input {
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--gm-font);
  font-size: 14px;
  color: var(--gm-text);
  width: 200px;
}

/* ── Table ─────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  padding: 11px 18px;
  border-bottom: 1px solid var(--gm-divider);
}
th {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gm-text-muted);
  background: var(--gm-bg);
}
th.num, td.num { width: 48px; color: var(--gm-text-faint); font-variant-numeric: tabular-nums; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--gm-row-hover); }
tbody tr:last-child td { border-bottom: none; }

td.name { font-weight: 400; }
td.target {
  color: var(--gm-text-muted);
  font-family: 'Roboto Mono', ui-monospace, Menlo, monospace;
  font-size: 12.5px;
}

/* Type badge — mirrors sidepanel .tag */
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--gm-surface-alt);
  color: var(--gm-text-muted);
}
.tag.substack { background: #fce4ec; color: #ad1457; }
.tag.form { background: var(--gm-blue-bg); color: var(--gm-blue); }

.empty-row td {
  text-align: center;
  color: var(--gm-text-faint);
  padding: 28px;
}

/* ── Analytics extras ──────────────────────────────────────── */
.gm-subtle {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gm-text-faint);
  background: var(--gm-surface-alt);
  padding: 3px 8px;
  border-radius: 6px;
  vertical-align: middle;
  margin-left: 6px;
}

td.ok   { color: var(--gm-green); font-variant-numeric: tabular-nums; }
td.fail { color: var(--gm-red);   font-variant-numeric: tabular-nums; }
td.skip { color: var(--gm-text-faint); font-variant-numeric: tabular-nums; }

/* Mini success-rate bar inside a table cell. */
.rate {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}
.rate .track {
  flex: 1;
  height: 6px;
  background: var(--gm-surface-alt);
  border-radius: 3px;
  overflow: hidden;
}
.rate .fill {
  height: 100%;
  border-radius: 3px;
  background: var(--gm-green);
}
.rate .fill.mid { background: var(--gm-yellow); }
.rate .fill.low { background: var(--gm-red); }
.rate .pct {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--gm-text-muted);
  width: 34px;
  text-align: right;
}

td.mono {
  font-family: 'Roboto Mono', ui-monospace, Menlo, monospace;
  font-size: 12.5px;
  color: var(--gm-text-muted);
}

/* ── Footer ────────────────────────────────────────────────── */
.gm-footer {
  margin-top: 20px;
  font-size: 12px;
  color: var(--gm-text-faint);
  text-align: center;
}

/* ── Error banner ──────────────────────────────────────────── */
.error {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gm-red-bg);
  border: 1px solid #f3c0bf;
  color: var(--gm-red);
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 13px;
}

/* ── Primary / icon buttons ────────────────────────────────── */
.gm-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 18px;
  background: var(--gm-blue);
  border: 1px solid var(--gm-blue);
  border-radius: 19px;
  color: #fff;
  font-family: var(--gm-font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
}
.gm-btn-primary:hover { background: var(--gm-blue-hover); box-shadow: var(--gm-shadow-1); }
.gm-btn-primary:active { transform: translateY(1px); }
.gm-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.gm-btn-primary .material-symbols-outlined { font-size: 18px; }

.gm-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--gm-text-muted);
  cursor: pointer;
  transition: background .15s;
}
.gm-icon-btn:hover { background: var(--gm-hover); }

.gm-head-actions { display: flex; align-items: center; gap: 10px; }

/* ── Modal ─────────────────────────────────────────────────── */
.gm-modal {
  position: fixed;
  inset: 0;
  background: rgba(32,33,36,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.gm-modal[hidden] { display: none; }

.gm-modal-card {
  background: var(--gm-surface);
  border-radius: 16px;
  box-shadow: var(--gm-shadow-2);
  width: 100%;
  max-width: 760px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gm-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 14px 20px;
  border-bottom: 1px solid var(--gm-divider);
}

.gm-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
}

.gm-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--gm-divider);
  background: var(--gm-bg);
}
.gm-modal-actions { display: flex; gap: 10px; }

/* ── Form fields ───────────────────────────────────────────── */
.gm-field { display: block; margin-bottom: 18px; }
.gm-field-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gm-text-muted);
  margin-bottom: 6px;
}

.gm-input,
.gm-field input,
.gm-editor-table input,
.gm-editor-table select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  font-family: var(--gm-font);
  font-size: 13px;
  color: var(--gm-text);
  background: var(--gm-surface);
  border: 1px solid var(--gm-border);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.gm-field input:focus,
.gm-editor-table input:focus,
.gm-editor-table select:focus {
  border-color: var(--gm-blue);
  box-shadow: 0 0 0 1px var(--gm-blue);
}

/* ── Editor table ──────────────────────────────────────────── */
.gm-editor-scroll {
  max-height: 46vh;
  overflow-y: auto;
  border: 1px solid var(--gm-divider);
  border-radius: 10px;
  margin-bottom: 14px;
}
.gm-editor-table { width: 100%; }
.gm-editor-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.gm-editor-table th, .gm-editor-table td {
  padding: 8px 10px;
  vertical-align: middle;
}
.gm-editor-table th.t-type, .gm-editor-table td.t-type { width: 130px; }
.gm-editor-table th.t-del, .gm-editor-table td.t-del { width: 44px; }
.gm-editor-table .gm-subtle { margin-left: 4px; }

.gm-row-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--gm-text-faint);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.gm-row-del:hover { background: var(--gm-red-bg); color: var(--gm-red); }
.gm-row-del .material-symbols-outlined { font-size: 18px; }

.gm-editor-msg { font-size: 13px; color: var(--gm-text-muted); }
.gm-editor-msg.error { color: var(--gm-red); }
.gm-editor-msg.success { color: var(--gm-green); }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.3); }
