:root {
  --bg: #071426;
  --panel: #0d2038;
  --panel2: #112b49;
  --blue: #369cff;
  --blue2: #75c5ff;
  --text: #edf7ff;
  --muted: #91abc5;
  --line: rgba(140,190,240,.14);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(ellipse at 50% -20%, #174d80 0%, transparent 48%),
    var(--bg);
  color: var(--text);
  font-family: 'Coiny', sans-serif;
  min-height: 100vh;
}

button, input {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  width: min(1100px, 92%);
  margin: 25px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.logo {
  font-size: 28px;
  color: white;
  letter-spacing: .5px;
}

.logo span {
  color: var(--blue2);
}

.top-actions {
  display: flex;
  gap: 9px;
}

.top-actions > .small-btn,
.top-actions > .role-badge {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.top-actions > .role-badge {
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
}

.small-btn, .settings-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 15px;
  padding: 10px 15px;
  transition: .2s;
}

.small-btn:hover, .settings-btn:hover {
  background: var(--panel2);
  border-color: var(--blue);
  transform: translateY(-2px);
}

.hero {
  width: min(1100px, 92%);
  margin: 65px auto 30px;
}

.hero h1 {
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.05;
}

.hero h1 span {
  color: var(--blue2);
}

.hero p {
  color: var(--muted);
  font-size: 15px;
  margin-top: 12px;
}

.search-wrap {
  width: min(1100px, 92%);
  margin: 28px auto;
}

.search {
  width: 100%;
  background: var(--panel);
  color: white;
  border: 1px solid var(--line);
  outline: none;
  border-radius: 18px;
  padding: 16px 19px;
  font-size: 15px;
  transition: .2s;
}

.search:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(54,156,255,.12);
}

.tabs {
  width: min(1100px, 92%);
  margin: 0 auto 25px;
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  padding: 10px 17px;
  border-radius: 14px;
  transition: .2s;
}

.tab:hover {
  color: white;
  border-color: var(--blue);
}

.tab.active {
  color: #06172a;
  background: var(--blue2);
  border-color: var(--blue2);
}

.content {
  width: min(1100px, 92%);
  margin: auto;
  padding-bottom: 70px;
}

.section-title {
  font-size: 22px;
  margin: 25px 0 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

.link-card {
  min-width: 0;
  background: linear-gradient(145deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 19px;
  padding: 17px;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: .2s;
}

.link-card:hover {
  transform: translateY(-3px);
  border-color: var(--blue);
  background: #15375a;
}

.link-name {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.link-url {
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 11px;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.arrow {
  color: var(--blue2);
  font-size: 20px;
  flex-shrink: 0;
}

.empty {
  display: none;
  text-align: center;
  color: var(--muted);
  padding: 40px 10px;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 25px;
  border-top: 1px solid var(--line);
}

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 10;
}

.modal-bg.show {
  display: flex;
}

.modal {
  background: #0d2038;
  border: 1px solid var(--line);
  border-radius: 23px;
  width: min(440px, 100%);
  padding: 23px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal h2 {
  font-size: 25px;
  margin-bottom: 18px;
}

.setting-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin: 15px 0 7px;
}

.setting-input {
  width: 100%;
  background: #071426;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  color: white;
  outline: none;
}

.setting-input:focus {
  border-color: var(--blue);
}

.setting-action {
  width: 100%;
  border: 0;
  border-radius: 13px;
  padding: 12px;
  background: var(--blue);
  color: #06172a;
  margin-top: 12px;
  transition: .2s;
}

.setting-action:hover {
  background: var(--blue2);
}

.close-modal {
  float: right;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 22px;
}

@media (max-width: 750px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero {
    margin-top: 48px;
  }
}

@media (max-width: 480px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .topbar {
    align-items: flex-start;
  }
  .logo {
    font-size: 24px;
  }
  .small-btn, .settings-btn {
    padding: 9px 11px;
  }
}

.topbar {
  flex-wrap: wrap;
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-link {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 9px 10px;
  transition: .2s;
}

.nav-link:hover, .nav-link.active {
  color: var(--text);
  border-bottom-color: var(--blue2);
}

.top-actions {
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.role-badge, .eyebrow {
  color: var(--blue2);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: page-in .25s ease-out;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 55px 0 25px;
}

.page-heading h1 {
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.1;
}

.page-heading .eyebrow {
  margin-bottom: 8px;
}

.page-count {
  color: var(--muted);
  font-size: 13px;
}

.link-card-wrap {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.link-card-wrap .link-card {
  flex: 1;
}

.favorite-toggle {
  width: 44px;
  flex: 0 0 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--muted);
  font-size: 19px;
}

.favorite-toggle:hover, .favorite-toggle.is-favorite {
  color: var(--blue2);
  border-color: var(--blue2);
}

.content.page {
  min-height: 55vh;
}

.settings-page {
  padding-bottom: 70px;
}

.settings-section {
  padding: 24px 0 28px;
  border-top: 1px solid var(--line);
}

.settings-section h2 {
  font-size: 21px;
  margin-bottom: 18px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.password-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.password-panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.password-panel h3 {
  margin-bottom: 16px;
  color: var(--blue2);
  font-size: 17px;
}

.password-panel .field + .field {
  margin-top: 14px;
}

.password-panel .settings-actions {
  margin-top: 16px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.field .setting-input {
  min-width: 0;
  font-size: 14px;
}

.toggle-list {
  max-width: 640px;
  margin-top: 22px;
  border-top: 1px solid var(--line);
}

.toggle-row {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
}

.switch {
  width: 40px;
  height: 23px;
  flex: 0 0 40px;
  border-radius: 99px;
  background: #33475e;
  position: relative;
  transition: .2s;
}

.switch::after {
  content: "";
  width: 17px;
  height: 17px;
  position: absolute;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: white;
  transition: .2s;
}

.toggle-row input:checked + .switch {
  background: var(--blue);
}

.toggle-row input:checked + .switch::after {
  transform: translateX(17px);
}

.toggle-row input:focus-visible + .switch {
  outline: 2px solid var(--blue2);
  outline-offset: 3px;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.settings-actions .setting-action {
  width: auto;
  margin: 0;
}

.settings-note, .setting-feedback {
  color: var(--muted);
  font-size: 13px;
  margin: -7px 0 18px;
}

.setting-feedback {
  min-height: 18px;
  margin: 12px 0 0;
}

.admin-settings {
  border-top-color: rgba(255, 179, 107, .35);
}

.admin-settings h2 {
  color: #ffbf82;
}

.about-copy {
  max-width: 680px;
  border-top: 1px solid var(--line);
  padding: 22px 0;
  color: var(--muted);
  line-height: 1.8;
}

.about-copy p + p {
  margin-top: 12px;
}

.auth-screen {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(ellipse at 50% 0%, #174d80 0%, transparent 55%), var(--bg);
}

.auth-screen[hidden], .admin-settings[hidden], [hidden] {
  display: none !important;
}

.auth-panel {
  width: min(440px, 100%);
  padding: 30px;
  background: rgba(13, 32, 56, .94);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.auth-logo {
  margin-bottom: 30px;
}

.auth-panel h1 {
  font-size: 27px;
  line-height: 1.2;
  margin: 7px 0 10px;
}

.auth-description {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 22px;
}

.auth-panel .field + .field {
  margin-top: 15px;
}

.auth-panel .setting-action {
  margin-top: 20px;
}

.compact .link-card {
  padding: 11px 14px;
}

.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after {
  animation-duration: .01ms !important;
  transition-duration: .01ms !important;
  scroll-behavior: auto !important;
}

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

@media (max-width: 850px) {
  .topbar {
    justify-content: center;
  }
  .main-nav {
    order: 3;
    width: 100%;
  }
  .top-actions {
    margin-left: auto;
  }
}

@media (max-width: 520px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .password-panels {
    grid-template-columns: 1fr;
  }
  .topbar {
    width: 94%;
  }
  .main-nav {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .nav-link {
    white-space: nowrap;
  }
  .top-actions .small-btn,
  .top-actions .role-badge {
    padding: 8px 10px;
  }
  .page-heading {
    margin-top: 40px;
  }
  .auth-panel {
    padding: 23px;
  }
}

.link-manager-heading {
  border-top: 1px solid var(--line);
  margin-top: 30px;
  padding-top: 24px;
}

.link-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 760px;
}

.link-editor .settings-actions {
  grid-column: 1 / -1;
  margin-top: 0;
}

.admin-link-list {
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.admin-link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.admin-link-details {
  min-width: 0;
}

.admin-link-details strong, .admin-link-details span {
  display: block;
  overflow-wrap: anywhere;
}

.admin-link-details span {
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 11px;
  margin-top: 3px;
}

.admin-link-actions {
  display: flex;
  gap: 7px;
  flex: 0 0 auto;
}

.admin-link-actions button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  padding: 7px 9px;
}

.admin-link-actions button:hover {
  border-color: var(--blue2);
  color: var(--text);
}

@media (max-width: 520px) {
  .link-editor {
    grid-template-columns: 1fr;
  }
  .admin-link-row {
    align-items: flex-start;
  }
  .admin-link-actions {
    flex-direction: column;
  }
}
