:root {
  color-scheme: dark;
  --bg: #090a08;
  --panel: rgba(23, 25, 21, 0.82);
  --panel-strong: rgba(31, 34, 28, 0.96);
  --panel-soft: rgba(255, 255, 255, 0.055);
  --line: rgba(255, 255, 255, 0.13);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #f3f0e8;
  --muted: #a6a094;
  --dim: #777066;
  --teal: #5eead4;
  --amber: #f8b84e;
  --rose: #ef6f91;
  --green: #a7f36b;
  --blue: #8ab4ff;
  --danger: #ff6b6b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 8px;
  --font-display: "Aptos Display", "Bahnschrift", "Segoe UI", sans-serif;
  --font-body: "Aptos", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: var(--font-body);
  background:
    linear-gradient(120deg, rgba(94, 234, 212, 0.08), transparent 28%),
    linear-gradient(300deg, rgba(248, 184, 78, 0.08), transparent 32%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 96px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 96px),
    var(--bg);
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.38;
  background-image:
    linear-gradient(135deg, transparent 0 45%, rgba(255, 255, 255, 0.06) 45% 46%, transparent 46%),
    linear-gradient(25deg, transparent 0 55%, rgba(94, 234, 212, 0.05) 55% 56%, transparent 56%);
  background-size: 180px 180px, 240px 240px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 520px);
  padding: clamp(28px, 6vw, 48px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  animation: rise-in 520ms ease both;
}

.brand-lock,
.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(94, 234, 212, 0.48);
  border-radius: var(--radius);
  color: var(--teal);
  background: rgba(94, 234, 212, 0.08);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0;
}

.brand-lock {
  width: 68px;
  height: 68px;
  margin-bottom: 26px;
  color: var(--amber);
  border-color: rgba(248, 184, 78, 0.52);
  background: rgba(248, 184, 78, 0.08);
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: 0;
}

.login-panel h1 {
  margin-bottom: 28px;
  font-size: clamp(2.6rem, 10vw, 5rem);
  line-height: 0.92;
}

.login-form label,
.field span,
.accent-field legend {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(0, 0, 0, 0.22);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input,
select {
  height: 48px;
  padding: 0 14px;
}

textarea {
  resize: vertical;
  min-height: 96px;
  padding: 13px 14px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(94, 234, 212, 0.7);
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.11);
  background: rgba(0, 0, 0, 0.34);
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.primary-button {
  padding: 0 18px;
  color: #06110f;
  font-weight: 800;
  background: linear-gradient(135deg, var(--teal), var(--green));
}

.secondary-button {
  padding: 0 15px;
  color: var(--text);
  font-weight: 800;
  border-color: rgba(248, 184, 78, 0.38);
  background: rgba(248, 184, 78, 0.1);
}

.ghost-button {
  padding: 0 15px;
  color: var(--muted);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.icon-button {
  width: 44px;
  height: 44px;
  color: var(--muted);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.045);
}

.icon-button.subtle {
  background: transparent;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.button-icon,
.field-icon,
[data-icon] {
  display: inline-flex;
  flex: 0 0 auto;
}

[data-icon] svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.form-error {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 0.92rem;
}

.app-view {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 46px);
  border-bottom: 1px solid var(--line);
  background: rgba(9, 10, 8, 0.76);
  backdrop-filter: blur(18px);
}

.identity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.identity h1 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.3rem);
  line-height: 1;
}

.identity .eyebrow {
  margin-bottom: 5px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(34vw, 360px);
  min-width: 210px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--dim);
  background: rgba(255, 255, 255, 0.045);
}

.search-field input {
  height: auto;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  box-shadow: none;
}

.content {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 44px);
}

.overview-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.overview-strip > div {
  min-width: 0;
  padding: 16px clamp(14px, 3vw, 24px);
  background: rgba(20, 22, 18, 0.84);
}

.overview-strip span {
  display: block;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  font-weight: 800;
  line-height: 1;
}

.overview-strip small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-weight: 700;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 18px;
  align-items: start;
}

.category-card {
  --accent: var(--teal);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 130px),
    var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.26);
  animation: rise-in 360ms ease both;
}

.category-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

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

.accent-dot {
  width: 12px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 38%, transparent);
}

.category-title h2 {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
  font-size: 1.2rem;
}

.category-title p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.category-tools {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.link-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.link-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  min-height: 86px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.18);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.link-item:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: rgba(255, 255, 255, 0.055);
}

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

.link-main a {
  display: inline-flex;
  max-width: 100%;
  color: var(--text);
  font-weight: 850;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.link-main a:hover {
  color: var(--accent);
}

.link-main p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.link-host {
  display: block;
  margin-top: 8px;
  color: var(--dim);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.link-actions {
  display: flex;
  gap: 6px;
}

.link-actions .icon-button,
.category-tools .icon-button {
  width: 36px;
  height: 36px;
  min-height: 36px;
}

.add-link-button {
  width: calc(100% - 28px);
  margin: 0 14px 14px;
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.category-empty {
  min-height: 84px;
  display: grid;
  place-items: center;
  margin: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--dim);
  text-align: center;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

.edit-dialog {
  width: min(100% - 28px, 560px);
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
}

.edit-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}

.dialog-card {
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    var(--panel-strong);
  box-shadow: var(--shadow);
}

.dialog-card.wide {
  width: min(100%, 720px);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.field {
  display: block;
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 14px;
}

.accent-field {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.accent-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.accent-choice {
  position: relative;
  width: 38px;
  height: 38px;
}

.accent-choice input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.accent-choice span {
  display: block;
  width: 100%;
  height: 100%;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: var(--swatch);
  cursor: pointer;
}

.accent-choice input:checked + span {
  border-color: var(--text);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 36px));
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 820px) {
  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr auto auto;
    width: 100%;
  }

  .search-field {
    width: 100%;
    min-width: 0;
  }

  .secondary-button span:last-child {
    display: none;
  }
}

@media (max-width: 620px) {
  .password-row,
  .form-grid,
  .overview-strip {
    grid-template-columns: 1fr;
  }

  .password-row .primary-button {
    width: 100%;
  }

  .content {
    padding-inline: 14px;
  }

  .category-head,
  .link-item {
    grid-template-columns: 1fr;
  }

  .link-item {
    display: block;
  }

  .link-actions {
    margin-top: 12px;
    justify-content: flex-end;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

