/* === reset === */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* === root layout === */
html, body {
  font-family: 'Segoe UI Variable', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f3f3f3;
  color: #1f1f1f;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

body {
  display: grid;
  grid-template-rows: auto auto 1fr;
}

/* === tab bar === */
.tab-bar {
  display: flex;
  align-items: center;
  background: #ffffff;
  padding: 0 12px;
  border-bottom: 1px solid #e5e5e5;
  gap: 2px;
  min-height: 38px;
}

/* Hidden tab bar: keep it in the grid layout so the content row below
   still gets its 1fr share. Collapse height/visibility instead of
   display:none. */
.tab-bar.hidden {
  display: flex !important;
  visibility: hidden;
  height: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
}

.tab-bar-spacer { flex: 1; }

.tab-bar-btn {
  padding: 10px 16px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: #6b6b6b;
  cursor: pointer;
  font-family: inherit;
  position: relative;
  border-radius: 4px 4px 0 0;
  transition: color 0.15s, background 0.15s;
}

.tab-bar-btn:hover:not(.active) {
  color: #1f1f1f;
  background: #fafafa;
}

.tab-bar-btn.active {
  color: #0078d4;
  font-weight: 600;
}

.tab-bar-btn.active::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  background: #0078d4;
  border-radius: 2px 2px 0 0;
}

/* === tab content wrapper === */
.tab-wrap {
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.tab-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tab-content.hidden {
  display: none !important;
}

.tab-stub {
  padding: 60px 40px;
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

/* === menu bar === */
.menu-bar {
  display: flex;
  background: #ffffff;
  padding: 2px 8px;
  border-bottom: 1px solid #e5e5e5;
  gap: 2px;
}

.menu-item {
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 4px;
  user-select: none;
  font-size: 13px;
}

.menu-item:hover {
  background: #f0f0f0;
}

/* === app body === */
.app-body {
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* === sidebar === */
.sidebar {
  width: 220px;
  background: #ffffff;
  border-right: 1px solid #e5e5e5;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: #1f1f1f;
  font-size: 13px;
  cursor: pointer;
  gap: 10px;
  position: relative;
  margin-bottom: 2px;
}

.nav-item:hover { background: #f5f5f5; }

.nav-item.active {
  background: #e6f1fa;
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: #0078d4;
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  font-size: 14px;
  width: 22px;
  text-align: center;
  display: inline-block;
}

.nav-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #efefef;
  font-size: 11px;
  font-weight: 700;
  color: #6b6b6b;
}

.nav-item.active .nav-step {
  background: #0078d4;
  color: white;
}

.nav-group-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b6b6b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 16px 12px 6px;
}

.sidebar-spacer { flex: 1; }

/* === content === */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px 40px;
  background: #f3f3f3;
}

.screen.hidden { display: none; }

.screen-title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.4px;
}

.screen-subtitle {
  color: #6b6b6b;
  font-size: 14px;
  margin-bottom: 28px;
}

/* === photos screen === */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.photo-card {
  position: relative;
  aspect-ratio: 1;
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e5e5;
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s;
}

.photo-card:active { cursor: grabbing; }

.photo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.photo-card.dragging { opacity: 0.4; }

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.photo-card.cover::after {
  content: 'Cover';
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 120, 212, 0.95);
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  pointer-events: none;
}

.photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  user-select: none;
}

.photo-card:hover .photo-remove { opacity: 1; }

.photo-card.add {
  background: #fafafa;
  border-style: dashed;
  border-color: #c8c8c8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #6b6b6b;
  font-size: 12px;
  cursor: pointer;
  gap: 4px;
}

.photo-card.add:hover {
  background: #f0f6fc;
  border-color: #0078d4;
  color: #0078d4;
  transform: none;
  box-shadow: none;
}

.add-icon {
  font-size: 26px;
  font-weight: 300;
  line-height: 1;
}

.helper-note {
  color: #6b6b6b;
  font-size: 12px;
  margin-bottom: 28px;
}

