:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #0f766e;
  --primary-hover: #0d9488;
  --accent: #2563eb;
  --wa-header: #075e54;
  --wa-header-owner: #115e59;
  --wa-bg: #efeae2;
  --wa-bubble-in: #ffffff;
  --wa-bubble-alert: #fef9c3;
  --sheet-green: #188038;
  --success: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

/* Topbar */
.topbar {
  background: #0f172a;
  color: #f8fafc;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981, #0d9488);
  display: grid;
  place-items: center;
  font-size: 20px;
}

.topbar h1 {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-demo {
  font-size: 10px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}

.subtitle {
  font-size: 12px;
  color: #94a3b8;
}

.nav-tabs {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px;
  border-radius: 10px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 7px 13px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.18s;
}

.tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.tab-btn.active {
  background: #10b981;
  color: #052e16;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Main Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* View Modes */
.container[data-active-view="public-form"] .view-dashboard-only,
.container[data-active-view="public-form"] #section-sheet {
  display: none !important;
}

.container[data-active-view="public-form"] .top-grid {
  grid-template-columns: minmax(320px, 560px);
  justify-content: center;
  margin-top: 20px;
}

.container[data-active-view="sheet"] .view-dashboard-only,
.container[data-active-view="sheet"] .top-grid {
  display: none !important;
}

/* Control Strip */
.control-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}

.stats-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-chip {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
}

.stat-chip strong {
  font-size: 16px;
  color: var(--text);
}

.owner-config {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 600;
}

.owner-config input {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  width: 175px;
  font-family: inherit;
}

.inline-status {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
}

/* Cards & Grid */
.top-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
  align-items: stretch;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

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

.card h2 {
  font-size: 16px;
  font-weight: 700;
}

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

/* Form Elements */
.field {
  margin-bottom: 13px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: #1e293b;
}

.req {
  color: var(--danger);
}

.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  background: #ffffff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.az-phone-group {
  display: grid;
  grid-template-columns: auto 84px 1fr;
  gap: 8px;
  align-items: center;
}

.az-prefix {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
  white-space: nowrap;
}

