@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&display=swap");

:root {
  --bg: #f4f4f0;
  --ink: #1f2428;
  --muted: #6b7177;
  --card: #ffffff;
  --accent: #111111;
  --accent-soft: #e0e3e6;
  --tile-text: #2f3338;
  --toggle-bg: #111111;
  --toggle-fg: #ffffff;
  --radius: 18px;
  --shadow: 0 18px 40px rgba(31, 36, 40, 0.08);
}

.theme-dark {
  --bg: #171a1d;
  --ink: #f1f3f5;
  --muted: #a3a9b1;
  --card: #22262a;
  --accent: #f5f5f5;
  --accent-soft: #2f3439;
  --tile-text: #d6d9de;
  --toggle-bg: #f5f5f5;
  --toggle-fg: #111111;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fbead7 0%, transparent 45%),
    radial-gradient(circle at bottom right, #d7edf5 0%, transparent 40%),
    var(--bg);
  min-height: 100vh;
}

.theme-dark body {
  background: radial-gradient(circle at top left, #2b2f35 0%, transparent 45%),
    radial-gradient(circle at bottom right, #1f2730 0%, transparent 40%),
    var(--bg);
}

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

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 8vw 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-decoration: none;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px #f1d7b8;
}

.nav {
  display: flex;
  gap: 18px;
  font-size: 0.95rem;
}

.nav a {
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}

.nav a:hover {
  border-bottom-color: var(--accent);
}

.theme-toggle {
  border: none;
  background: var(--toggle-bg);
  color: var(--toggle-fg);
  border-radius: 999px;
  padding: 12px 16px;
  cursor: pointer;
}

.theme-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.theme-toggle.floating {
  position: fixed;
  right: 24px;
  bottom: 20px;
  z-index: 60;
  box-shadow: var(--shadow);
}

.theme-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sun {
  display: none;
}

.theme-dark .icon-sun {
  display: inline-flex;
}

.theme-dark .icon-moon {
  display: none;
}

.content {
  flex: 1;
  padding: 0 8vw 60px;
}

.flash {
  margin: 0 8vw 10px;
  padding: 12px 16px;
  background: #fff6d6;
  border-radius: 12px;
  color: #7a5a1f;
  box-shadow: var(--shadow);
}

.intro {
  max-width: 540px;
  margin-bottom: 32px;
}

.intro h1 {
  margin: 0 0 10px;
  font-size: 2.3rem;
}

.intro p {
  margin: 0;
  color: var(--muted);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  align-items: stretch;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.category {
  margin-bottom: 32px;
}

.category-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.category-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.drag-handle {
  font-size: 1rem;
  color: var(--muted);
  cursor: grab;
  user-select: none;
}

.category.dragging {
  opacity: 0.6;
  transform: scale(0.995);
}

.category-header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.category-count {
  color: var(--muted);
  font-size: 0.9rem;
}

.tile {
  background: linear-gradient(140deg, var(--tile-color), #ffffff);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.theme-dark .tile {
  background: linear-gradient(140deg, var(--tile-color), #1f2428);
}

.tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 50px rgba(31, 36, 40, 0.14);
}

.tile-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tile h3 {
  margin: 0;
  font-size: 1.1rem;
}

.tile p {
  margin: 12px 0 0;
  color: var(--tile-text);
  font-size: 0.95rem;
}

.tile-icon {
  font-size: 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tile-lock {
  margin-left: auto;
  font-size: 0.9rem;
}

.empty {
  padding: 24px;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--muted);
}

.auth {
  max-width: 440px;
  margin: 40px auto;
}

.form-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--card);
  padding: 26px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95rem;
  color: var(--muted);
}

input,
select,
button {
  font-family: inherit;
  font-size: 1rem;
}

input,
select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #d5d9dd;
  background: #fff;
}

.theme-dark input,
.theme-dark select {
  background: #1e2226;
  border-color: #333940;
  color: var(--ink);
}


button,
.button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.button {
  display: inline-block;
}

button.link {
  background: none;
  color: var(--muted);
  padding: 0;
  border-radius: 0;
  font-weight: 500;
}

button.link.danger {
  color: #b23a3a;
}

.link {
  color: var(--muted);
  font-size: 0.95rem;
}

.hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-preview {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid #d5d9dd;
  display: inline-block;
}

.checkbox-group {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.checkbox.inline {
  flex-direction: row;
}

.checkbox input {
  accent-color: var(--accent);
}

.password-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.password-panel.is-hidden {
  display: none;
}
.password-card {
  padding: 14px 16px;
  border-radius: 14px;
  background: #f6f7f9;
  border: 1px solid #e0e3e6;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toggle-label {
  font-size: 0.95rem;
  color: var(--ink);
  white-space: nowrap;
  flex: 1;
}

.toggle {
  display: inline-flex;
  align-items: center;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #c9ced4;
  position: relative;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.toggle-track::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.toggle input:checked + .toggle-track {
  background: #1f2428;
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(18px);
}

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #d5d9dd;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.dropdown-caret {
  font-size: 0.8rem;
  color: var(--muted);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  padding: 12px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e0e3e6;
  box-shadow: var(--shadow);
  display: none;
  z-index: 10;
}

.dropdown-menu.open {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(21, 24, 28, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  width: min(600px, 90vw);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 40px 90px rgba(15, 18, 22, 0.3);
  padding: 20px;
  max-height: 82vh;
  overflow: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #e0e3e6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.table {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.table-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 2fr 0.8fr 1fr;
  gap: 12px;
  align-items: center;
  background: var(--card);
  padding: 14px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.table-head {
  background: transparent;
  box-shadow: none;
  font-weight: 600;
  color: var(--muted);
}

.table-row .actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  .topbar,
  .content {
    padding: 20px 6vw 40px;
  }

  .nav {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
  }

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