/* CreekEdit — internal message editor styles */
/* Plain CSS, no build step, no external deps */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --color-bg:        #f5f6f8;
  --color-surface:   #ffffff;
  --color-border:    #dde1e7;
  --color-primary:   #1d6fa4;
  --color-primary-h: #155a87;
  --color-danger:    #c0392b;
  --color-warn:      #e67e22;
  --color-success:   #27ae60;
  --color-text:      #1a1c20;
  --color-muted:     #6b7280;
  --radius:          6px;
  --shadow:          0 1px 4px rgba(0,0,0,.10);
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
}

/* ── Layout ── */
#app { max-width: 960px; margin: 0 auto; padding: 24px 16px 80px; }

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
header h1 { margin: 0; font-size: 1.3rem; font-weight: 700; }
header .subtitle { color: var(--color-muted); font-size: .85rem; margin-top: 2px; }

/* ── Banner ── */
.banner {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-weight: 600;
}
.banner.warn  { background: #fff3cd; border: 1px solid #ffc107; color: #7c5000; }
.banner.error { background: #fde8e8; border: 1px solid #e74c3c; color: #7a0000; }
.banner.info  { background: #e3f2fd; border: 1px solid #90caf9; color: #0d47a1; }

/* ── Card ── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card h2 { margin: 0 0 14px; font-size: 1rem; font-weight: 700; color: var(--color-muted); text-transform: uppercase; letter-spacing: .05em; }

/* ── Form elements ── */
label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .9rem; }
input[type="text"],
input[type="url"],
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--color-text);
  background: #fff;
  transition: border-color .15s;
}
input[type="text"]:focus,
input[type="url"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(29,111,164,.18);
}
textarea {
  /* v1: raw-content textarea intentionally — HTML round-trips exactly.
     A friendlier rich editor (e.g. ProseMirror/Tiptap) is deferred to Phase 2
     pending the fidelity harness that validates HTML↔content equivalence. */
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  resize: vertical;
  min-height: 260px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary  { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-h); }
.btn-secondary { background: #eef0f3; color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover:not(:disabled) { background: #e2e5ea; }
.btn-danger   { background: var(--color-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #a93226; }
.btn-sm { padding: 5px 12px; font-size: .82rem; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; align-items: center; }

/* ── Load row ── */
.load-row { display: flex; gap: 10px; align-items: flex-end; }
.load-row input { flex: 1; }

/* ── Status badge ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
}
.badge-warn    { background: #fff3cd; color: #7c5000; }
.badge-success { background: #d4edda; color: #155724; }
.badge-neutral { background: #e9ecef; color: #495057; }

/* ── Client-visible indicator ── */
#client-visible-badge { margin-left: 8px; }

/* ── History panel ── */
.history-list { list-style: none; margin: 0; padding: 0; }
.history-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.history-item:last-child { border-bottom: none; }
.history-meta { flex: 1; min-width: 0; }
.history-meta strong { display: block; font-size: .9rem; }
.history-meta .ts { color: var(--color-muted); font-size: .82rem; }
.history-reason { font-size: .85rem; color: var(--color-muted); font-style: italic; margin-top: 2px; }

/* ── Audit table ── */
.audit-table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
th {
  text-align: left;
  padding: 8px 10px;
  background: var(--color-bg);
  border-bottom: 2px solid var(--color-border);
  font-weight: 700;
  color: var(--color-muted);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
  word-break: break-word;
}
tr:hover td { background: #f9fafb; }
.audit-empty { text-align: center; color: var(--color-muted); padding: 24px; }

/* ── Toast ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9000;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 600;
  font-size: .9rem;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  animation: slide-in .2s ease;
  max-width: 360px;
}
.toast.success { background: var(--color-success); }
.toast.error   { background: var(--color-danger); }
.toast.info    { background: var(--color-primary); }

@keyframes slide-in {
  from { transform: translateX(30px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Modal overlay ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8000;
}
.modal {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 28px 32px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,.22);
}
.modal h3 { margin: 0 0 12px; font-size: 1.05rem; }
.modal p  { margin: 0 0 16px; color: #444; font-size: .93rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }

/* ── Checkbox row ── */
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0;
  padding: 12px 14px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--radius);
  font-size: .9rem;
}
.check-row input[type="checkbox"] { margin-top: 2px; accent-color: var(--color-primary); }

/* ── Utility ── */
.hidden  { display: none !important; }
.mt8     { margin-top: 8px; }
.mt14    { margin-top: 14px; }
.muted   { color: var(--color-muted); font-size: .88rem; }

/* ── Sign-in state ── */
#signed-out-view { text-align: center; padding: 60px 20px; }
#signed-out-view h2 { margin-bottom: 8px; }
#signed-out-view p  { color: var(--color-muted); margin-bottom: 24px; }

/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--color-border); margin-bottom: 20px; }
.tab-btn {
  padding: 9px 18px;
  border: none;
  background: none;
  font-size: .92rem;
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--color-primary); }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
