:root {
  color-scheme: light;
  --bg: #f7f9fb;
  --surface: #ffffff;
  --surface-soft: #eef5f4;
  --text: #1f2933;
  --muted: #667085;
  --line: #d8e0e7;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #d9f2ee;
  --warning: #9a3412;
  --shadow: 0 12px 32px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  min-height: 100vh;
  overflow: hidden;
  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;
}

.app-shell {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  flex: none;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 4px;
  font-size: 20px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.ghost-button,
.primary-button,
.chip-button,
.tab-button,
.style-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.ghost-button {
  min-height: 42px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.ghost-button span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.primary-button {
  min-height: 40px;
  padding: 8px 14px;
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 700;
}

.workspace {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 260px minmax(260px, 360px) minmax(0, 1fr);
  height: auto;
  min-height: 0;
  overflow: hidden;
}

.sidebar,
.question-list-panel,
.detail-panel {
  height: 100%;
  min-height: 0;
  overflow: auto;
}

.sidebar {
  padding: 20px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.question-list-panel {
  padding: 20px 16px;
  border-right: 1px solid var(--line);
}

.detail-panel {
  padding: 24px;
}

.control-block {
  margin-bottom: 20px;
}

label,
.control-heading {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

input,
select {
  min-height: 42px;
  padding: 9px 11px;
}

textarea {
  min-height: 88px;
  padding: 10px 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

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

.chip-button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
}

.chip-button.active,
.style-button.active,
.tab-button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stats-panel div {
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.stats-panel strong,
.stats-panel span {
  display: block;
  text-align: center;
}

.stats-panel strong {
  font-size: 20px;
}

.stats-panel span {
  color: var(--muted);
  font-size: 12px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-heading p,
.detail-empty p,
.helper-text {
  color: var(--muted);
}

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

.question-card {
  width: 100%;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
}

.question-card:hover {
  border-color: var(--accent);
}

.question-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.thumb {
  width: 74px;
  height: 88px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
  object-fit: cover;
  object-position: top center;
}

.question-card-title {
  margin-bottom: 5px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
}

.question-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.meta-pill {
  padding: 3px 7px;
  border-radius: 999px;
  background: #f1f5f9;
}

.detail-empty,
.detail-content {
  max-width: 1040px;
  margin: 0 auto;
}

.detail-empty {
  padding: 40px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.hidden {
  display: none;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.content-status {
  flex: none;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.content-status.pending {
  background: #fff7ed;
  color: var(--warning);
}

.question-image-frame {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.question-image-frame img {
  display: block;
  width: 100%;
  max-height: 760px;
  object-fit: contain;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
}

.tab-button {
  min-height: 38px;
  padding: 8px 12px;
  flex: none;
  font-weight: 800;
}

.learning-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  line-height: 1.8;
}

.learning-panel p {
  margin-bottom: 12px;
}

.learning-panel p:last-child {
  margin-bottom: 0;
}

.answer-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 18px;
  font-weight: 900;
}

.style-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.style-button {
  min-height: 36px;
  padding: 7px 10px;
  font-weight: 800;
}

.note-list {
  margin: 10px 0 0;
  padding-left: 20px;
}

.note-list li {
  margin: 6px 0;
}

.ask-panel {
  display: grid;
  gap: 10px;
}

.chat-box {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.chat-message {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
}

.chat-message.user {
  background: var(--accent-soft);
}

.empty-state {
  padding: 14px;
  border-radius: 8px;
  background: #fff7ed;
  color: var(--warning);
  font-weight: 700;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 240px minmax(260px, 340px) minmax(0, 1fr);
  }
}

@media (max-width: 920px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .topbar {
    height: auto;
    align-items: flex-start;
    padding: 14px 16px;
  }

  .workspace {
    display: block;
    height: auto;
    overflow: visible;
  }

  .sidebar,
  .question-list-panel,
  .detail-panel {
    height: auto;
    min-height: auto;
    overflow: visible;
    border-right: 0;
  }

  .sidebar,
  .question-list-panel {
    border-bottom: 1px solid var(--line);
  }

  .question-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 20px;
  }

  .topbar {
    flex-direction: column;
    gap: 12px;
  }

  .topbar-actions,
  .ghost-button {
    width: 100%;
  }

  .question-card {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .thumb {
    width: 64px;
    height: 76px;
  }

  .detail-panel {
    padding: 16px;
  }

  .question-image-frame {
    padding: 8px;
  }
}
