:root {
  --ink: #1f2933;
  --muted: #64748b;
  --line: #d9e2ec;
  --surface: #ffffff;
  --bg: #f4f7fb;
  --nav: #102033;
  --nav-soft: #1c344a;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --gold: #b7791f;
  --red: #b42318;
  --blue: #2563eb;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--nav);
  color: #f8fafc;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  display: grid;
  place-items: center;
  font-weight: 700;
}

.brand strong,
.brand span,
.provider span,
.provider strong {
  display: block;
}

.brand span,
.provider span {
  color: #c8d7e3;
  font-size: 12px;
  margin-top: 3px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 0 12px;
  color: #eef5fb;
  background: transparent;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  background: var(--nav-soft);
}

.provider {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.provider strong {
  margin-top: 5px;
}

.main {
  min-width: 0;
}

.topbar {
  min-height: 76px;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1,
.topbar p,
.panel-header h2,
.mock-site h3 {
  margin: 0;
}

.topbar h1 {
  font-size: 23px;
  line-height: 1.2;
}

.topbar p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.top-actions,
.button-row,
.item-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  min-height: 38px;
  border-radius: 8px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

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

.btn.danger {
  border-color: #f5c2be;
  color: var(--red);
}

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

.view {
  display: none;
  padding: 22px;
}

.view.active {
  display: block;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

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

.stack {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.panel.wide {
  max-width: 1200px;
}

.panel-header {
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header h2 {
  font-size: 16px;
}

.pill {
  border-radius: 999px;
  padding: 5px 9px;
  color: #0f6b60;
  background: #e6f5f2;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.warning {
  color: #805400;
  background: #fff4d8;
}

.lead-list,
.approval-list {
  display: grid;
}

.lead-button,
.approval-item,
.update-item {
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 15px 16px;
  text-align: left;
}

.lead-button {
  display: grid;
  gap: 8px;
}

.lead-button.active {
  background: #f0f8f7;
  box-shadow: inset 3px 0 0 var(--accent);
}

.lead-button:last-child,
.approval-item:last-child,
.update-item:last-child {
  border-bottom: 0;
}

.lead-button strong,
.approval-item strong,
.update-item strong {
  display: block;
  font-size: 15px;
}

.lead-button span,
.approval-item span,
.update-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-top: 4px;
}

.meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  background: #fbfcfd;
  font-size: 12px;
}

.brief-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.lead-tools {
  border-top: 1px solid var(--line);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.lead-tools textarea {
  min-height: 78px;
}

.compact-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.inline-form {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px auto;
  gap: 10px;
  align-items: center;
}

.brief-field {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
  min-height: 76px;
}

.brief-field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.brief-field strong {
  display: block;
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.generator {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.mode {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 0 10px;
  background: #fbfcfd;
  color: var(--ink);
}

.mode.active,
.mode:hover {
  border-color: var(--accent);
  background: #f0f8f7;
}

.field-label,
.form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: white;
}

textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.45;
}

button:focus-visible,
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

.draft-output,
.code-block {
  margin: 0;
  padding: 16px;
  min-height: 240px;
  white-space: pre-wrap;
  line-height: 1.55;
  color: #263642;
  overflow-wrap: anywhere;
}

.code-block {
  min-height: auto;
  background: #f8fafc;
  border-top: 1px solid var(--line);
}

.capability-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.capability {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.capability h3 {
  margin: 0;
  font-size: 15px;
}

.capability ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.approval-item,
.update-item {
  display: grid;
  gap: 10px;
}

.approval-content {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
  white-space: pre-wrap;
  line-height: 1.45;
  color: #2d3a45;
  max-height: 260px;
  overflow: auto;
}

.form {
  padding: 16px;
  display: grid;
  gap: 13px;
}

.form-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.form-error {
  color: var(--red);
  font-size: 13px;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--ink);
}

.checkbox-row input {
  width: auto;
}

.auth-card {
  width: min(460px, 100%);
}

.mock-site {
  padding: 18px;
  min-height: 230px;
  display: grid;
  align-content: start;
  gap: 13px;
}

.security-intro {
  padding: 16px;
  display: grid;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.security-intro p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.capability-grid.compact {
  grid-template-columns: 1fr;
}

.severity {
  text-transform: capitalize;
}

.severity.critical {
  color: var(--red);
  background: #fff0ee;
}

.severity.high {
  color: #805400;
  background: #fff4d8;
}

.severity.medium {
  color: #1d4ed8;
  background: #e9f0ff;
}

.mock-site p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 32, 51, 0.46);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  width: min(640px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.mindoxy-widget-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  border: 0;
  border-radius: 999px;
  min-height: 48px;
  padding: 0 18px;
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 26px rgba(15, 32, 51, 0.22);
}

.mindoxy-widget {
  position: fixed;
  right: 22px;
  bottom: 84px;
  z-index: 31;
  width: min(380px, calc(100vw - 28px));
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(15, 32, 51, 0.25);
  overflow: hidden;
}

.mindoxy-widget[hidden] {
  display: none;
}

.widget-head {
  padding: 13px 14px;
  background: var(--nav);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.widget-head strong,
.widget-head span {
  display: block;
}

.widget-head span {
  color: #c8d7e3;
  font-size: 12px;
  margin-top: 2px;
}

.widget-close {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: white;
  border-radius: 8px;
  width: 34px;
  height: 34px;
}

.widget-body {
  padding: 14px;
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.widget-msg {
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  line-height: 1.45;
  max-width: 92%;
}

.widget-msg.bot {
  background: #f2f6f9;
  border: 1px solid var(--line);
}

.widget-msg.user {
  justify-self: end;
  background: var(--accent);
  color: white;
}

.widget-quick-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.widget-quick-row button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.widget-quick-row button:hover {
  border-color: var(--accent);
}

.widget-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .provider {
    margin-top: 0;
  }

  .layout,
  .layout.two {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions,
  .button-row {
    width: 100%;
  }

  .btn,
  .top-actions .btn,
  .button-row .btn {
    width: 100%;
  }

  .view {
    padding: 14px;
  }

  .nav,
  .brief-grid,
  .mode-grid,
  .inline-form,
  .capability-grid {
    grid-template-columns: 1fr;
  }
}
