:root {
  --green: #1fb796;
  --haute: #16323c;
  --bronze: #8d7142;
  --loch: #00848b;
  --warning: #eb5844;
  --ink: #082637;
  --muted: #5e7480;
  --line: rgba(22, 50, 60, 0.16);
  --page: #eef6f3;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: #ffffff;
  --field: #ffffff;
  --shadow: 0 18px 46px rgba(22, 50, 60, 0.12);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --ink: #ffffff;
  --muted: #adc2c9;
  --line: rgba(127, 184, 190, 0.26);
  --page: #071c25;
  --panel: rgba(11, 47, 64, 0.9);
  --panel-strong: #0a3345;
  --field: #0d3b50;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    opacity 160ms ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.app {
  width: min(100%, 1180px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 20px 48px;
}

.hero {
  min-height: 330px;
  border-radius: 22px;
  overflow: hidden;
  position: relative;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(7, 28, 37, 0.9), rgba(0, 132, 139, 0.54)),
    url("https://images.unsplash.com/photo-1600607687939-ce8a6c25118c?auto=format&fit=crop&w=2200&q=80") center / cover;
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(22, 50, 60, 0.08), rgba(22, 50, 60, 0.44));
}

.hero-content {
  position: relative;
  z-index: 1;
  min-height: 330px;
  padding: clamp(28px, 4vw, 48px);
  display: grid;
  align-content: space-between;
  gap: 38px;
}

.theme-switch {
  position: absolute;
  right: clamp(22px, 4vw, 48px);
  bottom: clamp(22px, 4vw, 42px);
  z-index: 2;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  padding: 6px 14px 6px 7px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(12px);
}

.theme-switch:hover {
  transform: translateY(-2px);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.theme-switch:active {
  transform: translateY(0) scale(0.98);
}

.switch-track {
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 3px;
  display: inline-flex;
  align-items: center;
  transition: background 160ms ease;
}

.switch-knob {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transform: translateX(0);
  transition: transform 160ms ease;
}

[data-theme="dark"] .switch-track {
  background: var(--green);
}

[data-theme="dark"] .switch-knob {
  transform: translateX(18px);
}

.brand-row,
.toolbar,
.status-row,
.property-actions,
.filters,
.url-row,
.log-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

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

.brand img {
  width: 250px;
  max-width: 62vw;
  height: auto;
  display: block;
  filter: brightness(0) invert(1);
}

.hero-badge {
  margin-left: auto;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 13px 26px;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.hero h1 {
  margin: 0 0 16px;
  max-width: 780px;
  font-size: clamp(38px, 5.2vw, 64px);
  line-height: 1;
  letter-spacing: 0;
}

.hero p {
  margin: 0;
  max-width: 720px;
  font-size: clamp(16px, 1.8vw, 20px);
  line-height: 1.38;
  font-weight: 850;
}

.shell {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 26px;
  backdrop-filter: blur(14px);
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 18px;
  background: rgba(11, 47, 64, 0.94);
  color: #fff;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.18);
}

.topbar .sub,
.topbar .kicker {
  color: rgba(255, 255, 255, 0.82);
}

.topbar-property {
  min-width: min(360px, 42vw);
  max-width: 460px;
  border: 2px solid var(--green);
  border-radius: 16px;
  padding: 12px 20px;
  color: #fff;
  font-weight: 950;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow:
    0 0 0 4px rgba(31, 183, 150, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.topbar .toolbar,
.output-head .toolbar,
.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}

.topbar .toolbar {
  grid-template-columns: auto auto;
  justify-content: end;
  width: auto;
}

.output-head .toolbar {
  grid-template-columns: max-content max-content;
  justify-content: start;
}

.kicker {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.12;
}

.sub {
  margin: 5px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(31, 183, 150, 0.13);
}

.btn {
  border: 0;
  background: var(--green);
  color: #fff;
  border-radius: 999px;
  min-height: 42px;
  padding: 0 18px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow: 0 10px 20px rgba(31, 183, 150, 0.16);
}

.btn.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn.warning {
  background: var(--warning);
  box-shadow: 0 10px 20px rgba(235, 88, 68, 0.16);
}

.btn.compact {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

.btn:hover:not(:disabled),
.icon-btn:hover:not(:disabled),
.copy-response-btn:hover:not(:disabled),
.collapse-btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.btn:hover:not(:disabled) {
  box-shadow: 0 14px 26px rgba(31, 183, 150, 0.22);
}

.btn.secondary:hover:not(:disabled),
.icon-btn:hover:not(:disabled),
.copy-response-btn:hover:not(:disabled),
.collapse-btn:hover:not(:disabled) {
  border-color: rgba(31, 183, 150, 0.45);
  box-shadow: 0 10px 22px rgba(22, 50, 60, 0.10);
}

.btn.warning:hover:not(:disabled) {
  box-shadow: 0 14px 26px rgba(235, 88, 68, 0.24);
}

.btn:active:not(:disabled),
.icon-btn:active:not(:disabled),
.copy-response-btn:active:not(:disabled),
.collapse-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.copy-response-btn {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field);
  color: var(--ink);
  padding: 0 16px 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 900;
  white-space: nowrap;
}

.copy-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: rgba(22, 50, 60, 0.10);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

[data-theme="dark"] .copy-icon {
  background: rgba(255, 255, 255, 0.13);
}

.copy-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
}

form {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  border-radius: var(--radius);
  min-height: 44px;
  padding: 10px 13px;
  outline: none;
}

textarea {
  min-height: 104px;
  resize: vertical;
  line-height: 1.4;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(31, 183, 150, 0.14);
}

.url-list {
  display: grid;
  gap: 10px;
}

.url-row {
  display: grid;
  grid-template-columns: 1fr auto;
}

.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  font-weight: 900;
}

.prompt-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(7, 28, 37, 0.48);
  backdrop-filter: blur(4px);
}

