* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f3f5f8;
  color: #1d2430;
}

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

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  background: #2554d6;
  color: white;
}

button.secondary,
.secondary-link {
  background: #e8edf8;
  color: #1f3363;
}

button.small {
  padding: 7px 10px;
}

.secondary-link {
  display: inline-block;
  border-radius: 10px;
  text-decoration: none;
  padding: 8px 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd6e4;
  border-radius: 10px;
  padding: 10px 12px;
  background: white;
}

textarea {
  resize: vertical;
}

#app {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 18px;
  background: #111827;
  color: white;
}

.brand {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 18px;
}

.panel {
  background: white;
  color: #1d2430;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 25px rgba(16, 24, 40, 0.08);
}

.sidebar .panel {
  margin-bottom: 16px;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

.main {
  padding: 18px;
}

.empty-state {
  min-height: calc(100vh - 36px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 40px;
}

.workspace {
  display: block;
}

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

.workspace-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  gap: 18px;
}

.workspace-grid.second-row {
  grid-template-columns: 1fr 1fr;
  margin-top: 18px;
}

.doc-panel,
.side-panel,
.build-panel,
.pdf-panel,
.editor-panel {
  min-height: 280px;
}

#editorContainer {
  height: 68vh;
  border: 1px solid #d6dce8;
  border-radius: 12px;
  overflow: hidden;
}

.CodeMirror {
  height: 100%;
  font-size: 15px;
}

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

.list-item {
  border: 1px solid #d9dfeb;
  border-radius: 12px;
  padding: 10px 12px;
  background: #f9fbff;
  cursor: pointer;
}

.list-item.active {
  border-color: #2554d6;
  background: #edf2ff;
}

.list-item .title {
  font-weight: 700;
}

.list-item .sub {
  color: #5a6475;
  font-size: 13px;
  margin-top: 4px;
}

.row {
  display: flex;
}

.between {
  justify-content: space-between;
}

.center {
  align-items: center;
}

.wrap {
  flex-wrap: wrap;
}

.gap8 {
  gap: 8px;
}

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

.muted {
  color: #617086;
}

.strong {
  font-weight: 700;
}

.tiny {
  font-size: 12px;
}

.top-space {
  margin-top: 12px;
}

.hidden {
  display: none !important;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  background: #e8edf8;
  color: #2a4171;
  border-radius: 999px;
  font-size: 13px;
}

.label {
  font-weight: 700;
  display: block;
  margin-bottom: 6px;
}

.mono,
.build-log {
  font-family: Consolas, Monaco, 'Courier New', monospace;
}

.small-textarea {
  min-height: 88px;
}

.build-log {
  background: #10161f;
  color: #dce7ff;
  border-radius: 12px;
  padding: 12px;
  min-height: 280px;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
}

.pdf-frame {
  width: 100%;
  height: 420px;
  border: 1px solid #d6dce8;
  border-radius: 12px;
  background: white;
}

#toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #111827;
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.2s ease;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1200px) {
  #app {
    grid-template-columns: 1fr;
  }

  .workspace-grid,
  .workspace-grid.second-row {
    grid-template-columns: 1fr;
  }

  .workspace-header {
    flex-direction: column;
    align-items: flex-start;
  }

  #editorContainer {
    height: 55vh;
  }
}
