:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --line: #d9e0ec;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --blue: #2563eb;
  --amber: #b45309;
  --green: #15803d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.ce-suite-nav {
  position: sticky;
  z-index: 60;
  top: 0;
  min-height: 62px;
  background: linear-gradient(110deg, #072b49, #0a4268);
  box-shadow: 0 8px 24px rgba(8, 45, 77, .14);
}

.ce-product-links {
  min-width: 0;
  min-height: 62px;
  padding: 0 24px;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
}

.ce-product-link {
  min-width: 112px;
  padding: 10px 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  border-right: 1px solid rgba(255, 255, 255, .1);
  color: #d7e7f2;
  text-decoration: none;
  transition: background .16s ease, color .16s ease;
}

.ce-product-link:first-child { border-left: 1px solid rgba(255, 255, 255, .1); }
.ce-product-link strong { font-size: 13px; letter-spacing: .01em; }
.ce-product-link span { color: #9fc0d5; font-size: 9px; }
.ce-product-link:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.ce-product-link.active { position: relative; background: #fff; color: #082d4d; }
.ce-product-link.active::after { position: absolute; right: 14px; bottom: 0; left: 14px; height: 3px; border-radius: 3px 3px 0 0; background: #00b8bd; content: ""; }
.ce-product-link.active span { color: #528095; }

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 22px 28px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.header-logo {
  width: 132px;
  height: auto;
  object-fit: contain;
  flex: 0 0 auto;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 28px; }
h2 { margin-bottom: 4px; font-size: 22px; }
p { color: var(--muted); }

button, .file-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

button:hover, .file-button:hover { border-color: #aab7c9; }
button.primary { background: var(--brand); color: #fff; border-color: var(--brand); }

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file-button input { display: none; }

.header-actions, .row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.save-status {
  min-width: 5.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 700;
}

.save-status.error { color: #9b1c1c; }

.tabs {
  display: flex;
  gap: 8px;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab.active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

main { padding: 22px 28px 34px; }

.panel { display: none; }
.panel.active { display: block; }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: .03em;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
}

.kpi:nth-child(1) strong { color: var(--blue); }
.kpi:nth-child(2) strong { color: var(--brand); }
.kpi:nth-child(3) strong { color: var(--amber); }
.kpi:nth-child(4) strong { color: var(--green); }

.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.tool-surface, .report-preview {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: auto;
}

.market-summary-surface {
  margin-bottom: 12px;
}

.compact-table table {
  min-width: 900px;
}

.compact-table th, .compact-table td {
  padding: 8px 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 12px;
  color: #344054;
  background: #f8fafc;
  text-transform: uppercase;
}

td input, td select, .report-controls input, .report-controls select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  background: #fff;
}

.inline-email {
  width: min(320px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  background: #fff;
}

.inline-control {
  color: #344054;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.inline-control input {
  display: block;
  width: 150px;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  text-transform: none;
  font-weight: 400;
  color: var(--ink);
  background: #fff;
}

.inline-control select {
  display: block;
  min-width: 110px;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  text-transform: none;
  font-weight: 400;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 150px;
  margin-bottom: 10px;
  resize: vertical;
}

.report-controls {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.report-controls label {
  color: #344054;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-controls input, .report-controls select {
  display: block;
  margin-top: 5px;
  text-transform: none;
  font-weight: 400;
  color: var(--ink);
}

.market-controls {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(180px, 1fr) minmax(220px, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.log-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.market-controls label, .log-controls label {
  color: #344054;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.market-controls input, .market-controls select, .log-controls select {
  display: block;
  width: 100%;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  text-transform: none;
  font-weight: 400;
  color: var(--ink);
  background: #fff;
}

.market-kpis {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
}

.time-zone-kpis {
  grid-template-columns: repeat(7, minmax(145px, 1fr));
}

.time-zone-kpis .kpi {
  padding: 12px;
}

.time-zone-kpis .kpi strong {
  font-size: 26px;
}

.log-kpis {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
}

.report-kpis {
  grid-template-columns: repeat(8, minmax(150px, 1fr));
}

.sales-kpis, .verification-kpis {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.status-line {
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: #344054;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-pill.ready {
  border-color: #86efac;
  color: #166534;
  background: #ecfdf5;
}

.status-pill.blocked {
  border-color: #fed7aa;
  color: #9a3412;
  background: #fff7ed;
}

.report-actions { margin-bottom: 12px; }

.report-action-surface {
  margin-bottom: 12px;
}

.report-action-surface .status-line {
  margin: 0;
}

.report-preview {
  min-height: 320px;
  overflow: auto;
}

.report-preview h3 { margin-bottom: 6px; }
.report-preview .meta { color: var(--muted); margin-bottom: 14px; }

.bar-cell {
  display: grid;
  grid-template-columns: minmax(36px, 70px) 1fr minmax(34px, auto);
  gap: 10px;
  align-items: center;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #e6ebf3;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: var(--brand);
}

.compact-list {
  display: grid;
  gap: 8px;
}

.compact-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.compact-item strong,
.compact-item span {
  display: block;
}

.field-help {
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  margin: 12px 0;
}

.compact-item span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.integration-note {
  margin-bottom: 12px;
}

.integration-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.integration-flow span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: #344054;
  background: #f8fafc;
  font-weight: 800;
}

.customer-grid {
  display: grid;
  gap: 12px;
}

.customer-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.customer-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.customer-card-header strong,
.customer-card-header span {
  display: block;
}

.customer-card-header > div > span,
.customer-card .meta {
  color: var(--muted);
  font-size: 13px;
}

.verification-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.verification-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.verification-grid span,
.verification-grid strong {
  display: block;
}

.verification-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.verification-grid strong {
  margin-top: 4px;
  font-size: 16px;
}

.api-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, .8fr);
  gap: 14px;
}

.api-search-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 120px auto;
  gap: 10px;
  align-items: end;
}

.api-search-controls label {
  color: #344054;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.api-search-controls input,
.api-search-controls select {
  display: block;
  width: 100%;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  text-transform: none;
  font-weight: 400;
  color: var(--ink);
  background: #fff;
}

.numberbarn-results {
  display: grid;
  gap: 8px;
}

.number-result {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.number-result strong,
.number-result span {
  display: block;
}

.number-result strong {
  font-size: 18px;
}

.number-result span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.number-result button[disabled] {
  cursor: default;
  color: var(--muted);
  background: #f2f4f7;
}

.steps {
  margin-bottom: 0;
  color: #344054;
  line-height: 1.7;
}

.pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #166534;
  font-size: 12px;
  font-weight: 700;
}

.logo-cell {
  min-width: 150px;
}

.logo-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.logo-preview img {
  max-width: 72px;
  max-height: 38px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 3px;
}

.mini-file-button {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.link-button {
  border: 0;
  min-height: 0;
  padding: 0;
  color: var(--blue);
  background: transparent;
}

.report-logo {
  max-width: 150px;
  max-height: 72px;
  object-fit: contain;
  display: block;
  margin-bottom: 10px;
}

.summary-logo {
  max-width: 70px;
  max-height: 34px;
  object-fit: contain;
}

.empty {
  padding: 16px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .ce-product-links { padding: 0 14px; }
  .ce-product-link { min-width: 102px; padding-right: 12px; padding-left: 12px; }
  .app-header, .section-heading { flex-direction: column; align-items: stretch; }
  .header-brand { align-items: flex-start; }
  .kpis, .workspace-grid, .report-controls, .market-controls, .log-controls, .api-layout, .api-search-controls, .integration-flow, .verification-grid { grid-template-columns: 1fr; }
  .customer-card-header { flex-direction: column; }
  .number-result { align-items: stretch; flex-direction: column; }
  main { padding: 16px; }
  .tabs { padding: 12px 16px; }
}

@media (max-width: 700px) {
  .ce-product-link { min-width: 94px; }
  .ce-product-link span { display: none; }
}

@media print {
  .ce-suite-nav { display: none !important; }
  body { background: #fff; }
  .app-header, .tabs, .section-heading, .report-controls, .report-actions { display: none !important; }
  main { padding: 0; }
  .panel { display: none !important; }
  #reports { display: block !important; }
  .report-preview { border: 0; padding: 0; }
}
