:root {
  color-scheme: light;
  --ink: #05080c;
  --muted: #526478;
  --line: rgba(26, 124, 255, .16);
  --soft: #f4fbff;
  --blue: #1a7cff;
  --cyan: #27f3ff;
  --violet: #9a35ff;
  --gradient: linear-gradient(115deg, #27f3ff 0%, #1a7cff 48%, #9a35ff 100%);
  --shadow: 0 18px 52px rgba(5, 8, 12, .11);
  --shadow-soft: 0 10px 28px rgba(18, 38, 83, .08);
  --focus: 0 0 0 4px rgba(39, 243, 255, .24);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: #f7fbff; color: var(--ink); font-family: Inter, "Segoe UI", Arial, sans-serif; }
a { color: inherit; text-decoration: none; }
:where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid rgba(39, 243, 255, .56);
  outline-offset: 3px;
}
.admin-shell { min-height: 100vh; }
.admin-header {
  background: linear-gradient(135deg, #05080c 0%, #07111d 58%, #0f2542 100%);
  color: #fff;
  padding: 22px clamp(18px, 4vw, 42px);
  box-shadow: 0 10px 30px rgba(5, 8, 12, .18);
}
.admin-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; max-width: 1220px; margin: 0 auto; }
.admin-brand { display: flex; align-items: center; gap: 14px; font-weight: 950; }
.admin-brand img { width: 178px; max-height: 58px; object-fit: contain; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.admin-nav a, .admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid rgba(184, 243, 255, .2);
  border-radius: 8px;
  padding: 0 13px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-weight: 850;
  transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.admin-btn.primary { background: var(--gradient); border-color: transparent; color: #fff; }
.admin-btn.light { background: #fff; color: var(--ink); border-color: var(--line); }
.admin-nav a:hover, .admin-btn:hover { transform: translateY(-2px); border-color: rgba(39, 243, 255, .34); box-shadow: var(--shadow-soft); }
.admin-main { max-width: 1220px; margin: 0 auto; padding: clamp(22px, 4vw, 42px); }
.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}
.admin-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--blue);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
}
.login-card, .panel, .stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.login-card, .panel, .stat-card, .action-card, .lead-card {
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}
.login-card:before, .panel:before, .stat-card:before, .action-card:before, .lead-card:before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
}
.login-card { max-width: 460px; margin: 60px auto; padding: 30px; }
h1, h2, h3 { margin: 0; line-height: 1.08; }
h1 { font-size: clamp(32px, 4vw, 52px); }
h2 { font-size: 26px; }
p { color: var(--muted); line-height: 1.65; }
label { display: block; margin-bottom: 14px; color: var(--ink); font-weight: 900; }
input, select, textarea {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 50px;
  padding: 12px 13px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  transition: border-color .2s ease, box-shadow .2s ease;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: var(--focus); outline: 0; }
.alert {
  border: 1px solid rgba(214, 54, 56, .2);
  border-radius: 8px;
  padding: 13px 14px;
  background: rgba(214, 54, 56, .08);
  color: #9b1c1f;
  font-weight: 850;
}
.notice {
  border: 1px solid rgba(26, 124, 255, .2);
  border-radius: 8px;
  padding: 13px 14px;
  background: rgba(26, 124, 255, .08);
  color: var(--ink);
  font-weight: 850;
}
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 28px 0; }
.stat-card { padding: 20px; }
.stat-card span { display: block; color: var(--muted); text-transform: uppercase; font-size: 12px; font-weight: 950; }
.stat-card strong { display: block; margin-top: 6px; color: var(--blue); font-size: 36px; line-height: 1; }
.dashboard-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.action-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(5, 8, 12, .08);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.action-card:hover, .lead-card:hover { transform: translateY(-3px); border-color: rgba(26, 124, 255, .34); box-shadow: var(--shadow); }
.action-card span {
  display: block;
  color: var(--blue);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 950;
}
.action-card strong {
  display: block;
  margin: 7px 0;
  color: var(--ink);
  font-size: 20px;
}
.action-card em {
  display: block;
  color: var(--muted);
  font-style: normal;
  line-height: 1.5;
}
.panel { padding: 22px; margin-bottom: 22px; overflow: hidden; }
.panel-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.panel-title-row p { margin: 8px 0 0; }
.filters { display: grid; grid-template-columns: 1fr 1fr 2fr auto; gap: 12px; align-items: end; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 920px; }
th, td { border-bottom: 1px solid var(--line); padding: 13px 10px; text-align: left; vertical-align: top; }
th { color: var(--muted); text-transform: uppercase; font-size: 12px; font-weight: 950; }
td { color: var(--ink); font-weight: 700; }
.muted { color: var(--muted); font-weight: 700; }
.status-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(26, 124, 255, .1);
  color: var(--blue);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}
