:root {
  --text: #f7f8fb;
  --muted: rgba(247, 248, 251, 0.72);
  --panel: rgba(18, 23, 32, 0.68);
  --panel-light: rgba(255, 255, 255, 0.82);
  --line: rgba(255, 255, 255, 0.24);
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.28);
  --radius: 8px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
  background:
    linear-gradient(160deg, rgba(23, 43, 71, 0.74), rgba(56, 18, 36, 0.82)),
    radial-gradient(circle at 76% 47%, rgba(174, 101, 255, 0.5), transparent 18rem),
    linear-gradient(145deg, #54759b 0%, #253a57 42%, #1b392f 64%, #210811 100%);
  overflow-x: hidden;
}

.app[data-bg="forest"] {
  background:
    linear-gradient(160deg, rgba(8, 24, 22, 0.84), rgba(43, 19, 16, 0.82)),
    radial-gradient(circle at 70% 40%, rgba(68, 190, 128, 0.38), transparent 22rem),
    linear-gradient(145deg, #4f725d 0%, #1e403b 52%, #2c1a16 100%);
}

.app[data-bg="graphite"] {
  background:
    linear-gradient(150deg, rgba(10, 12, 16, 0.92), rgba(32, 36, 44, 0.88)),
    radial-gradient(circle at 66% 46%, rgba(255, 116, 74, 0.28), transparent 20rem),
    #12151b;
}

.auth-shell,
.settings-shell,
.board-shell {
  min-height: 100vh;
  padding: 28px;
}

.auth-shell {
  display: grid;
  place-items: center;
}

.auth-card,
.settings-panel,
.modal {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(15, 20, 29, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-card {
  padding: 28px;
}

.auth-title {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 650;
}

.auth-note {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 7px;
  margin: 0 0 14px;
}

.field span {
  color: var(--muted);
  font-size: 14px;
}

.input,
.select {
  width: 100%;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  color: #10131a;
  background: rgba(255, 255, 255, 0.9);
  padding: 0 13px;
  outline: none;
}

.input:focus,
.select:focus {
  border-color: rgba(255, 255, 255, 0.78);
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  color: #111827;
  background: #ffffff;
  padding: 0 15px;
  font-weight: 650;
}

.btn.secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.16);
}

.btn.danger {
  color: #ffffff;
  background: #d94b4b;
}

.round-action {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  color: #ffffff;
  background: rgba(18, 23, 32, 0.42);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(14px);
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.round-action:hover {
  border-color: rgba(255, 255, 255, 0.48);
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.round-action span {
  font-size: 22px;
  line-height: 1;
}

.error {
  min-height: 22px;
  color: #ffd3d3;
  font-size: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.clock {
  margin: 76px auto 30px;
  text-align: center;
}

.time {
  font-size: clamp(58px, 8vw, 96px);
  font-weight: 300;
  line-height: 1;
}

.date {
  margin-top: 12px;
  color: var(--muted);
  font-size: 20px;
}

.search {
  position: relative;
  width: min(1040px, 100%);
  margin: 0 auto 28px;
}

.search input {
  width: 100%;
  height: 62px;
  border: 0;
  border-radius: 31px;
  padding: 0 120px 0 28px;
  font-size: 20px;
  outline: none;
  box-shadow: 0 0 54px rgba(224, 121, 255, 0.38);
}

.search-actions {
  position: absolute;
  inset: 0 14px 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-items: center;
  color: #111827;
}

.grid {
  width: min(1040px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}

.tile {
  position: relative;
  height: 92px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: #171b22;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
  user-select: none;
}

.tile.dragging {
  opacity: 0.45;
}

.tile-main {
  width: 100%;
  height: 100%;
  border: 0;
  color: inherit;
  background: transparent;
  padding: 10px;
  text-align: center;
}

.site-icon {
  width: 30px;
  height: 30px;
  display: block;
  margin: 0 auto 6px;
  object-fit: contain;
}

.tile-title {
  font-size: 17px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-url {
  margin-top: 5px;
  color: rgba(0, 0, 0, 0.56);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-tile {
  border-radius: 16px;
  background: rgba(224, 228, 236, 0.9);
}

.folder-tile .tile-main {
  padding: 7px;
}

.folder-preview {
  height: 76px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 44px;
  gap: 4px;
  overflow: hidden;
}

.folder-preview-cell {
  min-width: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  overflow: hidden;
  padding: 3px;
}

.folder-preview-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.folder-preview-cell em {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
}

.folder-tile-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30px;
  display: grid;
  place-items: center;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(222, 225, 232, 0.96);
  color: #111111;
  font-size: 17px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 10px;
}

.context-menu {
  position: fixed;
  z-index: 30;
  width: 178px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(22, 25, 32, 0.94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px);
  animation: fadeIn 90ms ease-out;
}

.context-menu button {
  width: 100%;
  height: 40px;
  border: 0;
  color: #ffffff;
  background: transparent;
  padding: 0 13px;
  text-align: left;
}

.context-menu button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.add-tile {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
  display: grid;
  place-items: center;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.plus-icon {
  width: 36px;
  height: 36px;
  color: rgba(255, 255, 255, 0);
  transform: scale(0.84);
  transition: color 140ms ease, transform 140ms ease;
}

.plus-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.add-tile:hover {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.14);
}

.add-tile:hover .plus-icon {
  color: rgba(255, 255, 255, 0.9);
  transform: scale(1);
}

.inline-add-panel {
  width: min(1040px, 100%);
  margin: 48px auto 0;
  display: grid;
  gap: 12px;
  justify-items: stretch;
}

.inline-add-main {
  height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.14);
}

.inline-url-input {
  min-width: 0;
  height: 100%;
  border: 0;
  color: #20242b;
  background: transparent;
  padding: 0 18px;
  outline: none;
  font-size: 16px;
}

.inline-url-input::placeholder {
  color: rgba(32, 36, 43, 0.62);
}

.inline-caption-input {
  min-width: 0;
  height: 42px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  color: #111827;
  background: rgba(255, 255, 255, 0.96);
  padding: 0 18px;
  outline: none;
  font-size: 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.14);
}

.inline-caption-input::placeholder {
  color: rgba(32, 36, 43, 0.62);
}

.inline-caption-toggle {
  height: 100%;
  border: 0;
  color: #20242b;
  background: transparent;
  padding: 0 24px;
  font-size: 16px;
  font-weight: 700;
}

.inline-caption-toggle:hover {
  background: rgba(0, 0, 0, 0.06);
}

.inline-actions {
  justify-self: center;
  display: flex;
  gap: 10px;
}

.inline-done,
.inline-hide {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(35, 31, 43, 0.86);
  padding: 0 20px;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.inline-done:hover {
  background: rgba(42, 38, 51, 0.96);
}

.inline-hide {
  color: #c97575;
  background: rgb(255 255 255 / 0%);
}

.inline-hide:hover {
  background: #ffffff;
}

.fab {
  position: fixed;
  right: 28px;
  bottom: 24px;
  display: flex;
  gap: 10px;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.38);
  animation: fadeIn 160ms ease-out;
}

.folder-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(7, 12, 22, 0.16);
  animation: fadeIn 160ms ease-out;
}

.folder-overlay.closing {
  animation: fadeOut 180ms ease-in forwards;
}

.folder-panel {
  position: relative;
  width: min(1160px, calc(100vw - 48px));
  min-height: 248px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 26px;
  background: rgba(139, 154, 176, 0.72);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(24px);
  padding: 32px 46px 48px;
  animation: folderOpen 180ms ease-out;
}

.folder-overlay.closing .folder-panel {
  animation: folderClose 180ms ease-in forwards;
}

.folder-panel-head {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 96px;
  align-items: center;
  margin-bottom: 28px;
}

.folder-title-input {
  width: min(440px, 100%);
  height: 48px;
  justify-self: center;
  border: 0;
  border-radius: 9px;
  color: #ffffff;
  background: transparent;
  outline: none;
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  padding: 0 14px;
}

.folder-title-input:hover,
.folder-title-input:focus {
  background: rgba(255, 255, 255, 0.16);
}

.folder-panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  position: absolute;
  right: 5px;
  top: 5px;
}

.folder-icon {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.84);
  background: transparent;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, background 140ms ease;
}

.folder-panel:hover .folder-icon,
.folder-icon:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.folder-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.folder-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.folder-icon:hover {
  background: rgba(255, 255, 255, 0.14);
}

.folder-sites {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
}

.folder-site {
  height: 96px;
  border: 0;
  border-radius: 13px;
  color: #ffffff;
  padding: 12px;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.16);
  transition: transform 120ms ease, filter 120ms ease;
}

