* {
  box-sizing: border-box;
}

html,
body,
#app {
  height: 100%;
}

body {
  margin: 0;
  color: #172026;
  background: #f4f5f2;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid #b9c0ba;
  border-radius: 6px;
  background: #ffffff;
  color: #172026;
  cursor: pointer;
  min-height: 36px;
  padding: 0 12px;
}

button:hover {
  border-color: #496c68;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: 100%;
  min-height: 720px;
}

.sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-right: 1px solid #d8ddd7;
  background: #fbfbf8;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 16px;
  border-bottom: 1px solid #d8ddd7;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 6px;
  background: #254441;
  color: #ffffff;
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
}

.brand p {
  margin: 3px 0 0;
  color: #66706a;
  font-size: 13px;
}

.sidebar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #d8ddd7;
}

.draft-list {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
  padding: 12px;
}

.draft-item {
  display: flex;
  width: 100%;
  height: 64px;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.draft-item.active {
  border-color: #254441;
  background: #e8f1ee;
}

.draft-item span,
.draft-item small {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-item small,
.empty {
  color: #66706a;
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) 32px;
  min-width: 0;
  min-height: 0;
}

.toolbar {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid #d8ddd7;
  background: #ffffff;
}

.toolbar > div:first-child {
  min-width: 320px;
  flex: 1;
}

.title-input {
  width: 100%;
  height: 34px;
  border: 0;
  border-bottom: 1px solid #c9d0ca;
  font-size: 18px;
  font-weight: 650;
  outline: none;
}

.meta-row {
  display: grid;
  grid-template-columns: 1fr 0.7fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.meta-row input {
  width: 100%;
  min-width: 0;
  height: 30px;
  border: 1px solid #c9d0ca;
  border-radius: 4px;
  padding: 0 8px;
}

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

.status-pill {
  min-width: 96px;
  height: 28px;
  border: 1px solid #c9d0ca;
  border-radius: 999px;
  background: #f4f5f2;
  color: #254441;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 650;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) 380px;
  min-height: 0;
}

.canvas-wrap {
  min-width: 0;
  min-height: 0;
  background: #ffffff;
}

#canvas {
  width: 100%;
  height: 100%;
  min-height: 560px;
}

.details {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  border-left: 1px solid #d8ddd7;
  background: #fbfbf8;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-bottom: 1px solid #d8ddd7;
}

.tab {
  border: 0;
  border-right: 1px solid #d8ddd7;
  border-radius: 0;
  background: transparent;
}

.tab.active {
  background: #ffffff;
  color: #254441;
  font-weight: 650;
}

.tab-panel {
  display: none;
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label {
  color: #4f5d56;
  font-size: 12px;
  font-weight: 650;
}

textarea {
  width: 100%;
  min-height: 260px;
  flex: 1;
  resize: vertical;
  border: 1px solid #c9d0ca;
  border-radius: 6px;
  padding: 10px;
  color: #172026;
  background: #ffffff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
}

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

.result {
  min-height: 120px;
  overflow: auto;
  border: 1px solid #c9d0ca;
  border-radius: 6px;
  margin: 0;
  padding: 10px;
  background: #ffffff;
  color: #26332f;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.message {
  overflow: hidden;
  border-top: 1px solid #d8ddd7;
  padding: 7px 14px;
  color: #4f5d56;
  background: #ffffff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
    min-height: 100%;
  }

  .sidebar {
    display: none;
  }

  .toolbar,
  .toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .meta-row,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .details {
    min-height: 420px;
    border-left: 0;
    border-top: 1px solid #d8ddd7;
  }
}