.status-pill.contacted { background: rgba(39, 243, 255, .16); }
.status-pill.quoted { background: rgba(154, 53, 255, .12); color: #6e22ba; }
.status-pill.won,
.status-pill.accepted,
.status-pill.approved,
.status-pill.paid { background: rgba(0, 160, 90, .12); color: #047a46; }
.status-pill.lost,
.status-pill.rejected,
.status-pill.blocked { background: rgba(214, 54, 56, .1); color: #9b1c1f; }
.status-pill.open,
.status-pill.requested,
.status-pill.sent,
.status-pill.viewed,
.status-pill.pending,
.status-pill.draft { background: rgba(26, 124, 255, .1); color: var(--blue); }
.status-pill.client_reply,
.status-pill.urgent,
.status-pill.priority-urgent { background: rgba(214, 54, 56, .1); color: #9b1c1f; }
.status-pill.in_progress,
.status-pill.confirmed,
.status-pill.published { background: rgba(154, 53, 255, .12); color: #6e22ba; }
.status-pill.waiting_client,
.status-pill.payment_submitted { background: rgba(245, 158, 11, .16); color: #946200; }
.status-pill.resolved,
.status-pill.completed { background: rgba(0, 160, 90, .12); color: #047a46; }
.status-pill.closed,
.status-pill.cancelled,
.status-pill.void { background: rgba(82, 100, 120, .12); color: var(--muted); }
.status-pill.priority-high { background: rgba(245, 158, 11, .16); color: #946200; }
.status-pill.priority-low { background: rgba(82, 100, 120, .1); color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.detail-grid.single { grid-template-columns: 1fr; margin-top: 18px; }
.detail-item { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: var(--soft); }
.detail-item small { display: block; color: var(--muted); text-transform: uppercase; font-size: 11px; font-weight: 950; }
.detail-item strong { display: block; margin-top: 5px; color: var(--ink); word-break: break-word; }
.lead-chip-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}
.lead-chip-list small {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 950;
}
.lead-chip-list div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.lead-chip-list span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid rgba(26, 124, 255, .2);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(26, 124, 255, .08);
  color: var(--ink);
  font-size: 12px;
  font-weight: 950;
}
pre {
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #071019;
  color: #dff8ff;
}
.raw-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}
.raw-details summary {
  padding: 15px 16px;
  color: var(--ink);
  font-weight: 950;
  cursor: pointer;
}
.raw-details pre {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}
.event-list { display: grid; gap: 10px; }
.mini-list { display: grid; gap: 10px; margin-top: 14px; }
.mini-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: var(--soft);
}
.mini-item strong { color: var(--ink); }
.mini-item em { color: var(--muted); font-style: normal; font-size: 13px; }
.event-item { border-left: 3px solid var(--blue); padding: 8px 0 8px 12px; color: var(--muted); }
.event-item strong { color: var(--ink); }
.pipeline-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(230px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.pipeline-column {
  min-width: 230px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
  padding: 12px;
}
.pipeline-column h2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 18px;
}
.pipeline-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(26, 124, 255, .1);
  color: var(--blue);
  font-size: 12px;
  font-weight: 950;
}
.lead-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(18, 38, 83, .08);
}
.lead-card h3 { font-size: 17px; margin-bottom: 6px; }
.lead-card p { margin: 0 0 10px; font-size: 14px; }
.lead-card-actions { display: grid; gap: 8px; }
.lead-card-actions form { display: flex; gap: 8px; }
.lead-card-actions select { margin: 0; min-height: 38px; padding: 8px; }
.lead-card-actions .admin-btn { min-height: 38px; white-space: nowrap; }
.proposal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
}
.proposal-price {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--soft);
  min-width: 220px;
}
.proposal-price small { display: block; color: var(--muted); text-transform: uppercase; font-weight: 950; }
.proposal-price strong { display: block; margin-top: 8px; color: var(--blue); font-size: 38px; line-height: 1; }
.portal-progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(26, 124, 255, .1);
  overflow: hidden;
}
.portal-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--gradient);
}
.compact-filters {
  grid-template-columns: minmax(180px, 240px) minmax(260px, 1fr) auto;
}
.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}
.message-thread {
  display: grid;
  gap: 14px;
  margin: 18px 0 22px;
}
.message-bubble {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: var(--soft);
}
.message-bubble.admin {
  border-color: rgba(154, 53, 255, .2);
  background: rgba(154, 53, 255, .06);
}
.message-bubble.client {
  border-color: rgba(26, 124, 255, .18);
  background: #fff;
}
.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.message-bubble p { margin: 0; color: var(--ink); }
.reply-form { border-top: 1px solid var(--line); padding-top: 18px; }
.compact-form {
  display: grid;
  gap: 8px;
  min-width: 220px;
}
.compact-form select,
.compact-form textarea { margin: 0; }
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.inline-form { display: inline-flex; margin: 0; }
.content-editor textarea[name="content"] {
  min-height: 420px;
  line-height: 1.6;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}
@media (max-width: 820px) {
  .admin-header-inner, .admin-nav, .page-heading, .panel-title-row { align-items: flex-start; flex-direction: column; }
  .stats-grid, .dashboard-actions, .filters, .detail-grid, .proposal-hero, .split-layout { grid-template-columns: 1fr; }
  .admin-nav a, .admin-btn { width: 100%; }
  .table-actions, .inline-form { display: grid; width: 100%; }
}