.folder-site-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.folder-site:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.folder-site span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 20px;
  font-weight: 750;
}

.folder-site-add {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08) !important;
  box-shadow: none;
}

.folder-site-add .plus-icon {
  color: rgba(255, 255, 255, 0);
  transform: scale(0.84);
  transition: color 140ms ease, transform 140ms ease;
}

.folder-site-add:hover {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.18) !important;
}

.folder-site-add:hover .plus-icon {
  color: rgba(255, 255, 255, 0.9);
  transform: scale(1);
}

.folder-panel .inline-add-panel {
  width: 100%;
  margin-top: 22px;
}

.folder-add {
  position: absolute;
  right: 0;
  bottom: -54px;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(50, 42, 54, 0.82);
  padding: 0 15px;
  font-size: 18px;
  font-weight: 650;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.modal {
  padding: 22px;
  animation: popIn 180ms ease-out;
}

.modal.wide {
  width: min(760px, 100%);
}

.modal-title {
  margin: 0 0 16px;
  font-size: 22px;
}

.folder-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.settings-shell {
  display: grid;
  place-items: center;
}

.settings-panel {
  width: min(720px, 100%);
  padding: 24px;
}

.passwords-panel {
  width: min(980px, 100%);
}

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

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 18px;
}

.password-list {
  display: grid;
  gap: 10px;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(120px, 0.7fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  padding: 12px;
}

.password-row strong,
.password-row span,
.password-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.password-row span,
.password-row small {
  color: var(--muted);
}

.password-row code {
  overflow: hidden;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.24);
  padding: 8px 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty {
  border: 1px dashed rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  color: var(--muted);
  padding: 22px;
  text-align: center;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes folderOpen {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes folderClose {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
}

@media (max-width: 680px) {
  .auth-shell,
  .settings-shell,
  .board-shell {
    padding: 18px;
  }

  .clock {
    margin-top: 42px;
  }

  .search input {
    height: 54px;
    font-size: 16px;
    padding-right: 92px;
  }

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

  .folder-panel {
    width: min(100%, calc(100vw - 24px));
    border-radius: 18px;
    padding: 20px 16px 54px;
  }

  .folder-panel-head {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 18px;
  }

  .folder-panel-head > div:first-child {
    display: none;
  }

  .folder-icon {
    opacity: 1;
    pointer-events: auto;
  }

  .folder-title-input {
    width: calc(100% - 96px);
    justify-self: start;
    text-align: left;
    font-size: 22px;
  }

  .folder-sites {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .folder-site {
    height: 84px;
  }

  .folder-add {
    right: 16px;
    bottom: 12px;
  }

  .password-row {
    grid-template-columns: 1fr;
  }
}
