:root {
  color-scheme: light;

  /* Toss-inspired blue minimal palette */
  --bg: #f2f4f6;
  --surface: #ffffff;
  --surface-sunken: #f9fafb;
  --border: #e5e8eb;
  --border-strong: #d1d6db;
  --text: #191f28;
  --text-weak: #4e5968;
  --text-weaker: #8b95a1;
  --blue: #3182f6;
  --blue-strong: #2272eb;
  --blue-weak: #e8f1fd;
  --danger: #f04452;

  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --pill: 999px;

  --shadow-sm: 0 1px 2px rgba(23, 31, 40, 0.04);
  --shadow: 0 2px 8px rgba(23, 31, 40, 0.06), 0 12px 32px rgba(23, 31, 40, 0.05);

  font-family:
    "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    system-ui, "Segoe UI", "Apple SD Gothic Neo", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(49, 130, 246, 0.06), transparent 60%),
    var(--bg);
  letter-spacing: -0.01em;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: inherit;
}

button {
  border: 0;
  border-radius: var(--radius);
  background: var(--blue);
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
  min-height: 52px;
  padding: 14px 20px;
  transition:
    background 0.15s ease,
    transform 0.1s ease,
    box-shadow 0.15s ease;
}

button:hover {
  background: var(--blue-strong);
}

button:active {
  transform: scale(0.985);
}

button.secondary {
  background: var(--surface-sunken);
  color: var(--text-weak);
}

button.secondary:hover {
  background: var(--border);
}

label {
  display: grid;
  gap: 8px;
  color: var(--text-weak);
  font-size: 0.875rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  padding: 14px 15px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-weaker);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-weak);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

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

h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.app-shell {
  min-height: 100vh;
  padding: 20px;
}

.auth-layout,
.workspace {
  margin: 0 auto;
  max-width: 1080px;
}

.auth-layout {
  display: grid;
  min-height: calc(100vh - 40px);
  place-items: center;
}

.auth-layout .panel {
  max-width: 460px;
}

.panel,
.item-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
  animation: rise 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.panel {
  width: 100%;
}

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

.item-card {
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

.item-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.item-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.item-card p {
  color: var(--text-weak);
  line-height: 1.6;
  white-space: pre-wrap;
}

.eyebrow {
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.lede {
  color: var(--text-weak);
  line-height: 1.6;
}

.form-stack,
.form-grid {
  display: grid;
  gap: 18px;
}

.form-grid {
  grid-template-columns: 1fr;
}

.button-row,
.topbar,
.toolbar,
.nav,
.tag-row,
.item-card__topline {
  display: flex;
  gap: 10px;
}

.button-row,
.toolbar,
.nav,
.tag-row {
  flex-wrap: wrap;
}

.button-row button {
  flex: 1;
  min-width: 140px;
}

.topbar {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.topbar button.secondary {
  min-height: 44px;
  padding: 10px 18px;
}

.toolbar {
  align-items: end;
  margin-bottom: 18px;
}

.nav {
  align-items: center;
  gap: 8px;
}

.tag-row span,
.item-card__topline span {
  border-radius: var(--pill);
  background: var(--surface-sunken);
  color: var(--text-weak);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 11px;
}

.item-card__topline {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.item-card__topline span:first-child {
  background: var(--blue-weak);
  color: var(--blue-strong);
}

.nav-button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-weak);
  min-height: 44px;
  padding: 9px 16px;
  font-size: 0.9rem;
}

.nav-button:hover {
  background: var(--surface-sunken);
  border-color: var(--border-strong);
}

.nav-button.is-active,
.nav-button.is-active:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.wide {
  grid-column: 1 / -1;
}

.list-section {
  margin-top: 28px;
}

.list-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.list-header h2 {
  font-size: 1.15rem;
}

.count-badge {
  border-radius: var(--pill);
  background: var(--surface-sunken);
  color: var(--text-weaker);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 11px;
}

.item-list {
  display: grid;
  gap: 14px;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  padding: 52px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
  color: var(--text-weaker);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
}

.message {
  align-self: center;
  color: var(--text-weaker);
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0;
}

#auth-message,
#unlock-message,
#item-message {
  color: var(--danger);
  font-weight: 600;
}

@media (min-width: 760px) {
  .app-shell {
    padding: 40px 32px;
  }

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

  .toolbar {
    justify-content: space-between;
  }

  .toolbar .wide {
    min-width: 280px;
    max-width: 360px;
  }

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