:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --panel: #ffffff;
  --line: #d9ddd0;
  --line-strong: #b9c1ae;
  --text: #18211c;
  --muted: #667064;
  --soft: #eef1e9;
  --green: #1f7a4d;
  --green-dark: #135c39;
  --teal: #0e7490;
  --gold: #946200;
  --danger: #aa2e25;
  --shadow: 0 18px 45px rgba(34, 42, 34, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  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 {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 380px;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  background: #fbfcf8;
  padding: 22px;
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #1f2a24;
  color: #fff;
  font-weight: 800;
}

.brand h1,
.panel-title h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.category-nav {
  display: grid;
  gap: 6px;
}

.nav-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 0 11px;
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  border-color: var(--line);
  background: var(--soft);
}

.nav-button span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count {
  min-width: 28px;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  line-height: 22px;
  text-align: center;
}

.sync-panel {
  display: grid;
  gap: 12px;
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.sync-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.sync-row strong {
  color: var(--text);
  font-size: 14px;
}

.main {
  min-width: 0;
  padding: 24px;
}

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

.search-box {
  display: flex;
  width: min(640px, 100%);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 12px;
}

.search-box svg {
  width: 18px;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  height: 42px;
  border: 0;
  outline: 0;
  background: transparent;
}

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

.icon-button,
.primary-button,
.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
}

.icon-button {
  width: 40px;
  padding: 0;
}

.icon-button svg,
.primary-button svg,
.submit-button svg {
  width: 18px;
  height: 18px;
}

.primary-button,
.submit-button {
  border-color: var(--green-dark);
  background: var(--green);
  color: #fff;
}

.primary-button:hover,
.submit-button:hover {
  background: var(--green-dark);
}

.overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.project-list {
  display: grid;
  gap: 12px;
}

.project-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.project-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: cover;
}

.project-head {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.project-title {
  min-width: 0;
}

.project-title a {
  color: var(--text);
  font-size: 17px;
  font-weight: 750;
  text-decoration: none;
}

.project-title a:hover {
  color: var(--green-dark);
}

.project-title p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.stats {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.stat svg {
  width: 15px;
  height: 15px;
}

.summary {
  margin: 12px 0 0;
  color: #2f3a32;
  line-height: 1.6;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag,
.category-pill {
  border-radius: 999px;
  background: var(--soft);
  color: #415046;
  font-size: 12px;
  line-height: 24px;
  padding: 0 9px;
}

.category-pill {
  background: #e6f2ec;
  color: var(--green-dark);
}

.editor-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: #fff;
  padding: 22px;
}

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

.mobile-close {
  display: none;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #344039;
  font-size: 13px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--text);
  outline: 0;
  padding: 10px 11px;
}

input,
select {
  height: 40px;
}

textarea {
  min-height: 86px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.14);
}

.inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
}

.repo-preview {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 11px;
}

.preview-avatar {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--soft);
  background-size: cover;
  background-position: center;
}

.repo-preview strong,
.repo-preview p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repo-preview p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.submit-button {
  width: 100%;
  margin-top: 4px;
}

.status-line {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.status-line.error {
  color: var(--danger);
}

.status-line.success {
  color: var(--green-dark);
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .editor-panel {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 20;
    width: min(420px, 100%);
    transform: translateX(100%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow);
  }

  .editor-panel.open {
    transform: translateX(0);
  }

  .mobile-close {
    display: inline-flex;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
    padding: 16px;
  }

  .category-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sync-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main {
    padding: 16px;
  }

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

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

  .overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-card {
    grid-template-columns: 44px minmax(0, 1fr);
    padding: 13px;
  }

  .avatar {
    width: 44px;
    height: 44px;
  }

  .project-head {
    display: grid;
  }
}