/* === category screen === */
.category-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 36px;
  border: 1px solid #e5e5e5;
  margin-bottom: 28px;
}

.category-name {
  font-size: 34px;
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

.category-path {
  color: #6b6b6b;
  font-size: 14px;
  margin-bottom: 24px;
}

.category-path .sep {
  margin: 0 8px;
  color: #c8c8c8;
}

.change-link {
  color: #0078d4;
  font-size: 13px;
  text-decoration: none;
  font-weight: 500;
}

.change-link:hover { text-decoration: underline; }

/* === stub screens === */
.screen.stub {
  text-align: center;
  padding-top: 100px;
}

/* === persistent screen-nav arrows === */
.screen-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.nav-arrow {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #d0d0d0;
  background: #ffffff;
  color: #1f1f1f;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.nav-arrow:hover:not(:disabled) {
  background: #f5f5f5;
  border-color: #0078d4;
  color: #0078d4;
}

.nav-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* === home screen === */
.home-empty {
  text-align: center;
  padding-top: 80px;
}

.home-empty-title {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

.home-empty-subtitle {
  color: #6b6b6b;
  font-size: 15px;
  margin-bottom: 40px;
}

.home-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  padding: 14px 28px;
}

.home-cta-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

.home-queue-header .home-cta-row {
  justify-content: flex-end;
}

.rewrite-box {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 24px;
  max-width: 720px;
}

.rewrite-status {
  font-size: 13px;
  color: #6b6b6b;
  margin-top: 12px;
  min-height: 18px;
}
.rewrite-status.error { color: #b03030; }

.home-cta-plus {
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
}

.home-queue { }

.home-queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.home-queue-header .screen-title { margin: 0; }

.queue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.queue-card {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 16px 20px;
  gap: 16px;
  transition: box-shadow 0.15s;
  position: relative;
}

.queue-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.queue-card.saved {
  background: #fafafa;
  border-color: #e8e8e8;
}

.queue-card.saved .queue-card-title {
  color: #6b6b6b;
}

.queue-card.saved::before {
  content: '✓';
  position: absolute;
  left: -2px;
  top: 50%;
  transform: translateY(-50%);
  background: #0a8a4a;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.queue-card.saved {
  padding-left: 28px;
}

.queue-card-main { flex: 1; }

.queue-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.queue-card-meta {
  color: #6b6b6b;
  font-size: 12px;
}

.hidden { display: none !important; }

/* === sidebar disabled walk step === */
.nav-item.walk-step.disabled {
  color: #c0c0c0;
  cursor: default;
  pointer-events: none;
}

.nav-item.walk-step.disabled .nav-step {
  background: #f5f5f5;
  color: #c0c0c0;
}

/* === identify screen === */
.identify-fields {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-bottom: 32px;
  max-width: 540px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: #1f1f1f;
}

.field-optional {
  font-weight: 400;
  color: #6b6b6b;
}

.field input,
.field textarea {
  padding: 10px 12px;
  border: 1px solid #c8c8c8;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #ffffff;
  color: #1f1f1f;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: #0078d4;
  box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.15);
}

.field textarea {
  resize: vertical;
  min-height: 80px;
}

.field {
  max-width: 880px;
  margin-bottom: 24px;
  position: relative;
}

.char-counter {
  position: absolute;
  right: 4px;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #b0b0b0;
}

.char-counter.low  { color: #b07a30; }
.char-counter.good { color: #0a8a4a; }

.tdc-status {
  font-size: 13px;
  color: #6b6b6b;
  margin-bottom: 14px;
  min-height: 18px;
}
.tdc-status.error { color: #b03030; }

/* === datasheet screen === */
.datasheet {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 28px 32px;
  margin-bottom: 24px;
  max-width: 920px;
}

.ds-section {
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid #f0f0f0;
}
.ds-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.ds-heading {
  font-size: 13px;
  font-weight: 700;
  color: #6b6b6b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.ds-subheading {
  font-size: 12px;
  font-weight: 700;
  color: #8a8a8a;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin: 14px 0 6px;
}

.ds-title {
  font-size: 18px;
  font-weight: 600;
  color: #1f1f1f;
  font-family: 'Segoe UI Variable', 'Segoe UI', system-ui, monospace;
  background: #fafafa;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid #f0f0f0;
}

.ds-line {
  font-size: 14px;
  color: #1f1f1f;
  line-height: 1.5;
}

.ds-body {
  font-size: 14px;
  color: #1f1f1f;
  line-height: 1.55;
  white-space: pre-wrap;
}

.ds-empty {
  font-size: 13px;
  color: #6b6b6b;
  font-style: italic;
  padding: 6px 0;
}

.ds-specs {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ds-specs td {
  padding: 8px 12px;
  border-top: 1px solid #f0f0f0;
  vertical-align: top;
}

.ds-spec-name {
  width: 35%;
  color: #6b6b6b;
  font-weight: 500;
}

.ds-spec-value {
  color: #1f1f1f;
  cursor: text;
  border-radius: 4px;
}

.ds-spec-value:hover {
  background: #f5f5f5;
}

.ds-spec-input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid #0078d4;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  background: #ffffff;
  color: #1f1f1f;
  box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.15);
}
.ds-spec-input:focus { outline: none; }

/* === thank-you modal === */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: #ffffff;
  border-radius: 12px;
  padding: 32px 36px;
  max-width: 460px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.modal-title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: -0.4px;
  color: #1f1f1f;
}

.modal-body {
  font-size: 15px;
  color: #1f1f1f;
  margin-bottom: 16px;
  line-height: 1.5;
}

.modal-counter {
  font-size: 13px;
  color: #1f1f1f;
  background: #fafafa;
  border: 1px solid #f0f0f0;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 16px;
  font-weight: 500;
}

.modal-link {
  font-size: 13px;
  color: #6b6b6b;
  margin-bottom: 28px;
  line-height: 1.5;
}

.modal-link a {
  color: #0078d4;
  text-decoration: none;
  font-weight: 500;
}

.modal-link a:hover { text-decoration: underline; }

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.button[disabled],
.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === items-like-yours (comps) screen === */
.comps-status {
  font-size: 13px;
  color: #6b6b6b;
  margin-bottom: 14px;
  min-height: 18px;
}

.comps-status.error { color: #b03030; }

.comps-list {
  display: flex;
  flex-direction: column;
  margin-bottom: 24px;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  overflow: hidden;
}

.comp-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid #f0f0f0;
}

.comp-row:last-child { border-bottom: none; }

.comp-row:hover { background: #fafafa; }

.comp-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.comp-link {
  color: #0078d4;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.comp-link:hover { text-decoration: underline; }

.comp-cond {
  font-size: 11px;
  color: #6b6b6b;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}

.comp-mine-btn {
  padding: 6px 14px;
  font-size: 12px;
  flex-shrink: 0;
}

.comps-refine {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 24px;
}

.refine-message {
  font-size: 13px;
  color: #1f1f1f;
  margin-bottom: 12px;
  line-height: 1.4;
}

.refine-row {
  display: flex;
  gap: 10px;
}

.refine-row input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #c8c8c8;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #ffffff;
  color: #1f1f1f;
}

.refine-row input:focus {
  outline: none;
  border-color: #0078d4;
  box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.15);
}

/* === photo placeholder (when blob URL not rebound) === */
.photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  color: #6b6b6b;
  font-size: 11px;
  padding: 8px;
  text-align: center;
  word-break: break-all;
}

/* === action row === */
.action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid #e5e5e5;
}

.button {
  padding: 10px 22px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.button.primary {
  background: #0078d4;
  color: white;
  border-color: #0078d4;
}

.button.primary:hover { background: #106ebe; border-color: #106ebe; }

.button.secondary {
  background: #ffffff;
  color: #1f1f1f;
  border-color: #c8c8c8;
}

.button.secondary:hover { background: #f5f5f5; }