.field-hint {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Buttons */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #0f766e, #059669);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, filter 0.15s;
  margin-top: 4px;
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-primary:active {
  transform: scale(0.99);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-primary-sm {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.sheet-actions .btn-ghost {
  background: #f8fafc;
  color: #0f172a;
  border-color: #cbd5e1;
}

.btn-mini {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-mini:hover {
  background: #dcfce7;
}

.form-feedback {
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}

.form-feedback.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.form-feedback.success {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.hidden {
  display: none !important;
}

/* Pipeline Steps */
.status-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.status-pill.idle {
  background: #f1f5f9;
  color: #475569;
}

.status-pill.running {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-pill.done {
  background: #dcfce7;
  color: #15803d;
}

.pipeline-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f8fafc;
  transition: all 0.25s ease;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #334155;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.step-body strong {
  font-size: 13.5px;
}

.step-body span {
  font-size: 12px;
  color: var(--muted);
}

.step-item.active {
  border-color: #3b82f6;
  background: #eff6ff;
  transform: translateX(3px);
}

.step-item.active .step-num {
  background: #2563eb;
  color: #ffffff;
}

.step-item.done {
  border-color: #86efac;
  background: #f0fdf4;
}

.step-item.done .step-num {
  background: #16a34a;
  color: #ffffff;
}

.step-item.warn {
  border-color: #fcd34d;
  background: #fffbeb;
}

.step-item.warn .step-num {
  background: #d97706;
  color: #ffffff;
}

/* WhatsApp Simulators */
.whatsapp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.wa-phone {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wa-phone-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 700;
  padding: 0 4px;
}

.wa-target-tag {
  font-size: 12px;
  background: #e2e8f0;
  color: #1e293b;
  padding: 3px 10px;
  border-radius: 999px;
}

.owner-tag {
  background: #fef3c7;
  color: #92400e;
}

.wa-window {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
  height: 410px;
  background: var(--wa-bg);
}

.wa-header {
  background: var(--wa-header);
  color: #ffffff;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
}

.wa-header-owner {
  background: var(--wa-header-owner);
}

.wa-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}

.customer-av {
  background: #25d366;
}

.owner-av {
  background: #f59e0b;
}

.wa-contact-info {
  flex: 1;
  min-width: 0;
}

.wa-contact-info strong {
  display: block;
  font-size: 14px;
}

.wa-contact-info span {
  display: block;
  font-size: 11.5px;
  color: #d1fae5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-icons {
  font-size: 15px;
  letter-spacing: 6px;
  opacity: 0.9;
}

.wa-chat-body {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #efeae2;
  background-image: radial-gradient(rgba(15, 23, 42, 0.06) 1px, transparent 1px);
  background-size: 18px 18px;
}

.wa-empty {
  margin: auto;
  text-align: center;
  max-width: 300px;
  background: rgba(255, 255, 255, 0.85);
  color: #475569;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.wa-bubble {
  max-width: 90%;
  background: var(--wa-bubble-in);
  padding: 10px 12px 8px;
  border-radius: 0 12px 12px 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  font-size: 13.2px;
  white-space: pre-wrap;
  word-break: break-word;
  animation: popIn 0.28s ease;
}

.wa-bubble.owner-alert {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
}

.wa-bubble-meta-top {
  font-size: 11px;
  font-weight: 700;
  color: #075e54;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.wa-bubble-time {
  margin-top: 6px;
  text-align: right;
  font-size: 11px;
  color: #64748b;
}

.wa-ticks {
  color: #34b7f1;
  font-weight: 700;
  margin-left: 3px;
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.wa-footer-bar {
  background: #f0f2f5;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #e2e8f0;
}

.wa-fake-input {
  flex: 1;
  background: #ffffff;
  color: #94a3b8;
  padding: 7px 12px;
  border-radius: 20px;
  font-size: 12.5px;
}

.wa-mic {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #00a884;
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 14px;
}

/* Google Sheets Table */
.sheet-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sheet-title-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
}

.sheet-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--sheet-green);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
}

.sheet-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.add-prop-bar {
  display: grid;
  grid-template-columns: 110px 2fr 95px 95px 95px 110px 130px auto;
  gap: 8px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
}

.add-prop-bar input,
.add-prop-bar select {
  padding: 7px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font-size: 12.5px;
}

.sheet-table-wrap {
  overflow-x: auto;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sheet-table th,
.sheet-table td {
  border: 1px solid #e2e8f0;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

.sheet-table tr.col-letters th {
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  text-align: center;
  padding: 4px;
}

.sheet-table thead tr:nth-child(2) th {
  background: #ecfdf5;
  color: #065f46;
  font-weight: 700;
}

.sheet-table td.row-idx,
.sheet-table th.row-idx {
  background: #f8fafc;
  color: #64748b;
  text-align: center;
  width: 34px;
  font-size: 12px;
}

.sheet-table td.wrap-cell {
  white-space: normal;
  min-width: 240px;
}

.sheet-table tbody tr:hover {
  background: #f8fafc;
}

.sheet-table tbody tr.matched-row {
  background: #dcfce7 !important;
  outline: 2px solid #22c55e;
  outline-offset: -2px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
}

.status-badge.aktiv {
  background: #dcfce7;
  color: #15803d;
}

.status-badge.rented {
  background: #f1f5f9;
  color: #64748b;
}

.match-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  background: #16a34a;
  color: #ffffff;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 700;
}

@media (max-width: 1024px) {
  .top-grid,
  .whatsapp-grid {
    grid-template-columns: 1fr;
  }
  .add-prop-bar {
    grid-template-columns: 1fr 1fr;
  }
}


/* === Canlı Rejim & İnteqrasiya Paneli === */
.badge-live {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.5);
}

.view-integrations-only {
  display: none;
}

.container[data-active-view="integrations"] .view-integrations-only {
  display: block;
}

.container[data-active-view="integrations"] .view-dashboard-only,
.container[data-active-view="integrations"] .top-grid,
.container[data-active-view="integrations"] #section-sheet {
  display: none !important;
}

body.public-kiosk .nav-tabs,
body.public-kiosk #btn-reset,
body.public-kiosk #btn-fill-sample {
  display: none !important;
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.integration-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.integration-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.int-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}

.int-pill.live {
  background: #dcfce7;
  color: #166534;
}

.int-pill.mock {
  background: #fef3c7;
  color: #92400e;
}

.integration-detail {
  font-size: 13px;
  color: var(--muted);
  word-break: break-word;
}

.integration-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.env-guide {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 13px;
}

.env-guide h3 {
  font-size: 14px;
  margin-bottom: 8px;
  color: #34d399;
}

.env-guide ul {
  margin-left: 18px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.env-guide code {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  color: #93c5fd;
}

.delivery-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 4px;
}

.delivery-chip.live {
  background: #dcfce7;
  color: #166534;
}

.delivery-chip.fail {
  background: #fee2e2;
  color: #991b1b;
}

.delivery-chip.mock {
  background: #e2e8f0;
  color: #475569;
}
