:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --ink: #111827;
  --ink-secondary: #4b5563;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #f9fafb;
  --accent: #1e3a8a; /* Veriyum Kurumsal Koyu Mavi */
  --accent-dark: #172554;
  --accent-light: #eff6ff;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select {
  font: inherit;
}

button {
  cursor: pointer;
  transition: all 0.15s ease;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9em;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 6px;
  color: #0f172a;
  border: 1px solid #e2e8f0;
}

/* TOPBAR */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

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

.brand-logo {
  height: 38px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
}

.brand strong {
  display: block;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

/* CUSTOMER VIEW BANNER */
.customer-banner {
  background: #dbeafe;
  border-bottom: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 10px 20px;
  font-size: 13px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.customer-banner-content {
  max-width: 1200px;
  width: 100%;
}

/* APP SHELL */
.app-shell {
  max-width: 1540px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(520px, 1.25fr);
  gap: 20px;
  align-items: start;
}

/* PANEL */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.editor {
  padding: 24px;
}

.preview-wrap {
  padding: 20px;
  position: sticky;
  top: 88px;
}

.panel-head h1 {
  margin: 4px 0 6px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.panel-head p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13.5px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
}

.section-title {
  font-size: 12.5px;
  font-weight: 750;
  color: var(--ink);
  margin: 18px 0 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* FORM FIELDS */
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.profile-links {
  display: flex;
  gap: 8px;
}

.profile-links a {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.profile-links a:hover {
  text-decoration: underline;
}

.field-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.field-grid.one {
  grid-template-columns: 1fr;
}

.field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sub-grid {
  margin-bottom: 0;
}

.field span, .toggle-field span {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.field input, .field select {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  outline: none;
  background: white;
  color: var(--ink);
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
}

.toggle-field {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  margin-top: 21px;
  background: var(--soft);
}

.toggle-field span {
  margin: 0;
}

/* VALIDATION BOX */
.validation-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid var(--warning);
  border-radius: 8px;
  margin-bottom: 12px;
}

.val-icon {
  font-size: 16px;
}

.val-content strong {
  font-size: 12.5px;
  color: #92400e;
  display: block;
}

.val-content p {
  margin: 2px 0 6px;
  font-size: 11.5px;
  color: #78350f;
  line-height: 1.35;
}

.mini-btn {
  background: var(--warning);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
}

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

/* BUTTONS & ACTIONS */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.primary-btn, .secondary-btn, .ghost-btn {
  border-radius: 8px;
  border: 1px solid transparent;
  min-height: 40px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.primary-btn {
  background: var(--accent);
  color: white;
}

.primary-btn:hover {
  background: var(--accent-dark);
}

.secondary-btn {
  background: white;
  border-color: #d1d5db;
  color: var(--ink);
}

.secondary-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.ghost-btn {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.ghost-btn:hover {
  background: #f3f4f6;
  color: var(--ink);
}

.status {
  min-height: 18px;
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
}

.hidden {
  display: none !important;
}

/* COMPACT SELF-SERVICE TOOLBAR */
.self-service-widget {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 12px;
}

.self-service-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.self-service-tag {
  font-size: 11px;
  font-weight: 750;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 2px;
}

.chip-sep {
  color: #cbd5e1;
  font-size: 12px;
  margin: 0 2px;
}

.chip-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip-btn {
  background: white;
  border: 1px solid #cbd5e1;
  color: #334155;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
}

.chip-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chip-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* GUIDE STYLING */
.guide {
  background: white;
  border-radius: 12px;
}

.guide-brand-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 2px solid #f1f5f9;
}

.guide-brand-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.guide-brand-logo {
  height: 38px;
  width: auto;
  max-width: 130px;
  object-fit: contain;
}

.guide h2 {
  margin: 3px 0 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.guide-badge {
  padding: 5px 10px;
  border-radius: 20px;
  background: #dbeafe;
  color: #1e3a8a;
  font-size: 11.5px;
  font-weight: 750;
  white-space: nowrap;
}

.welcome-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.welcome-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #eff6ff;
  color: var(--accent);
  font-size: 16px;
  flex-shrink: 0;
}

.welcome-card strong {
  font-size: 13.5px;
  display: block;
}

.welcome-card p {
  margin: 2px 0 0;
  color: var(--ink-secondary);
  font-size: 12.5px;
  line-height: 1.45;
}

.guide-section {
  margin-top: 20px;
}

.section-heading {
  margin: 0 0 10px;
  font-size: 13.5px;
  font-weight: 750;
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* SETTINGS CARDS */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.setting-card {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 0;
}

.setting-card small {
  display: block;
  color: var(--muted);
  margin-bottom: 3px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.setting-card strong {
  display: block;
  font-size: 12.5px;
  color: var(--ink);
  overflow-wrap: anywhere;
  font-weight: 600;
}

/* STEPS FLOW */
.steps-flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.step-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: white;
  align-items: flex-start;
}

.step-number {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--ink);
  color: white;
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.step-body {
  flex: 1;
}

.step-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.step-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.step-badge {
  font-size: 10px;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.step-instruction {
  font-size: 12.5px;
  color: #374151;
  line-height: 1.5;
}

/* NOTICES */
.notice {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
}

.security-notice {
  background: #fefce8;
  border: 1px solid #fef08a;
  border-left: 4px solid #eab308;
  color: #713f12;
}

.info-notice {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #3b82f6;
  color: #1e40af;
}

.notice strong {
  display: block;
  margin-bottom: 3px;
  font-size: 12.5px;
}

.notice p {
  margin: 0;
}

/* GUIDE FOOTER */
.guide-footer {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.guide-footer strong {
  font-size: 12px;
  color: var(--ink);
}

.guide-footer p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.footer-meta {
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

/* MODAL */
.app-modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 90%;
}

.app-modal::backdrop {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}

.modal-card {
  padding: 20px;
  background: white;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
}

.icon-close {
  background: transparent;
  border: none;
  font-size: 16px;
  color: var(--muted);
}

.modal-body {
  padding: 14px 0;
}

.modal-sub {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.profile-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
  display: grid;
  gap: 6px;
}

.profile-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.prof-info strong {
  display: block;
  font-size: 12.5px;
}

.prof-info span {
  font-size: 10.5px;
  color: var(--muted);
}

.del-btn {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 10.5px;
  font-weight: 700;
}

.del-btn:hover {
  background: #fecaca;
}

.empty-msg {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 16px 0;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

/* CUSTOMER VIEW MODE */
body.view-mode .editor {
  display: none !important;
}

body.view-mode .app-shell {
  grid-template-columns: minmax(0, 840px);
  justify-content: center;
  padding-top: 14px;
}

body.view-mode .preview-wrap {
  position: static;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

body.view-mode #exitViewModeBtn {
  display: inline-flex !important;
}

body.view-mode #resetBtn {
  display: none;
}

/* RESPONSIVE */
@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .preview-wrap {
    position: static;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 0 14px;
  }
  .app-shell {
    padding: 10px;
  }
  .editor, .preview-wrap {
    padding: 14px;
  }
  .field-grid.two, .field-grid.three, .settings-grid {
    grid-template-columns: 1fr;
  }
  .guide h2 {
    font-size: 18px;
  }
  .guide-brand-row, .guide-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* PRINT STYLES (A4 PDF OPTIMIZATION) */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 14mm;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .no-print {
    display: none !important;
  }

  .app-shell {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
  }

  .preview-wrap {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .guide {
    padding: 0 !important;
  }

  .welcome-card, .setting-card, .step-item, .notice {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .settings-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .step-item {
    border: 1px solid #ccc !important;
    margin-bottom: 8px !important;
  }

  .notice {
    border: 1px solid #ccc !important;
  }
}
