:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #172033;
  --muted: #657084;
  --line: #d9e0e8;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #dff7f3;
  --danger: #b42318;
  --code: #111827;
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 650;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  background: #a8b2bf;
}

.ghost-button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--line);
}

.ghost-button:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  width: min(1280px, 100%);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

.brand-logo {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
}

.eyebrow,
.section-label {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: clamp(28px, 4vw, 46px);
}

h2 {
  font-size: 20px;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(320px, 440px) 1fr;
  gap: 16px;
  align-items: stretch;
}

.input-panel,
.result-panel {
  min-height: 680px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f6;
}

.tab {
  min-height: 38px;
  background: transparent;
  color: var(--muted);
}

.tab:hover,
.tab.is-active {
  color: var(--text);
  background: #fff;
}

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

.is-hidden {
  display: none;
}

label {
  color: #2d3748;
  font-size: 13px;
  font-weight: 720;
}

input[type="url"],
input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.input-row button,
.full-button {
  min-height: 44px;
  padding: 0 16px;
}

.upload-box {
  display: grid;
  place-items: center;
  min-height: 190px;
  padding: 24px;
  border: 1px dashed #9aa7b7;
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.upload-box input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 8px;
  border-radius: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 26px;
  font-weight: 800;
}

.upload-title {
  color: var(--text);
  font-weight: 760;
}

.upload-meta {
  margin-top: 4px;
  font-size: 13px;
}

.status-strip {
  margin: 18px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #fbfcfd;
  font-size: 13px;
}

.status-strip.is-error {
  color: var(--danger);
  border-color: #f2b8b5;
  background: #fff4f2;
}

.profile-panel {
  display: grid;
  gap: 18px;
}

.history-panel {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.history-item {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 11px;
  color: var(--text);
  text-align: left;
  background: #fbfcfd;
  border: 1px solid var(--line);
}

.history-item:hover {
  color: var(--text);
  background: #f3faf9;
}

.history-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 720;
}

.history-item small {
  color: var(--muted);
  font-size: 12px;
}

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

.swatch {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.compact-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

#styleSummary {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.result-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.result-toolbar button {
  min-height: 38px;
  padding: 0 14px;
}

textarea {
  width: 100%;
  min-height: 0;
  resize: none;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: #e5e7eb;
  background: var(--code);
  line-height: 1.55;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

@media (max-width: 860px) {
  .app-shell {
    padding: 16px;
  }

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

  .input-panel,
  .result-panel {
    min-height: auto;
  }

  .result-panel {
    height: 620px;
  }
}

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

  .input-row {
    grid-template-columns: 1fr;
  }
}
