/* ── Reset & base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  background: #f5f5f5;
  color: #222;
  min-height: 100vh;
}

button {
  cursor: pointer;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 13px;
}
button:hover { background: #f0f0f0; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

input[type="text"], select {
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 13px;
}

.hidden { display: none !important; }

/* ── Header ───────────────────────────────────────── */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1a1a2e;
  color: #fff;
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}
#header h1 { font-size: 18px; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 12px; }
#btn-refresh { background: #2d2d5a; color: #fff; border-color: #444; }
#btn-refresh:hover { background: #3d3d7a; }
.status-idle    { color: #aaa; font-size: 12px; }
.status-loading { color: #ffd700; font-size: 12px; }
.status-ok      { color: #90ee90; font-size: 12px; }
.status-error   { color: #ff6b6b; font-size: 12px; }

/* ── Banner ───────────────────────────────────────── */
#banner {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
}
#banner.error   { background: #fde8e8; color: #c00; border-bottom: 2px solid #c00; }
#banner.warning { background: #fff8e0; color: #7a5c00; border-bottom: 2px solid #f0c000; }
#banner.success { background: #e6f4ea; color: #1a7a2a; border-bottom: 2px solid #1a7a2a; }

/* ── Section cards ────────────────────────────────── */
section {
  background: #fff;
  border-radius: 8px;
  margin: 12px 16px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
section h2 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }

/* ── Contact Today ────────────────────────────────── */
#contact-today-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.today-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #fafafa;
  border-radius: 6px;
  border-left: 4px solid #1a1a2e;
}
.today-card .today-name    { font-weight: 600; flex: 1; }
.today-card .today-meta    { color: #666; font-size: 12px; }
.today-card .today-actions { display: flex; gap: 6px; align-items: center; }
.today-card .today-actions a { color: #4466cc; font-size: 16px; text-decoration: none; }

/* ── AI Chat ──────────────────────────────────────── */
.ai-input-row { display: flex; gap: 8px; }
#ai-input { flex: 1; }
#ai-response {
  margin-top: 10px;
  padding: 10px;
  background: #f0f4ff;
  border-radius: 6px;
  border-left: 3px solid #4466cc;
  font-size: 13px;
}
#ai-response ul { margin: 6px 0 0 18px; }
#ai-response li { margin-bottom: 2px; }
.ai-actions { display: flex; gap: 8px; margin-top: 8px; }
#btn-confirm-ai { background: #1a7a2a; color: #fff; border-color: #1a7a2a; }
#btn-cancel-ai  { background: #fff; color: #666; }

/* ── Bulk bar ─────────────────────────────────────── */
#section-bulk {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
}
.bulk-controls { display: flex; gap: 8px; align-items: center; }
.bulk-count    { margin-left: auto; color: #666; font-size: 12px; }

/* ── Confirmation overlay ─────────────────────────── */
#overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
#dialog {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
#dialog h3 { margin-bottom: 10px; font-size: 16px; }
#dialog-description { color: #555; margin-bottom: 8px; }
#dialog-contact-list { padding-left: 20px; margin-bottom: 16px; color: #333; }
#dialog-contact-list li { margin-bottom: 3px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; }
#btn-confirm { background: #1a7a2a; color: #fff; border-color: #1a7a2a; padding: 6px 16px; }
#btn-cancel  { padding: 6px 16px; }

/* ── Bucket grid ──────────────────────────────────── */
#main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin: 0 16px 16px;
}
.bucket-col {
  background: #fff;
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  min-height: 200px;
  margin: 0;
}
.bucket-col h2 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.bucket-count  { font-weight: 400; color: #888; font-size: 12px; }
.bucket-desc   { font-size: 11px; color: #999; margin-bottom: 10px; }
.contact-list  { display: flex; flex-direction: column; gap: 8px; }

/* ── Contact card ─────────────────────────────────── */
.contact-card {
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  padding: 10px;
  background: #fafafa;
  transition: background .15s;
}
.contact-card:hover { background: #f0f0f0; }
.card-header   { display: flex; align-items: flex-start; gap: 6px; }
.card-checkbox { margin-top: 3px; flex-shrink: 0; }
.card-name     { font-weight: 600; font-size: 13px; flex: 1; }
.card-days     { font-size: 11px; color: #888; white-space: nowrap; }
.card-contacts { display: flex; gap: 8px; margin-top: 5px; padding-left: 20px; }
.card-contacts a { color: #4466cc; text-decoration: none; font-size: 12px; }
.card-contacts a:hover { text-decoration: underline; }
.card-stage {
  display: inline-block;
  margin: 4px 0 0 20px;
  padding: 1px 6px;
  border-radius: 10px;
  background: #e8e8e8;
  color: #555;
  font-size: 11px;
}
.card-note {
  margin: 5px 0 0 20px;
  font-size: 11px;
  color: #888;
  font-style: italic;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 220px;
}
.card-actions { margin-top: 8px; padding-left: 20px; }
.btn-log {
  font-size: 11px;
  padding: 2px 8px;
  background: #e6f4ea;
  border-color: #1a7a2a;
  color: #1a7a2a;
}
.btn-log:hover  { background: #1a7a2a; color: #fff; }
.btn-log.logged { background: #1a7a2a; color: #fff; }

.empty-state { color: #aaa; font-size: 13px; padding: 12px 0; }

/* ── Quick log input ───────────────────────────────── */
.log-input-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.log-note-input {
  width: 160px;
  font-size: 12px;
  padding: 2px 6px;
}
.btn-log-submit {
  font-size: 11px;
  padding: 2px 8px;
  background: #1a7a2a;
  color: #fff;
  border-color: #1a7a2a;
}
.btn-log-submit:hover   { background: #155c20; }
.btn-log-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-log-cancel {
  font-size: 11px;
  padding: 2px 6px;
  color: #999;
  border-color: #ccc;
}
