/* ==========================================================================
   Media Solutions — Internal Tools — shared design system
   ========================================================================== */

:root {
  --brand: #871622;
  --brand-dark: #63101a;
  --brand-light: #ab5c64;
  --brand-tint: #fbeced;

  --ink: #16181d;
  --muted: #6b7280;
  --faint: #9ca3af;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --line: #e6e8ec;
  --line-2: #dfe2e7;

  --ok: #137a37;
  --ok-bg: #e9f7ec;
  --bad: #a61b1b;
  --bad-bg: #fdeaea;
  --warn: #9a5b00;
  --warn-bg: #fff4e5;
  --blue: #1e40af;
  --blue-bg: #dbeafe;
  --grey-bg: #eef1f4;
  --grey-ink: #52525b;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 20px 60px rgba(16, 24, 40, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand-logo {
  height: 34px;
  width: auto;
  display: block;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.topnav-link {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.topnav-link:hover { background: var(--grey-bg); color: var(--ink); }

.topnav-link.active {
  background: var(--brand-tint);
  color: var(--brand);
}

/* ---------- page hero ---------- */

.page-hero {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
}

.page-hero-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 34px 24px;
}

.page-hero h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.page-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
}

.page-hero .eyebrow {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 8px;
}

/* ---------- layout ---------- */

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.container.narrow { max-width: 840px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 26px 28px;
  margin-bottom: 20px;
}

.panel h2 {
  margin: 0 0 18px;
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
}

.panel h2 .muted-count {
  font-weight: 600;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- forms ---------- */

form { display: flex; flex-direction: column; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 20px;
}

.field { display: flex; flex-direction: column; margin-bottom: 16px; }
.field.span-2 { grid-column: 1 / -1; }

label {
  margin-bottom: 6px;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
}

input[type="text"],
input[type="date"],
input[type="search"],
input[type="tel"],
select,
textarea {
  padding: 11px 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

::placeholder { color: var(--faint); }

/* ---------- buttons ---------- */

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  transition: background 0.15s, transform 0.05s;
}

button:hover, .btn:hover { background: var(--brand-light); }
button:active, .btn:active { transform: translateY(1px); }

.btn-secondary {
  background: var(--grey-bg);
  color: var(--ink);
}
.btn-secondary:hover { background: #e3e6ea; }

.btn-outline {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--brand);
}
.btn-outline:hover { background: var(--brand-tint); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 6px; }

/* ---------- messages ---------- */

.message {
  margin-top: 4px;
  margin-bottom: 20px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
}
.message.success { background: var(--ok-bg); color: var(--ok); }
.message.error { background: var(--bad-bg); color: var(--bad); }

/* ---------- summary / totals ---------- */

.totals, .status-totals, .client-totals, .monthly {
  background: #f9f9fa;
  border: 1px solid var(--line);
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.totals p { margin: 0; }
.totals strong { margin-right: 5px; }

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.section-title {
  margin: 0 0 10px;
  font-weight: 800;
  font-size: 13px;
  color: var(--grey-ink);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.card.highlight { background: #fff8e1; border-color: #f4e2a0; }

hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }

/* ---------- pills ---------- */

.pill {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--grey-bg);
  color: var(--grey-ink);
  margin: 2px 6px 2px 0;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.1s, background 0.1s;
}
.pill:hover { opacity: 0.85; }

.agent-pill.highlight { background: var(--blue-bg); color: var(--blue); border-color: #cddffb; }

.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.blue { background: var(--blue-bg); color: var(--blue); }
.pill.grey { background: var(--grey-bg); color: var(--grey-ink); }

/* ---------- client status rows (Verify Clients results) ---------- */

.row {
  margin-bottom: 10px;
  border-radius: var(--radius);
  padding: 4px 2px;
}
.row h3 { margin: 4px 0 6px; font-size: 15px; }
.row p { margin: 3px 0; font-size: 13.5px; }

.stopped-client { background-color: var(--bad-bg); color: var(--bad); padding: 14px 16px; border-radius: var(--radius); }
.stopped-client p, .stopped-client h3 { color: var(--bad); }

.active-client { background-color: var(--ok-bg); color: var(--ok); padding: 14px 16px; border-radius: var(--radius); }
.active-client p, .active-client h3 { color: var(--ok); }

/* ---------- table / modal ---------- */

table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid var(--line); padding: 9px 10px; text-align: left; font-size: 13.5px; }
th { background: #fafafa; font-weight: 700; }

.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(16, 18, 22, 0.5); z-index: 9990;
}
.modal {
  display: none; position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(860px, 92%); max-height: 82vh; overflow: auto;
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); z-index: 9991;
}
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: #fff;
}
.modal-title { font-weight: 800; color: var(--ink); font-size: 15.5px; }
.modal-body { padding: 16px 20px; }
.close-btn { background: var(--grey-bg); color: var(--ink); border: none; padding: 7px 14px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 700; }
.close-btn:hover { background: #e3e6ea; }

/* ---------- dashboard ---------- */

.hero {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
}
.hero-inner {
  max-width: 1080px; margin: 0 auto; padding: 56px 24px 64px;
  text-align: center;
}
.hero .eyebrow {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: rgba(255,255,255,0.72); margin-bottom: 10px;
}
.hero h1 { margin: 0 0 10px; font-size: 30px; font-weight: 800; letter-spacing: -0.01em; }
.hero p { margin: 0; color: rgba(255,255,255,0.85); font-size: 15px; }

.tool-grid {
  max-width: 1080px; margin: -40px auto 60px; padding: 0 24px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}

.tool-card {
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow); border: 1px solid var(--line);
  padding: 26px 24px 24px; display: flex; flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(16,24,40,0.14); }

