:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px monospace;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  border: 0;
  color: var(--text);
  background: var(--panel2);
  border-radius: 9px;
  padding: 9px 13px;
}
button:hover {
  background: #292e39;
}
.app {
  display: flex;
  height: 100vh;
}
.sidebar {
  width: 260px;
  border-right: 1px solid var(--border);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.logo {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}
.workspaces {
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: auto;
}
.workspace {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--muted);
  cursor: pointer;
}
.workspace:hover,
.workspace.active {
  background: var(--panel2);
  color: var(--text);
}
.workspace-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--panel2);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 650;
  flex: none;
  overflow: hidden;
}
.workspace-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.workspace-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workspace .del {
  opacity: 0;
  color: var(--danger);
  padding: 2px 5px;
  background: none;
}
.workspace:hover .del {
  opacity: 1;
}
.add {
  margin-top: auto;
  width: 100%;
}
.main {
  flex: 1;
  overflow: auto;
  padding: 36px;
  max-width: 1100px;
}
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.title {
  font-size: 28px;
  font-weight: 700;
}
.subtitle {
  color: var(--muted);
  margin-top: 4px;
}
.actions {
  display: flex;
  gap: 8px;
}
.primary {
  background: var(--accent);
  color: #111722;
  font-weight: 650;
}
.primary:hover {
  filter: brightness(1.08);
  background: var(--accent);
}
.links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.link {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 16px;
  display: flex;
  gap: 13px;
  align-items: center;
  cursor: pointer;
  transition:
    background 0.12s,
    border-color 0.12s;
}
.link:hover {
  background: var(--panel2);
  border-color: var(--accent);
}
.favicon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--panel2);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex: none;
  overflow: hidden;
}
.favicon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}
.linkbody {
  min-width: 0;
  flex: 1;
}
.linktitle {
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.url {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}
.link button {
  padding: 5px 8px;
  background: none;
  color: var(--muted);
}
.link button:hover {
  color: var(--danger);
}
.empty {
  border: 1px dashed var(--border);
  border-radius: 13px;
  padding: 45px;
  text-align: center;
  color: var(--muted);
}
.empty b {
  display: block;
  color: var(--text);
  font-size: 16px;
  margin-bottom: 6px;
}
.modal {
  position: fixed;
  inset: 0;
  background: #0008;
  display: none;
  place-items: center;
  padding: 20px;
}
.modal.show {
  display: grid;
}
.dialog {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 22px;
}
.dialog h2 {
  margin: 0 0 18px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}
.field label {
  color: var(--muted);
}
.field label .optional {
  font-size: 12px;
  opacity: 0.7;
}
input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px;
  color: var(--text);
  outline: none;
}
input:focus {
  border-color: var(--accent);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}
.icon-mode-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.icon-mode-tab {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 7px 10px;
  font-size: 12.5px;
  border-radius: 8px;
}
.icon-mode-tab:hover {
  color: var(--text);
}
.icon-mode-tab.active {
  background: var(--accent);
  color: #111722;
  border-color: var(--accent);
  font-weight: 600;
}
.icon-picker-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  justify-content: flex-start;
  text-align: left;
  color: var(--text);
}
.icon-picker-toggle:hover {
  background: var(--bg);
  border-color: var(--accent);
}
.icon-preview {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--panel2);
  display: grid;
  place-items: center;
  flex: none;
  font-size: 13px;
}
.icon-grid {
  position: relative;
  margin-top: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.icon-grid input#iconSearch {
  margin-bottom: 8px;
}
.icon-grid-items {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  max-height: 190px;
  overflow-y: auto;
}
.icon-choice {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--panel2);
  color: var(--text);
  border-radius: 8px;
  padding: 0;
  font-size: 15px;
}
.icon-choice:hover {
  background: #3a4150;
}
.icon-choice.selected {
  background: var(--accent);
  color: #111722;
}
.icon-grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 14px 0;
  font-size: 13px;
}
@media (max-width: 700px) {
  .sidebar {
    width: 210px;
  }
  .main {
    padding: 22px;
  }
  .header {
    align-items: flex-start;
    flex-direction: column;
  }
}