.prompt-overlay.is-open {
  display: flex;
}

.prompt-box {
  width: min(420px, 100%);
  border: 1px solid rgba(31, 183, 150, 0.28);
  border-radius: 16px;
  background: #0d3b50;
  color: #fff;
  padding: 26px 28px 28px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.prompt-title {
  margin: 0 0 14px;
  color: var(--green);
  font-size: 20px;
  line-height: 1.2;
  font-weight: 950;
}

.prompt-message {
  margin: 0 0 10px;
  color: #fff;
  font-weight: 900;
  line-height: 1.35;
}

.prompt-input {
  min-height: 48px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-size: 16px;
  font-weight: 850;
  box-shadow: 0 0 0 4px rgba(31, 183, 150, 0.14);
}

.prompt-input[hidden] {
  display: none;
}

.prompt-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.prompt-actions .btn.secondary {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  button,
  .switch-track,
  .switch-knob {
    transition: none;
  }

  .btn:hover:not(:disabled),
  .icon-btn:hover:not(:disabled),
  .copy-response-btn:hover:not(:disabled),
  .collapse-btn:hover:not(:disabled),
  .theme-switch:hover,
  .btn:active:not(:disabled),
  .icon-btn:active:not(:disabled),
  .copy-response-btn:active:not(:disabled),
  .collapse-btn:active:not(:disabled),
  .theme-switch:active {
    transform: none;
  }
}

.split-actions {
  display: grid;
  grid-template-columns: max-content max-content;
  gap: 12px;
  align-items: center;
  justify-content: start;
}

.split-actions .toolbar {
  display: grid;
  grid-template-columns: max-content max-content;
  gap: 10px;
  width: auto;
}

#propertyFormPanel .btn {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

.filters {
  margin-top: 20px;
  grid-template-columns: minmax(240px, 420px) max-content max-content;
  justify-content: start;
  align-items: center;
}

.filters input {
  max-width: 420px;
}

.filters .btn {
  min-width: 92px;
}

.properties {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.property-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.property-actions {
  gap: 8px;
}

.property-actions .btn {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

.property-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.property-title {
  margin: 0;
  font-size: 20px;
}

.meta {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.output-box {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.output-head {
  display: grid;
  gap: 18px;
}

pre {
  margin: 0;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 13px 14px;
  min-height: 48px;
  max-height: none;
  overflow: visible;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.45;
}

.activity-log-panel {
  background: var(--panel-strong);
}

.activity-log-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.activity-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.collapse-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: rgba(31, 183, 150, 0.14);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.activity-log-panel.is-collapsed .logs,
.activity-log-panel.is-collapsed #clearLogsBtn {
  display: none;
}

.logs {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  max-height: 430px;
  overflow: auto;
}

.log-item {
  border-left: 4px solid var(--green);
  background: var(--field);
  border-radius: var(--radius);
  padding: 14px;
}

.log-item.error {
  border-left-color: var(--warning);
}

.log-item p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--muted);
  font-weight: 850;
  text-align: center;
}

.footer {
  margin: 30px 0 0;
  display: grid;
  gap: 4px;
  justify-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

.footer strong {
  color: var(--ink);
}

@media (min-width: 820px) {
  .form-grid {
    grid-template-columns: minmax(160px, 220px) minmax(320px, 1fr) minmax(190px, 240px);
    align-items: end;
  }

  .field-code {
    grid-column: 1;
  }

  .field-type {
    grid-column: 3;
  }

  .split-actions {
    grid-template-columns: max-content max-content;
    align-items: center;
  }

  .property-actions {
    display: grid;
    grid-template-columns: repeat(4, max-content);
    justify-content: start;
  }
}

@media (max-width: 720px) {
  .app {
    padding: 10px 12px 36px;
  }

  .hero {
    min-height: 390px;
  }

  .hero-content {
    min-height: 390px;
    align-content: start;
    gap: 18px;
    padding: 28px;
  }

  .brand-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-badge {
    margin-left: 0;
  }

  .theme-switch {
    position: relative;
    right: auto;
    bottom: auto;
    justify-self: end;
    align-self: end;
    margin-top: 4px;
    min-height: 40px;
  }

  .hero h1 {
    margin-bottom: 12px;
    font-size: clamp(34px, 11vw, 46px);
  }

  .hero p {
    max-width: 280px;
    font-size: 16px;
    line-height: 1.25;
  }

  .panel {
    padding: 20px;
  }

  .topbar {
    top: 8px;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .topbar-property {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .topbar .toolbar,
  .output-head .toolbar,
  .activity-log-head,
  .activity-actions,
  .property-actions {
    grid-template-columns: 1fr;
  }

  .property-actions .btn {
    width: 100%;
    min-height: 40px;
    font-size: 13px;
  }

  .split-actions,
  .split-actions .toolbar {
    grid-template-columns: 1fr;
    width: 100%;
  }

  #propertyFormPanel .btn {
    width: 100%;
  }

  .activity-log-head,
  .activity-actions {
    display: grid;
    width: 100%;
  }

  .collapse-btn {
    justify-self: start;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .filters input,
  .filters .btn {
    width: 100%;
    max-width: none;
  }

  h2 {
    font-size: 26px;
  }
}
