:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #1a1d22;
  --panel-2: #20242b;
  --text: #f4f0e8;
  --muted: #a8b0bd;
  --line: #323844;
  --accent: #23c6a8;
  --accent-2: #ffcf5a;
  --danger: #ff6f61;
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app {
  width: min(820px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(28px, env(safe-area-inset-bottom));
}

.login-view {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 18px;
}

.brand h1,
.topbar h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
}

.brand p,
#statusText,
#jobText,
#galleryCount,
.message {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.topbar,
.result-head,
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  margin-bottom: 14px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.tab,
.ghost,
.icon-button,
.danger-button,
.primary {
  border: 0;
  border-radius: 8px;
}

.tab,
.ghost,
.icon-button {
  min-height: 42px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.tab.active {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-button {
  width: 44px;
  font-size: 22px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin: 12px 0;
}

.login-panel,
.compact {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

textarea,
input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(35, 198, 168, 0.16);
}

.grid {
  display: grid;
  gap: 12px;
}

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

.full {
  grid-column: 1 / -1;
}

.preview-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: 12px;
}

.preview-strip img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.preview-item {
  position: relative;
  flex: 0 0 auto;
}

.preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(16, 17, 20, 0.82);
  color: var(--text);
  font-size: 20px;
  line-height: 24px;
}

.primary {
  width: 100%;
  min-height: 54px;
  background: var(--accent);
  color: #071411;
  font-weight: 800;
  font-size: 17px;
}

.primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

summary {
  color: var(--accent-2);
}

.advanced {
  margin-top: 12px;
}

.result-head h2 {
  margin: 0;
  font-size: 18px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.result-grid.empty {
  display: block;
  color: var(--muted);
  padding: 18px 0 4px;
}

.result-card {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.result-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0c0d10;
}

.image-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-card a {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}

.danger-button {
  min-height: 34px;
  padding: 0 12px;
  background: rgba(255, 111, 97, 0.12);
  color: var(--danger);
  border: 1px solid rgba(255, 111, 97, 0.3);
}

.error {
  color: var(--danger) !important;
}

@media (max-width: 560px) {
  .two,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .brand h1,
  .topbar h1 {
    font-size: 26px;
  }
}
