:root {
    --bg: #f3efe6;
    --bg-accent: #f6e6c2;
    --ink: #1b1916;
    --muted: #6f665c;
    --card: #ffffff;
    --line: #e3dacd;
    --primary: #2b74ff;
    --primary-dark: #1e57c8;
    --shadow: 0 12px 26px rgba(23, 18, 12, 0.12);
    --radius: 20px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family:
        "Space Grotesk",
        system-ui,
        -apple-system,
        sans-serif;
    color: var(--ink);
    background: radial-gradient(
        circle at top,
        #fff7e2 0%,
        var(--bg) 45%,
        #f0efe9 100%
    );
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: radial-gradient(
        rgba(28, 26, 23, 0.04) 1px,
        transparent 1px
    );
    background-size: 18px 18px;
    pointer-events: none;
    opacity: 0.6;
}

#root {
    position: relative;
    z-index: 1;
}

.app-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px 56px;
}

.hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    justify-content: start;
    margin-bottom: 18px;
}

.hero > div {
    justify-self: start;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.nav-btn {
    border: 1px solid var(--line);
    background: #fffdf9;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 12px;
    cursor: pointer;
}

.nav-btn-active {
    background: var(--ink);
    color: white;
    border-color: var(--ink);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-project {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
}

.nav-project strong {
    color: var(--ink);
}

.nav-project small {
    font-size: 11px;
}

.sync-pill {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid var(--line);
    color: var(--muted);
    background: #fffdf9;
}

.sync-pill-ok {
    color: #1b6f43;
    border-color: rgba(27, 111, 67, 0.3);
    background: rgba(27, 111, 67, 0.08);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 12px;
    color: var(--muted);
    margin: 0 0 12px;
}

.hero h1 {
    font-family: "Fraunces", serif;
    font-size: 34px;
    margin: 0 0 8px;
}

.hero-subtitle {
    max-width: 560px;
    color: var(--muted);
    font-size: 14px;
    margin: 0;
}

.hero-logo img {
    width: 64px;
    height: auto;
    display: block;
    border-radius: 10px;
    box-shadow: none;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(224, 214, 201, 0.7);
}

.auth-card {
    margin-bottom: 18px;
}

.auth-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.field {
    display: grid;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
}

.field span {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 10px;
}

.field input {
    border-radius: 10px;
    border: 1px solid var(--line);
    padding: 10px 12px;
    font-size: 13px;
    background: #fffdf9;
    color: var(--ink);
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.auth-actions .status-text {
  flex-basis: 100%;
  margin-left: 0;
}

.file-btn {
  cursor: pointer;
}

.file-btn input {
  display: none;
}

.status-text {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  margin-left: 12px;
  white-space: nowrap;
}

.status-pill {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid var(--line);
    color: var(--muted);
}

.status-ok {
    color: #1b6f43;
    border-color: rgba(27, 111, 67, 0.3);
    background: rgba(27, 111, 67, 0.08);
}

.status-error {
    color: #a43b2f;
    border-color: rgba(164, 59, 47, 0.3);
    background: rgba(164, 59, 47, 0.08);
}

.status-checking {
    color: #7a4f1a;
    border-color: rgba(122, 79, 26, 0.3);
    background: rgba(122, 79, 26, 0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header h2 {
    margin: 0 0 6px;
    font-family: "Fraunces", serif;
    font-size: 20px;
}

.card-header p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.issue-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.issue-field {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--muted);
}

.issue-field span {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 10px;
}

.issue-field input {
    border-radius: 10px;
    border: 1px solid var(--line);
    padding: 6px 10px;
    font-size: 12px;
    min-width: 88px;
    background: #fffdf9;
}

.save-stack {
    display: grid;
    gap: 6px;
    justify-items: end;
}

.save-status {
    margin: 0;
    font-size: 11px;
    color: var(--muted);
}

.save-status-ok {
    color: #1b6f43;
}

.save-status-error {
    color: #a43b2f;
}

.list-card {
    margin-top: 18px;
}

.issues-layout .list-card,
.issues-layout .editor-card {
    margin-top: 0;
}

.issues-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.3fr) minmax(0, 0.7fr);
    gap: 18px;
    align-items: start;
}

.project-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.project-form .field {
    flex: 1;
}

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

.issue-scroll {
    max-height: 420px;
    overflow: auto;
    padding-right: 4px;
    margin-bottom: 12px;
}

.issue-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    padding: 12px 14px;
    background: #fffdf9;
    font-size: 13px;
    text-align: left;
    align-items: flex-start;
    cursor: pointer;
    box-shadow: none;
}

.issue-row-active {
    border-color: rgba(43, 116, 255, 0.6);
    box-shadow: 0 6px 14px rgba(43, 116, 255, 0.12);
}

.issue-row-vertical {
    flex-direction: column;
    align-items: flex-start;
}


.issue-id {
    font-weight: 600;
}

.issue-path {
    color: var(--muted);
    font-size: 12px;
}

.issue-summary {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.ghost.delete-btn-armed {
    color: #d03b2f;
    border-color: rgba(208, 59, 47, 0.4);
    background: rgba(208, 59, 47, 0.12);
}

.empty {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.list-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.list-status {
    margin-top: 8px;
}

.info-body {
    display: grid;
    gap: 16px;
}

.info-body h3 {
    margin: 0;
    font-family: "Fraunces", serif;
    font-size: 18px;
}

.info-body p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.info-body code {
    background: #f1ede6;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 12px;
}

.empty-state {
    min-height: 420px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--line);
    background: #fffdf9;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 13px;
}

.workspace {
    display: block;
}

.editor-panel {
    width: 100%;
}

.tab-panels {
    width: 100%;
}

.panel-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.panel-toolbar-tight {
    margin-bottom: 8px;
}

.editor-tabs {
    width: 100%;
}

.editor-tabs .tab-list {
    margin-bottom: 12px;
}

.editor-tabs .tab-panels {
    width: 100%;
}

.preview-only {
    width: 100%;
}

.tab-list {
    display: inline-flex;
    background: #f8f2e9;
    border-radius: 999px;
    padding: 4px;
    gap: 4px;
}

.tab {
    border: none;
    padding: 7px 16px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}

.tab-active {
    background: var(--ink);
    color: white;
}

.tab-idle {
    background: transparent;
    color: var(--muted);
}

.tab-panels {
    margin-top: 12px;
}

.editor {
  width: 100%;
  min-height: 520px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  padding: 16px;
    font-family: "Space Grotesk", sans-serif;
    font-size: 14px;
    line-height: 1.45;
    resize: vertical;
  background: #fffdf9;
}

.editor-drop {
  border-radius: var(--radius-sm);
}

.editor-drop-active {
  outline: 2px dashed rgba(43, 116, 255, 0.5);
  outline-offset: 4px;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.upload-progress {
  height: 6px;
  border-radius: 999px;
  background: #f1ede6;
  overflow: hidden;
  margin-top: 8px;
}

.upload-bar {
  height: 100%;
  background: var(--primary);
  transition: width 0.2s ease;
}

.files-block {
  margin-bottom: 16px;
}

.file-list {
  display: grid;
  gap: 8px;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fffdf9;
  font-size: 12px;
}

.file-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.preview {
  min-height: 520px;
  max-height: 520px;
  overflow: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  padding: 18px;
  background: #fffdf9;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

.preview img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  display: block;
  margin: 12px 0;
  border-radius: 10px;
}

.preview h1,
.preview h2,
.preview h3 {
    font-family: "Fraunces", serif;
}

.preview code {
    background: #f1ede6;
    padding: 2px 6px;
    border-radius: 6px;
}

.comments-panel h3 {
    margin: 0;
    font-family: "Fraunces", serif;
    font-size: 18px;
}

.comments-block {
    margin-top: 16px;
}

.comment-form {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

.comment-accordion .ghost {
    cursor: pointer;
    margin-bottom: 12px;
}

.comment-input {
    min-height: 90px;
    border-radius: 10px;
    border: 1px solid var(--line);
    padding: 10px 12px;
    font-size: 13px;
    background: #fffdf9;
    resize: vertical;
}

.comment-list {
    display: grid;
    gap: 8px;
}

.comment-card {
    border-radius: 14px;
    border: 1px solid var(--line);
    padding: 10px 12px;
    background: #fffdf9;
    min-height: 56px;
}

.comment-title {
    margin: 0 0 6px;
    font-weight: 600;
    font-size: 12px;
}

.comment-body {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.primary,
.ghost {
    border: none;
    border-radius: 10px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
}

.primary:disabled,
.ghost:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 8px 18px rgba(43, 116, 255, 0.2);
}

.ghost {
    background: #f5efe6;
    color: var(--muted);
}

@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
    }

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

    .issues-layout {
        grid-template-columns: 1fr;
    }

    .auth-grid {
        grid-template-columns: 1fr;
    }

    .auth-actions {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .app-shell {
        padding: 28px 14px 48px;
    }

    .card {
        padding: 16px;
    }

    .hero h1 {
        font-size: 26px;
    }

    .tab-list {
        width: 100%;
        justify-content: space-between;
    }
}