.tool-icon {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--brand-tint); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.tool-icon svg { width: 24px; height: 24px; }

.tool-card h3 { margin: 0 0 8px; font-size: 16.5px; font-weight: 800; }
.tool-card p { margin: 0 0 20px; color: var(--muted); font-size: 13.5px; flex-grow: 1; }

.tool-card .btn { align-self: flex-start; }

.dash-footer {
  max-width: 1080px; margin: 0 auto; padding: 0 24px 40px;
  color: var(--faint); font-size: 12.5px; text-align: center;
}

/* ---------- client lookup ---------- */

.search-bar { display: flex; gap: 10px; margin-bottom: 8px; }
.search-bar input {
  flex: 1; padding: 13px 15px; border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); font-size: 16px; font-family: inherit;
}
.search-bar button { padding: 0 24px; }

.hint { color: var(--muted); font-size: 12.5px; margin: 0 2px 20px; }

.note { padding: 12px 15px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; }
.note.err { background: var(--bad-bg); color: var(--bad); border: 1px solid #f3d4d4; }
.note.empty { background: #fff; border: 1px solid var(--line); color: var(--muted); text-align: center; padding: 36px; border-radius: var(--radius); }

.result-count { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }

.result-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 0; margin-bottom: 14px; overflow: hidden; box-shadow: var(--shadow-sm);
}
.result-card .top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.result-card .co { font-size: 16.5px; font-weight: 800; }
.result-card .cn { color: var(--muted); font-size: 13px; margin-top: 2px; }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kv { padding: 13px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kv .l { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); font-weight: 700; margin-bottom: 3px; }
.kv .v { font-size: 14.5px; font-weight: 700; }
.kv .v.big { font-size: 15.5px; font-weight: 800; }
.kv.tele .v { color: var(--brand); }

.note-row { padding: 13px 18px; color: var(--muted); font-size: 13px; }
.note-row b { color: var(--ink); }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .tool-grid { grid-template-columns: 1fr; margin-top: -30px; }
  .form-grid { grid-template-columns: 1fr; }
  .topnav-link { padding: 7px 10px; font-size: 12.5px; }
  .hero-inner { padding: 44px 20px 56px; }
  .hero h1 { font-size: 24px; }
}

@media (max-width: 520px) {
  .topbar-inner { height: auto; flex-wrap: wrap; padding: 12px 16px; }
  .brand-logo { height: 28px; }
  .panel { padding: 20px 18px; }
}
