/* Support Panel — minimal v0.3 stylesheet.
 *
 * Editorial-leaning: serif headings, monospace IDs, restrained palette.
 * No design system yet — when v0.4 lands a reply form / detail view,
 * extract tokens to :root vars and split into per-feature stylesheets. */

:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --ink: #1a1a1a;
  --ink-soft: #5a5a5a;
  --ink-muted: #8a8a8a;
  --rule: #e3e0d8;
  --accent: #2a4a8a;
  --accent-soft: #e8edf6;
  --warn: #b4632c;
  --warn-soft: #f7eadd;
  --danger: #993333;
  --good: #2e6e3e;
  --mono: 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
  --serif: Charter, 'Iowan Old Style', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code { font-family: var(--mono); font-size: 0.92em; background: var(--accent-soft); padding: 1px 6px; border-radius: 3px; }

/* Topbar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
}
.brand {
  font-family: var(--serif); font-weight: 600; font-size: 18px;
  color: var(--ink); letter-spacing: 0.01em;
}
.topbar-nav { display: flex; gap: 18px; align-items: center; }
.who { color: var(--ink-soft); font-size: 13px; }
.logout { font-size: 13px; color: var(--ink-soft); }

/* Layout */
.main { max-width: 1280px; margin: 0 auto; padding: 28px 24px 80px; }

/* Login */
.login { max-width: 420px; margin: 80px auto 0; text-align: center; }
.login h1 { font-family: var(--serif); font-size: 28px; font-weight: 600; margin: 0 0 12px; }
.login p { color: var(--ink-soft); }
.login .small { font-size: 12px; margin-top: 32px; }
.login-widget { margin: 32px 0; min-height: 50px; display: flex; justify-content: center; }
.muted { color: var(--ink-soft); }

/* Page header */
.page-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--rule);
}
.page-header h1 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 0; }

/* Filter tabs */
.filter-tabs { display: flex; gap: 4px; }
.filter-tabs .tab {
  padding: 6px 14px; font-size: 13px; color: var(--ink-soft);
  border-radius: 4px; transition: background 0.15s;
}
.filter-tabs .tab:hover { background: var(--accent-soft); text-decoration: none; }
.filter-tabs .tab.active { background: var(--accent); color: var(--surface); }
.filter-tabs .tab.active:hover { background: var(--accent); }

/* Ticket table */
.ticket-table {
  width: 100%; border-collapse: collapse;
  background: var(--surface);
  font-size: 14px;
}
.ticket-table th {
  text-align: left; font-weight: 500; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-muted);
  padding: 10px 14px; border-bottom: 1px solid var(--rule);
}
.ticket-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.ticket-row:hover { background: var(--accent-soft); }
.ticket-row.priority-high { border-left: 3px solid var(--danger); }
.ticket-row.priority-medium { border-left: 3px solid var(--warn); }
.ticket-row.priority-low { border-left: 3px solid transparent; }
.ticket-id { font-family: var(--mono); color: var(--ink-soft); }
.preview { color: var(--ink-soft); display: block; font-size: 13px; margin-top: 2px; }

/* Badges */
.badge {
  display: inline-block;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 6px; border-radius: 3px; margin-left: 6px;
  font-weight: 600;
}
.badge.unread { background: var(--accent); color: var(--surface); }
.badge.review { background: var(--warn-soft); color: var(--warn); }

.mode { font-family: var(--mono); font-size: 11px; padding: 2px 6px; border-radius: 3px; }
.mode-ai { background: var(--accent-soft); color: var(--accent); }
.mode-manual { background: var(--warn-soft); color: var(--warn); }

.priority { font-size: 12px; }
.priority-high { color: var(--danger); font-weight: 600; }
.priority-medium { color: var(--warn); }
.priority-low { color: var(--ink-muted); }

/* Pagination */
.pagination {
  display: flex; gap: 24px; align-items: center; justify-content: center;
  margin-top: 24px; font-size: 13px;
}

.empty {
  text-align: center; color: var(--ink-muted);
  padding: 80px 0; font-style: italic;
}

