:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #64748b;
  --line: #dbe3ef;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --good: #047857;
  --warn: #b45309;
  --radius: 8px;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px 14px 32px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 1.75rem;
  line-height: 1.1;
}

h2 {
  font-size: 1rem;
}

.count {
  min-width: 74px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: right;
}

.count strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1;
}

.count span {
  color: var(--muted);
  font-size: 0.72rem;
}

.controls,
.quick,
.apps {
  margin-top: 12px;
}

.search {
  display: grid;
  gap: 6px;
}

.search span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.search input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.chips {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.chip,
#clear-pins {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  white-space: nowrap;
}

.chip.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 10px;
}

.section-head span,
.section-head button {
  color: var(--muted);
  font-size: 0.82rem;
}

.rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.rail .app-card {
  flex: 0 0 min(78vw, 320px);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.app-card {
  position: relative;
  min-height: 122px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.app-link {
  display: grid;
  grid-template-columns: 48px 1fr;
  grid-template-rows: 1fr auto;
  gap: 10px 12px;
  min-height: 122px;
  padding: 14px;
  color: inherit;
  text-decoration: none;
}

.app-link:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: -3px;
}

.app-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: #eef2ff;
  color: #1d4ed8;
  font-weight: 800;
}

.app-main {
  display: grid;
  min-width: 0;
}

.app-title {
  padding-right: 28px;
  font-weight: 800;
  line-height: 1.28;
}

.app-folder,
.app-note {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-meta {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.status,
.category {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 700;
}

.status {
  background: #ecfdf5;
  color: var(--good);
}

.status[data-status="draft"] {
  background: #fffbeb;
  color: var(--warn);
}

.category {
  background: #f1f5f9;
  color: #334155;
}

.pin-button {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
}

.pin-button::before {
  content: "+";
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
}

.pin-button.is-pinned {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.pin-button.is-pinned::before {
  content: "✓";
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
}

@media (max-width: 620px) {
  .shell {
    padding: 14px 10px 28px;
  }

  .topbar {
    align-items: center;
  }

  h1 {
    font-size: 1.45rem;
  }

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