:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #202423;
  --muted: #66706b;
  --line: #dde3dc;
  --accent: #167a68;
  --accent-dark: #0f5f51;
  --danger: #b64b42;
  --shadow: 0 18px 55px rgba(32, 36, 35, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(246, 247, 244, 0.2)),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-pill {
  min-width: 82px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  padding: 0 14px;
}

.sync-pill[data-state="synced"] {
  border-color: rgba(22, 122, 104, 0.28);
  color: var(--accent-dark);
}

.sync-pill[data-state="error"] {
  border-color: rgba(182, 75, 66, 0.35);
  color: var(--danger);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 2rem;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}

.icon-button:hover,
.quick-add button:hover,
.sync-panel button:hover,
.empty-state button:hover {
  background: var(--accent-dark);
}

.sync-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(32, 36, 35, 0.06);
}

.quick-add {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 1.5fr) minmax(160px, 0.8fr) auto;
  gap: 12px;
  align-items: end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(32, 36, 35, 0.06);
  position: sticky;
  top: 12px;
  z-index: 5;
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfa;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 122, 104, 0.13);
}

.quick-add button,
.sync-panel button,
.empty-state button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  padding: 0 20px;
}

.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.section-card {
  min-height: 156px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(32, 36, 35, 0.05);
}

.section-header {
  display: grid;
  grid-template-columns: 1fr 32px;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.section-title {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 800;
  padding: 0;
}

.section-title:focus {
  box-shadow: none;
  border-color: transparent;
}

.section-links {
  display: grid;
  gap: 8px;
}

.bookmark-row {
  display: grid;
  grid-template-columns: 1fr 28px;
  gap: 8px;
  align-items: center;
}

.bookmark-link {
  min-width: 0;
  min-height: 38px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfa;
  color: var(--ink);
  font-weight: 700;
  padding: 0 12px;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bookmark-link:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.small-button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
}

.small-button:hover {
  background: #f2e7e4;
  color: var(--danger);
}

.empty-state {
  margin-top: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 8px;
}

.empty-state p {
  margin: 0 auto 16px;
  max-width: 430px;
  color: var(--muted);
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 24px, 1120px);
    padding-top: 22px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    flex-direction: column-reverse;
    align-items: flex-end;
  }

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

  .quick-add {
    position: static;
    grid-template-columns: 1fr;
  }
}