/* Ticket detail */
.ticket-detail { max-width: 920px; }
.lock-banner {
  background: var(--warn-soft);
  border-left: 3px solid var(--warn);
  color: var(--warn);
  padding: 12px 16px;
  border-radius: 0 4px 4px 0;
  margin: 12px 0 18px;
  font-size: 13px;
}
.lock-banner strong { font-weight: 600; }
.back-link {
  display: inline-block; font-size: 13px; color: var(--ink-soft);
  margin-bottom: 16px;
}
.ticket-status-row { display: flex; gap: 10px; align-items: center; }
.status {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 3px 8px; border-radius: 3px;
}
.status-open { background: var(--good); color: var(--surface); }
.status-closed { background: var(--ink-soft); color: var(--surface); }

.ticket-meta {
  background: var(--surface); padding: 18px 22px;
  border: 1px solid var(--rule); border-radius: 4px;
  margin-bottom: 24px;
}
.ticket-meta dl {
  display: grid; grid-template-columns: 110px 1fr; gap: 8px 16px;
  margin: 0; font-size: 14px;
}
.ticket-meta dt { color: var(--ink-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 2px; }
.ticket-meta dd { margin: 0; }
.mono { font-family: var(--mono); font-size: 12px; }

/* Thread */
.thread, .reply { margin-bottom: 24px; }
.thread-heading, .reply-heading {
  font-family: var(--serif); font-size: 16px; font-weight: 600;
  margin: 0 0 12px; color: var(--ink-soft); text-transform: uppercase;
  letter-spacing: 0.05em; font-size: 12px;
}
.msg {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 14px 18px;
  margin-bottom: 10px;
}
.msg-user { border-left: 3px solid var(--accent); }
.msg-ai { border-left: 3px solid #6a8aaa; background: #fbfaf5; }
.msg-support { border-left: 3px solid var(--good); }
.msg-system { border-left: 3px solid var(--ink-muted); background: #faf8f4; }
.msg-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 6px; font-size: 12px;
}
.msg-role { font-weight: 600; font-size: 13px; }
.msg-time { color: var(--ink-muted); }
.msg-body {
  font-size: 14px; line-height: 1.55;
  white-space: pre-wrap; word-wrap: break-word;
}
.msg-attachments {
  list-style: none; padding: 6px 0 0; margin: 6px 0 0;
  border-top: 1px dashed var(--rule); font-size: 12px;
}
.msg-attachments li { padding: 2px 0; }

/* Delivery badges (next to outbound message timestamps) */
.badge.delivery {
  margin-left: auto; font-weight: 500; text-transform: none; letter-spacing: 0;
  font-size: 11px; padding: 2px 7px;
}
.delivery.delivery-good { background: #e1f0e3; color: var(--good); }
.delivery.delivery-pending { background: #f5f0d8; color: #7a6320; }
.delivery.delivery-failed { background: #f5dada; color: var(--danger); }
.delivery.delivery-unknown { background: var(--bg); color: var(--ink-muted); }

/* Reply form */
.reply-form textarea {
  width: 100%; min-height: 110px; padding: 10px 12px;
  border: 1px solid var(--rule); border-radius: 4px;
  font: 14px/1.5 var(--sans); resize: vertical;
  background: var(--surface);
}
.reply-form textarea:focus { outline: none; border-color: var(--accent); }
.reply-actions {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; gap: 16px;
}
.reply-hint { font-size: 12px; }
.btn {
  border: none; cursor: pointer;
  font: 500 14px/1 var(--sans);
  padding: 9px 18px; border-radius: 4px;
  transition: background 0.15s;
}
.btn-primary { background: var(--accent); color: var(--surface); }
.btn-primary:hover { background: #1c3a72; }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: var(--surface); }
.btn-danger:hover { background: #7a2828; }
.btn-secondary {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule);
}
.btn-secondary:hover { background: var(--bg); }

/* Actions row */
.actions {
  margin-top: 24px; padding-top: 20px;
  border-top: 1px solid var(--rule);
}
.actions-heading {
  font-family: var(--serif); font-weight: 600;
  margin: 0 0 12px; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: 0.05em; font-size: 12px;
}
.actions-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.action-form { display: inline-flex; }
.action-form-inline {
  display: flex; gap: 8px; align-items: center;
}
.action-input {
  padding: 8px 12px; font-size: 13px;
  border: 1px solid var(--rule); border-radius: 4px;
  font-family: inherit; min-width: 220px;
  background: var(--surface);
}
.action-input:focus { outline: none; border-color: var(--accent); }
