:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #eef4f6;
  --text: #172026;
  --muted: #62717d;
  --border: #d9e2e6;
  --accent: #0f6b5f;
  --accent-2: #1f6fb2;
  --shadow: 0 18px 45px rgba(23, 32, 38, 0.08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--border);
  background: #fbfcfc;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px 22px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 7px;
  background: var(--text);
  color: white;
  font-size: 21px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  line-height: 1.2;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

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

.category-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.category-button strong {
  color: inherit;
  font-size: 14px;
  font-weight: 650;
}

.category-button span {
  color: inherit;
  font-size: 12px;
}

.category-button:hover,
.category-button.active {
  background: var(--surface-2);
  color: var(--text);
}

.main {
  min-width: 0;
  padding: 38px clamp(18px, 4vw, 56px);
}

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

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

.topbar p {
  max-width: 640px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 7px;
  background: var(--text);
  color: white;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search {
  display: grid;
  grid-template-columns: auto minmax(180px, 420px);
  align-items: center;
  gap: 12px;
  width: min(100%, 560px);
}

.search span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search input {
  width: 100%;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f9fbfb;
  color: var(--text);
  outline: none;
}

.search input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(31, 111, 178, 0.12);
}

.status {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.link-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 10px;
}

.link-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 14px;
  row-gap: 9px;
  min-height: 112px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.link-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 10px 20px rgba(23, 32, 38, 0.12);
}

.link-icon svg {
  width: 27px;
  height: 27px;
}

.tone-blue {
  background: linear-gradient(135deg, #1683e9, #1856b7);
}

.tone-dark {
  background: linear-gradient(135deg, #27313d, #101820);
}

.tone-green {
  background: linear-gradient(135deg, #10a869, #087348);
}

.tone-indigo {
  background: linear-gradient(135deg, #4057d6, #24308f);
}

.tone-orange {
  background: linear-gradient(135deg, #ff9f2f, #db5b1d);
}

.tone-pink {
  background: linear-gradient(135deg, #f85f9c, #b22472);
}

.tone-red {
  background: linear-gradient(135deg, #f45d48, #b32922);
}

.tone-slate {
  background: linear-gradient(135deg, #64748b, #27313d);
}

.tone-teal {
  background: linear-gradient(135deg, #0ea5a4, #0f6b5f);
}

.tone-violet {
  background: linear-gradient(135deg, #7c5cf4, #4633aa);
}

.tone-yellow {
  background: linear-gradient(135deg, #ffc400, #f39a09);
}

.link-meta {
  min-width: 0;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.link-meta h2 {
  overflow: hidden;
  min-width: 0;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.status-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 107, 95, 0.12);
}

.url {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 4px;
  color: var(--accent-2);
  font-size: 13px;
  line-height: 1.4;
}

.description {
  grid-column: 2 / 4;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.tags {
  grid-column: 2 / 3;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 4px 7px;
  border-radius: 6px;
  background: #edf5f2;
  color: #195a51;
  font-size: 12px;
  font-weight: 700;
}

.actions {
  grid-column: 3 / 4;
  grid-row: 1 / 2;
  display: flex;
  gap: 8px;
  align-self: end;
}

.open-link,
.copy-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f9fbfb;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.open-link:hover,
.copy-link:hover {
  border-color: #b9c8cf;
  background: var(--surface-2);
}

.empty {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed #b9c8cf;
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

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

  .category-button {
    min-height: 46px;
  }

  .main {
    padding: 24px 16px 34px;
  }

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

  .primary-action {
    width: 100%;
  }

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

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

  .link-card {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .link-icon {
    width: 46px;
    height: 46px;
  }

  .description,
  .tags,
  .actions {
    grid-column: 2 / 3;
  }

  .actions {
    grid-row: auto;
    justify-self: start;
  }
}

@media (max-width: 520px) {
  .category-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  h1 {
    font-size: 34px;
  }
}
