
:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-dark: #253044;
  --primary: #2563eb;
  --primary-2: #7c3aed;
  --orange: #f59e0b;
  --green: #059669;
  --soft: #eef4ff;
  --dark: #0b1220;
  --dark-2: #111827;
  --shadow: 0 16px 50px rgba(15, 23, 42, .08);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, .06);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 12.5px;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  display: grid;
  grid-template-columns: 385px 1fr;
  height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #0b1220 0%, #070b13 100%);
  color: white;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,.06);
}

.brand {
  padding: 12px 8px 16px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.02em;
  color: white;
}

.brand-subtitle {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.35;
  color: #9ca3af;
}

.section-title {
  margin: 12px 4px 4px;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .09em;
}

.select {
  width: 100%;
  border: 1px solid var(--line-dark);
  background: rgba(17, 24, 39, .88);
  color: white;
  padding: 10px 11px;
  border-radius: 12px;
  outline: none;
  font-weight: 600;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d1d5db;
  font-size: 12px;
  padding: 2px 2px;
}

.secondary-btn,
.settings-btn {
  width: 100%;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 800;
  text-align: left;
  background: rgba(17, 24, 39, .86);
  color: white;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.secondary-btn:hover,
.settings-btn:hover {
  background: rgba(37, 99, 235, .18);
  border-color: rgba(96, 165, 250, .35);
  transform: translateY(-1px);
}

.sidebar-footer {
  margin-top: auto;
  color: #6b7280;
  font-size: 11px;
  padding: 8px 4px 0;
}

.main {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.topbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -.03em;
}

.topbar p {
  color: var(--muted);
  margin: 4px 0 0;
}

.topbar .lead {
  max-width: 760px;
  color: #4b5563;
}

.status-pill {
  background: #ecfdf5;
  color: var(--green);
  padding: 7px 11px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  box-shadow: var(--shadow-soft);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.logout-btn {
  text-decoration: none;
  border: 1px solid var(--line);
  background: white;
  color: #374151;
  padding: 7px 11px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  box-shadow: var(--shadow-soft);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.logout-btn:hover {
  background: #f9fafb;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.context-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.card {
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 12px;
  box-shadow: var(--shadow-soft);
}

.card-label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.card-value {
  font-weight: 900;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-prompts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.quick-prompts button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 7px 11px;
  cursor: pointer;
  font-weight: 900;
  font-size: 13px;
  box-shadow: var(--shadow-soft);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.quick-prompts button:hover {
  background: var(--soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.report-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 15px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

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

.report-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
}

.report-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.report-controls {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.report-controls label {
  display: grid;
  gap: 5px;
  color: #374151;
  font-size: 12px;
  font-weight: 900;
}

.report-controls input {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 9px 10px;
  outline: none;
  font-family: inherit;
  font-size: 12.5px;
  background: white;
}

.report-error {
  color: #991b1b;
  background: #fee2e2;
  padding: 9px 11px;
  border-radius: 12px;
  font-weight: 800;
  margin-bottom: 12px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--line);
}

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

.report-table th {
  background: #111827;
  color: white;
  font-size: 12px;
}

.report-table tr:last-child td {
  border-bottom: 0;
}

.report-table td:last-child {
  font-weight: 900;
}

.generated-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  min-height: 70vh;
  height: min(82vh, calc(100vh - 128px));
  max-height: 82vh;
  overflow: auto;
}

.generated-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin: -10px -10px 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.generated-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
}

.generated-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.ads-list {
  display: grid;
  gap: 6px;
}

.ad-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fbfcff;
}

.ad-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}

.ad-card label {
  font-weight: 900;
}

.ad-meta {
  color: var(--muted);
  font-size: 12px;
}

.ad-title {
  font-weight: 900;
  font-size: 15px;
  margin-bottom: 3px;
}

.ad-title2 {
  font-weight: 800;
  color: #374151;
  margin-bottom: 3px;
}

.ad-text {
  color: #111827;
}

.ad-lengths {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.sitelinks-box {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.sitelink-item {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 9px;
}

.sitelink-title {
  font-weight: 900;
  color: var(--primary);
}

.sitelink-desc {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.ad-errors {
  margin-top: 8px;
  color: #991b1b;
  background: #fee2e2;
  padding: 7px 9px;
  border-radius: 10px;
  font-size: 12px;
}

.ads-diagnostics {
  border: 1px solid #fbbf24;
  background: #fffbeb;
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 12px;
  display: grid;
  gap: 8px;
}

.diagnostic-card {
  background: white;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 10px;
  font-size: 12px;
  color: #111827;
}

.diagnostic-title {
  font-weight: 900;
  margin-bottom: 6px;
}

.diagnostic-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.diagnostic-card li {
  margin-bottom: 4px;
}

.diagnostic-card span,
.diagnostic-errors {
  color: #991b1b;
}

.diagnostic-errors {
  margin-top: 8px;
  font-weight: 800;
}

.chat {
  flex: 1;
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.message {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.message.user {
  flex-direction: row-reverse;
}

.avatar {
  width: 31px;
  height: 31px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  flex: none;
}

.message.user .avatar {
  background: #111827;
  color: white;
}

.bubble {
  max-width: 780px;
  white-space: pre-wrap;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 16px;
  background: #f9fafb;
  border: 1px solid var(--line);
}

.message.user .bubble {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  border-color: transparent;
}

.composer {
  display: flex;
  gap: 10px;
  padding-top: 12px;
}

.composer input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
  outline: none;
  font-size: 12.5px;
  background: white;
  box-shadow: var(--shadow-soft);
}

.composer button,
.primary-btn {
  border: 0;
  border-radius: 16px;
  padding: 11px 16px;
  background: linear-gradient(135deg, var(--primary), var(--orange));
  color: white;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(37, 99, 235, .22);
  transition: transform .12s ease, box-shadow .12s ease;
}

.composer button:hover,
.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(37, 99, 235, .28);
}

.composer button {
  min-width: 54px;
  font-size: 18px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .58);
  display: grid;
  place-items: center;
  padding: 14px;
}

.hidden {
  display: none !important;
}

.modal-card {
  width: min(1080px, 96vw);
  max-height: 92vh;
  overflow: auto;
  background: white;
  border-radius: 24px;
  box-shadow: 0 30px 90px rgba(0,0,0,.22);
  padding: 18px;
}

.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
}

.modal-header p {
  margin: 5px 0 0;
  color: var(--muted);
}

.icon-btn {
  border: 0;
  background: #f3f4f6;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 22px;
  font-weight: 800;
}

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

.settings-block {
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
}

.settings-block.wide {
  grid-column: 1 / -1;
}

.settings-block h3 {
  margin-top: 0;
  font-size: 18px;
  font-weight: 900;
}

.settings-block label {
  display: block;
  font-weight: 900;
  margin: 10px 0 5px;
}

.settings-block input,
.settings-block textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 8px 10px;
  outline: none;
  font-family: inherit;
  font-size: 12.5px;
  background: white;
}

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

.client-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr 82px;
  gap: 8px;
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
}

.delete-client {
  border: 0;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 12px;
  padding: 9px;
  cursor: pointer;
  font-weight: 900;
}


.progress-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-soft);
}

.progress-title {
  font-weight: 900;
  margin-bottom: 8px;
}

.progress-track {
  width: 100%;
  height: 9px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  width: 35%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary), var(--orange));
  border-radius: 999px;
  animation: progressMove 1.1s infinite ease-in-out;
}

@keyframes progressMove {
  0% { transform: translateX(-120%); }
  50% { transform: translateX(120%); }
  100% { transform: translateX(320%); }
}


.sidebar {
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,.45) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,.45);
  border-radius: 999px;
}

.sidebar .secondary-btn,
.sidebar .settings-btn {
  min-height: 38px;
  padding-top: 8px;
  padding-bottom: 8px;
  line-height: 1.15;
}

.sidebar .section-title {
  margin-top: 8px;
  margin-bottom: 3px;
}

.sidebar .select {
  min-height: 38px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.checkbox-line {
  min-height: 28px;
}

.brand {
  padding-bottom: 12px;
}

.checkbox-line.light { color: var(--text); margin-top: 10px; font-weight: 800; }
